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

**URL:** <https://forum.inductiveautomation.com/t/bar-chart-in-report-control-chart-title-using-configure-edit-script/82774>\
**Category:** Ignition\
**Tags:** ignition79, reporting\
**Created:** [December 6, 2023, 12:38pm UTC](https://forum.inductiveautomation.com/t/bar-chart-in-report-control-chart-title-using-configure-edit-script/82774 "2023-12-06T12:38:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard\_Tryon](https://avatars.discourse-cdn.com/v4/letter/r/ac8455/32.png) [@Richard\_Tryon](https://forum.inductiveautomation.com/u/Richard_Tryon)\
**Post date:** [December 6, 2023, 12:38pm UTC](https://forum.inductiveautomation.com/t/bar-chart-in-report-control-chart-title-using-configure-edit-script/82774/1 "2023-12-06T12:38:06Z")

</div>

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)

```auto
	#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)

```

 ![Report Bar Chart Title](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/8/e8fc62538906e7e604c2ff2c082e567373f87523.png)

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [December 6, 2023, 3:28pm UTC](https://forum.inductiveautomation.com/t/bar-chart-in-report-control-chart-title-using-configure-edit-script/82774/2 "2023-12-06T15:28:35Z")

</div>

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](https://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/title/TextTitle.html)

So you would do something like:

```auto
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.

---

<div class="post-metadata">

**Author:** ![Richard\_Tryon](https://avatars.discourse-cdn.com/v4/letter/r/ac8455/32.png) [@Richard\_Tryon](https://forum.inductiveautomation.com/u/Richard_Tryon)\
**Post date:** [December 6, 2023, 4:37pm UTC](https://forum.inductiveautomation.com/t/bar-chart-in-report-control-chart-title-using-configure-edit-script/82774/3 "2023-12-06T16:37:30Z")

</div>

> [@lrose](#):
>
> ```auto
> title = TextTitle('A Shift',Font('Arial'))
> chart.setTitle(title)
> 
> ```

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)....

---

<div class="post-metadata">

**Author:** ![Richard\_Tryon](https://avatars.discourse-cdn.com/v4/letter/r/ac8455/32.png) [@Richard\_Tryon](https://forum.inductiveautomation.com/u/Richard_Tryon)\
**Post date:** [December 6, 2023, 4:40pm UTC](https://forum.inductiveautomation.com/t/bar-chart-in-report-control-chart-title-using-configure-edit-script/82774/4 "2023-12-06T16:40:59Z")

</div>

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

```auto
||#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)|

```
