"Stop Running the Script?" in IE with large data set.

152 views
Skip to first unread message

mani

unread,
Nov 14, 2013, 5:43:48 AM11/14/13
to google-visua...@googlegroups.com
When i am trying to load google chart with large data set it works fine with Chrome and Firefox,but "Stop Running the Script?" in IE all versions .
Below is the code,eventhough i am generating data at server still code doesnt wrk,how can i improve the performance.How can i display data in chunks??
Please point me to the code where i can do this 
Thanks


    <script type="text/javascript">
          
            // Prepare the data
            
    function drawVisualization() {
    var json = $.ajax({
    url: 'state_dist_book_chartdata.php', // make this url point to the data file
    dataType: 'json',
    async: false
    }).responseText;
   
   
   
    var data = new google.visualization.DataTable(json);
   
            // Define category pickers for 'Country', 'Region/State' and 'City'
            var statePicker = new google.visualization.ControlWrapper({
              'controlType': 'CategoryFilter',
              'containerId': 'control1',
              'options': {
                'filterColumnLabel': 'State',
                'ui': {
                  'labelStacking': 'vertical',
                  'allowTyping': false,
                  'allowMultiple': false
                }
              }
            });
          
            var cityPicker = new google.visualization.ControlWrapper({
              'controlType': 'CategoryFilter',
              'containerId': 'control2',
              'options': {
                'filterColumnLabel': 'District',
                'ui': {
                  'labelStacking': 'vertical',
                  'allowTyping': false,
                  'allowMultiple': false
                }
              }
            });
          
            var bookPicker = new google.visualization.ControlWrapper({
              'controlType': 'CategoryFilter',
              'containerId': 'control3',
              'options': {
                'filterColumnLabel': 'Book',
                'ui': {
                  'labelStacking': 'vertical',
                  'allowTyping': false,
                  'allowMultiple': false
                }
              }
            });
          
            // Define a bar chart to show 'Amount' data
            var barChart = new google.visualization.ChartWrapper({
              'chartType': 'PieChart',
              'containerId': 'chart1',
              'options': {
                'width': 900,
                'height': 700,
    is3D: 'true',
                'chartArea': {top: 0, right: 0, bottom: 0}
              },
    
              'view': {'columns': [2, 3]}
            });
          
            // Create the dashboard.
            new google.visualization.Dashboard(document.getElementById('dashboard')).
             
              bind(statePicker, cityPicker).
     bind(cityPicker, barChart).
        
              draw(data);
          }

asgallant

unread,
Nov 14, 2013, 10:36:39 AM11/14/13
to google-visua...@googlegroups.com
There could be two different issues here: 1) you could have problems loading the data or 2) you could have problems processing the data.  Add in the line

alert('loaded data');

after the AJAX call.  If the stop script warning pops up before the alert, then you have a problem loading the data; if it pops up after, then you have a problem processing the data.
Message has been deleted
Message has been deleted

mani

unread,
Nov 14, 2013, 11:37:43 PM11/14/13
to google-visua...@googlegroups.com
thanks drew,
i tried your suggestion ,alert message pops up before stop script warning pop up,so it means i have problem processing the data.
how can i improve data processing??

asgallant

unread,
Nov 15, 2013, 10:42:29 AM11/15/13
to google-visua...@googlegroups.com
How large is the data set (number of rows)?  If your data set is large enough, then the pie chart will almost certainly end up with either a large portion grouped into the "Other" slice (comprised of the slices smaller than 1/720th of the total by default) or a large number of tiny slices, making the chart an illegible mess.  I suggest implementing default selections on your filters to cut down on the size of the data set displayed.

manish philip

unread,
Nov 15, 2013, 10:16:02 PM11/15/13
to google-visua...@googlegroups.com
pls let me know what option to set for a default value display.
> --
> 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/mVVAHqydgy4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> google-visualizati...@googlegroups.com.
> To post to this group, send email to
> google-visua...@googlegroups.com.
> Visit this group at
> http://groups.google.com/group/google-visualization-api.
> For more options, visit https://groups.google.com/groups/opt_out.
>

asgallant

unread,
Nov 15, 2013, 11:17:17 PM11/15/13
to google-visua...@googlegroups.com
In your CategoryFilters, you can set a default selection by setting the state.selectedValues parameter:


var statePicker = new google.visualization.ControlWrapper({
    'controlType': 'CategoryFilter',
    'containerId': 'control1',
    'options': {
        'filterColumnLabel': 'State',
        'ui': {
            'labelStacking': 'vertical',
            'allowTyping': false,
            'allowMultiple': false
        }
    },
    state: {
        selectedValues: [/* array of values to have selected by default */]
    }
});

mani

unread,
Nov 16, 2013, 12:41:32 AM11/16/13
to google-visua...@googlegroups.com
Also i have a question that since alert message pops up before stop script warning pop up does it mean all data is loaded isnt it possible that ajax call is over and loaded pop up is displayed?? or is it that complete data is loaded from backend since there are more than 10000 records. 


On Thursday, 14 November 2013 16:13:48 UTC+5:30, mani wrote:

mani

unread,
Nov 16, 2013, 1:52:51 AM11/16/13
to google-visua...@googlegroups.com
earlier i tried using  but it didnt wrk,is this not correct??

 var defaultRow = 1;

 state: {
        selectedValues: [data.getValue(defaultRow, State)]
    }

Sample of Data that i am getting from 'state_dist_book_chartdata.php' that i am getting in JSON format.


{"cols":[{"label":"Month","type":"string"},{"label":"State","type":"string"},{"label":"District","type":"string"},{"label":"BOOK","type":"string"},{"label":"Amount","type":"number"}],"rows":[{"c":[{"v":"July-2013"},{"v":"KARNATAKA"},{"v":"DAKSHIN KANNADA"},{"v":"ABHYUDAYA CO-OP BOOK LTD"},{"v":25000}]},{"c":[{"v":"May-2013"},{"v":"KARNATAKA"},{"v":"DAKSHIN KANNADA"},{"v":"ABHYUDAYA CO-OP BOOK LTD"},{"v":50000}]},{"c":[{"v":"September-2013"},{"v":"KARNATAKA"},{"v":"DAKSHIN KANNADA"},{"v":"ABHYUDAYA CO-OP BOOK LTD"},{"v":152226}]},{"c":[{"v":"April-2013"},{"v":"MAHARASHTRA"},{"v":"MUMBAI"},{"v":"ABHYUDAYA CO-OP BOOK LTD"},{"v":659786}]},{"c":[{"v":"August-2013"},{"v":"MAHARASHTRA"},{"v":"MUMBAI"},{"v":"ABHYUDAYA CO-OP BOOK LTD"},{"v":2087419}]},{"c":[{"v":"July-2013"},{"v":"MAHARASHTRA"},{"v":"MUMBAI"},{"v":"ABHYUDAYA CO-OP BOOK LTD"},{"v":2104998}]},{"c":[{"v":"June-2013"},{"v":"MAHARASHTRA"},{"v":"MUMBAI"},{"v":"ABHYUDAYA CO-OP BOOK LTD"},{"v":3514648}]},{"c":[{"v":"May-2013"},{"v":"MAHARASHTRA"},{"v":"MUMBAI"},{"v":"ABHYUDAYA CO-OP BOOK LTD"},{"v":1404391}]},{"c":[{"v":"October-2013"},{"v":"MAHARASHTRA"},{"v":"MUMBAI"},{"v":"ABHYUDAYA CO-OP BOOK LTD"},{"v":2121287}]},{"c":[{"v":"September-2013"},


Thanks,

On Thursday, 14 November 2013 16:13:48 UTC+5:30, mani wrote:

asgallant

unread,
Nov 16, 2013, 10:10:15 AM11/16/13
to google-visua...@googlegroups.com
Is "State" a variable?  If not, then that won't work.  If you want to get the "State" value, you need to reference column 1:

state: {
    selectedValues: [data.getValue(defaultRow, 1)]

manish philip

unread,
Nov 17, 2013, 11:51:38 PM11/17/13
to google-visua...@googlegroups.com
Thanks a lot now the problem is partially solved,earlier in IE i used to get "Stop script error" pop up 7-8 times but now after implementing the default rows it just comes once until the chart is fully loaded,now i have to get rid of the remaining "Stop script error" pop up,if you have any suggestion pls do let me know.

I have a query how is google maps is  loaded ,though data may be huge
can you please point me to some useful links if you have any for
1) server side data process using php and mysql
2)displaying data in chunks or lazy loading.

Thanks in advance.


--
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/mVVAHqydgy4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.

asgallant

unread,
Nov 18, 2013, 10:29:59 AM11/18/13
to google-visua...@googlegroups.com
Do you have a public facing page I could test?
To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsub...@googlegroups.com.

manish philip

unread,
Nov 18, 2013, 11:35:42 AM11/18/13
to google-visua...@googlegroups.com
nope, its an intranet application

is there any other way i can let you know the error.

On 11/18/13, asgallant <drew_g...@abtassoc.com> wrote:
> Do you have a public facing page I could test?
>
> On Sunday, November 17, 2013 11:51:38 PM UTC-5, mani wrote:
>>
>> Thanks a lot now the problem is partially solved,earlier in IE i used to
>> get "Stop script error" pop up 7-8 times but now after implementing the
>> default rows it just comes once until the chart is fully loaded,now i have
>>
>> to get rid of the remaining "Stop script error" pop up,if you have any
>> suggestion pls do let me know.
>>
>> I have a query how is google maps is loaded ,though data may be huge
>> can you please point me to some useful links if you have any for
>> 1) server side data process using php and mysql
>> 2)displaying data in chunks or lazy loading.
>>
>> Thanks in advance.
>>
>>
>> On Sat, Nov 16, 2013 at 8:40 PM, asgallant
>> <drew_g...@abtassoc.com<javascript:>
>>> google-visualizati...@googlegroups.com <javascript:>.
>>> To post to this group, send email to
>>> google-visua...@googlegroups.com<javascript:>
>>> .
>>> Visit this group at
>>> http://groups.google.com/group/google-visualization-api.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>
> --
> 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/mVVAHqydgy4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> google-visualizati...@googlegroups.com.

asgallant

unread,
Nov 18, 2013, 11:48:26 AM11/18/13
to google-visua...@googlegroups.com
Hmm...could you post the full javascript/HTML code you are using and a sample data set that is large enough to trigger the "stop script" message?  You can use synthetic data if your real data is confidential, I just need to be able to duplicate the effect.
>>> To post to this group, send email to
>>> google-visua...@googlegroups.com<javascript:>
>>> .
>>> Visit this group at
>>> http://groups.google.com/group/google-visualization-api.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>
> --
> 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/mVVAHqydgy4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to

manish philip

unread,
Nov 19, 2013, 12:43:44 AM11/19/13
to google-visua...@googlegroups.com
please find the code with synthetic data,let me if this is fine.




To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.
data.txt
state_dist_chart.html
state_dist_book_chartdata.php

asgallant

unread,
Nov 19, 2013, 10:58:07 AM11/19/13
to google-visua...@googlegroups.com
I haven't tested it in IE8 yet, but I can see something right away that you should fix.  You set the state of each control to the same thing:

state: {
    selectedValues: [data.getValue(defaultRow, defaultCol)]
}


The problem with this is that you use the same value for "defaultCol" for each control (1), but the controls are all working on different columns.  You need to specify the correct column for each control:

Month:

state: {
    selectedValues: [data.getValue(defaultRow, 0)]
}


State:

state: {
    selectedValues: [data.getValue(defaultRow, 1)]
}


City:

state: {
    selectedValues: [data.getValue(defaultRow, 2)]
}


Book (which you don't have hooked up to your Dashboard):

state: {
    selectedValues: [data.getValue(defaultRow, 3)]
}


Try that and see if it fixes your "stop script" error.
>>> To post to this group, send email to
>>> google-visua...@googlegroups.com<javascript:>
>>> .
>>> Visit this group at
>>> http://groups.google.com/group/google-visualization-api.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>
> --
> 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/mVVAHqydgy4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> To post to this group, send email to

manish philip

unread,
Nov 20, 2013, 11:29:30 PM11/20/13
to google-visua...@googlegroups.com
Thanks a lot your suggestion solved the problem.


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

mani

unread,
Dec 3, 2013, 2:32:57 AM12/3/13
to google-visua...@googlegroups.com
Hi Drew,

i am grouping the data by months but the output is alphabetical,instead i want to show it chronologically.

my query is :

select
  concat(monthname(a.fdate),'-',year(a.fdate)) Month,
  s.new_state State,
  d.new_dist District,
  b.ifbook Book,
  sum(a.amt) Amount
from str a
JOIN sc b on b.scd = a.isc
JOIN user c on a.ed = c.str
JOIN state_mapping s on b.state = s.org_state
JOIN dist_mapping d on b.dist = d.org_dist
where TRIM(b.ifbook) <> '' and b.ifbook IS NOT NULL and b.ifbook not like '%TR%'
  and TRIM(d.new_dist) <> '' and d.new_dist IS NOT NULL
group by b.ifbook, d.new_dist, s.new_state, Month
order by year(a.fdate), month(a.fdate)

should i make any change is chart initializations to achieve this, because the query displays result chronologically but the month dropdown shows months alphabetically.
To post to this group, send email to google-visualization-api@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.

asgallant

unread,
Dec 3, 2013, 12:02:49 PM12/3/13
to google-visua...@googlegroups.com
Try setting the control's ui.sortValues option to false.
Reply all
Reply to author
Forward
0 new messages