| @@ -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 | } |
| @@ -467,9 +428,9 @@ | ||
| 467 | 428 | |
| 468 | 429 | switch(type) { |
| 469 | 430 | case 'number': |
| 470 | 431 | // 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, ''); | |
| 432 | + format = format.replace(/#/g, '0'); | |
| 472 | 433 | // we also replace all instance of '$' as that is more relevant for ticks. |
| 473 | 434 | if(removeDollar){ |
| 474 | 435 | format = format.replace(/\$/g, ''); |
| 475 | 436 | } |