PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.7.1
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.7.1
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 -127 3.10.13.7.1 View file →
@@ -46,10 +46,9 @@
46 46 case 'column':
47 47 type = 'bar';
48 48 break;
49 49 case 'bar':
50 - type = 'bar';
51 - settings.indexAxis = 'y';
50 + type = 'horizontalBar';
52 51 break;
53 52 case 'pie':
54 53 // donut is not a setting but a separate chart type.
55 54 if(typeof settings['custom'] !== 'undefined' && settings['custom']['donut'] === 'true'){
@@ -64,9 +63,9 @@
64 63
65 64 for (i = 0; i < data.length; i++) {
66 65 row = [];
67 66 for (j = 0; j < series.length; j++) {
68 - if (series[j].type === 'date' || series[j].type === 'datetime') {
67 + if (series[j].type === 'date' || series[j].type === 'datetime') {
69 68 date = new Date(data[i][j]);
70 69 data[i][j] = null;
71 70 if (Object.prototype.toString.call(date) === "[object Date]") {
72 71 if (!isNaN(date.getTime())) {
@@ -112,42 +111,8 @@
112 111 }
113 112
114 113 handleSettings(settings, chart);
115 114
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 - label += format_datum( context.formattedValue, format );
137 - } else {
138 - format = 'undefined' !== typeof context.chart.config._config.options.format ? context.chart.config._config.options.format : '';
139 - if ( format ) {
140 - label += format_datum( context.formattedValue, format );
141 - } else {
142 - label += context.formattedValue;
143 - }
144 - }
145 - return label;
146 - }
147 - }
148 - };
149 -
150 115 var chartjs = new Chart(context, {
151 116 type: type,
152 117 data: {
153 118 labels: labels,
@@ -159,9 +124,9 @@
159 124 var canvas = $( 'canvas' )[0];
160 125 if ( $( '#chart-img' ).length ) {
161 126 $( '#chart-img' ).val( canvas.toDataURL() );
162 127 }
163 - }
128 + },
164 129 }],
165 130 });
166 131
167 132 // this line needs to be included twice. This is not an error.
@@ -225,12 +190,8 @@
225 190 }
226 191 }
227 192 }
228 193
229 - settings.plugins = {
230 - legend: settings.legend,
231 - };
232 -
233 194 handleAxes(settings, chart);
234 195
235 196 override(settings, chart);
236 197 }
@@ -238,27 +199,13 @@
238 199 function handleAxes(settings, chart){
239 200 if(typeof settings['yAxes'] !== 'undefined' && typeof settings['xAxes'] !== 'undefined'){
240 201 // stacking has to be defined on both axes.
241 202 if(typeof settings['yAxes']['stacked_bool'] !== 'undefined'){
242 - settings['yAxes']['stacked_bool'] = 'true';
203 + settings['xAxes']['stacked_bool'] = 'true';
243 204 }
244 205 if(typeof settings['xAxes']['stacked_bool'] !== 'undefined'){
245 - settings['xAxes']['stacked_bool'] = 'true';
206 + settings['yAxes']['stacked_bool'] = 'true';
246 207 }
247 - // Bar percentage.
248 - if (typeof settings['yAxes']['barPercentage_int'] !=='undefined' && ''!== settings['yAxes']['barPercentage_int']){
249 - settings['barPercentage'] = settings['yAxes']['barPercentage_int'];
250 - }
251 - if (typeof settings['xAxes']['barPercentage_int'] !=='undefined' && ''!== settings['xAxes']['barPercentage_int']){
252 - settings['barPercentage'] = settings['xAxes']['barPercentage_int'];
253 - }
254 - // Bar thickness.
255 - if (typeof settings['yAxes']['barThickness'] !=='undefined' && ''!== settings['yAxes']['barThickness']){
256 - settings['barThickness'] = settings['yAxes']['barThickness'];
257 - }
258 - if (typeof settings['xAxes']['barThickness'] !=='undefined' && ''!== settings['xAxes']['barThickness']){
259 - settings['barThickness'] = settings['xAxes']['barThickness'];
260 - }
261 208 }
262 209 configureAxes(settings, 'yAxes', chart);
263 210 configureAxes(settings, 'xAxes', chart);
264 211 }
@@ -327,56 +274,8 @@
327 274 }
328 275 var $axis = $scales['scales'][axis];
329 276
330 277 $axis.push($features);
331 - // Migrate xAxes settings to v3.0+
332 - if ( $scales.scales && $scales.scales.xAxes ) {
333 - for (var x in $scales.scales.xAxes) {
334 - $scales.scales.x = {
335 - display: $scales.scales.xAxes[x].scaleLabel.display,
336 - title: {
337 - display:true,
338 - text: $scales.scales.xAxes[x].scaleLabel.labelString,
339 - color: $scales.scales.xAxes[x].scaleLabel.fontColor,
340 - font: {
341 - family: $scales.scales.xAxes[x].scaleLabel.fontFamily,
342 - size: $scales.scales.xAxes[x].scaleLabel.fontSize
343 - }
344 - },
345 - suggestedMax: $scales.scales.xAxes[x].ticks.suggestedMax || '',
346 - suggestedMin: $scales.scales.xAxes[x].ticks.suggestedMin || '',
347 - ticks: {
348 - maxTicksLimit: $scales.scales.xAxes[x].ticks.maxTicksLimit
349 - },
350 - stacked: $scales.scales.xAxes[x].stacked || false
351 - }
352 - }
353 - delete $scales.scales.xAxes;
354 - }
355 - // Migrate yAxes settings to v3.0+
356 - if ( $scales.scales && $scales.scales.yAxes ) {
357 - for (var y in $scales.scales.yAxes) {
358 - $scales.scales.y = {
359 - display: $scales.scales.yAxes[y].scaleLabel.display,
360 - title: {
361 - display:true,
362 - text: $scales.scales.yAxes[y].scaleLabel.labelString,
363 - color: $scales.scales.yAxes[y].scaleLabel.fontColor,
364 - font: {
365 - family: $scales.scales.yAxes[y].scaleLabel.fontFamily,
366 - size: $scales.scales.yAxes[y].scaleLabel.fontSize
367 - }
368 - },
369 - suggestedMax: $scales.scales.yAxes[y].ticks.suggestedMax || '',
370 - suggestedMin: $scales.scales.yAxes[y].ticks.suggestedMin || '',
371 - ticks: {
372 - maxTicksLimit: $scales.scales.yAxes[y].ticks.maxTicksLimit
373 - },
374 - stacked: $scales.scales.yAxes[y].stacked || false
375 - }
376 - }
377 - delete $scales.scales.yAxes;
378 - }
379 278 $.extend(settings, $scales);
380 279
381 280 // to prevent duplication, indicates that the axis has been set.
382 281 var $custom = {};
@@ -386,24 +285,21 @@
386 285
387 286 // format the axes labels.
388 287 if(typeof settings[axis + '_format'] !== 'undefined' && settings[axis + '_format'] !== ''){
389 288 var format = settings[axis + '_format'];
390 - var isDateFormat = moment( moment().format( format ),format, true ).isValid();
391 - if ( ! isDateFormat ) {
392 - switch(axis){
393 - case 'xAxes':
394 - settings.scales.x.ticks.callback = function(value, index, values){
395 - return format_datum(value, format);
396 - };
397 - break;
398 - case 'yAxes':
399 - settings.scales.y.ticks.callback = function(value, index, values){
400 - return format_datum(value, format);
401 - };
402 - break;
403 - }
404 - delete settings[axis + '_format'];
405 - }
289 + switch(axis){
290 + case 'xAxes':
291 + settings.scales.xAxes[0].ticks.callback = function(value, index, values){
292 + return format_datum(value, format);
293 + };
294 + break;
295 + case 'yAxes':
296 + settings.scales.yAxes[0].ticks.callback = function(value, index, values){
297 + return format_datum(value, format);
298 + };
299 + break;
300 + }
301 + delete settings[axis + '_format'];
406 302 }
407 303 delete settings[axis];
408 304 }
409 305
@@ -485,13 +381,8 @@
485 381
486 382 function format_data(datum, j, settings, series){
487 383 j = j - 1;
488 384 var format = typeof settings.series !== 'undefined' && typeof settings.series[j] !== 'undefined' ? settings.series[j].format : '';
489 - if ( '' === format && typeof settings.yAxes_format !== 'undefined' ) {
490 - format = settings.yAxes_format;
491 - } else if ( '' === format && typeof settings.xAxes_format !== 'undefined' ) {
492 - format = settings.xAxes_format;
493 - }
494 385 return format_datum(datum, format, series[j + 1].type);
495 386 }
496 387
497 388 function override(settings, chart) {