antdig wrote at 2012-07-10 22:30:
I've created a line graph to plot data on and it's working well. I'd like to have the background show colored bands to represent red/yellow/green areas. For example, the background of the graph should be red for Y values less than 10; yellow for Y values >= 10 and < 20; green for Y values >= 20.
What's the best way to achieve this?
(Here's a crude example: http://www.csc-scc.gc.ca/text/pblct/rpp/rpp2012-13/images/ex1-eng.jpg )
objo wrote at 2012-07-11 00:24:
This could be done by annotations. I added a "RectangleAnnotation" class - see the example "Annotations | RectangleAnnotation - horizontal bands" in the "Example browser". The code is in the ExampleLibrary/Examples/AnnotationExamples.cs
antdig wrote at 2012-07-11 02:23:
Dude, you rock! That works perfectly.
One thing I noticed is that if I specify the MaximumY parameter as double.MaxValue it didn't plot the RectangleAnnotation. However, this was trivial to solve by omitting the MaximumY parameter.
objo wrote at 2012-07-11 14:50:
I added support also for double.MinValue/MaxValue (same effect as using NaN). I see this is useful when setting only the upper/lower bound.
Ps. The hatched (pattern) brush in your example is not supported by OxyPlot.
Customer support service by UserEcho