Report TimeSeries constant lines as min/max

I am trying to plot constant line in Timeseries chart on a report.

Below is the Script code I am using for Trend’s script and ValueMarker is 142.5.
How can I pass the MarkerValue from report parameters?

def configureChart(chart):

from org.jfree.ui import Layer
from org.jfree.ui import RectangleAnchor
from org.jfree.ui import TextAnchor
from org.jfree.chart.plot import ValueMarker
from java.awt import BasicStroke, Color
stroke = BasicStroke(2.0)
color = Color(255,0,0)
plot = chart.getPlot()
targetValue = ValueMarker(142.5);   
targetValue.setLabelAnchor(RectangleAnchor.LEFT)
targetValue.setLabelTextAnchor(TextAnchor.CENTER_LEFT)
targetValue.setLabel("Target")
targetValue.setStroke(stroke)
targetValue.setPaint(color)
plot.addRangeMarker(targetValue, Layer.BACKGROUND)

Thanks!
Fred Zaboli

Hello Fredz,
Were you able to find a solution to this issue?

As of...a while ago, somewhere in 8.0.x, I think, the configureChart extension functions in reporting are provided the same data object (with all parameters and data sources in the report) available in scripted data sources. This would allow you to directly refer to a parameter's value and use it as a marker value using the script example here.

1 Like