Skip to content

Commit e0b2fe4

Browse files
Merge pull request #956 from Codeinwp/bugfix/955
Fixed table chart decimal number issue
2 parents 61bf50d + 77d4505 commit e0b2fe4

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

classes/Visualizer/Source.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ protected function _normalizeData( $data ) {
218218
}
219219
switch ( $series['type'] ) {
220220
case 'number':
221+
$data[ $i ] = preg_replace( '/[\x{200B}-\x{200D}\x{FEFF}]/u', '', $data[ $i ] );
221222
$data[ $i ] = ( is_numeric( $data[ $i ] ) ) ? floatval( $data[ $i ] ) : ( is_numeric( str_replace( ',', '', $data[ $i ] ) ) ? floatval( str_replace( ',', '', $data[ $i ] ) ) : null );
222223
break;
223224
case 'boolean':

js/render-datatables.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@
247247
}
248248
if(typeof series.format.decimal !== ''){
249249
parts[1] = series.format.decimal;
250+
if ( '' === series.format.precision ) {
251+
series.format.precision = 2;
252+
}
250253
}
251254
if(typeof series.format.precision !== '' && parseInt(series.format.precision) > 0){
252255
parts[2] = series.format.precision;

0 commit comments

Comments
 (0)