Chart in reports

The report module is my real weakness. I’m trying to get it to just display a simple chart, but it just wont do what I want.
I’ve attached an image of what I want to accomplish.
I have a 3 column dataset:
Group Speed Production
groupname 2000 2323232

Can someone let me know how to set this up. I’m in V7.8.4.


I got this far before I ran into what I believe is a hard limit with reporting. This script is on a Bar Chart - it correctly renders two lines and two axes, but I can’t get the second line onto the second axis.

This would go into the configureChart section of your bar chart:

	from org.jfree.chart.renderer.category import LineAndShapeRenderer
	from import CategoryDataset
	from org.jfree.chart.axis import NumberAxis
	plot = chart.getPlot()
	line1 = LineAndShapeRenderer()
	axis2 = NumberAxis()
	axis2.setRange(0, 2000)
	axis1 = plot.getRangeAxis()
	ds = plot.getDataset().clone()
	plot.setDataset(1, ds)
	plot.setRangeAxis(1, axis2)
	plot.mapDatasetToRangeAxis(1, 1)
	plot.setRenderer(0, line1)

For future SEO:
Report reporting chart bar category line dual multiple data series axis axes xy

Thanks Paul, you got further than I did! At least I know how to draw a line graph now instead of a bar chart.

Just tested it in the client though and it shows as bar chart rather than a line graph, in the designer it shows fine. Just fired off a scheduled task email of the report and that shows as good as well. It seems the client report viewer cannot show the LineAndShapeRenderer?

Configure chart scripts weren’t working in the client – that’s been fixed in 7.9.1. If you can’t move off 7.8, send a note to support asking to have that backported to 7.8

[edit] Looks like 7.8.5 is out, and that’s the last scheduled 7.8.x release. You’ll need to upgrade to 7.9.1

Thanks Kathy. We are waiting for 7.9.1 to come out of beta to do that update.
Do you know if 7.9.1 enables multi axis as per my first post?

Not that I know of. That would be something to request at

Here you go.

	from org.jfree.chart.renderer.category import LineAndShapeRenderer
	from import DefaultCategoryDataset
	from org.jfree.chart.axis import NumberAxis
	from java.awt import Color, BasicStroke
	myStroke = BasicStroke(3.0)
	plot = chart.getPlot()
	ds = plot.getDataset()
	ds1 = DefaultCategoryDataset()	# Speed
	ds2 = DefaultCategoryDataset()	# Production

	# Build the new datasets
	for row in ds.getRowKeys():
		for col in ds.getColumnKeys():
			v = ds.getValue(row,col)
			if row == "Speed":
			elif row == "Production":
				ds2.addValue(v, row, col)
	# Speed Renderer	
	line1 = LineAndShapeRenderer()
	# Production Renderer
	line2 = LineAndShapeRenderer()
	axis1 = NumberAxis()
#	axis1.setRange(0, 2000)
	axis2 = NumberAxis()
#	axis2.setRange(0,1400000)

	# Assign Speed Dataset and Axis
	plot.setRenderer(0, line1)
	plot.mapDatasetToRangeAxis(0, 0)

	# Assign Production Dataset and Axis
	plot.setDataset(1, ds2)
	plot.setRangeAxis(1, axis2)
	plot.mapDatasetToRangeAxis(1, 1)
1 Like

That works perfectly, thanks jpark, much appreciated.


I had a look at the code above and tried to implement on the reporting. Although I seem to be missing a step.

I have this data:

which I also formatted as:

I would like to display it with 2 axis on the bar chart:

Using the scripting I was able to change the bar chart in the report to show two axis, but the values are not being pulled through. Any help in pointing me in the right direction will be appreciated.