Skip to content

Commit f4d6b0e

Browse files
boolean values of false vanish in editor
can use 'true', 'yes', '1' for true and 'false', 'no', 0 for false #214 (comment)
1 parent 9d34f89 commit f4d6b0e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

classes/Visualizer/Source.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ protected function _normalizeData( $data ) {
215215
$data[ $i ] = ( is_numeric( $data[ $i ] ) ) ? floatval( $data[ $i ] ) : ( is_numeric( str_replace( ',', '', $data[ $i ] ) ) ? floatval( str_replace( ',', '', $data[ $i ] ) ) : null );
216216
break;
217217
case 'boolean':
218-
$data[ $i ] = ! empty( $data[ $i ] ) ? filter_var( $data[ $i ], FILTER_VALIDATE_BOOLEAN ) : null;
218+
$datum = trim( strval( $data[ $i ] ) );
219+
$data[ $i ] = in_array( $datum, array( 'true', 'yes', '1' ) ) ? 'true' : 'false';
219220
break;
220221
case 'timeofday':
221222
$date = new DateTime( '1984-03-16T' . $data[ $i ] );

js/render-google.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,11 @@ var __visualizer_chart_images = [];
220220
data[i][j] = null;
221221
}
222222
break;
223+
case 'boolean':
224+
if (typeof data[i][j] === 'string'){
225+
data[i][j] = data[i][j] === 'true';
226+
}
227+
break;
223228
case 'date':
224229
// fall-through.
225230
case 'datetime':

0 commit comments

Comments
 (0)