Bar Chart in Report - Control Chart Title using Configure/Edit Script

I have been able to create a chart title (as opposed to just creating a text object and dragging it over top of the chart).
I can't seem to set the font information for the title I created.
The attached picture shows the title I created with the script
for the A shift bar chart, and B shift bar chart has the text object.
Does anyone know how to do this?
(unfortunately I am still with Ver7.9.12)

	#Example: chart.setTitle(data['myKey'])
	#Set the chart title
	chart.setTitle('A Shift')

	#this code below to set the title font does not work
	#chart.setTitleFont (Arial, Bold, 8)

	#Hide the Y Axis as the numbers are not needed.
	plot = chart.getPlot() 
	range = plot.getRangeAxis() 
	range.setVisible(False)

Instead of setting the title with a String Value, the function has an overload which allows you to set it with a TextTitle object, which will allow you to set the font, as well as other things.

https://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/title/TextTitle.html

So you would do something like:

title = TextTitle('A Shift',Font('Arial'))
chart.setTitle(title)

Obviously you can configure whatever font and appropriate settings you want with the constructor for the Font object.

Thank you for the suggestion, however I wasn't able to get that to work as intended. If I use that code, the title disappears (which tells me the report software isn't happy with it)....

I have a solution from the help support desk. Here it is.

||#Example: chart.setTitle(data['myKey'])|
|---|---|
||#Set the chart title|
||#to set the font of a chart's title, you will need to import |
||#and use Java's Font libraries. Once you do so, you can declare |
||#and set the font accordingly. |
||from java.awt import Font |
||chart.setTitle('A Shift')|
||myFont = Font('Arial', Font.BOLD, 12) |
||chart.getTitle().setFont(myFont)|
1 Like