PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.4.8
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.4.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 3.10.4 All 148 releases
← All changes | js/render-chartjs.js +20 -140 3.10.43.4.8 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,
@@ -152,17 +117,9 @@
152 117 data: {
153 118 labels: labels,
154 119 datasets: datasets
155 120 },
156 - options: settings,
157 - plugins: [{
158 - afterRender: function () {
159 - var canvas = $( 'canvas' )[0];
160 - if ( $( '#chart-img' ).length ) {
161 - $( '#chart-img' ).val( canvas.toDataURL() );
162 - }
163 - }
164 - }],
121 + options: settings
165 122 });
166 123
167 124 // this line needs to be included twice. This is not an error.
168 125 $.extend(settings, { responsive: true, maintainAspectRatio: false });
@@ -207,14 +164,14 @@
207 164 settings['tooltip']['intersect'] = settings['tooltip']['intersect'] == true || parseInt(settings['tooltip']['intersect']) === 1; // jshint ignore:line
208 165 }
209 166
210 167 if(typeof settings['fontName'] !== 'undefined' && settings['fontName'] !== ''){
211 - Chart.defaults.font.family = settings['fontName'];
168 + Chart.defaults.global.defaultFontFamily = settings['fontName'];
212 169 delete settings['fontName'];
213 170 }
214 171
215 172 if(typeof settings['fontSize'] !== 'undefined' && settings['fontSize'] !== ''){
216 - Chart.defaults.font.size = parseInt(settings['fontSize']);
173 + Chart.defaults.global.defaultFontSize = settings['fontSize'];
217 174 delete settings['fontSize'];
218 175 }
219 176
220 177 // handle legend defaults.
@@ -225,12 +182,8 @@
225 182 }
226 183 }
227 184 }
228 185
229 - settings.plugins = {
230 - legend: settings.legend,
231 - };
232 -
233 186 handleAxes(settings, chart);
234 187
235 188 override(settings, chart);
236 189 }
@@ -238,27 +191,13 @@
238 191 function handleAxes(settings, chart){
239 192 if(typeof settings['yAxes'] !== 'undefined' && typeof settings['xAxes'] !== 'undefined'){
240 193 // stacking has to be defined on both axes.
241 194 if(typeof settings['yAxes']['stacked_bool'] !== 'undefined'){
242 - settings['yAxes']['stacked_bool'] = 'true';
195 + settings['xAxes']['stacked_bool'] = 'true';
243 196 }
244 197 if(typeof settings['xAxes']['stacked_bool'] !== 'undefined'){
245 - settings['xAxes']['stacked_bool'] = 'true';
198 + settings['yAxes']['stacked_bool'] = 'true';
246 199 }
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 200 }
262 201 configureAxes(settings, 'yAxes', chart);
263 202 configureAxes(settings, 'xAxes', chart);
264 203 }
@@ -327,56 +266,8 @@
327 266 }
328 267 var $axis = $scales['scales'][axis];
329 268
330 269 $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 270 $.extend(settings, $scales);
380 271
381 272 // to prevent duplication, indicates that the axis has been set.
382 273 var $custom = {};
@@ -386,24 +277,21 @@
386 277
387 278 // format the axes labels.
388 279 if(typeof settings[axis + '_format'] !== 'undefined' && settings[axis + '_format'] !== ''){
389 280 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 - }
281 + switch(axis){
282 + case 'xAxes':
283 + settings.scales.xAxes[0].ticks.callback = function(value, index, values){
284 + return format_datum(value, format);
285 + };
286 + break;
287 + case 'yAxes':
288 + settings.scales.yAxes[0].ticks.callback = function(value, index, values){
289 + return format_datum(value, format);
290 + };
291 + break;
292 + }
293 + delete settings[axis + '_format'];
406 294 }
407 295 delete settings[axis];
408 296 }
409 297
@@ -440,11 +328,8 @@
440 328 return;
441 329 }
442 330 for(var i in settings.series[j]){
443 331 var $attribute = {};
444 - if ( settings.series[j].backgroundColor == '' ) {
445 - delete settings.series[j].backgroundColor;
446 - }
447 332 $attribute[i] = settings.series[j][i];
448 333 $.extend($attributes, $attribute);
449 334 }
450 335 }
@@ -485,13 +370,8 @@
485 370
486 371 function format_data(datum, j, settings, series){
487 372 j = j - 1;
488 373 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 374 return format_datum(datum, format, series[j + 1].type);
495 375 }
496 376
497 377 function override(settings, chart) {