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.
Unfortunately, activation email could not send to your email. Please try again.

Empty point hiding

Thread ID:

Created:

Updated:

Platform:

Replies:

102186 Jan 6,2012 12:47 PM Jan 9,2012 08:25 AM WPF 2
loading
Tags: Chart
James
Asked On January 6, 2012 12:47 PM

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


James
Replied On January 6, 2012 01:39 PM

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.


Michael Prabhu M [Syncfusion]
Replied On January 9, 2012 08:25 AM

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.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;