PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.9.2
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.9.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 +10 -47 4.0.73.9.2 View file →
@@ -18,13 +18,8 @@
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 - }
27 22 rendered_charts[id] = 'yes';
28 23
29 24 series = chart.series;
30 25 data = chart.data;
@@ -122,40 +117,8 @@
122 117 if ( getChart ) {
123 118 return;
124 119 }
125 120
126 - // Format series label.
127 - settings.plugins.tooltip = {
128 - callbacks: {
129 - label: function(context) {
130 - var label = '';
131 - if ( 'object' === typeof context.dataset.label ) {
132 - label = context.label || '';
133 - } else {
134 - label = context.dataset.label || '';
135 - }
136 - if ( label ) {
137 - label += ': ';
138 - }
139 - var format = context.dataset.format || '';
140 - if ( format ) {
141 - var lastSuffix = numeral(context.formattedValue).format(format).replace(/[0-9]/g, '');
142 - label += context.formattedValue + lastSuffix;
143 - } else {
144 - format = 'undefined' !== typeof context.chart.config._config.options.format ? context.chart.config._config.options.format : '';
145 - if ( format ) {
146 - label += format_datum( context.formattedValue, format );
147 - } else {
148 - label += context.formattedValue;
149 - }
150 - }
151 - return label;
152 - }
153 - }
154 - };
155 -
156 - override(settings, chart);
157 -
158 121 var chartjs = new Chart(context, {
159 122 type: type,
160 123 data: {
161 124 labels: labels,
@@ -167,9 +130,9 @@
167 130 var canvas = $( 'canvas' )[0];
168 131 if ( $( '#chart-img' ).length ) {
169 132 $( '#chart-img' ).val( canvas.toDataURL() );
170 133 }
171 - }
134 + },
172 135 }],
173 136 });
174 137
175 138 // this line needs to be included twice. This is not an error.
@@ -205,8 +168,12 @@
205 168 if(typeof settings['animation'] !== 'undefined' && parseInt(settings['animation']['duration']) === 0){
206 169 settings['animation']['duration'] = 1000;
207 170 }
208 171
172 + if(typeof settings['title'] !== 'undefined' && settings['title']['text'] !== ''){
173 + settings['title']['display'] = true;
174 + }
175 +
209 176 if(typeof settings['tooltip'] !== 'undefined' && typeof settings['tooltip']['intersect'] !== 'undefined'){
210 177 // jshint ignore:line
211 178 settings['tooltip']['intersect'] = settings['tooltip']['intersect'] == true || parseInt(settings['tooltip']['intersect']) === 1; // jshint ignore:line
212 179 }
@@ -233,15 +200,11 @@
233 200 settings.plugins = {
234 201 legend: settings.legend,
235 202 };
236 203
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 - }
204 + handleAxes(settings, chart);
242 205
243 - handleAxes(settings, chart);
206 + override(settings, chart);
244 207 }
245 208
246 209 function handleAxes(settings, chart){
247 210 if(typeof settings['yAxes'] !== 'undefined' && typeof settings['xAxes'] !== 'undefined'){
@@ -278,9 +241,9 @@
278 241 var $o = {};
279 242 if(Array.isArray(settings[axis][i]) || typeof settings[axis][i] === 'object'){
280 243 for(var j in settings[axis][i]){
281 244 var $val = '';
282 - if(j === 'labelString'){
245 + if(j === 'labelString'){
283 246 $o['display'] = true;
284 247 $val = settings[axis][i][j];
285 248 }else if(i === 'ticks'){
286 249 // number values under ticks need to be converted to numbers or the library throws a JS error.
@@ -474,9 +437,9 @@
474 437
475 438 switch(type) {
476 439 case 'number':
477 440 // numeral.js works on 0 instead of # so we just replace that in the ICU pattern set.
478 - format = format.replace(/#/g, '0').replace(/%/g, '');
441 + format = format.replace(/#/g, '0');
479 442 // we also replace all instance of '$' as that is more relevant for ticks.
480 443 if(removeDollar){
481 444 format = format.replace(/\$/g, '');
482 445 }
@@ -505,9 +468,9 @@
505 468 function override(settings, chart) {
506 469 if (settings.manual) {
507 470 try{
508 471 var options = JSON.parse(settings.manual);
509 - $.extend(true, settings, options);
472 + $.extend(settings, options);
510 473 delete settings.manual;
511 474 }catch(error){
512 475 console.error("Error while adding manual configuration override " + settings.manual);
513 476 }