PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.7.2
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.7.2
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 +16 -63 3.10.103.7.2 View file →
@@ -64,9 +64,9 @@
64 64
65 65 for (i = 0; i < data.length; i++) {
66 66 row = [];
67 67 for (j = 0; j < series.length; j++) {
68 - if (series[j].type === 'date' || series[j].type === 'datetime') {
68 + if (series[j].type === 'date' || series[j].type === 'datetime') {
69 69 date = new Date(data[i][j]);
70 70 data[i][j] = null;
71 71 if (Object.prototype.toString.call(date) === "[object Date]") {
72 72 if (!isNaN(date.getTime())) {
@@ -112,43 +112,8 @@
112 112 }
113 113
114 114 handleSettings(settings, chart);
115 115
116 - const getChart = Chart.getChart(context);
117 - if ( getChart ) {
118 - return;
119 - }
120 -
121 - // Format series label.
122 - settings.plugins.tooltip = {
123 - callbacks: {
124 - label: function(context) {
125 - var label = '';
126 - if ( 'object' === typeof context.dataset.label ) {
127 - label = context.label || '';
128 - } else {
129 - label = context.dataset.label || '';
130 - }
131 - if ( label ) {
132 - label += ': ';
133 - }
134 - var format = context.dataset.format || '';
135 - if ( format ) {
136 - var lastSuffix = numeral(context.formattedValue).format(format).replace(/[0-9]/g, '');
137 - label += context.formattedValue + lastSuffix;
138 - } else {
139 - format = 'undefined' !== typeof context.chart.config._config.options.format ? context.chart.config._config.options.format : '';
140 - if ( format ) {
141 - label += format_datum( context.formattedValue, format );
142 - } else {
143 - label += context.formattedValue;
144 - }
145 - }
146 - return label;
147 - }
148 - }
149 - };
150 -
151 116 var chartjs = new Chart(context, {
152 117 type: type,
153 118 data: {
154 119 labels: labels,
@@ -160,9 +125,9 @@
160 125 var canvas = $( 'canvas' )[0];
161 126 if ( $( '#chart-img' ).length ) {
162 127 $( '#chart-img' ).val( canvas.toDataURL() );
163 128 }
164 - }
129 + },
165 130 }],
166 131 });
167 132
168 133 // this line needs to be included twice. This is not an error.
@@ -226,12 +191,8 @@
226 191 }
227 192 }
228 193 }
229 194
230 - settings.plugins = {
231 - legend: settings.legend,
232 - };
233 -
234 195 handleAxes(settings, chart);
235 196
236 197 override(settings, chart);
237 198 }
@@ -387,24 +348,21 @@
387 348
388 349 // format the axes labels.
389 350 if(typeof settings[axis + '_format'] !== 'undefined' && settings[axis + '_format'] !== ''){
390 351 var format = settings[axis + '_format'];
391 - var isDateFormat = moment( moment().format( format ),format, true ).isValid();
392 - if ( ! isDateFormat ) {
393 - switch(axis){
394 - case 'xAxes':
395 - settings.scales.x.ticks.callback = function(value, index, values){
396 - return format_datum(value, format);
397 - };
398 - break;
399 - case 'yAxes':
400 - settings.scales.y.ticks.callback = function(value, index, values){
401 - return format_datum(value, format);
402 - };
403 - break;
404 - }
405 - delete settings[axis + '_format'];
406 - }
352 + switch(axis){
353 + case 'xAxes':
354 + settings.scales.x.ticks.callback = function(value, index, values){
355 + return format_datum(value, format);
356 + };
357 + break;
358 + case 'yAxes':
359 + settings.scales.y.ticks.callback = function(value, index, values){
360 + return format_datum(value, format);
361 + };
362 + break;
363 + }
364 + delete settings[axis + '_format'];
407 365 }
408 366 delete settings[axis];
409 367 }
410 368
@@ -467,9 +425,9 @@
467 425
468 426 switch(type) {
469 427 case 'number':
470 428 // numeral.js works on 0 instead of # so we just replace that in the ICU pattern set.
471 - format = format.replace(/#/g, '0').replace(/%/g, '');
429 + format = format.replace(/#/g, '0');
472 430 // we also replace all instance of '$' as that is more relevant for ticks.
473 431 if(removeDollar){
474 432 format = format.replace(/\$/g, '');
475 433 }
@@ -486,13 +444,8 @@
486 444
487 445 function format_data(datum, j, settings, series){
488 446 j = j - 1;
489 447 var format = typeof settings.series !== 'undefined' && typeof settings.series[j] !== 'undefined' ? settings.series[j].format : '';
490 - if ( '' === format && typeof settings.yAxes_format !== 'undefined' ) {
491 - format = settings.yAxes_format;
492 - } else if ( '' === format && typeof settings.xAxes_format !== 'undefined' ) {
493 - format = settings.xAxes_format;
494 - }
495 448 return format_datum(datum, format, series[j + 1].type);
496 449 }
497 450
498 451 function override(settings, chart) {