# Easy chart multiple maximum values

**URL:** <https://forum.inductiveautomation.com/t/easy-chart-multiple-maximum-values/63894>\
**Category:** Ignition\
**Created:** [September 8, 2022, 5:42pm UTC](https://forum.inductiveautomation.com/t/easy-chart-multiple-maximum-values/63894 "2022-09-08T17:42:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![robb](https://avatars.discourse-cdn.com/v4/letter/r/a183cd/32.png) [@robb](https://forum.inductiveautomation.com/u/robb)\
**Post date:** [September 8, 2022, 5:42pm UTC](https://forum.inductiveautomation.com/t/easy-chart-multiple-maximum-values/63894/1 "2022-09-08T17:42:22Z")

</div>

Hi everyone. I have an easy chart which I would like to get 2 maximum values from. Since the recorded values are analog, I would like to catch the “peaks” if that makes sense. I can get one maximum value, but I am not sure how to get a second peak value. I tried with:

```auto
#get values from volume for 2 maximum values
		if event.propertyName in ('startDate', 'endDate'):
 		   startDate = event.source.startDate
		endDate = event.source.endDate
	tagPath= '[default]Work Tank 2/Work Tank 2 Volume Imperial Gallons'    		    	    	    
    	Max = system.tag.queryTagHistory(paths= [tagPath],
    		startDate=startDate,
    		endDate=endDate,
    		returnSize=2,
    		aggregationMode='Maximum')
    	event.source.parent.getComponent('Max1').value = Max.getValueAt(0,1)
    	event.source.parent.getComponent('Max2').value = Max.getValueAt(0,2)

```

but get an error:

java.lang.ArrayIndexOutOfBoundsException

java.lang.ArrayIndexOutOfBoundsException: java.lang.ArrayIndexOutOfBoundsException

caused by ArrayIndexOutOfBoundsException

I’m sure it’s due to using Array(0,2), but I don’t think that would get the correct value anyway, as it would return the 2nd highest value, which would be a data point immediately next to the maximum. I’d like to find the maximum value of a secondary maximum. Sorry for the confusing write up.

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [September 8, 2022, 6:30pm UTC](https://forum.inductiveautomation.com/t/easy-chart-multiple-maximum-values/63894/2 "2022-09-08T18:30:06Z")

</div>

```auto
event.source.parent.getComponent('Max1').value = Max.getValueAt(0,1)
event.source.parent.getComponent('Max2').value = Max.getValueAt(1,1)

```

---

<div class="post-metadata">

**Author:** ![robb](https://avatars.discourse-cdn.com/v4/letter/r/a183cd/32.png) [@robb](https://forum.inductiveautomation.com/u/robb)\
**Post date:** [September 8, 2022, 6:43pm UTC](https://forum.inductiveautomation.com/t/easy-chart-multiple-maximum-values/63894/3 "2022-09-08T18:43:54Z")

</div>

Super! Thanks so much.
