12class KPlotAxis::Private
18 , m_showTickLabels(false)
20 , m_labelFieldWidth(0)
28 bool m_showTickLabels : 1;
31 int m_labelFieldWidth;
37 : d(new Private(this))
51 d->m_visible = visible;
56 return d->m_showTickLabels;
61 d->m_showTickLabels = b;
76 d->m_labelFieldWidth = fieldWidth;
77 d->m_labelFmt = format;
78 d->m_labelPrec = precision;
83 return d->m_labelFieldWidth;
93 return d->m_labelPrec;
98 d->m_MajorTickMarks.clear();
99 d->m_MinorTickMarks.clear();
104 modf(log10(length), &pwr);
105 double s = pow(10.0, pwr);
106 double t = length / s;
108 double TickDistance = 0.0;
109 int NumMajorTicks = 0;
110 int NumMinorTicks = 0;
121 NumMajorTicks = int(t);
123 }
else if (t < 10.0) {
124 TickDistance = s * 2.0;
125 NumMajorTicks = int(t / 2.0);
127 }
else if (t < 20.0) {
128 TickDistance = s * 4.0;
129 NumMajorTicks = int(t / 4.0);
132 TickDistance = s * 5.0;
133 NumMajorTicks = int(t / 5.0);
142 double Tick0 = x0 - fmod(x0, TickDistance);
144 Tick0 -= TickDistance;
148 for (
int i = 0; i < NumMajorTicks + 2; i++) {
149 double xmaj = Tick0 + i * TickDistance;
150 if (xmaj >= x0 && xmaj <= x0 + length) {
151 d->m_MajorTickMarks.append(xmaj);
154 for (
int j = 1; j < NumMinorTicks; j++) {
155 double xmin = xmaj + TickDistance * j / NumMinorTicks;
156 if (xmin >= x0 && xmin <= x0 + length) {
157 d->m_MinorTickMarks.append(xmin);
165 if (d->m_labelFmt ==
't') {
169 while (val >= 24.0) {
174 int m = int(60. * (val - h));
178 return QStringLiteral(
"%1").
arg(val, d->m_labelFieldWidth, d->m_labelFmt, d->m_labelPrec);
183 return d->m_MajorTickMarks;
188 return d->m_MinorTickMarks;
QList< double > majorTickMarks() const
void setTickMarks(double x0, double length)
Determine the positions of major and minor tickmarks for this axis.
int tickLabelPrecision() const
char tickLabelFormat() const
void setLabel(const QString &label)
Sets the axis label.
void setTickLabelFormat(char format='g', int fieldWidth=0, int precision=-1)
Set the display format for converting the double value of the tick's position to the QString for the ...
KPlotAxis(const QString &label=QString())
Constructor, constructs an axis with the label label.
void setTickLabelsShown(bool b)
Determine whether tick labels will be drawn for this axis.
void setVisible(bool visible)
Sets the "visible" property of the axis.
bool areTickLabelsShown() const
QList< double > minorTickMarks() const
int tickLabelWidth() const
QString tickLabel(double value) const
QString arg(Args &&... args) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:23 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.