| @@ -4,9 +4,8 @@ | ||
| 4 | 4 | |
| 5 | 5 | // this will store the images for each chart rendered. |
| 6 | 6 | var __visualizer_chart_images = []; |
| 7 | 7 | var chartWrapperError = []; |
| 8 | -var isResizeRequest = false; | |
| 9 | 8 | |
| 10 | 9 | (function($) { |
| 11 | 10 | var gv; |
| 12 | 11 | var all_charts, objects; |
| @@ -13,20 +12,11 @@ | ||
| 13 | 12 | // so that we know which charts belong to our library. |
| 14 | 13 | var rendered_charts = []; |
| 15 | 14 | |
| 16 | 15 | function renderChart(id) { |
| 17 | - | |
| 18 | - if ( ! all_charts || 0 === Object.keys( all_charts ).length ) { | |
| 19 | - return; | |
| 20 | - } | |
| 21 | - | |
| 22 | 16 | var chart = all_charts[id]; |
| 23 | 17 | var hasAnnotation = false; |
| 24 | 18 | |
| 25 | - if ( ! chart ) { | |
| 26 | - return; | |
| 27 | - } | |
| 28 | - | |
| 29 | 19 | // re-render the chart only if it doesn't have annotations and it is on the front-end |
| 30 | 20 | // this is to prevent the chart from showing "All series on a given axis must be of the same data type" during resize. |
| 31 | 21 | // remember, some charts do not support annotations so they should not be included in this. |
| 32 | 22 | var no_annotation_charts = ['tabular', 'timeline', 'gauge', 'geo', 'bubble', 'candlestick']; |
| @@ -49,14 +39,13 @@ | ||
| 49 | 39 | |
| 50 | 40 | function renderSpecificChart(id, chart) { |
| 51 | 41 | var render, container, series, data, table, settings, i, j, row, date, axis, property, format, formatter; |
| 52 | 42 | |
| 53 | - if( chart.library !== 'google' ) { | |
| 43 | + if ( $('#' + id).hasClass('visualizer-chart-loaded') || $('#' + id).children( ':not(.loader)' ).length > 0 ) { | |
| 54 | 44 | return; |
| 55 | 45 | } |
| 56 | - | |
| 57 | - // Bail if the chart is already rendered or is being rendered. | |
| 58 | - if ( ! window.isResizeRequest && ( $('#' + id).hasClass('visualizer-chart-loaded') || ( 'canvas' !== id && $('#' + id).children( ':not(.loader, style)' ).length > 0 ) ) ) { | |
| 46 | + | |
| 47 | + if(chart.library !== 'google'){ | |
| 59 | 48 | return; |
| 60 | 49 | } |
| 61 | 50 | rendered_charts[id] = 'yes'; |
| 62 | 51 | |
| @@ -127,13 +116,8 @@ | ||
| 127 | 116 | { |
| 128 | 117 | settings['animation']['startup'] = true; |
| 129 | 118 | settings['animation']['duration'] = parseInt(settings['animation']['duration']); |
| 130 | 119 | } |
| 131 | - if ( settings['controls'] ) { | |
| 132 | - settings['controls']['ui']['allowMultiple'] = 'true' === settings['controls']['allowMultiple'] ? true : false; | |
| 133 | - settings['controls']['ui']['allowTyping'] = 'true' === settings['controls']['allowTyping'] ? true : false; | |
| 134 | - settings['controls']['ui']['showRangeValues'] = 'true' === settings['controls']['showRangeValues'] ? true : false; | |
| 135 | - } | |
| 136 | 120 | |
| 137 | 121 | // mark roles for series that have specified a role |
| 138 | 122 | // and then remove them from future processing |
| 139 | 123 | // and also adjust the indices of the series array so that |
| @@ -492,11 +476,10 @@ | ||
| 492 | 476 | |
| 493 | 477 | var resizeTimeout; |
| 494 | 478 | |
| 495 | 479 | $(document).ready(function() { |
| 496 | - $(window).resize(function(e) { | |
| 480 | + $(window).resize(function() { | |
| 497 | 481 | clearTimeout(resizeTimeout); |
| 498 | - window.isResizeRequest = 'undefined' !== typeof e.originalEvent ? true : false; | |
| 499 | 482 | resizeTimeout = setTimeout(render, 100); |
| 500 | 483 | }); |
| 501 | 484 | |
| 502 | 485 | resizeHiddenContainers(true); |
| @@ -587,9 +570,9 @@ | ||
| 587 | 570 | |
| 588 | 571 | objects = {}; |
| 589 | 572 | if ( 'object' === typeof google ) { |
| 590 | 573 | $chart_types.push( 'controls' ); |
| 591 | - google.load( 'visualization', '51', {packages: $chart_types, mapsApiKey: v.map_api_key, 'language' : v.language, | |
| 574 | + google.load( 'visualization', 'current', {packages: $chart_types, mapsApiKey: v.map_api_key, 'language' : v.language, | |
| 592 | 575 | callback: function () { |
| 593 | 576 | gv = google.visualization; |
| 594 | 577 | all_charts = v.charts; |
| 595 | 578 | if(v.is_front == true && typeof v.id !== 'undefined'){ // jshint ignore:line |