2014年7月13日 星期日

[RESOLVED] Chart Control, Minimum Y Interval in Auto Mode


I am using an <asp:Chart
control where the Y axis, which represents an injury count, has the interval set to auto. This works great if there are more than a few injuries (for example, if the maximum value is 92, I have tick marks at 0, 20, 40, 60, and 80. However, if there is only
1 injury, I have tick marks at 0, 0.2, 0.4, 0.6, 0.8, and 1.0. Fractions of an injury do not make sense, so I want to set the minimum interval level to 1. How do I do this?




Hi,


after you fill the series with all the datapoints you can find maximum and minimum from data points and then decide if you want to set the interval to 1.


And refer the similar thread


http://stackoverflow.com/questions/3739370/auto-interval-precision-in-ms-chart


http://stackoverflow.com/questions/10898542/ms-chart-net-how-to-control-axis-interval-in-auto-mode


Hope it can help you



Here is what I did.


'Set Minimum Y Axis Interval to avoid fractional tick marks
If IncidentCount < 2 Then
Me.Chart1.ChartAreas(0).AxisY.Interval = 1
End If


沒有留言:

張貼留言