简体   繁体   中英

Insert break in data series of C# chart

I have several data series plotted on a chart. This is logged data spanning several hours. However, there is occasionally a period of 30 minutes where no data is logged. This causes the chart to draw a line between the last sample before logging stopped and the first sample when logging resumes.

This can appear quite misleading where sudden jumps in data appear. It is preferable to show that there is not logged data in this period.

Is there any way to tell the series not to plot data between two points? So it would still be one series, but with a break in the middle.

If you are asking for microsoft chart controls for .net, you can add an empty data point. Add or create a DataPoint and set it's IsEmpty property to true.

Note that you have to configure the series to show the empty data points.

In addition to @HCL's answer, I think you have to set this property on the series itself in order to show or not missing points (for example when a Y value is double.NaN ):

series.IsXValueIndexed = true;//this allows to NOT draw missing points

From MSDN .

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM