| @@ -4,8 +4,9 @@ | ||
| 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; | |
| 8 | 9 | |
| 9 | 10 | (function($) { |
| 10 | 11 | var gv; |
| 11 | 12 | var all_charts, objects; |
| @@ -12,11 +13,20 @@ | ||
| 12 | 13 | // so that we know which charts belong to our library. |
| 13 | 14 | var rendered_charts = []; |
| 14 | 15 | |
| 15 | 16 | function renderChart(id) { |
| 17 | + | |
| 18 | + if ( ! all_charts || 0 === Object.keys( all_charts ).length ) { | |
| 19 | + return; | |
| 20 | + } | |
| 21 | + | |
| 16 | 22 | var chart = all_charts[id]; |
| 17 | 23 | var hasAnnotation = false; |
| 18 | 24 | |
| 25 | + if ( ! chart ) { | |
| 26 | + return; | |
| 27 | + } | |
| 28 | + | |
| 19 | 29 | // re-render the chart only if it doesn't have annotations and it is on the front-end |
| 20 | 30 | // this is to prevent the chart from showing "All series on a given axis must be of the same data type" during resize. |
| 21 | 31 | // remember, some charts do not support annotations so they should not be included in this. |
| 22 | 32 | var no_annotation_charts = ['tabular', 'timeline', 'gauge', 'geo', 'bubble', 'candlestick']; |
| @@ -39,9 +49,9 @@ | ||
| 39 | 49 | |
| 40 | 50 | function renderSpecificChart(id, chart) { |
| 41 | 51 | var render, container, series, data, table, settings, i, j, row, date, axis, property, format, formatter; |
| 42 | 52 | |
| 43 | - if ( $('#' + id).hasClass('visualizer-chart-loaded') || ( 'canvas' !== id && $('#' + id).children( ':not(.loader)' ).length > 0 ) ) { | |
| 53 | + if ( ! window.isResizeRequest && ( $('#' + id).hasClass('visualizer-chart-loaded') || ( 'canvas' !== id && $('#' + id).children( ':not(.loader)' ).length > 0 ) ) ) { | |
| 44 | 54 | return; |
| 45 | 55 | } |
| 46 | 56 | |
| 47 | 57 | if(chart.library !== 'google'){ |
| @@ -116,8 +126,13 @@ | ||
| 116 | 126 | { |
| 117 | 127 | settings['animation']['startup'] = true; |
| 118 | 128 | settings['animation']['duration'] = parseInt(settings['animation']['duration']); |
| 119 | 129 | } |
| 130 | + if ( settings['controls'] ) { | |
| 131 | + settings['controls']['ui']['allowMultiple'] = 'true' === settings['controls']['allowMultiple'] ? true : false; | |
| 132 | + settings['controls']['ui']['allowTyping'] = 'true' === settings['controls']['allowTyping'] ? true : false; | |
| 133 | + settings['controls']['ui']['showRangeValues'] = 'true' === settings['controls']['showRangeValues'] ? true : false; | |
| 134 | + } | |
| 120 | 135 | |
| 121 | 136 | // mark roles for series that have specified a role |
| 122 | 137 | // and then remove them from future processing |
| 123 | 138 | // and also adjust the indices of the series array so that |
| @@ -476,10 +491,11 @@ | ||
| 476 | 491 | |
| 477 | 492 | var resizeTimeout; |
| 478 | 493 | |
| 479 | 494 | $(document).ready(function() { |
| 480 | - $(window).resize(function() { | |
| 495 | + $(window).resize(function(e) { | |
| 481 | 496 | clearTimeout(resizeTimeout); |
| 497 | + window.isResizeRequest = 'undefined' !== typeof e.originalEvent ? true : false; | |
| 482 | 498 | resizeTimeout = setTimeout(render, 100); |
| 483 | 499 | }); |
| 484 | 500 | |
| 485 | 501 | resizeHiddenContainers(true); |