EZChart Shaded Areas

My client would like to have shaded area above and below their desired operating range on an EZChart. (Think UCL/LCL). The low side is pretty easy using CalcPens and an area chart as it shades the are under the curve. Now I need to shade the area above the curve for the upper limit. Anyone have any suggestions?

You could use almost the same trick:

  • Set the plot background to something shaded (no pattern possible though, so it will probably have to be grey)
  • Add a pen to draw a white background up to the top value
  • Add a pen to draw a shaded background up to the bottom value again

This should leave you with a white “valid” range.

Btw, could you write “easy” the next time, it took me a while to figure out what kind of chart you meant. We’re not all native speakers…

Thanks Sanderd17, I’ve played with the solution you mentioned and it does work. I was hoping for something a little more elegant and without the compromises. Maybe something that accesses the JFreeChart directly. I will probably move forward with your suggestion for now though. Thanks again.

In your scenario, you have to remove the gridlines since they will show in the top portion but be covered by the area plots everywhere else. Also there is a small band of background that shows on the right side of the plot that isn’t desirable. Lastly there is the order of the pens. It seems like the order of the pens determines their Z position on the chart. If you set the first pen as your high level, then the low level one will be beneath it and not show up. Most of these can be overcome but, as I said, I was looking for something a bit more elegant. I’m just not smart enough to dig into the JFreeChart API without some help.

By the way, could you write “by the way” next time. It took me a while to figure out that Btw meant by the way. We’re not all millennials… lol :smiley:

1 Like