c# - MSChart AxisY.Minimum changes wrong value - Stack Overflow

I'm having trouble insertingadding the correct AxisY.Minimum value to my chart. I'm having n

I'm having trouble inserting/adding the correct AxisY.Minimum value to my chart. I'm having no problem with the AxisY.Maximum value.

I use below code:

myChart1.ChartAreas[0].AxisY.Minimum = 9.3;
myChart1.ChartAreas[0].AxisY.Maximum = 10.3;

Even though I write 9.3 as the minimum value in the code, this is altered on the chart image to 9.0.

Furthermore if I change the AxisY.Minimum to 8.7, the minimum value displayed on the chart is 8.0.

How can I change it on the chart, so that the AxisY.Minimum value corresponds to the value in the code?

Tried changing the myChart1.ChartAreas[0].AxisY.IsStartedFromZero to false but didn't help.

I'm having trouble inserting/adding the correct AxisY.Minimum value to my chart. I'm having no problem with the AxisY.Maximum value.

I use below code:

myChart1.ChartAreas[0].AxisY.Minimum = 9.3;
myChart1.ChartAreas[0].AxisY.Maximum = 10.3;

Even though I write 9.3 as the minimum value in the code, this is altered on the chart image to 9.0.

Furthermore if I change the AxisY.Minimum to 8.7, the minimum value displayed on the chart is 8.0.

How can I change it on the chart, so that the AxisY.Minimum value corresponds to the value in the code?

Tried changing the myChart1.ChartAreas[0].AxisY.IsStartedFromZero to false but didn't help.

Share Improve this question asked Mar 26 at 22:09 Henrik MelgaardHenrik Melgaard 211 silver badge2 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 1

Are you binding your data to the chart? If so, make sure to set the AxisY.Minimum and AxisY.Maximum value after the data has been added. That way the chart does not override your axis settings based on the data range.
You can also try to disable a scaling extension of the axis by disabling IsMarginVisible:
myChart1.ChartAreas[0].AxisY.IsMarginVisible = false;

The solution were to change the YValueType for the Series myChart1.Series[1].YValueType = ChartValueType.Int32; to myChart1.Series[1].YValueType = ChartValueType.Double;.

Now both minimum and maximum YValues on the chart, corresponds to the values set in the code.

myChart1.ChartAreas[0].AxisY.Minimum = 9.3;
myChart1.ChartAreas[0].AxisY.Maximum = 10.3;

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744123447a4559509.html

相关推荐

  • c# - MSChart AxisY.Minimum changes wrong value - Stack Overflow

    I'm having trouble insertingadding the correct AxisY.Minimum value to my chart. I'm having n

    8天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信