# Error: Maximum Call Stack Size Exceeded When Plotting XY Chart

**URL:** <https://forum.inductiveautomation.com/t/error-maximum-call-stack-size-exceeded-when-plotting-xy-chart/101478>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [January 28, 2025, 9:58am UTC](https://forum.inductiveautomation.com/t/error-maximum-call-stack-size-exceeded-when-plotting-xy-chart/101478 "2025-01-28T09:58:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xavier\_Sanchez\_Botel](https://avatars.discourse-cdn.com/v4/letter/x/e79b87/32.png) [@Xavier\_Sanchez\_Botel](https://forum.inductiveautomation.com/u/Xavier_Sanchez_Botel)\
**Post date:** [January 28, 2025, 9:58am UTC](https://forum.inductiveautomation.com/t/error-maximum-call-stack-size-exceeded-when-plotting-xy-chart/101478/1 "2025-01-28T09:58:16Z")

</div>

Hello,

I'm encountering an issue when plotting data in an XY chart using perspective. Despite working with a relatively small dataset (30 rows and 4 columns fetched from the database using a query), I receive the following error in the graph: **"Maximum call stack size exceeded."**  
Is there a way to avoid having that problem (such as increasing resources or optimizing somehow the graph)? Thank you for the help, I attach the error I get.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/5/6568a0768b836e6105b370411ca0645b05e51eb7.png)

---

<div class="post-metadata">

**Author:** ![MG3](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mg3/32/84125_2.png) [@MG3](https://forum.inductiveautomation.com/u/MG3)\
**Post date:** [January 28, 2025, 10:26am UTC](https://forum.inductiveautomation.com/t/error-maximum-call-stack-size-exceeded-when-plotting-xy-chart/101478/2 "2025-01-28T10:26:11Z")

</div>

Just to get a better picture, how are you plotting this data? Is it a binding or is it populated via Scripting?

---

<div class="post-metadata">

**Author:** ![Xavier\_Sanchez\_Botel](https://avatars.discourse-cdn.com/v4/letter/x/e79b87/32.png) [@Xavier\_Sanchez\_Botel](https://forum.inductiveautomation.com/u/Xavier_Sanchez_Botel)\
**Post date:** [January 28, 2025, 10:36am UTC](https://forum.inductiveautomation.com/t/error-maximum-call-stack-size-exceeded-when-plotting-xy-chart/101478/3 "2025-01-28T10:36:21Z")

</div>

I am plotting the data using a binding in the "key" of the "dataSources" in the XY graph properties, where I refer to a Named Query that performs a SELECT statement to the database, with some parameters to filter the results I want to show.

---

<div class="post-metadata">

**Author:** ![MG3](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mg3/32/84125_2.png) [@MG3](https://forum.inductiveautomation.com/u/MG3)\
**Post date:** [January 28, 2025, 10:52am UTC](https://forum.inductiveautomation.com/t/error-maximum-call-stack-size-exceeded-when-plotting-xy-chart/101478/4 "2025-01-28T10:52:55Z")

</div>

Okay! From what limited information I know about JavaScript, this error occurs when there are too many nested function calls, causing the stack to exceed the limits.

Try using a LIMIT in your SQL statement (just in case more data is being returned than you thought). Also, someone has previously had this issue and fixed it by:

> [@\[XY Chart\] Maximum call stack size exceeded](https://forum.inductiveautomation.com/t/xy-chart-maximum-call-stack-size-exceeded/75696/2):
>
> only return the events every 5 min, considering that each entry will represent the average data for the last 5 minute

or

> [@\[XY Chart\] Maximum call stack size exceeded](https://forum.inductiveautomation.com/t/xy-chart-maximum-call-stack-size-exceeded/75696/2):
>
> or only keep in "decadrages" table the events which correspond to a minute when something happens on an other table called "headtem

Hopefully there is a solution in here that will work for you! If not then I'd recommend waiting for someone from IA to reply back with their thoughts.
