Skip to content

Commit 12669ba

Browse files
google table chart with boolean values shows all true in gutenberg
#733 (comment)
1 parent 3ae3ab3 commit 12669ba

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

classes/Visualizer/Gutenberg/Block.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,12 @@ public function get_visualizer_data( $post ) {
352352
// handle data filter hooks
353353
$data['visualizer-data'] = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, unserialize( html_entity_decode( get_the_content( $post_id ) ) ), $post_id, $data['visualizer-chart-type'] );
354354

355+
// we are going to format only for tabular charts, because we are not sure of the effect on others.
356+
// this is to solve the case where boolean data shows up as all-ticks on gutenberg.
357+
if ( in_array( $data['visualizer-chart-type'], array( 'tabular' ), true ) ) {
358+
$data['visualizer-data'] = $this->format_chart_data( $data['visualizer-data'], $data['visualizer-series'] );
359+
}
360+
355361
$data['visualizer-data-exploded'] = '';
356362
// handle annotations for google charts
357363
if ( 'GoogleCharts' === $library ) {

0 commit comments

Comments
 (0)