Project

General

Profile

Actions

Feature #2905

open

axis autoscale

Added by Стойчо Стефанов Stoycho Stefanov almost 10 years ago. Updated almost 10 years ago.

Status:
Feedback
Priority:
Normal
Assignee:
Target version:
-
Start date:
04/04/2014
Due date:
% Done:

0%

Estimated time:

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

axis_autoscale.png (9.85 KB) axis_autoscale.png axis auto scale Стойчо Стефанов Stoycho Stefanov, 04/04/2014 05:54 PM
Actions #1

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

Actions #2

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

Actions

Also available in: Atom PDF