PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 4.0.8
Visualizer – Tables & Charts Manager with Built-in AI Generator v4.0.8
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
← All changes | js/render-chartjs.js +18 -10 3.10.04.0.8 View file →
@@ -18,8 +18,13 @@
18 18
19 19 if(chart.library !== 'chartjs'){
20 20 return;
21 21 }
22 +
23 + // Bail if the chart is already rendered or is being rendered.
24 + if ( ! window.isResizeRequest && ( $('#' + id).hasClass('visualizer-chart-loaded') || ( 'canvas' !== id && $('#' + id).children( ':not(.loader, style)' ).length > 0 ) ) ) {
25 + return;
26 + }
22 27 rendered_charts[id] = 'yes';
23 28
24 29 series = chart.series;
25 30 data = chart.data;
@@ -132,9 +137,10 @@
132 137 label += ': ';
133 138 }
134 139 var format = context.dataset.format || '';
135 140 if ( format ) {
136 - label += format_datum( context.formattedValue, format );
141 + var lastSuffix = numeral(context.formattedValue).format(format).replace(/[0-9]/g, '');
142 + label += context.formattedValue + lastSuffix;
137 143 } else {
138 144 format = 'undefined' !== typeof context.chart.config._config.options.format ? context.chart.config._config.options.format : '';
139 145 if ( format ) {
140 146 label += format_datum( context.formattedValue, format );
@@ -146,8 +152,10 @@
146 152 }
147 153 }
148 154 };
149 155
156 + override(settings, chart);
157 +
150 158 var chartjs = new Chart(context, {
151 159 type: type,
152 160 data: {
153 161 labels: labels,
@@ -197,12 +205,8 @@
197 205 if(typeof settings['animation'] !== 'undefined' && parseInt(settings['animation']['duration']) === 0){
198 206 settings['animation']['duration'] = 1000;
199 207 }
200 208
201 - if(typeof settings['title'] !== 'undefined' && settings['title']['text'] !== ''){
202 - settings['title']['display'] = true;
203 - }
204 -
205 209 if(typeof settings['tooltip'] !== 'undefined' && typeof settings['tooltip']['intersect'] !== 'undefined'){
206 210 // jshint ignore:line
207 211 settings['tooltip']['intersect'] = settings['tooltip']['intersect'] == true || parseInt(settings['tooltip']['intersect']) === 1; // jshint ignore:line
208 212 }
@@ -229,11 +233,15 @@
229 233 settings.plugins = {
230 234 legend: settings.legend,
231 235 };
232 236
237 + if(typeof settings['title'] !== 'undefined' && settings['title']['text'] !== ''){
238 + settings.plugins['title'] = {};
239 + settings.plugins['title']['display'] = true;
240 + settings.plugins['title']['text'] = settings['title']['text'];
241 + }
242 +
233 243 handleAxes(settings, chart);
234 -
235 - override(settings, chart);
236 244 }
237 245
238 246 function handleAxes(settings, chart){
239 247 if(typeof settings['yAxes'] !== 'undefined' && typeof settings['xAxes'] !== 'undefined'){
@@ -270,9 +278,9 @@
270 278 var $o = {};
271 279 if(Array.isArray(settings[axis][i]) || typeof settings[axis][i] === 'object'){
272 280 for(var j in settings[axis][i]){
273 281 var $val = '';
274 - if(j === 'labelString'){
282 + if(j === 'labelString'){
275 283 $o['display'] = true;
276 284 $val = settings[axis][i][j];
277 285 }else if(i === 'ticks'){
278 286 // number values under ticks need to be converted to numbers or the library throws a JS error.
@@ -466,9 +474,9 @@
466 474
467 475 switch(type) {
468 476 case 'number':
469 477 // numeral.js works on 0 instead of # so we just replace that in the ICU pattern set.
470 - format = format.replace(/#/g, '0');
478 + format = format.replace(/#/g, '0').replace(/%/g, '');
471 479 // we also replace all instance of '$' as that is more relevant for ticks.
472 480 if(removeDollar){
473 481 format = format.replace(/\$/g, '');
474 482 }
@@ -497,9 +505,9 @@
497 505 function override(settings, chart) {
498 506 if (settings.manual) {
499 507 try{
500 508 var options = JSON.parse(settings.manual);
501 - $.extend(settings, options);
509 + $.extend(true, settings, options);
502 510 delete settings.manual;
503 511 }catch(error){
504 512 console.error("Error while adding manual configuration override " + settings.manual);
505 513 }