JFree Chart Reporting Scripting - Series color change base on setpoint

In the Reporting module >, Timeseries chart >, jfree chart scripting, I am trying to change the series color based on a setpoint(s). I could say the script that I use, work to some extent but not quite to the point, it is working as I expected.

For example, my setpoint is at 73, and I need the series color to be RED when values are below the setpoint and BLUE when it is above setpoint.

What is happening at the moment with this script that I use is that values that drop from above setpoint to below setpoint (example 78 to 65) will have a red line drawn all the way (from 78 to 65) as the new value 65 is below the setpoint. This is happening vice versa as well. (from below setpoint to above setpoint).


Let me know if you guys have any suggestions or examples that I could try.
Thank you.


Keywords - Reporting, Timeseries chart, XYLineAndShapeRenderer, JFree Chart, Dash Line.

I’m not sure if jfreechart actually supports something this granular. As you notice, the lines only have one color, from point to point. The two options would be to insert intermediary points in your dataset at the setpoint via scripting (hard) or find a way to customize the line rendering of JFreeChart even further (also hard).

Thank you for the suggestions.
I am working on a 3rd option, which is trending two tags. I create two derived tags for this process value tag and trended those 1-sec intervals to get a smooth curve. But there are still some small gaps.
However, I think the good approach would be finding a way on jfree chart (scripting) as it would allow me to go back on the time and create reports. Otherwise, the other options will only allow me to create reports from now on.

(Two Tags trending)