# Add a space between each category bars (xy chart component)

**URL:** <https://forum.inductiveautomation.com/t/add-a-space-between-each-category-bars-xy-chart-component/66702>\
**Category:** General Discussion\
**Tags:** perspective\
**Created:** [November 18, 2022, 7:15pm UTC](https://forum.inductiveautomation.com/t/add-a-space-between-each-category-bars-xy-chart-component/66702 "2022-11-18T19:15:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lalillo1](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@Lalillo1](https://forum.inductiveautomation.com/u/Lalillo1)\
**Post date:** [November 18, 2022, 7:15pm UTC](https://forum.inductiveautomation.com/t/add-a-space-between-each-category-bars-xy-chart-component/66702/1 "2022-11-18T19:15:44Z")

</div>

Hi, I am trying to add a space on the xy chart between categories:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/8/3885c4ec00ad2b53a86c672498a524467c306506.png)  
I have been looking into other topics. And I found these two topics useful:

[How to add space between category bars - XY Chart](https://forum.inductiveautomation.com/t/how-to-add-space-between-category-bars-xy-chart/47966/2)

[Bars distance in XY Chart](https://forum.inductiveautomation.com/t/bars-distance-in-xy-chart/54914/5)

However, there's an error in my script saying that the "array.array" object has no attribute 'getRowCount'

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/1/c165dca85c871a29638925890726f1b2396bb5ac.png)

Any hints for me?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 18, 2022, 7:18pm UTC](https://forum.inductiveautomation.com/t/add-a-space-between-each-category-bars-xy-chart-component/66702/2 "2022-11-18T19:18:42Z")

</div>

Your Query return type is JSON, but getRowCount is a DataSet function.  
Try this instead:  
`for row in range(0, len(value))`

---

<div class="post-metadata">

**Author:** ![Lalillo1](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@Lalillo1](https://forum.inductiveautomation.com/u/Lalillo1)\
**Post date:** [November 18, 2022, 7:20pm UTC](https://forum.inductiveautomation.com/t/add-a-space-between-each-category-bars-xy-chart-component/66702/3 "2022-11-18T19:20:21Z")

</div>

Thank you. Now it's complaining about the getValueAt  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/b/9b0aacd5e57432cc9880eda67ee89965b2ee5598.png)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 18, 2022, 7:20pm UTC](https://forum.inductiveautomation.com/t/add-a-space-between-each-category-bars-xy-chart-component/66702/4 "2022-11-18T19:20:53Z")

</div>

Because... getValueAt is a DataSet function.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 18, 2022, 7:23pm UTC](https://forum.inductiveautomation.com/t/add-a-space-between-each-category-bars-xy-chart-component/66702/5 "2022-11-18T19:23:37Z")

</div>

```auto
return [
    {
        "NestId": value[i]["NestID"] # access like this
    } for i in range(lenvalue))
]

```

---

<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:** [November 18, 2022, 9:40pm UTC](https://forum.inductiveautomation.com/t/add-a-space-between-each-category-bars-xy-chart-component/66702/6 "2022-11-18T21:40:13Z")

</div>

Better might be:

```python
return [dict(blank=0,blank1=0, **value)]

```

---

<div class="post-metadata">

**Author:** ![Lalillo1](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@Lalillo1](https://forum.inductiveautomation.com/u/Lalillo1)\
**Post date:** [November 18, 2022, 9:56pm UTC](https://forum.inductiveautomation.com/t/add-a-space-between-each-category-bars-xy-chart-component/66702/7 "2022-11-18T21:56:31Z")

</div>

> [@lrose](#):
>
> `return [dict(blank=0,blank1=0, **value)]`

Thank you very much for your help!

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/1/510c066cbd3ada5f30ab7a0d7847fbf69fb4ac35.png)

---

<div class="post-metadata">

**Author:** ![Lalillo1](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@Lalillo1](https://forum.inductiveautomation.com/u/Lalillo1)\
**Post date:** [December 8, 2022, 1:06am UTC](https://forum.inductiveautomation.com/t/add-a-space-between-each-category-bars-xy-chart-component/66702/8 "2022-12-08T01:06:26Z")

</div>

@cmallonee Question:  
Instead of NestID column name now it's called "station". However, I would like to map values from 1-7 to the Station Description. How can I correct the line **station": value[row].stationDesc["station"]**?

```auto
	stationDesc = { 1: "Tube Inserts",
					2: "Valve Load",
					3: "Foot Load",
					4: "Pres. Test", 
					5: "Clock Valve", 
					6: "Foot Snap", 
					7: "Part Present"
					}
	return [
		{	
			"blank": 0,
			"station": value[row].stationDesc["station"],
			"Ch1": value[row]["Ch1"],
			"Ch2": value[row]["Ch2"],
			"Ch3": value[row]["Ch3"],
			"Ch4": value[row]["Ch4"],
			"blank1": 0
		}	for row in range (0, len(value))
	]

```

---

<div class="post-metadata">

**Author:** ![Lalillo1](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@Lalillo1](https://forum.inductiveautomation.com/u/Lalillo1)\
**Post date:** [December 8, 2022, 3:56am UTC](https://forum.inductiveautomation.com/t/add-a-space-between-each-category-bars-xy-chart-component/66702/9 "2022-12-08T03:56:44Z")

</div>

@cmallonee Never mind. I got it this way:

```auto
	stationDesc = { 1: "Tube Inserts",
						2: "Valve Load",
						3: "Foot Load",
						4: "Pres. Test", 
						5: "Clock Valve", 
						6: "Foot Snap", 
						7: "Part Present"
						}
	return [
		{	
			"blank": 0,
			"station":stationDesc.get(value[row]["station"]),
			"Ch1": value[row]["Ch1"],
			"Ch2": value[row]["Ch2"],
			"Ch3": value[row]["Ch3"],
			"Ch4": value[row]["Ch4"],
			"blank1": 0
		}	for row in range (0, len(value))
	]

```
