Skip to content

Commit fbd101d

Browse files
authored
Merge pull request #817 from Codeinwp/bugfix/814
Fix google line chart loading issue when create chart first time
2 parents ed3478f + 80096dd commit fbd101d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

classes/Visualizer/Module/Admin.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,18 @@ public function renderLibraryPage() {
903903
$series = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_SERIES, get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true ), $chart->ID, $type );
904904
$data = self::get_chart_data( $chart, $type );
905905

906+
// Set default setting series when add manual chart data - Only during first creation.
907+
if ( isset( $settings['series'] ) && ! empty( $series ) ) {
908+
$count_series = count( $series ) - count( $settings['series'] );
909+
if ( $count_series > 1 ) {
910+
$clone_last_series = end( $settings['series'] );
911+
$clone_last_series = array_fill_keys( array_keys( $clone_last_series ), '' );
912+
foreach ( range( 1, $count_series ) as $item ) {
913+
$settings['series'][] = $clone_last_series;
914+
}
915+
}
916+
}
917+
906918
$library = $this->load_chart_type( $chart->ID );
907919

908920
$id = 'visualizer-' . $chart->ID;

0 commit comments

Comments
 (0)