PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.7.12
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.7.12
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 -56 4.0.43.7.12 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;
@@ -117,45 +112,8 @@
117 112 }
118 113
119 114 handleSettings(settings, chart);
120 115
121 - const getChart = Chart.getChart(context);
122 - if ( getChart ) {
123 - return;
124 - }
125 -
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 116 var chartjs = new Chart(context, {
159 117 type: type,
160 118 data: {
161 119 labels: labels,
@@ -167,9 +125,9 @@
167 125 var canvas = $( 'canvas' )[0];
168 126 if ( $( '#chart-img' ).length ) {
169 127 $( '#chart-img' ).val( canvas.toDataURL() );
170 128 }
171 - }
129 + },
172 130 }],
173 131 });
174 132
175 133 // this line needs to be included twice. This is not an error.
@@ -205,8 +163,12 @@
205 163 if(typeof settings['animation'] !== 'undefined' && parseInt(settings['animation']['duration']) === 0){
206 164 settings['animation']['duration'] = 1000;
207 165 }
208 166
167 + if(typeof settings['title'] !== 'undefined' && settings['title']['text'] !== ''){
168 + settings['title']['display'] = true;
169 + }
170 +
209 171 if(typeof settings['tooltip'] !== 'undefined' && typeof settings['tooltip']['intersect'] !== 'undefined'){
210 172 // jshint ignore:line
211 173 settings['tooltip']['intersect'] = settings['tooltip']['intersect'] == true || parseInt(settings['tooltip']['intersect']) === 1; // jshint ignore:line
212 174 }
@@ -229,19 +191,11 @@
229 191 }
230 192 }
231 193 }
232 194
233 - settings.plugins = {
234 - legend: settings.legend,
235 - };
195 + handleAxes(settings, chart);
236 196
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 -
243 - handleAxes(settings, chart);
197 + override(settings, chart);
244 198 }
245 199
246 200 function handleAxes(settings, chart){
247 201 if(typeof settings['yAxes'] !== 'undefined' && typeof settings['xAxes'] !== 'undefined'){
@@ -278,9 +232,9 @@
278 232 var $o = {};
279 233 if(Array.isArray(settings[axis][i]) || typeof settings[axis][i] === 'object'){
280 234 for(var j in settings[axis][i]){
281 235 var $val = '';
282 - if(j === 'labelString'){
236 + if(j === 'labelString'){
283 237 $o['display'] = true;
284 238 $val = settings[axis][i][j];
285 239 }else if(i === 'ticks'){
286 240 // number values under ticks need to be converted to numbers or the library throws a JS error.
@@ -474,9 +428,9 @@
474 428
475 429 switch(type) {
476 430 case 'number':
477 431 // 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, '');
432 + format = format.replace(/#/g, '0');
479 433 // we also replace all instance of '$' as that is more relevant for ticks.
480 434 if(removeDollar){
481 435 format = format.replace(/\$/g, '');
482 436 }
@@ -505,9 +459,9 @@
505 459 function override(settings, chart) {
506 460 if (settings.manual) {
507 461 try{
508 462 var options = JSON.parse(settings.manual);
509 - $.extend(true, settings, options);
463 + $.extend(settings, options);
510 464 delete settings.manual;
511 465 }catch(error){
512 466 console.error("Error while adding manual configuration override " + settings.manual);
513 467 }