# Setting Chart X axis min tick size?

**URL:** <https://forum.inductiveautomation.com/t/setting-chart-x-axis-min-tick-size/4500>\
**Category:** Ignition\
**Created:** [May 19, 2012, 5:59am UTC](https://forum.inductiveautomation.com/t/setting-chart-x-axis-min-tick-size/4500 "2012-05-19T05:59:16Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![cswett](https://avatars.discourse-cdn.com/v4/letter/c/b3f665/32.png) [@cswett](https://forum.inductiveautomation.com/u/cswett)\
**Post date:** [May 19, 2012, 5:59am UTC](https://forum.inductiveautomation.com/t/setting-chart-x-axis-min-tick-size/4500/1 "2012-05-19T05:59:16Z")

</div>

How could I set a chart so that the tick size is every full 1.0? For instance, I have a chart with the X-axis being weeks of the year. Weeks such as 17, 18, 19 are displayed 17, 17.5, 18, 18.5, 19, 19.5 across the X-axis of the chart.

Thanks  
Casey  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/3/352b6f02b103219ffd18b6109a7202e41f5390c8.PNG)

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [May 21, 2012, 3:27pm UTC](https://forum.inductiveautomation.com/t/setting-chart-x-axis-min-tick-size/4500/2 "2012-05-21T15:27:06Z")

</div>

No, you can’t set the tick units for the x-axis. You can only do it for the y-axis.

---

<div class="post-metadata">

**Author:** ![cswett](https://avatars.discourse-cdn.com/v4/letter/c/b3f665/32.png) [@cswett](https://forum.inductiveautomation.com/u/cswett)\
**Post date:** [May 21, 2012, 4:14pm UTC](https://forum.inductiveautomation.com/t/setting-chart-x-axis-min-tick-size/4500/3 "2012-05-21T16:14:47Z")

</div>

Any thoughts of a possible work around? I can resize the chart smaller till the half marks go away.  
Thanks  
Casey

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [May 21, 2012, 5:09pm UTC](https://forum.inductiveautomation.com/t/setting-chart-x-axis-min-tick-size/4500/4 "2012-05-21T17:09:43Z")

</div>

Are you married into using a line chart? A bar chart would put things into categories for you.  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/0/0a19f27020e1563a86bd645db0dc1fce0a6cfa1d.png)

---

<div class="post-metadata">

**Author:** ![cswett](https://avatars.discourse-cdn.com/v4/letter/c/b3f665/32.png) [@cswett](https://forum.inductiveautomation.com/u/cswett)\
**Post date:** [May 21, 2012, 6:00pm UTC](https://forum.inductiveautomation.com/t/setting-chart-x-axis-min-tick-size/4500/5 "2012-05-21T18:00:50Z")

</div>

I could do that, change to a bar chart and I do see that works just fine with the exception of that the line chart automatically sorted the dataset ascending for me.

Could you please help explain the dataset sorting ability?

system.dataset.sort(dataset, keyColumn [, ascending])  
Parameters  
Dataset dataset - The dataset to sort.  
String keyColumn - The index or column name of the column to sort on.  
boolean ascending - True for ascending order, False for descending order. [optional]

I have tried using the following, yet I get an error that name WEEK doesn’t exist. If I change from the name of the column to the int of it… 0, then I get a 1st arg can’t be coerced to com.ind…

if event.propertyName == “dbbrowse”:  
dbbrowse = system.dataset.toPyDataSet(event.newValue)  
newData2 = []

for row in dbbrowse:  
newData2.append([row[2], row[3]])

event.source.newData2 = system.dataset.toDataSet([“WEEK”, “LBS PMH”], newData2)  
system.dataset.sort(newData2, WEEK [,True])

Thanks,  
Casey

---

<div class="post-metadata">

**Author:** ![Greg.Buehler](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@Greg.Buehler](https://forum.inductiveautomation.com/u/Greg.Buehler)\
**Post date:** [May 21, 2012, 6:23pm UTC](https://forum.inductiveautomation.com/t/setting-chart-x-axis-min-tick-size/4500/6 "2012-05-21T18:23:42Z")

</div>

Try:

```auto
if event.propertyName == "dbbrowse":
  dbbrowse = system.dataset.toPyDataSet(event.newValue)
  rows = []

  for row in dbbrowse:
    rows.append([row[2], row[3]])

  data = system.dataset.toDataSet(["WEEK", "LBS PMH"], rows)
  system.dataset.sort(data, "WEEK" , 1)
```

I think you were getting confused by having the optional parameters in square brackets in the documentation and true being represented by a non-zero number.

---

<div class="post-metadata">

**Author:** ![cswett](https://avatars.discourse-cdn.com/v4/letter/c/b3f665/32.png) [@cswett](https://forum.inductiveautomation.com/u/cswett)\
**Post date:** [May 21, 2012, 6:43pm UTC](https://forum.inductiveautomation.com/t/setting-chart-x-axis-min-tick-size/4500/7 "2012-05-21T18:43:07Z")

</div>

Yes that was confusing me. I just tried that, now no errors, but also no data in the dataset. I also tried changing the syntax within the existing script and same result. No error, but also no result within the dataset, the data stayed sorted the same way.

Thanks  
Casey

---

<div class="post-metadata">

**Author:** ![Greg.Buehler](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@Greg.Buehler](https://forum.inductiveautomation.com/u/Greg.Buehler)\
**Post date:** [May 21, 2012, 7:24pm UTC](https://forum.inductiveautomation.com/t/setting-chart-x-axis-min-tick-size/4500/8 "2012-05-21T19:24:42Z")

</div>

[quote=“cswett”]Yes that was confusing me. I just tried that, now no errors, but also no data in the dataset. I also tried changing the syntax within the existing script and same result. No error, but also no result within the dataset, the data stayed sorted the same way.

Thanks  
Casey[/quote]

Sorry about that. `sort` actually returns a sorted dataset instead of manipulating the referenced dataset.

```auto
sortedData = system.dataset.sort(data, "WEEK" , 1)
```

---

<div class="post-metadata">

**Author:** ![cswett](https://avatars.discourse-cdn.com/v4/letter/c/b3f665/32.png) [@cswett](https://forum.inductiveautomation.com/u/cswett)\
**Post date:** [May 21, 2012, 8:52pm UTC](https://forum.inductiveautomation.com/t/setting-chart-x-axis-min-tick-size/4500/9 "2012-05-21T20:52:12Z")

</div>

I wonder what I’m still missing, I’m getting:

File “event:propertyChange”, line 9, in   
TypeError: sort(): 1st arg can’t be coerced to com.inductiveautomation.ignition.common.Dataset

Line 9: sortedData = system.dataset.sort(newData2, “WEEK” , 1)

----Under the root container, I have customer properties configured for three datasets (dbbrowse, newData2, and sortedData).

if event.propertyName == “dbbrowse”:  
dbbrowse = system.dataset.toPyDataSet(event.newValue)  
newData2 = []

for row in dbbrowse:  
newData2.append([row[1], row[2], row[3]])

event.source.newData2 = system.dataset.toDataSet([“WEEK”, “LBS PMH”, “GOAL”], newData2)  
sortedData = system.dataset.sort(newData2, “WEEK” , 1)

---

<div class="post-metadata">

**Author:** ![cswett](https://avatars.discourse-cdn.com/v4/letter/c/b3f665/32.png) [@cswett](https://forum.inductiveautomation.com/u/cswett)\
**Post date:** [May 21, 2012, 10:13pm UTC](https://forum.inductiveautomation.com/t/setting-chart-x-axis-min-tick-size/4500/10 "2012-05-21T22:13:03Z")

</div>

I was able to get this working by using the expression sort functionality and then choosing Expression under the data binding for each chart.

sortDataset({Root Container.newData2}, 0, true)

I would still like to figure out what I was doing wrong under the scripting, but this gets me running.

Thanks,  
Casey

---

<div class="post-metadata">

**Author:** ![cswett](https://avatars.discourse-cdn.com/v4/letter/c/b3f665/32.png) [@cswett](https://forum.inductiveautomation.com/u/cswett)\
**Post date:** [May 21, 2012, 10:47pm UTC](https://forum.inductiveautomation.com/t/setting-chart-x-axis-min-tick-size/4500/11 "2012-05-21T22:47:52Z")

</div>

I was also able to come up with a way to keep the mid-tick size graduations from showing up. I just increased the size of the font for the tick labels. Now I can make the line chart as large as I want without the other ticks showing up.
