buy now
log in

Q: I just set Y-data for my LineSeries and the X-axis is fine – it has regular ticks, while the Y-axis gets only two ticks. Here is what I do:

 series.YData = new List() { 0.9, 1.3, 0.7, 1.2, 1.4, 0.23 }; 

I want my Y axis to have more than 2 divisions. How I do this?

A: When you create the chart initially e.g. drop it onto the form, it has the Interval of its Y-axis set to 20. The default value for Interval, which tells the control to auto-calculate it is double.NaN. Because it is 20 e.g. it is set, it is not changed when the control recalculates the axis. In your case, because the data is much smaller than the initial YData for the LineSeries the control creates just one interval for the axis, the interval is big enough for all data to fit in.

The solution is to change the value of YAxisSettings.Interval:

 lineChart1.XAxisSettings.Interval = 0.2;

If you want 10 divisions, you can change YAxisSettings.MaxValue:

lineChart1.XAxisSettings.MaxValue = 2;

Maybe we should consider leaving the Interval property unset for future releases – I will bring the question to our developer team.

Copyright © 2001-2019 MindFusion LLC. All rights reserved.
Terms of Use - Contact Us