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.
2 Answers
Reset to default 1Are 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
评论列表(0条)