Maximum call stack size exceeded on Google LineChart

957 views
Skip to first unread message

Luis Rito

unread,
Jul 6, 2017, 9:48:20 PM7/6/17
to Google Visualization API
Hello everyone.

I've seen that some developers already experienced the same problem as I am currently.

When I try to load a Line Chart with Google Charts API, I receive the error "Maximum call stack size exceeded".
The DataTable is an array of 4 columns and more than 3000 rows and constantly growing. I only get this error when I try to load a chart with dashboard controls. I don't get this error when loading any other charts without dashboard controls.
I use a web server installed on my PC (XAMPP). When I try to run the script on an online editor like W3Schools (https://www.w3schools.com/), the script runs without any problem.

Anyone knows how to deal properly with this issue?
Thank you very much in advance.

Kind regards,

Luis Rito

Daniel LaLiberte

unread,
Jul 6, 2017, 11:49:37 PM7/6/17
to Google Visualization API
Hi Luis,

If you can point us at a page demonstrating the problem, that will allow us to look into it.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/accd61fd-abb1-46b4-82e0-cae552887826%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Luis Rito

unread,
Jul 7, 2017, 6:43:55 AM7/7/17
to google-visua...@googlegroups.com
Hello Daniel,

Thanks for the reply.

I am sending in attachment the php file and the javascript file where it is loaded (the javascript file is the FDAXquote_and_trade.php file, I had to change the file extension to send it by email. Please change the file extension to .js).
It is a page that is still in construction, so it is not yet visually well organised.
This javascript file with the Google Chart API code is loaded on a div with an id="FDAX_quote_and_trade_chart".
The chart is not visible when the page is loaded. It will be visible only after clicking in "FDAX (DAX 30)" and then in an arrow button to slide between a table and the other charts.

Kind regards,

Luis Rito


2017-07-07 4:49 GMT+01:00 'Daniel LaLiberte' via Google Visualization API <google-visua...@googlegroups.com>:
Hi Luis,

If you can point us at a page demonstrating the problem, that will allow us to look into it.
On Thu, Jul 6, 2017 at 9:48 PM, Luis Rito <lr...@polivalor.pt> wrote:
Hello everyone.

I've seen that some developers already experienced the same problem as I am currently.

When I try to load a Line Chart with Google Charts API, I receive the error "Maximum call stack size exceeded".
The DataTable is an array of 4 columns and more than 3000 rows and constantly growing. I only get this error when I try to load a chart with dashboard controls. I don't get this error when loading any other charts without dashboard controls.
I use a web server installed on my PC (XAMPP). When I try to run the script on an online editor like W3Schools (https://www.w3schools.com/), the script runs without any problem.

Anyone knows how to deal properly with this issue?
Thank you very much in advance.

Kind regards,

Luis Rito

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsubscr...@googlegroups.com.



--

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/iigCT7a-MFk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsub...@googlegroups.com.
Files.zip

Daniel LaLiberte

unread,
Jul 7, 2017, 8:03:46 AM7/7/17
to Google Visualization API
I can't use a php file, but I looked your code over and I don't see anything obviously wrong.  

If you can't give us the URL for the page, then save the page in the browser, complete with its loaded scripts.

If the problem is that you can't get that browser page because your server fails with the stack limit error when it is generating the output, then that would be a problem in your php code, and we can't help with that.

On Fri, Jul 7, 2017 at 6:43 AM, Luis Rito <lr...@moonlight.pt> wrote:
Hello Daniel,

Thanks for the reply.

I am sending in attachment the php file and the javascript file where it is loaded (the javascript file is the FDAXquote_and_trade.php file, I had to change the file extension to send it by email. Please change the file extension to .js).
It is a page that is still in construction, so it is not yet visually well organised.
This javascript file with the Google Chart API code is loaded on a div with an id="FDAX_quote_and_trade_chart".
The chart is not visible when the page is loaded. It will be visible only after clicking in "FDAX (DAX 30)" and then in an arrow button to slide between a table and the other charts.

Kind regards,

Luis Rito


To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsubscr...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Luis Rito

unread,
Jul 7, 2017, 9:30:29 AM7/7/17
to google-visua...@googlegroups.com
Hello Daniel,

Please find attached a folder with the web page saved.

Kind regards,

Luis Rito





--

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/iigCT7a-MFk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsub...@googlegroups.com.
Web_page.zip

Daniel LaLiberte

unread,
Jul 7, 2017, 11:07:48 AM7/7/17
to Google Visualization API
That's a huge attachment.

It appears that calling google.charts.load on previously loaded packages still causes them to be loaded again, by adding more script tags, even though they are loaded over the network only once (since they are cacheable).  This was not as intended, since this causes the loaded scripts to be executed more than once, and this likely will cause problems with the state of the code.

I'm not sure this is behind the stack overflow problem you are seeing, but I will be investigating it nevertheless.  

Meanwhile, can you try loading '45' or '45.1' instead of 'current' ?

On Fri, Jul 7, 2017 at 9:30 AM, Luis Rito <lr...@moonlight.pt> wrote:
Hello Daniel,

Please find attached a folder with the web page saved.

Kind regards,

Luis Rito


To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsubscr...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Luis Rito

unread,
Jul 7, 2017, 11:37:28 AM7/7/17
to google-visua...@googlegroups.com
Hello Daniel,

If I try google.charts.load('45') or google.charts.load('45.1') instead of 'current', I get the following messages:
- One or more participants failed to draw().
- this G.H. is not a function.

Ok, if you get to a solution, could please let me know? I am not in a hurry as the site is not online. I am just building it and it is far away from being complete. I don't even know if I want to put this online.

Kind regards and thanks for the help,

Luis Rito






--

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/iigCT7a-MFk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsub...@googlegroups.com.

Daniel LaLiberte

unread,
Jul 7, 2017, 2:07:17 PM7/7/17
to Google Visualization API
I have fixed the problem with multiple google.charts.load() calls (which was loading all the packages multiple times).  I am very surprised no one has noticed many more serious problems.

So I am wondering if this fix will affect your stack limit problem.

On Fri, Jul 7, 2017 at 11:37 AM, Luis Rito <lr...@moonlight.pt> wrote:
Hello Daniel,

If I try google.charts.load('45') or google.charts.load('45.1') instead of 'current', I get the following messages:
- One or more participants failed to draw().
- this G.H. is not a function.

Ok, if you get to a solution, could please let me know? I am not in a hurry as the site is not online. I am just building it and it is far away from being complete. I don't even know if I want to put this online.

Kind regards and thanks for the help,

Luis Rito



To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsubscr...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Luis Rito

unread,
Jul 10, 2017, 9:52:45 AM7/10/17
to google-visua...@googlegroups.com
Hello Daniel,

It works very fine now, with no problems at all. I just had to put google.charts.load('current', {'packages':['corechart', 'controls']}); on the head of the web page instead of putting on every javascript file. Otherwise only the first chart would load. Thank you very much.

Kind regards,

Luis Rito





--

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/iigCT7a-MFk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsub...@googlegroups.com.

Daniel LaLiberte

unread,
Jul 10, 2017, 10:03:44 AM7/10/17
to Google Visualization API
Hi Luis,

Thanks for your update.  By replacing all the separate calls to google.charts.load with one call in the head, you avoided the problem that used to exist, until I hopefully have fixed it.  It should now work as you had it before, with multiple separate calls to google.charts.load.

You can still only use one version of Google Charts in each document, by the way, in case anyone is getting ideas otherwise.  The version specified on the first call of google.charts.load will be used thereafter, and only missing packages will be loaded before proceeding with the callbacks and any subsequent google.charts.load calls.


On Mon, Jul 10, 2017 at 9:52 AM, Luis Rito <lr...@moonlight.pt> wrote:
Hello Daniel,

It works very fine now, with no problems at all. I just had to put google.charts.load('current', {'packages':['corechart', 'controls']}); on the head of the web page instead of putting on every javascript file. Otherwise only the first chart would load. Thank you very much.

Kind regards,

Luis Rito


To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsubscr...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Luis Rito

unread,
Jul 10, 2017, 10:20:24 AM7/10/17
to google-visua...@googlegroups.com
I will try with multiple separate calls to google.charts.load as I had before. I didn't know we couldn't load several versions on the same page. Until now I never needed to do it, but don't know if I won't need it in the future.
But really, it is excellent right now. Works very smooth, very fine.

Kind regards,

Luis Rito





--

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/iigCT7a-MFk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsub...@googlegroups.com.

Luis Rito

unread,
Jul 11, 2017, 5:04:00 PM7/11/17
to google-visua...@googlegroups.com
Hello Daniel,

I removed the call to google.charts.load on the webpage and tried to load all charts with separate call on each javascript file and also works fine this way.

Kind regards,

Luis Rito





--

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/iigCT7a-MFk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsub...@googlegroups.com.

Daniel LaLiberte

unread,
Jul 11, 2017, 5:07:27 PM7/11/17
to Google Visualization API
Glad to hear it.  Thanks for the feedback.

On Tue, Jul 11, 2017 at 5:03 PM, Luis Rito <lr...@moonlight.pt> wrote:
Hello Daniel,

I removed the call to google.charts.load on the webpage and tried to load all charts with separate call on each javascript file and also works fine this way.

Kind regards,

Luis Rito


To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsubscr...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Luis Rito

unread,
Jul 21, 2017, 12:40:51 PM7/21/17
to google-visua...@googlegroups.com
Hello Daniel,

When a chart with range slider is loaded, the initial data displayed on the chart matches the 'lowValue' and 'highValue' of the 'state' option, but the thumbs position doesn't match. Both thumbs appear at the minimum value (on the left). My code is as indicated below. The DataTable has more than 3800 rows and I want to show only the data of the last 1000 rows on the very first view (before any interact of the user on the thumbs).

var dashboard = new google.visualization.Dashboard(document.getElementById('FDAX_quote_and_trade_chart'));
var lowThumbInitialPosition ;
var highThumbInitialPosition ;
lowThumbInitialPosition = data.getNumberOfRows(0) - 1000 ;
highThumbInitialPosition = data.getNumberOfRows(0) ;
var rangeSlider = new google.visualization.ControlWrapper({
'controlType': 'NumberRangeFilter',
'containerId': 'FDAX_quote_and_trade_chart_data_filter',
'options': {
'filterColumnLabel': 'Bar'
},
'state': {'lowValue': lowThumbInitialPosition, 'highValue': highThumbInitialPosition}
});

var lineChart = new google.visualization.ChartWrapper({
'chartType': 'LineChart',
'containerId': 'FDAX_quote_and_trade_chart_div',
'options': {
axisTitlesPosition: 'none',
hAxis: {
title: 'Bar',
gridlines: {count: 0}
},
chartArea: {right: 0, top: 10, width:'92%', height:'90%'},
crosshair: {trigger: 'focus'},
legend: {position: 'none'},
tooltip: {showColorCode: true},
vAxis: {viewWindowMode: 'maximized'},
width: 1000,
height: 400,
fontName:'Roboto',
series: {
0: {color: '#b2c2c2', lineWidth: 1.2},
1: {color: '#0c69b2', lineWidth: 1.5},
2: {color: '#ff9a00', lineWidth: 1.5}
}
}
});

dashboard.bind(rangeSlider, lineChart);

dashboard.draw(data);
}

Kind regards,

Luis Rito





--

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/iigCT7a-MFk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages