I am developing windows based application using charts. The chart is a line chart having an x-axis as a System.DateTime
type. I am adding real time data to the chart for every 1 sec and I have to display the 10 minutes frame all the time(like 0-10 min, 10-20 min..). For that I set minimum and maximum values of the chart. I did not set the isXValueIndexed
property to true. User has a provision to select the datapoint with a mouse click. I need to mark the user selected data point. I tried the following code, but it is not working. Please guide me.
private void chart1_CursorPositionChanged(object sender, CursorEventArgs e)
{
DataPoint pt = chart1.Series[0].Points[(int)Math.Max(e.ChartArea.CursorX.Position - 1, 0)];
pt.MarkerStyle = MarkerStyle.Square;
pt.MarkerColor = Color.Brown;
pt.MarkerSize = 10;
pt.MarkerBorderWidth = 5;
}
I am getting the e.ChartArea.CursorX.Position
value as a double (for example 42502.00002) and getting a System.ArgumentOutOfRangeException
.