I have an application that uses a line chart. Every second my application reads a value and its recording time from database and add that value and its recording time to a line chart. Value is in Y axis and record time is in X axis.
My line chart's x points increase one by one every seconds. I want line chart have more x points with no Y values when it is first created (about 60 points of seconds when it is first created). How can i do that?
Note : recording time is DateTime. It shows hours minutes and seconds
You just need to set the minimum and maximum value for the X axis of your chart before adding points to it.
Assuming your chart has index CHART_INDEX, and that the start and end times are of type DateTime
, do this:
var xAxis = yourChart.ChartAreas[CHART_INDEX].AxisX;
xAxis.Minimum = myStartTime.ToOADate();
xAxis.Maximum = myEndTime.ToOADate();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.