I want to show values (y axis) in a range of hours (x axis) from 7am to 12m, the X axis should show always that range even if I have no value for a specific hour. Here an example to clarify that:
X=7, Y (no value)
X=8, Y (no value)
X=9, Y=24
X=10, Y=60
X=11, Y=30
X=12, Y=80
To accomplish that, I filled out the empty Y values with zeros, so I was able to show the values from 7-12, otherwise I gonna show only the values from 9-12.
But now, i开发者_运维知识库t is causing me problems. So my question is, is there any way that I can keep showing the range from 7-12 even if I have no Y values in the beginning like the above example?
I use: SeriesChartType.Column;
Here is the solution:
chart1.ChartAreas[0].AxisX.Minimum = 7;
chart1.ChartAreas[0].AxisX.Maximum = 12;
Thanks
In addition to the previous answer from @Somebody: if you don't have a value for a certain point, you must put a "NaN" value there, anyway if you want that point to be rendered:
double emptyYvalue = double.NaN;
Use this value for the Y value in your data binding structure.
Not sure I understand the question fully, but first you should use DateTime types for your chart not ints, then Date.Hour. The wonderful MSChart will then fill in the x-axis gaps and this also enables you to use all the chart's datetime functions to assign ranges etc.
精彩评论