Reputation: 2639
I have a data point with a y-value of 1 being plotted, the MS Chart control will use increments of 0.2 on the y-axis. How can I force it to not use a decimal, keeping in mind I will have values of >100 so I can't just force an increment of 1 on the y-axis?
Upvotes: 2
Views: 3412
Reputation: 51
In the code behind set the chart area's axis label style format:
chtArea.AxisX.LabelStyle.Format = "{#,###}";
chtArea.AxisY.LabelStyle.Format = "{#,###}";
Or in aspx
<ChartAreas>
<asp:ChartArea Name="MainChartArea">
<AxisY>
<LabelStyle Format="#,###" />
</AxisY>
<AxisX IsMarginVisible="false">
<LabelStyle Format="#,###" />
</AxisX>
Upvotes: 5
Reputation: 847
You need to write some custom logic to make that happen. You can use chart1.ChartAreas[0].AxisY.RoundAxisValues(); but then it will display 0.00 at all the points. I would suggest if there is only 1 data point with value 1, set YAxis Maximum property to 2 and set interval to 1
Upvotes: 0