|
Restricting y-axis minimum scale value |
Posted by John on Jun-19-2013 18:49 |
|
Hi,
Every time when I pass a set of data points to the scatterlayer, the ChartDirector autoscales X-axis and Y-axis and displays the graph.
If you observe the screen shot attached for your reference the plot area from Y=0 to Y= 400 is left blank. so I want to start my Y-axis default scale from 450.
How can I able to do this ?
Thanks,
John.
|
Re: Restricting y-axis minimum scale value |
Posted by Peter Kwan on Jun-19-2013 19:31 |
|
Hi John,
By default, for a numeric linear y-axis, if the minimum and maximum data values are very close together (like 999.9 to 1000.1), ChartDirector would not start the axis at 0. If the data values are "far part", ChartDirector would start the axis at 0. By default, "far apart" means the minimum data value is less than 80% of the maximum data value. On the other hand. This is configurable with Axis.setAutoScale.
If you would like ChartDirector not to give any special preference to start the y-axis to 0, you may set the zero affinity parameter to 0. Furthermore, if you would like ChartDirector to not add margins to the scale (in this case, it is possible for the minimum data point to touch the bottom border of the plot area, and the maximum data point to touch the top border), you may set the topExtension and bottomExtension to 0. For example (in C#/Java):
//no top and bottom margin, no preference to start at 0
c.yAxis().setAutoScale(0.02, 0.02, 0);
I note that there is another enquiry in this form that mentions the "ScatterLayer" should "pass through" (1, 0). Is that enquiry also from you? As you describe your current chart as a "ScatterLayer", but it seems to have a "LineLayer" or "SplineLayer", I am thinking may be in that enquiry, you mean that the "line" should pass through (1, 0). (Because the "ScatterLayer" cannot pass through anything, my original interpretation of that enquiry is that the entire chart should be auto-scaled to contain (1, 0).) If this is the case, please plot the scatter layer using your oringal data, and then add one more data point (1, 0) to your data arrays, and use them to plot your line layer or spline layer. In this way, the scatter symbols will not contain (1, 0), while the line will pass through (1, 0).
Hope this can help.
Regards
Peter Kwan |
|