29 return paint.fontMetrics().width(
"-000.00") + 10;
43 float inc = (maxf - val) / n;
52 int prec = trunc(log10f(inc));
54 if (prec < 0) dp = -prec;
55 round = powf(10.f, prec);
56 #ifdef DEBUG_TIME_VALUE_LAYER 57 cerr <<
"inc = " << inc <<
", round = " << round <<
", dp = " << dp << endl;
63 for (
int i = 0; i < n; ++i) {
71 v->height() < paint.fontMetrics().height() * (n*2)) {
74 dispval = lrintf(val / round) * round;
76 #ifdef DEBUG_TIME_VALUE_LAYER 77 cerr <<
"val = " << val <<
", dispval = " << dispval << endl;
82 ty = y - paint.fontMetrics().height() + paint.fontMetrics().ascent() + 2;
84 if (prevy >= 0 && (prevy - y) < paint.fontMetrics().height()) {
89 sprintf(buffer,
"%.*f", dp, dispval);
91 QString label = QString(buffer);
93 paint.drawLine(w - 5, y, w, y);
96 paint.drawText(w - paint.fontMetrics().width(label) - 6,
int getWidth(View *v, QPainter &paint)
void paintVertical(View *v, const VerticalScaleLayer *layer, QPainter &paint, int x0, float minf, float maxf)
virtual int getYForValue(View *, float value) const =0
View is the base class of widgets that display one or more overlaid views of data against a horizonta...
virtual QString getScaleUnits() const =0