# Easy Chart start and end values

**URL:** <https://forum.inductiveautomation.com/t/easy-chart-start-and-end-values/1668>\
**Category:** Ignition\
**Created:** [March 19, 2010, 3:12pm UTC](https://forum.inductiveautomation.com/t/easy-chart-start-and-end-values/1668 "2010-03-19T15:12:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jgreenewv](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@jgreenewv](https://forum.inductiveautomation.com/u/jgreenewv)\
**Post date:** [March 19, 2010, 3:12pm UTC](https://forum.inductiveautomation.com/t/easy-chart-start-and-end-values/1668/1 "2010-03-19T15:12:27Z")

</div>

Here is another one from the customer that wants everything to look like their old system. They are asking for numeric displays on the same screen as their Easy Charts displaying the first and last values of each pen. I am using SQLTags Historian pens on the charts. I’d appreciate any pointers as to if this is even possible. Thanks.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [March 19, 2010, 3:40pm UTC](https://forum.inductiveautomation.com/t/easy-chart-start-and-end-values/1668/2 "2010-03-19T15:40:13Z")

</div>

First and last? You mean, given the scope of what the chart is displaying?

---

<div class="post-metadata">

**Author:** ![jgreenewv](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@jgreenewv](https://forum.inductiveautomation.com/u/jgreenewv)\
**Post date:** [March 19, 2010, 3:42pm UTC](https://forum.inductiveautomation.com/t/easy-chart-start-and-end-values/1668/3 "2010-03-19T15:42:41Z")

</div>

That is correct. If the chart range is from 11:14 AM to 9:22 PM, I need to show the values of the pens at those two times.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [March 19, 2010, 3:53pm UTC](https://forum.inductiveautomation.com/t/easy-chart-start-and-end-values/1668/4 "2010-03-19T15:53:15Z")

</div>

I think this is going to have to be done with some custom scripting. You’ll probably have to separately run the same queries that the Easy Chart is running (via system.tag.queryTagHistory), and then pull the first and last values out of the resulting dataset.

The downside to this approach (besides the time it will take to create) is that you’ll be doubling your traffic - running each query twice. This sounds bad. Maybe we can add some hooks into the Easy Chart so that you can at least pull the values out of the chart…

Or you could skip all of that and convince them to use the X-Trace mode as-is. 😆

---

<div class="post-metadata">

**Author:** ![jgreenewv](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@jgreenewv](https://forum.inductiveautomation.com/u/jgreenewv)\
**Post date:** [March 19, 2010, 4:10pm UTC](https://forum.inductiveautomation.com/t/easy-chart-start-and-end-values/1668/5 "2010-03-19T16:10:19Z")

</div>

If only it was that easy. And I quote, “The pen name on the X-trace covers up part of the trend line, can you move the name or get rid of it?”. If I need to do the separate queries, that’s fine. I’ll try it and see how it works. Thanks.

---

<div class="post-metadata">

**Author:** ![jgreenewv](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@jgreenewv](https://forum.inductiveautomation.com/u/jgreenewv)\
**Post date:** [March 19, 2010, 4:52pm UTC](https://forum.inductiveautomation.com/t/easy-chart-start-and-end-values/1668/6 "2010-03-19T16:52:49Z")

</div>

Help! ![:scratch:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/76d1620bec252bfac07050c889ff5a91dc8a9c25.gif ":scratch:") I’m having trouble getting it to work properly. Can you give me an example of how I need to set up queryTagHistory?

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [March 19, 2010, 6:00pm UTC](https://forum.inductiveautomation.com/t/easy-chart-start-and-end-values/1668/7 "2010-03-19T18:00:39Z")

</div>

You can call chart.getStartDate() and chart.getEndDate() to obtain the stand and end dates for the chart. You can loop through the tagPens dataset to pull together a list of tag paths. Something like this:

[code]chart=event.source.parent.getComponent(“Easy Chart”)  
start = chart.getStateDate()  
end = chart.getEndDate()

paths = []  
for r in range(chart.tagPens.rowCount):  
path = chart.tagPens.getValueAt(r, “TAG\_PATH”)  
paths.append(path)

results = system.tag.queryTagHistory(paths, start, end, chart.tagHistoryResolution, “MinMax”)[/code]
