# \[Question\] XYChart with Tag History

**URL:** <https://forum.inductiveautomation.com/t/question-xychart-with-tag-history/21021>\
**Category:** Ignition Early Access\
**Created:** [November 22, 2018, 1:51pm UTC](https://forum.inductiveautomation.com/t/question-xychart-with-tag-history/21021 "2018-11-22T13:51:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![software.development](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/software.development/32/6688_2.png) [@software.development](https://forum.inductiveautomation.com/u/software.development)\
**Post date:** [November 22, 2018, 1:51pm UTC](https://forum.inductiveautomation.com/t/question-xychart-with-tag-history/21021/1 "2018-11-22T13:51:06Z")

</div>

How am I supposed to show tag history through XYChart? Should I make a binding in dataSources property?  
Thanks for your help

---

<div class="post-metadata">

**Author:** ![SteveE](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/stevee/32/14460_2.png) [@SteveE](https://forum.inductiveautomation.com/u/SteveE)\
**Post date:** [November 26, 2018, 5:00am UTC](https://forum.inductiveautomation.com/t/question-xychart-with-tag-history/21021/2 "2018-11-26T05:00:40Z")

</div>

+1 to this question

Any documentation about?

---

<div class="post-metadata">

**Author:** ![Kevin.McClusky](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@Kevin.McClusky](https://forum.inductiveautomation.com/u/Kevin.McClusky)\
**Post date:** [November 29, 2018, 1:29am UTC](https://forum.inductiveautomation.com/t/question-xychart-with-tag-history/21021/3 "2018-11-29T01:29:37Z")

</div>

From the demo, this page does tag history in a chart:  
[http://demo.inductiveautomation.com/data/perspective/client/OnlineDemo/feature/history/charts](http://demo.inductiveautomation.com/data/perspective/client/OnlineDemo/feature/history/charts)

We just posted the demo project files. Hopefully taking a look at them will provide a little guidance.

> [@Ignition 8 Online Demo Examples](http://forum.inductiveautomation.com/t/ignition-8-online-demo-examples/21118):
>
> Since a lot of people have been asking about how certain features of the demo project were accomplished, we thought we would share that with everyone here. The user/password for Ignition is: admin/password \*\*Edit: The downloads are now available on our Ignition Extras page.\*\* [Ignition Extras](https://inductiveautomation.com/downloads/extra-material) The download under Gateway Backups includes everything to create your own copy of the demo on your own Ignition setup. This includes a Gateway Backup, SQL files, instructions, and individual project expo…

Note that we have two major things that we're working on improving in this area:

1. Tag History Binding UI (you won't need to create objects like you do today)
2. Improving chart components

This will mean that the examples will be obsolete before our final release. However, if you wanted to do this in the mean time, you can certainly follow what we did there for the demo.

---

<div class="post-metadata">

**Author:** ![software.development](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/software.development/32/6688_2.png) [@software.development](https://forum.inductiveautomation.com/u/software.development)\
**Post date:** [November 30, 2018, 10:18am UTC](https://forum.inductiveautomation.com/t/question-xychart-with-tag-history/21021/4 "2018-11-30T10:18:19Z")

</div>

Thanks a lot. One more question: is queryHistory function something you have defined in gateway scripts (not included in demo project files)? Copy/Paste of the function could be helpful too.

---

<div class="post-metadata">

**Author:** ![osolorzano](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/osolorzano/32/6432_2.png) [@osolorzano](https://forum.inductiveautomation.com/u/osolorzano)\
**Post date:** [December 20, 2018, 7:44pm UTC](https://forum.inductiveautomation.com/t/question-xychart-with-tag-history/21021/5 "2018-12-20T19:44:01Z")

</div>

Sorry for the late response but, the queryHistory() function that is used in the demo project is located in the Project \> Scripting \> Script Library \> history file on the project browser for the demo project. Although I will warn you, it is very complex and probably more than what a normal history binding should look like.

I’ve attached a more simple example of history binding using the XYChart. [testHistory.proj](https://us1.discourse-cdn.com/inductiveautomation/original/2X/0/09145259fce71a133ce3f5a4f46da35326265112.proj) (13.8 KB) This project has one view with 2 XYCharts. One using the tag history binding, and the other using a property binding that then calls the system.tag.queryTagHistory() function in a script transform for more flexibility.  
This project relies on a a tag with tag path Sine0 in the default tag provider. I just grabbed the one in the Generic Simulator and threw it on the root of the tag browser. Doing just that should make the project work.

For the base case of just getting history to show, there is only two things that need to change from the defaults on the XYChart:

First, bind the “example” dataSource of the XYChart to the tag you have history on (note, as of now it does require that the tag path contain the tag provider even if it’s [default]) In the project, this is [default]Sine0

Second, on the “series” array in the XYChart, pick one and go to it’s “data” property. There, change the x to “t\_stamp” and y to the tag path(in this example project it’s just Sine0). This data object is what actually defines the data points for the specific series. Notice the source says “example” which corresponds to the example dataSource. The x and y parts correspond to the column names of the dataset that makes up the example dataSource.

Those two steps will give you the very basic chart that shows historical data. After that, you can dive into the other options to see what they do, they mostly do with how the chart looks and what the labels say.

In the project provided some optional steps are also provided as an example, such as the polling object on the top chart for history binding and the ability to change the range of data viewed with the bottom chart. Check it out, it hopefully is a lot easier to navigate than the demo project to get started with tag history on the XYChart.

---

<div class="post-metadata">

**Author:** ![Steve\_Laubach](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steve_laubach/32/60900_2.png) [@Steve\_Laubach](https://forum.inductiveautomation.com/u/Steve_Laubach)\
**Post date:** [January 25, 2019, 3:37pm UTC](https://forum.inductiveautomation.com/t/question-xychart-with-tag-history/21021/6 "2019-01-25T15:37:31Z")

</div>

Is this functionality going to be simplified soon?

Should we expect the method to display historical data to be like this at Ignition 8 launch?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 8, 2019, 11:48pm UTC](https://forum.inductiveautomation.com/t/question-xychart-with-tag-history/21021/7 "2019-05-08T23:48:34Z")

</div>

I’m finding the XY chart equally difficult to configure… there are just so many options and they’re all deeply nested within each other making it a slow process to configure.

---

<div class="post-metadata">

**Author:** ![Steve\_Laubach](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steve_laubach/32/60900_2.png) [@Steve\_Laubach](https://forum.inductiveautomation.com/u/Steve_Laubach)\
**Post date:** [May 9, 2019, 1:53pm UTC](https://forum.inductiveautomation.com/t/question-xychart-with-tag-history/21021/8 "2019-05-09T13:53:47Z")

</div>

I used online json editor.

Adding things to arrays in the designer gets exponentially slower with each new item. I made a chart with over 100 series (customer request) on it and then copy/pasted the json into the series. If you try to add array element in designer it takes 10 min or so. In other words, json editor is the only way to go. Also, the best way I’ve found to hide series on a chart is to dynamically adjust the axis assigned to a series. If the axis is blank the series hides.

When you copy/paste things from designer they are in your paste buffer as json code. So you can actually copy/paste json into your designer. Keep backups of your screens and test on those first. Pasting incorrect json can pretty much pave your view. Also, you can right click on views to close them without saving. Just passing that on in case you didn’t know. I discovered it in a freak notepad accident.

I’m sure there’s a good way to do all of this with python but I haven’t had time to play with it. When I started delivering Perspective stuff to a customer they have been throwing all kinds of interesting requests at me so I’ve been busy trying to figure out how to satisfy them. It’s like drinking from a fire hose but it’s been a fun adventure.
