开发者

Fixed Intervals on MSChart Axis

开发者 https://www.devze.com 2023-03-16 18:46 出处:网络
I have a windows forms project in VS2010 with a simple line chart. The data is dynamic and always ranging between 1.4000 and 1.5000.

I have a windows forms project in VS2010 with a simple line chart.

The data is dynamic and always ranging between 1.4000 and 1.5000.

I want the Y axis's gridlines/labels to always be displayed on every #.##20 data point, as in:

1.4080 ----------------------------

1.4060 ----------------------------

1.4040 ----------------------------

1.4020 ----------------------------

1.4000 ----------------------------

etc.

So I tried the Interval property for the axis gridlines/labels, setting it to 0.002, and the result was that the gridlines/labels were displayed every 0.0020 points, like for example this:

1.4084 ----------------------------

1.4064 ----------------------------

1.4044 ----------------------------

开发者_如何学Python

1.4024 ----------------------------

1.4004 ----------------------------

but not on 0.0020 points too as shown previously.

Any suggestions on how to get it to be displayed the way I want?


In your AxisY, set the Minimum value to 1.4004, Maximum value to 1.4084(or the corresponding minimum/maximum value rounded to 4 decimal places pulled from your dynamic data), Interval to 0.0020 and IntervalAutoMode to FixedCount. Also, set the axis' LabelStyle's Format to {0.0000} to have four decimal places of rounding in the label.

0

精彩评论

暂无评论...
验证码 换一张
取 消