How to make a broken line graph

Answered (Verified) This post has 1 verified answer | 9 Replies | 3 Followers Thread's RSS feed.

andyman123
Points 110
Replied On: Wed, Jun 1 2011 4:48 PM Reply

I need the ability to not draw a line between certain points in a line series.  For example, say you had the following points:

1, 10

2, 20

3, 50

4, 30

5, 10

If the Y scale only went to 40, then there would be a break between points 2 and 4 above.  In other words you would have a line connecting 1 and 2 and another line connecting 4 and 5, but nothing in between. 

If I simply delete point 3, I end up with a line from 2 to 4 which isn't what I'm looking for.

Thank you.

  • Post Points: 20

Verified Answer

Answered (Verified) Replied On: Wed, Jun 1 2011 4:54 PM Reply
Verified by andyman123

Hi,

Try setting the value of that point to double.NaN, and if the series type you are using has the UnknownValuePlotting property set it to DontPlot.

Hope this helps!

-Graham

  • Post Points: 70

All Replies

Answered (Verified) Replied On: Wed, Jun 1 2011 4:54 PM Reply
Verified by andyman123

Hi,

Try setting the value of that point to double.NaN, and if the series type you are using has the UnknownValuePlotting property set it to DontPlot.

Hope this helps!

-Graham

  • Post Points: 70
andyman123
Points 110
Replied On: Wed, Jun 1 2011 5:07 PM Reply

That worked!  Thanks for the super fast response.  We just bought the control so don't know it all that well.  So far I'm very happy with the support!

  • Post Points: 5
Mike Graham
Points 240
Replied On: Sun, Jul 17 2011 10:01 AM Reply

I have a scenario where I need to be able to support both gaps and interpolation in the same series.  Ideally, I would like to use 'null' to indicate that the the series should 'DontPlot' and 'double.NaN' to indicate that the series should 'Interpolate'

This is VERY important to our app.  Can you tell me how to do this or if there is a work around you can think of?

 

  • Post Points: 20
Answered (Not Verified) Replied On: Mon, Jul 18 2011 9:15 AM Reply

Hi,

The chart doesn't currently support both of these methods simultaneously. You could make a feature request to this effect though.

My other recommendation is to set the series on Don't Plot, and use the null values to indicate this, but then remove the Double.NaN values, which should be interpolated, from the sequence before assigning it to the ItemsSource. You can remove them either by just subtracting them from the sequence, unless its important to show a data value at that index, or substituting them with a linear interpolated value between the previous and the next point.

In this way you can support both the discontinuities in the line, and the interpolated sections.

Hope this helps!

-Graham

  • Post Points: 20
Mike Graham
Points 240
Replied On: Mon, Jul 18 2011 10:10 AM Reply

I like the idea - we didn't consider this approach because all of our series (plural) are in the same IEnumeralbe<T>

But your suggestion made me think - we could create a CollectionViewSource, set its source to the IEnumerable<T>, and set its filter so that it removes the points from the view that are double.NaN, but just for the appropriate series.

Each series can have its own CollectionViewSource and its own independent filter...

Thanks for the help :)

-Mike

  • Post Points: 5
rosensaft
Points 90
Replied On: Wed, Sep 28 2011 2:41 PM Reply

This helps. But sometimes after zooming and scrolling I get this snark.

At the beginning:

After zooming and scrolling (a snark):

How can I avoid this?

  • Post Points: 20
Replied On: Thu, Sep 29 2011 2:56 PM Reply

hi,

Your images aren't showing and I'm uncertain what you mean by snark. Could you clarify? Is there a way you can provide a sample project that reproduces the issue?

-Graham

  • Post Points: 20
rosensaft
Points 90
Replied On: Fri, Sep 30 2011 4:00 PM Reply

I loaded these images!

Sometimes after zooming and scrolling I get this snark.

At the beginning:

After zooming and scrolling (a snark):

How can I avoid this?

Truly yours Mikhail

  • Post Points: 20
Replied On: Tue, Oct 11 2011 3:08 PM Reply

Hi,

I am unable to see your images. Could you try sharing them again?

-Graham

  • Post Points: 5
Page 1 of 1 (10 items) | RSS