views:

678

answers:

2

When you use Zedgraph for linegraphs and set IsSmooth to true, the lines are nicely curved instead of having hard corners/angles.

While this looks much better for most graphs -in my humble opinion- there is a small catch. The smoothing algorithm makes the line take a little 'dive' or 'bump' before going upwards or downwards.

In most cases, if the datapoint are themselves smooth, this isn't a problem, but if your datapoints go from say 0 to 15, the 'dive' makes the line go under the x-axis, which makes it seems as though there are some datapoints below zero (which is not the case).

How can I fix this (prefably easily ;)

+1  A: 

You could try to alter the myCurve.Line.SmoothTension property up or down and see if that helps.

Roger Ween
+2  A: 

No simple answer for this. Keeping the tension near zero will be your simplest solution.

ZedGraph uses GDI's DrawCurve tension parameter to apply smoothness, which is probably Hermite Interpolation. You can try to implement your own Cosine Interpolation, which will keep local extremes because of its nature. You can look at the this link to see why: http://local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/

shaun
+1 for the analysis, proposed solution and reference.
Peter Mortensen