# Apex Chart problem with tag history formatting

**URL:** <https://forum.inductiveautomation.com/t/apex-chart-problem-with-tag-history-formatting/62751>\
**Category:** Ignition\
**Created:** [August 7, 2022, 6:14am UTC](https://forum.inductiveautomation.com/t/apex-chart-problem-with-tag-history-formatting/62751 "2022-08-07T06:14:30Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aiasa21](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Aiasa21](https://forum.inductiveautomation.com/u/Aiasa21)\
**Post date:** [August 7, 2022, 6:14am UTC](https://forum.inductiveautomation.com/t/apex-chart-problem-with-tag-history-formatting/62751/1 "2022-08-07T06:14:30Z")

</div>

Good morning guys,  
I’m having problem showing data in a chart (line or area) using Apex Chart… after some try and some help I figure out that the exactly structure to show data is this (with “0” as t\_stamp and “1” as value) and it work  
 ![chart 1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/5/951618af6b0282c4a37bfa68cae11febe3e6134b.png)

The problem is that I can’t make it work with tag history, I bind the “data” property of the series and I select the tag and I set as in picture (I even tried to change “Value format” from Dataset to Document )

 ![chart 2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/f/7f0a52212baaa954f8d1a9fd2e4a7ed40f3c0bf4.png)

and the result is that the structure could be correct, but instead of “0” as t\_stamp and “1” as value, I have the names saved in the database.

 ![chart 3](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/f/df172697f8c337cff37188a3809ed34a26faad89.png)

What do I wrong guys?

---

<div class="post-metadata">

**Author:** ![djs](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@djs](https://forum.inductiveautomation.com/u/djs)\
**Post date:** [August 8, 2022, 12:54pm UTC](https://forum.inductiveautomation.com/t/apex-chart-problem-with-tag-history-formatting/62751/2 "2022-08-08T12:54:23Z")

</div>

You could change the format of the data with a script transform. I got it to work with this:

```auto
return [[row['t_stamp'], row['tag_name']] for row in value]

```

Keep the return type as _document_ and replace _tag\_name_ with the name of your tag (or give the tag an alias of _tag\_name_).

---

<div class="post-metadata">

**Author:** ![Aiasa21](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Aiasa21](https://forum.inductiveautomation.com/u/Aiasa21)\
**Post date:** [August 8, 2022, 2:02pm UTC](https://forum.inductiveautomation.com/t/apex-chart-problem-with-tag-history-formatting/62751/3 "2022-08-08T14:02:10Z")

</div>

Great! This is working perfectly, thanks a lot for the help.

Is strange that it must be done with a transformation like this the data loading. Anyway thanks again, this is very helpful

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 8, 2022, 3:56pm UTC](https://forum.inductiveautomation.com/t/apex-chart-problem-with-tag-history-formatting/62751/4 "2022-08-08T15:56:01Z")

</div>

You can also just populate the ‘alias’ column in your screenshot to avoid the spaces, which is the cause of the “error” in the properties.

---

<div class="post-metadata">

**Author:** ![Aiasa21](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Aiasa21](https://forum.inductiveautomation.com/u/Aiasa21)\
**Post date:** [August 8, 2022, 4:42pm UTC](https://forum.inductiveautomation.com/t/apex-chart-problem-with-tag-history-formatting/62751/5 "2022-08-08T16:42:14Z")

</div>

I made some test but if I populate the alias column I just change the Y values, or is there a way to alias both X and Y?

---

<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:** [August 8, 2022, 4:44pm UTC](https://forum.inductiveautomation.com/t/apex-chart-problem-with-tag-history-formatting/62751/6 "2022-08-08T16:44:35Z")

</div>

You don’t need to alias the X values. The “error” you are seeing is from the spaces that are in your tag name. That is why only those values have the read highlight.

---

<div class="post-metadata">

**Author:** ![Aiasa21](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Aiasa21](https://forum.inductiveautomation.com/u/Aiasa21)\
**Post date:** [August 8, 2022, 5:59pm UTC](https://forum.inductiveautomation.com/t/apex-chart-problem-with-tag-history-formatting/62751/7 "2022-08-08T17:59:54Z")

</div>

Actually I’ve just make a try and even if I show a tag with no spaces, it’s not showed …

---

<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:** [August 8, 2022, 6:02pm UTC](https://forum.inductiveautomation.com/t/apex-chart-problem-with-tag-history-formatting/62751/8 "2022-08-08T18:02:16Z")

</div>

Are any of those values greater than 0?

---

<div class="post-metadata">

**Author:** ![Aiasa21](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Aiasa21](https://forum.inductiveautomation.com/u/Aiasa21)\
**Post date:** [August 8, 2022, 6:02pm UTC](https://forum.inductiveautomation.com/t/apex-chart-problem-with-tag-history-formatting/62751/9 "2022-08-08T18:02:58Z")

</div>

Yes sorry for the screenshot, the arrays after the [4] index are populated with actual temperature

---

<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:** [August 8, 2022, 6:04pm UTC](https://forum.inductiveautomation.com/t/apex-chart-problem-with-tag-history-formatting/62751/10 "2022-08-08T18:04:47Z")

</div>

What does the trend look like?

---

<div class="post-metadata">

**Author:** ![Aiasa21](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Aiasa21](https://forum.inductiveautomation.com/u/Aiasa21)\
**Post date:** [August 8, 2022, 6:13pm UTC](https://forum.inductiveautomation.com/t/apex-chart-problem-with-tag-history-formatting/62751/11 "2022-08-08T18:13:12Z")

</div>

The chart shows NaN if I try to x-trace it

---

<div class="post-metadata">

**Author:** ![Janez\_Stravs](https://avatars.discourse-cdn.com/v4/letter/j/e9c0ed/32.png) [@Janez\_Stravs](https://forum.inductiveautomation.com/u/Janez_Stravs)\
**Post date:** [October 16, 2023, 12:39pm UTC](https://forum.inductiveautomation.com/t/apex-chart-problem-with-tag-history-formatting/62751/12 "2023-10-16T12:39:10Z")

</div>

Is there an easy way to bind Apex Chart to Tag History?  
When adding script transform, values are still not shown.

 ![BindingTagHistoryScriptTransform](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/c/accdb1c0b4b5310e53f68664f2e5ee85f8764094.png)
