Skip to content

Commit 11e395e

Browse files
Merge pull request #476 from contactashish13/issue-186-pro
Combo chart does not work with combo setting "candlechart"
2 parents 3cdaaaf + db25be5 commit 11e395e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

classes/Visualizer/Module/Utility.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,18 @@ public static function set_defaults( $chart, $post_status = 'auto-draft' ) {
157157
*/
158158
private static function set_defaults_google( $chart, $post_status ) {
159159
$type = get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );
160+
$series = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true );
160161

161162
$attributes = array();
162163
if ( $post_status === 'auto-draft' ) {
163164
switch ( $type ) {
164165
case 'combo':
165-
// chart type 'bars' and first series 'line'.
166+
// chart type 'bars' and randomly choose the type of each series.
167+
$types = array( 'area', 'line', 'steppedArea', 'bar' );
166168
$attributes['seriesType'] = 'bars';
167-
$attributes['series'][0]['type'] = 'line';
169+
for ( $x = 0; $x < count( $series ); $x++ ) {
170+
$attributes['series'][ $x ]['type'] = $types[ rand( 0, count( $types ) - 1 ) ];
171+
}
168172
break;
169173
}
170174
}

0 commit comments

Comments
 (0)