Feature #2905
openaxis autoscale
0%
Description
Hey,
it seems to me the axis auto scaling algorithm should be improved. When the y-axis is auto scaled ant a horizontal line (at 3.3. see attachment) is rendered the scaling, or more precisely the axis labelling fails. The axis settings are:
Chart::WAxis& yAxis = chart->axis(Chart::YAxis);
yAxis.setAutoLimits(Chart::MinimumValue | Chart::MaximumValue);
yAxis.setRange(Chart::WAxis::AUTO_MINIMUM, Chart::WAxis::AUTO_MAXIMUM);
yAxis.setRoundLimits(Chart::MinimumValue | Chart::MaximumValue);
Could you try to fix it, please? I'd looked in the sources but it's quite difficult for me to understand the scaling and labelling algorithms and suggest something or just find better solution for my needs.
regards,
Stoycho
Files
Updated by Koen Deforche almost 10 years ago
- Status changed from New to Feedback
- Assignee set to Koen Deforche
Hey,
When you want an automatic axis scale but only have a single data point, then the axis does not really know what resolution you want. You can indicate it with axis.setResolution().
For example, in this case, an axis.setResolution(0.1) could be appropriate.
Regards,
koen
Updated by Стойчо Стефанов Stoycho Stefanov almost 10 years ago
Hey,
perhaps you could consider the following automatic axis scale when the chart has equal data points in some dimension (pseudo code):
if (chart_.series(0).min() == chart_.series(0).max()){
double value = chart_.series(0).min();
...
double res = exp10(floor(log10(value)) - 1);
yAxis.setResolution(res);
}
For me it seems reasonable.
Regards,
Stoycho