Question

Let's say I have a sine curve in ZedGraph that goes from -10 to +10 on the y-axis. I'd like to be able to put limits on the curve (let's say a minimum of -5, and a maximum of +7), such that anything below -5 and anything above +7 is shaded, and everything in the middle is not. Is this possible in ZedGraph?

Is this possible in any open source .NET charting libraries (free commercial use)?

Was it helpful?

Solution

I can see three routes (can't say I've tried them), if you want to shade the whole graph area then either of these two:

(1) Use BoxObj, with a Fill defined with an alpha value - this should be completely flexible. BoxObj is used towards the bottom of this demo.

(2) Use a filled plot style as shown here, you can see how a semi-transparent fill is defined here as well. Not sure how to control where the fill goes (i.e the graph min or max) rather than to the x-axis.

Alternatively if you just want to shade the points, then you could build the curve objects conditionally.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top