We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Empty point hiding

Hello,

I'm trying to hide points that have a Y coordinate of 0 on a 2D line chart. I thought this could simply be accomplished by setting the series' "ShowEmptyPoints" property to false. But this does not seem to work.

This is the code that I am using:

ChartListData points = new ChartListData();

points.Add(new ChartPoint(10, 10));
points.Add(new ChartPoint(20, 20));
points.Add(new ChartPoint(30, 30));
points.Add(new ChartPoint( 40, 30));
points.Add(new ChartPoint( 50, 0)); //this point should be hidden
points.Add(new ChartPoint( 60, 30));
points.Add(new ChartPoint( 70, 30));
points.Add(new ChartPoint( 80, 40));
points.Add(new ChartPoint( 90, 50));

ChartSeries series = new ChartSeries();
series.Type = ChartTypes.Line;
series.StrokeThickness = 2;

series.ShowEmptyPoints = false;

series.Data = points;

C.Areas[0].Series.Add(series);

I'm expecting to see no line between X axis values of 40 and 60. But there is a V-shaped drop to a Y value of zero.

How can I get the empty points to be hidden.

Thanks in advance.

James


2 Replies

JA James January 6, 2012 06:39 PM UTC

I actually managed to solve this one myself. Turns out that the empty point is determined by a value of Double.Nan and not 0. So for the following points I get the desired result:

points.Add(new ChartPoint(10, 10));
points.Add(new ChartPoint(20, 20));
points.Add(new ChartPoint(30, 30));
points.Add(new ChartPoint( 40, 30));
points.Add(new ChartPoint( 50, Double.NaN));
points.Add(new ChartPoint( 60, 30));
points.Add(new ChartPoint( 70, 30));
points.Add(new ChartPoint( 80, 40));
points.Add(new ChartPoint( 90, 50));

Problem resolved.



MP Michael Prabhu M Syncfusion Team January 9, 2012 01:25 PM UTC

Hi James,

Thanks for the update, we are glad that your issue has been resolved. Please let us know if you need further clarification.

Thanks,
Michael Prabhu.


Loader.
Live Chat Icon For mobile
Up arrow icon