简体   繁体   English

在C#图表的数据系列中插入break

[英]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. 但是,有时会有30分钟的时间没有记录数据。 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. 如果要求.net的微软图表控件,则可以添加空数据点。 Add or create a DataPoint and set it's IsEmpty property to true. 添加或创建DataPoint并将其IsEmpty属性设置为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 ): 除了@ HCL的答案之外,我认为您必须在系列本身上设置此属性才能显示或不显示缺失点(例如,当Y值为double.NaN ):

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

From MSDN . 来自MSDN

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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