views:

776

answers:

1

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 minimum of -5, and 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 OpenSource .NET charting libraries (free commercial use)?

+1  A: 

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.

Ian Hopkinson
(1) Looks promising. I'll give it a try in the morning. Thanks!
Pwninstein