# How format date axis axis for bar chart component in Report Module

**URL:** <https://forum.inductiveautomation.com/t/how-format-date-axis-axis-for-bar-chart-component-in-report-module/27075>\
**Category:** Ignition\
**Created:** [August 1, 2019, 11:04am UTC](https://forum.inductiveautomation.com/t/how-format-date-axis-axis-for-bar-chart-component-in-report-module/27075 "2019-08-01T11:04:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [August 1, 2019, 11:04am UTC](https://forum.inductiveautomation.com/t/how-format-date-axis-axis-for-bar-chart-component-in-report-module/27075/1 "2019-08-01T11:04:36Z")

</div>

Hi  
There is no option for formatting the date in horizontal axis in bar component in Report module.  
I want to show only yyyy/DD/MM and hide time section. How can I do this?

---

<div class="post-metadata">

**Author:** ![kibitzllc](https://avatars.discourse-cdn.com/v4/letter/k/4da419/32.png) [@kibitzllc](https://forum.inductiveautomation.com/u/kibitzllc)\
**Post date:** [June 2, 2020, 6:41pm UTC](https://forum.inductiveautomation.com/t/how-format-date-axis-axis-for-bar-chart-component-in-report-module/27075/2 "2020-06-02T18:41:11Z")

</div>

I have the same problem. I would also like to rotate the date 45° or 90°.

---

<div class="post-metadata">

**Author:** ![kibitzllc](https://avatars.discourse-cdn.com/v4/letter/k/4da419/32.png) [@kibitzllc](https://forum.inductiveautomation.com/u/kibitzllc)\
**Post date:** [June 3, 2020, 1:11pm UTC](https://forum.inductiveautomation.com/t/how-format-date-axis-axis-for-bar-chart-component-in-report-module/27075/3 "2020-06-03T13:11:13Z")

</div>

I enabled scripting and put this code into the def configureChart(data, chart) script:

```
plot = chart.getPlot()
axis = plot.getDomainAxis()
axis.setCategoryLabelPositions(CategoryLabelPositions.UP_45)

```

According to JFreeChart this should work but it doesn’t.

---

<div class="post-metadata">

**Author:** ![kibitzllc](https://avatars.discourse-cdn.com/v4/letter/k/4da419/32.png) [@kibitzllc](https://forum.inductiveautomation.com/u/kibitzllc)\
**Post date:** [June 3, 2020, 3:10pm UTC](https://forum.inductiveautomation.com/t/how-format-date-axis-axis-for-bar-chart-component-in-report-module/27075/4 "2020-06-03T15:10:00Z")

</div>

I added  
from org.jfree.chart.axis import CategoryLabelPositions  
and then it worked

I formatted my date in my SQL query. Hopefully the rotate angle script will help you get to date formatting.

---

<div class="post-metadata">

**Author:** ![corey](https://avatars.discourse-cdn.com/v4/letter/c/838e76/32.png) [@corey](https://forum.inductiveautomation.com/u/corey)\
**Post date:** [April 17, 2025, 2:14am UTC](https://forum.inductiveautomation.com/t/how-format-date-axis-axis-for-bar-chart-component-in-report-module/27075/6 "2025-04-17T02:14:40Z")

</div>

I added this script to configure chart. I needed to display the day of week only  
the script I used is below, you can chane (EEE) to (dd-MM-yyyy) to get 18-03-2025

```python
	from java.text import SimpleDateFormat
	
	plot = chart.getPlot()
	dataset = plot.getDataset()
	
	inputFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
	outputFormat = SimpleDateFormat("EEEE")
	
	columnCount = dataset.getColumnCount()
	rowCount = dataset.getRowCount()
	
	# Create a new dataset to copy values into, with new keys
	from org.jfree.data.category import DefaultCategoryDataset
	newDataset = DefaultCategoryDataset()
	
	for row in range(rowCount):
	    rowKey = dataset.getRowKey(row)
	    for col in range(columnCount):
	        colKey = str(dataset.getColumnKey(col))
	        value = dataset.getValue(row, col)
	        try:
	            dateObj = inputFormat.parse(colKey)
	            formattedKey = outputFormat.format(dateObj)
	        except:
	            formattedKey = colKey # fallback
	
	        newDataset.setValue(value, rowKey, formattedKey)
	
	# Set the new dataset
	plot.setDataset(newDataset)

```

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/9/091c42d843ddb9defa9ad75f3f08819f0153d615.png)
