Skip to content

Commit e0c5a43

Browse files
Add chart default slices settings #1051
1 parent 8e36388 commit e0c5a43

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

classes/Visualizer/Module/Wizard.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,13 @@ private function setup_wizard_import_chart() {
212212
'message' => __( 'Something went wrong while importing the chart', 'visualizer' ),
213213
);
214214

215+
$data = $source->getData();
215216
$args = array(
216217
'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
217218
'post_title' => 'Visualization',
218219
'post_author' => get_current_user_id(),
219220
'post_status' => 'publish',
220-
'post_content' => $source->getData(),
221+
'post_content' => $data,
221222
);
222223
$chart_id = wp_insert_post( $args );
223224

@@ -232,8 +233,10 @@ private function setup_wizard_import_chart() {
232233
update_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $series );
233234
update_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_LIBRARY, '' );
234235

236+
$data = maybe_unserialize( $data );
235237
$setting_series = array();
236-
foreach ( $series as $s ) {
238+
$setting_slices = array();
239+
foreach ( $data as $s ) {
237240
$setting_series[] = array(
238241
'visibleInLegend' => '',
239242
'lineWidth' => '',
@@ -243,6 +246,10 @@ private function setup_wizard_import_chart() {
243246
'color' => '',
244247
'role' => '',
245248
);
249+
$setting_slices[] = array(
250+
'offset' => 0,
251+
'color' => '',
252+
);
246253
}
247254
update_post_meta(
248255
$chart_id,
@@ -289,7 +296,7 @@ private function setup_wizard_import_chart() {
289296
),
290297
'focusTarget' => 'datum',
291298
'series' => $setting_series,
292-
'slices' => array(),
299+
'slices' => $setting_slices,
293300
'vAxis' => array(
294301
'title' => '',
295302
'textPosition' => '',

0 commit comments

Comments
 (0)