PluginProbe
Chartify – WordPress Chart Plugin / 3.5.2
Chartify – WordPress Chart Plugin v3.5.2
3.8.0 3.7.9 3.7.8 3.7.7 3.7.6 3.7.5 trunk 1.0.0 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 All 83 releases
chart-builder / includes / class-chart-builder-functions.php

class-chart-builder-functions.php in Chartify – WordPress Chart Plugin 3.5.2, at includes/class-chart-builder-functions.php

1,829 lines 113.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if( !class_exists( 'Chart_Builder_Functions' ) ){
4
5 /**
6 * Class Chart_Builder_Functions
7 * Class contains useful functions that uses in common
8 *
9 *
10 * Hooks used in the class
11 * There are not hooks yet
12 * @hooks @actions
13 * @filters
14 *
15 *
16 * @param $plugin_name
17 *
18 * @since 1.0.0
19 * @package Chart_Builder
20 * @subpackage Chart_Builder/includes
21 * @author Chart Builder Team <info@ays-pro.com>
22 */
23 class Chart_Builder_Functions {
24
25 /**
26 * The ID of this plugin.
27 *
28 * @since 1.0.0
29 * @access private
30 * @var string $plugin_name The ID of this plugin.
31 */
32 private $plugin_name;
33
34 /**
35 * The database table name
36 *
37 * @since 1.0.0
38 * @access private
39 * @var string $db_table The database table name
40 */
41 private $db_table;
42
43 /**
44 * The constructor of the class
45 *
46 * @since 1.0.0
47 * @param $plugin_name
48 */
49 public function __construct( $plugin_name ) {
50 global $wpdb;
51 /**
52 * Assigning $plugin_name to the @plugin_name property
53 */
54 $this->plugin_name = $plugin_name;
55 $this->db_table = $wpdb->prefix . CHART_BUILDER_DB_PREFIX . "charts";
56 }
57
58 /**
59 * Get instance of this class
60 *
61 * @access public
62 * @since 1.0.0
63 * @param $plugin_name
64 * @return Chart_Builder_Functions
65 */
66 public static function get_instance( $plugin_name ){
67 return new self( $plugin_name );
68 }
69
70 /**
71 * Date validation function
72 *
73 * @accept two parameters
74 * @param $date
75 * @param string $format
76 *
77 * @return bool
78 */
79 public function validateDate( $date, $format = 'Y-m-d H:i:s' ){
80 $d = DateTime::createFromFormat($format, $date);
81 return $d && $d->format($format) == $date;
82 }
83
84 /**
85 * Version compare function
86 *
87 * @accept two parameters
88 * @param $version1
89 * @param $operator
90 * @param $version2
91 *
92 * @return bool|int
93 */
94 public function versionCompare( $version1, $operator, $version2 ) {
95
96 $_fv = intval ( trim ( str_replace ( '.', '', $version1 ) ) );
97 $_sv = intval ( trim ( str_replace ( '.', '', $version2 ) ) );
98
99 if (strlen ( $_fv ) > strlen ( $_sv )) {
100 $_sv = str_pad ( $_sv, strlen ( $_fv ), 0 );
101 }
102
103 if (strlen ( $_fv ) < strlen ( $_sv )) {
104 $_fv = str_pad ( $_fv, strlen ( $_sv ), 0 );
105 }
106
107 return version_compare ( ( string ) $_fv, ( string ) $_sv, $operator );
108 }
109
110 public function get_all_charts_count() {
111 global $wpdb;
112 $where = str_replace("WHERE", "AND", Chart_Builder_DB_Actions::get_where_condition());
113
114 $sql = "SELECT COUNT(id) FROM {$this->db_table} WHERE `status` = %s {$where}";
115 return intval( $wpdb->get_var( $wpdb->prepare($sql, 'published') ));// phpcs:ignore
116 }
117
118 /**
119 * Gets the allowed types
120 *
121 * @access private
122 */
123 public function getAllowedTypes() {
124 return array(
125 'string',
126 'number',
127 'boolean',
128 'date',
129 'datetime',
130 'timeofday',
131 );
132 }
133
134 /**
135 * Gets the properties of the post type
136 *
137 * @access private
138 */
139 public function get_post_type_properties( $post_type ) {
140 $array = null;
141
142 $query = new WP_Query(
143 array(
144 'post_type' => $post_type,
145 'no_rows_found' => false,
146 'post_per_page' => 1,
147 'orderby' => 'post_date',
148 'order' => 'DESC',
149 'fields' => 'ids',
150 'update_post_meta_cache' => false,
151 'update_post_term_cache' => false,
152 )
153 );
154
155 $array = array(
156 'post_title',
157 'post_status',
158 'comment_count',
159 'post_date',
160 'post_modified',
161 );
162
163 if ( $query->have_posts() ) {
164 $id = $query->posts[0];
165 $meta = get_post_meta( $id, '', true );
166 foreach ( $meta as $key => $values ) {
167 $array[] = $key;
168 }
169 }
170
171 return $array;
172 }
173
174 /**
175 * Gets all tables and their columns.
176 *
177 * @access public
178 * @return array
179 */
180 public function get_all_db_tables_column_mapping( $chart_id, $use_filter = true ) {
181 $mapping = array();
182 $tables = $this->get_db_tables();
183 foreach ( $tables as $table ) {
184 $cols = $this->get_db_table_columns( $table, true );
185 $names = wp_list_pluck( $cols, 'name' );
186 $mapping[ $table ] = $names;
187 }
188
189 return $mapping;
190 }
191
192 /**
193 * Gets the tables in the database;
194 *
195 * @access public
196 * @return array
197 */
198 public function get_db_tables() {
199 global $wpdb;
200 $tables = get_transient( CHART_BUILDER_DB_PREFIX . 'db_tables' );
201 if ( $tables ) {
202 return $tables;
203 }
204 $tables = array();
205
206 $sql = $wpdb->get_col( 'SHOW TABLES', 0 );// phpcs:ignore
207 foreach ( $sql as $table ) {
208 if ( empty( $prefix ) || 0 === strpos( $table, $wpdb->prefix ) ) {
209 $tables[] = $table;
210 }
211 }
212
213 set_transient( CHART_BUILDER_DB_PREFIX . 'db_tables', $tables, HOUR_IN_SECONDS );
214 return $tables;
215 }
216
217 /**
218 * Gets the column information for the table.
219 *
220 * @param string $table The table.
221 * @param bool $prefix_with_table Whether to prefix column name with the name of the table.
222 * @access private
223 * @return array
224 */
225 private function get_db_table_columns( $table, $prefix_with_table = false ) {
226 global $wpdb;
227 $columns = get_transient( CHART_BUILDER_DB_PREFIX . "db_{$table}_columns" );
228 if ( $columns ) {
229 return $columns;
230 }
231 $columns = array();
232 // @codingStandardsIgnoreStart
233 $rows = $wpdb->get_results( "SHOW COLUMNS IN `$table`", ARRAY_N );
234 // @codingStandardsIgnoreEnd
235 if ( $rows ) {
236 // n => numeric, d => date-ish, s => string-ish.
237 foreach ( $rows as $row ) {
238 $col = ( $prefix_with_table ? "$table." : '' ) . $row[0];
239 $type = $row[1];
240 if ( strpos( $type, 'int' ) !== false || strpos( $type, 'float' ) !== false ) {
241 $type = 'n';
242 } elseif ( strpos( $type, 'date' ) !== false || strpos( $type, 'time' ) !== false ) {
243 $type = 'd';
244 } else {
245 $type = 's';
246 }
247 $columns[] = array( 'name' => $col, 'type' => $type );
248 }
249 }
250
251 set_transient( CHART_BUILDER_DB_PREFIX . "db_{$table}_columns", $columns, DAY_IN_SECONDS );
252 return $columns;
253 }
254
255 /**
256 * Gets the dependent tables and then gets column information for all the tables.
257 *
258 * @param string $table The table.
259 * @access public
260 * @return array
261 */
262 public function get_table_columns( $table ) {
263 $columns = array();
264 if ( ! $table ) {
265 return $columns;
266 }
267
268 $tables = array( $table );
269 $mapping = $this->get_db_table_mapping();
270 if ( array_key_exists( $table, $mapping ) ) {
271 $tables[] = $mapping[ $table ];
272 }
273 foreach ( $tables as $table ) {
274 $cols = $this->get_db_table_columns( $table, count( $tables ) > 1 );
275 $columns = array_merge( $columns, $cols );
276 }
277 return $columns;
278 }
279
280 /**
281 * Gets the relationship between tables in the database.
282 *
283 * @access public
284 * @return array
285 */
286 public function get_db_table_mapping() {
287 global $wpdb;
288 $mapping = get_transient( CHART_BUILDER_DB_PREFIX . 'db_table_mapping' );
289 if ( $mapping ) {
290 return $mapping;
291 }
292 // no need to provide x=>y and then y=>x as we will flip the array shortly.
293 $mapping = array(
294 $wpdb->prefix . 'posts' => $wpdb->prefix . 'postmeta',
295 $wpdb->prefix . 'users' => $wpdb->prefix . 'usermeta',
296 $wpdb->prefix . 'terms' => $wpdb->prefix . 'termmeta',
297 $wpdb->prefix . 'comments' => $wpdb->prefix . 'commentmeta',
298 );
299
300 $mapping += array_flip( $mapping );
301 set_transient( CHART_BUILDER_DB_PREFIX . 'db_table_mapping', $mapping, HOUR_IN_SECONDS );
302 return $mapping;
303 }
304
305 /**
306 * Creates HTML table from passed data
307 *
308 * @access public
309 * @return string
310 */
311 public function get_table_html( $headers, $rows, $table_id = 'results' ) {
312 ob_start();
313 ?>
314 <table cellspacing="0" width="100%" id="<?php echo esc_attr($table_id) ?>">
315 <thead>
316 <tr>
317 <?php
318 foreach ( $headers as $header ) {
319 if( empty( $header ) ){
320 continue;
321 }
322 echo '<th>' . esc_html($header) . '</th>';
323 }
324 ?>
325 </tr>
326 </thead>
327 <tfoot>
328 </tfoot>
329 <tbody>
330 <?php
331 foreach ( $rows as $row ) {
332 if( empty( $row ) ){
333 continue;
334 }
335 echo '<tr>';
336 foreach ( $row as $r ) {
337 echo '<td>' . esc_html($r) . '</td>';
338 }
339 echo '</tr>';
340 }
341 ?>
342 </tbody>
343 </table>
344 <?php
345 return ob_get_clean();
346 }
347
348 /**
349 * Gets the the queries from quiz maker database tables.
350 *
351 * @access public
352 * @return array
353 */
354 public function get_quiz_query ($query, $quiz_id = null, $user_id = null) {
355 global $wpdb;
356 $reports_table = $wpdb->prefix . 'aysquiz_reports';
357 $quizes_table = $wpdb->prefix . 'aysquiz_quizes';
358
359 switch ($query) {
360 case 'q1':
361 $sql = "SELECT CAST(end_date AS date) AS `Date`, COUNT(id) AS `Count` FROM {$reports_table} WHERE quiz_id = %d GROUP BY CAST(end_date AS date)";
362 $result = $wpdb->get_results($wpdb->prepare($sql, $quiz_id), "ARRAY_A");// phpcs:ignore
363 break;
364 case 'q2':
365 $sql = "SELECT CAST(end_date AS date) AS `Date`, COUNT(id) AS `Count` FROM {$reports_table} WHERE user_id = %d GROUP BY CAST(end_date AS date)";
366 $result = $wpdb->get_results($wpdb->prepare($sql, $user_id), "ARRAY_A");// phpcs:ignore
367 break;
368 case 'q3':
369 $sql = "SELECT CAST(end_date AS date) AS `Date`, COUNT(id) AS `Count` FROM {$reports_table} WHERE user_id = %d AND quiz_id = %d GROUP BY CAST(end_date AS date)";
370 $result = $wpdb->get_results($wpdb->prepare($sql, $user_id, $quiz_id), "ARRAY_A");// phpcs:ignore
371 break;
372 case 'q4':
373 $sql = "SELECT {$quizes_table}.title AS `Quiz`, AVG({$reports_table}.score) AS `Average` FROM {$reports_table} LEFT JOIN {$quizes_table} ON {$reports_table}.quiz_id = {$quizes_table}.id WHERE {$reports_table}.user_id = %d GROUP BY {$quizes_table}.title";
374 $result = $wpdb->get_results($wpdb->prepare($sql, $user_id), "ARRAY_A");// phpcs:ignore
375 break;
376 case 'q5':
377 $sql = "SELECT {$quizes_table}.title AS `Quiz`, COUNT({$reports_table}.score) AS `Count` FROM {$reports_table} LEFT JOIN {$quizes_table} ON {$reports_table}.quiz_id = {$quizes_table}.id WHERE {$reports_table}.user_id = %d GROUP BY {$quizes_table}.title";
378 $result = $wpdb->get_results($wpdb->prepare($sql, $user_id), "ARRAY_A");// phpcs:ignore
379 break;
380 case 'q6':
381 $sql = "SELECT score AS `Score` FROM {$reports_table} WHERE user_id = %d AND quiz_id = %d";
382 $result = $wpdb->get_results($wpdb->prepare($sql, $user_id, $quiz_id), "ARRAY_A");// phpcs:ignore
383 break;
384 default:
385 break;
386 }
387
388
389 $message = empty($result) ? __( "There is no data for your query.", "chart-builder" ) : "";
390 return array(
391 'message' => $message,
392 'result' => $result,
393 'query' => $sql
394 );
395 }
396
397 /**
398 * Gets all settings of google charts for admin area.
399 *
400 * @access public
401 * @return array
402 */
403 public function get_chart_settings_google_admin ($settings, $action, $source) {
404 $chart_default_colors = array('#3366cc','#dc3912','#ff9900','#109618', '#990099','#0099c6','#dd4477','#66aa00', '#b82e2e','#316395','#994499','#22aa99', '#aaaa11','#6633cc','#e67300','#8b0707', '#651067','#329262','#5574a6','#3b3eac', '#b77322','#16d620','#b91383','#f4359e', '#9c5935','#a9c413','#2a778d','#668d1c', '#bea413','#0c5922','#743411');
405
406 $tooltip_trigger_options = array(
407 "hover" => __("While hovering", "chart-builder"),
408 "selection" => __("When selected", "chart-builder"),
409 "none" => __("Disable", "chart-builder")
410 );
411
412 $tooltip_bold_options = array(
413 "default" => __("Default", "chart-builder"),
414 "true" => __("Enable", "chart-builder"),
415 "false" => __("Disable", "chart-builder")
416 );
417
418 $tooltip_text_options = array(
419 "value" => __("Value", "chart-builder"),
420 "percentage" => __("Percent", "chart-builder"),
421 "both" => __("Value & Percent", "chart-builder")
422 );
423
424 $focus_target_options = array(
425 "datum" => __("Single data", "chart-builder"),
426 "category" => __("Group data", "chart-builder"),
427 );
428
429 $legend_positions = array(
430 "left" => __("Left of the chart", "chart-builder"),
431 "right" => __("Right of the chart", "chart-builder"),
432 "top" => __("Above the chart", "chart-builder"),
433 "bottom" => __("Below the chart", "chart-builder"),
434 "in" => __("Inside the chart", "chart-builder"),
435 "labeled" => __("Labeled", "chart-builder"),
436 "none" => __("Hide", "chart-builder")
437 );
438
439 $legend_alignments = array(
440 "start" => __("Start", "chart-builder"),
441 "center" => __("Center", "chart-builder"),
442 "end" => __("End", "chart-builder"),
443 );
444
445 $slice_texts = array(
446 "percentage" => __("Percentage", "chart-builder"),
447 "value" => __("Quantitative value", "chart-builder"),
448 "label" => __("Name", "chart-builder"),
449 "none" => __("Disable", "chart-builder")
450 );
451
452 $axes_text_positions = array(
453 "in" => __("Inside the chart", "chart-builder"),
454 "out" => __("Outside the chart", "chart-builder"),
455 "none" => __("Hide", "chart-builder")
456 );
457
458 $haxis_slanted_options = array(
459 "automatic" => __("Automatic", "chart-builder"),
460 "true" => __("True", "chart-builder"),
461 "false" => __("False", "chart-builder")
462 );
463
464 $title_positions = array(
465 "left" => __("Left", "chart-builder"),
466 "right" => __("Right", "chart-builder"),
467 "center" => __("Center", "chart-builder")
468 );
469
470 $border_styles = array(
471 "solid" => __("Solid", "chart-builder"),
472 "dashed" => __("Dashed", "chart-builder"),
473 "dotted" => __("Dotted", "chart-builder"),
474 "double" => __("Double", "chart-builder"),
475 "groove" => __("Groove", "chart-builder"),
476 "inset" => __("Inset", "chart-builder"),
477 "outset" => __("Outset", "chart-builder"),
478 "ridge" => __("Ridge", "chart-builder")
479 );
480
481 $animation_easing_options = array(
482 "linear" => __("Linear", "chart-builder"),
483 "in" => __("Ease in", "chart-builder"),
484 "out" => __("Ease out", "chart-builder"),
485 "inAndOut" => __("Ease in and out", "chart-builder")
486 );
487
488 $multiple_data_format_options = array(
489 "category" => __("Category", "chart-builder"),
490 "series" => __("Series", "chart-builder"),
491 "auto" => __("Auto", "chart-builder"),
492 "none" => __("None", "chart-builder"),
493 );
494
495 $point_shape_options = array(
496 "circle" => __("Circle", "chart-builder"),
497 "triangle" => __("Triangle", "chart-builder"),
498 "square" => __("Square", "chart-builder"),
499 "diamond" => __("Diamond", "chart-builder"),
500 "star" => __("Star", "chart-builder"),
501 "polygon" => __("Polygon", "chart-builder"),
502 );
503
504 $crosshair_trigger_options = array(
505 "focus" => __("Focus", "chart-builder"),
506 "selection" => __("Selection", "chart-builder"),
507 "both" => __("Focus and Selection", "chart-builder"),
508 "none" => __("Disable", "chart-builder"),
509 );
510
511 $crosshair_orientation_options = array(
512 "vertical" => __("Vertical", "chart-builder"),
513 "horizontal" => __("Horizontal", "chart-builder"),
514 "both" => __("Both", "chart-builder"),
515 );
516
517 $axes_format_options = array(
518 "" => __("None", "chart-builder"),
519 "decimal" => __("Decimal", "chart-builder"),
520 "scientific" => __("Scientific", "chart-builder"),
521 "currency" => __("Currency", "chart-builder"),
522 "percent" => __("Percent", "chart-builder"),
523 "short" => __("Short", "chart-builder"),
524 "long" => __("Long", "chart-builder"),
525 );
526
527 $group_width_format_options = array(
528 "%" => __("%", "chart-builder"),
529 "px" => __("px", "chart-builder"),
530 );
531
532 $position_styles = array(
533 "left" => 'margin-left:0',
534 "right" => 'margin-right:0',
535 "center" => 'margin:auto',
536 );
537
538 $org_chart_font_size_options = array(
539 "small" => __("Small", "chart-builder"),
540 "medium" => __("Medium", "chart-builder"),
541 "large" => __("Large", "chart-builder"),
542 );
543
544 $text_transforms = array(
545 "uppercase" => __("Uppercase", "chart-builder"),
546 "lowercase" => __("Lowercase", "chart-builder"),
547 "capitalize" => __("Capitalize", "chart-builder"),
548 "none" => __("None", "chart-builder"),
549 );
550
551 $text_decorations = array(
552 "overline" => __("Overline", "chart-builder"),
553 "underline" => __("Underline", "chart-builder"),
554 "line-through" => __("Line through", "chart-builder"),
555 "none" => __("None", "chart-builder"),
556 );
557
558 // Width
559 $settings['width'] = isset( $settings['width'] ) && $settings['width'] != '' ? esc_attr( $settings['width'] ) : '100';
560 $settings['width_format'] = isset( $settings['width_format'] ) && $settings['width_format'] != '' ? esc_attr( $settings['width_format'] ) : '%';
561 $settings['width_format_options'] = $group_width_format_options;
562
563 // responsive width
564 $settings['responsive_width'] = ( isset( $settings['responsive_width'] ) && $settings['responsive_width'] != '' ) ? $settings['responsive_width'] : 'off';
565 $settings['responsive_width'] = isset( $settings['responsive_width'] ) && $settings['responsive_width'] == 'on' ? 'checked' : '';
566
567 // position
568 $settings['position'] = isset( $settings['position'] ) && $settings['position'] != '' ? esc_attr( $settings['position'] ) : 'center';
569 $settings['position_styles'] = $position_styles;
570
571 // Height
572 $settings['height'] = isset( $settings['height'] ) && $settings['height'] != '' ? esc_attr( $settings['height'] ) : '400';
573 $settings['height_format'] = isset( $settings['height_format'] ) && $settings['height_format'] != '' ? esc_attr( $settings['height_format'] ) : 'px';
574
575 // Font size
576 $settings['font_size'] = isset( $settings['font_size'] ) && $settings['font_size'] != '' ? esc_attr( $settings['font_size'] ) : '15';
577
578 // Background color
579 $settings['background_color'] = isset( $settings['background_color'] ) && $settings['background_color'] != '' ? esc_attr( $settings['background_color'] ) : '#ffffff';
580
581 // Transparent background
582 $settings['transparent_background'] = isset( $settings['transparent_background'] ) && $settings['transparent_background'] != '' ? esc_attr( $settings['transparent_background'] ) : 'off';
583 $settings['transparent_background'] = isset( $settings['transparent_background'] ) && $settings['transparent_background'] == 'on' ? 'checked' : '';
584
585 // Box shadow
586 $settings['box_shadow'] = isset( $settings['box_shadow'] ) && $settings['box_shadow'] != '' ? esc_attr( $settings['box_shadow'] ) : 'off';
587 $settings['box_shadow'] = isset( $settings['box_shadow'] ) && $settings['box_shadow'] == 'on' ? 'checked' : '';
588
589 // Border width
590 $settings['border_width'] = isset( $settings['border_width'] ) && $settings['border_width'] != '' ? esc_attr( $settings['border_width'] ) : '0';
591
592 // Border radius
593 $settings['border_radius'] = isset( $settings['border_radius'] ) && $settings['border_radius'] != '' ? esc_attr( $settings['border_radius'] ) : '0';
594
595 // Border color
596 $settings['border_color'] = isset( $settings['border_color'] ) && $settings['border_color'] != '' ? esc_attr( $settings['border_color'] ) : '#666666';
597
598 // Border style
599 $settings['border_style'] = isset( $settings['border_style'] ) && $settings['border_style'] != '' ? esc_attr( $settings['border_style'] ) : 'solid';
600
601 // Border width with title
602 $settings['border_width_with_title'] = isset( $settings['border_width_with_title'] ) && $settings['border_width_with_title'] != '' ? esc_attr( $settings['border_width_with_title'] ) : '0';
603
604 // Border radius with title
605 $settings['border_radius_with_title'] = isset( $settings['border_radius_with_title'] ) && $settings['border_radius_with_title'] != '' ? esc_attr( $settings['border_radius_with_title'] ) : '0';
606
607 // Border color with title
608 $settings['border_color_with_title'] = isset( $settings['border_color_with_title'] ) && $settings['border_color_with_title'] != '' ? esc_attr( $settings['border_color_with_title'] ) : '#000000';
609
610 // Border style with title
611 $settings['border_style_with_title'] = isset( $settings['border_style_with_title'] ) && $settings['border_style_with_title'] != '' ? esc_attr( $settings['border_style_with_title'] ) : 'solid';
612 $settings['border_styles'] = $border_styles;
613
614 // Padding outer
615 $settings['padding_outer'] = isset( $settings['padding_outer'] ) && $settings['padding_outer'] != '' ? esc_attr( $settings['padding_outer'] ) : '0';
616
617 // Box shadow color
618 $settings['box_shadow_color'] = isset( $settings['box_shadow_color'] ) && $settings['box_shadow_color'] != '' ? esc_attr( $settings['box_shadow_color'] ) : $settings['border_color'];
619
620 // Chart Area background color
621 $settings['chart_background_color'] = isset( $settings['chart_background_color'] ) && $settings['chart_background_color'] != '' ? esc_attr( $settings['chart_background_color'] ) : '#ffffff';
622
623 // Chart Area border width
624 $settings['chart_border_width'] = isset( $settings['chart_border_width'] ) && $settings['chart_border_width'] != '' ? esc_attr( $settings['chart_border_width'] ) : '0';
625
626 // Chart Area border color
627 $settings['chart_border_color'] = isset( $settings['chart_border_color'] ) && $settings['chart_border_color'] != '' ? esc_attr( $settings['chart_border_color'] ) : '#666666';
628
629 // Chart Area left margin
630 $settings['chart_left_margin'] = isset( $settings['chart_left_margin'] ) && $settings['chart_left_margin'] != '' ? esc_attr( $settings['chart_left_margin'] ) : '';
631 $settings['chart_left_margin_for_js'] = isset( $settings['chart_left_margin'] ) && $settings['chart_left_margin'] != '' ? esc_attr( $settings['chart_left_margin'] ) : 'auto';
632
633 // Chart Area right margin
634 $settings['chart_right_margin'] = isset( $settings['chart_right_margin'] ) && $settings['chart_right_margin'] != '' ? esc_attr( $settings['chart_right_margin'] ) : '';
635 $settings['chart_right_margin_for_js'] = isset( $settings['chart_right_margin'] ) && $settings['chart_right_margin'] != '' ? esc_attr( $settings['chart_right_margin'] ) : 'auto';
636
637 // Chart Area top margin
638 $settings['chart_top_margin'] = isset( $settings['chart_top_margin'] ) && $settings['chart_top_margin'] != '' ? esc_attr( $settings['chart_top_margin'] ) : '';
639 $settings['chart_top_margin_for_js'] = isset( $settings['chart_top_margin'] ) && $settings['chart_top_margin'] != '' ? esc_attr( $settings['chart_top_margin'] ) : 'auto';
640
641 // Chart Area bottom margin
642 $settings['chart_bottom_margin'] = isset( $settings['chart_bottom_margin'] ) && $settings['chart_bottom_margin'] != '' ? esc_attr( $settings['chart_bottom_margin'] ) : '';
643 $settings['chart_bottom_margin_for_js'] = isset( $settings['chart_bottom_margin'] ) && $settings['chart_bottom_margin'] != '' ? esc_attr( $settings['chart_bottom_margin'] ) : 'auto';
644
645 // Title color
646 $settings['title_color'] = isset( $settings['title_color'] ) && $settings['title_color'] != '' ? esc_attr( $settings['title_color'] ) : '#000000';
647
648 // Title color
649 $settings['title_shadow_color'] = isset( $settings['title_shadow_color'] ) && $settings['title_shadow_color'] != '' ? esc_attr( $settings['title_shadow_color'] ) : $settings['title_color'];
650
651 // Title font size
652 $settings['title_font_size'] = isset( $settings['title_font_size'] ) && $settings['title_font_size'] != '' ? esc_attr( $settings['title_font_size'] ) : '30';
653
654 // Title Bold text
655 $settings['title_bold'] = ( isset( $settings['title_bold'] ) && $settings['title_bold'] != '' ) ? esc_attr($settings['title_bold']) : 'on';
656 $settings['title_bold'] = isset( $settings['title_bold'] ) && $settings['title_bold'] == 'on' ? 'checked' : '';
657
658 // Title text shadow
659 $settings['title_text_shadow'] = ( isset( $settings['title_text_shadow'] ) && $settings['title_text_shadow'] != '' ) ? esc_attr($settings['title_text_shadow']) : 'off';
660 $settings['title_text_shadow'] = isset( $settings['title_text_shadow'] ) && $settings['title_text_shadow'] == 'on' ? 'checked' : '';
661
662 // Title italic text
663 $settings['title_italic'] = ( isset( $settings['title_italic'] ) && $settings['title_italic'] != '' ) ? esc_attr($settings['title_italic']) : 'off';
664 $settings['title_italic'] = isset( $settings['title_italic'] ) && $settings['title_italic'] == 'on' ? 'checked' : '';
665
666 // Title gap
667 $settings['title_gap'] = isset( $settings['title_gap'] ) && $settings['title_gap'] != '' ? esc_attr( $settings['title_gap'] ) : '5';
668
669 // Title gap
670 $settings['title_gap_description'] = isset( $settings['title_gap_description'] ) && $settings['title_gap_description'] != '' ? esc_attr( $settings['title_gap_description'] ) : '5';
671
672 // Title letter spacing
673 $settings['title_letter_spacing'] = isset( $settings['title_letter_spacing'] ) && $settings['title_letter_spacing'] != '' ? esc_attr( $settings['title_letter_spacing'] ) : 0;
674
675 // Title position
676 $settings['title_position'] = isset( $settings['title_position'] ) && $settings['title_position'] != '' ? esc_attr( $settings['title_position'] ) : 'left';
677 $settings['title_positions'] = $title_positions;
678
679 // Title text transform
680 $settings['title_text_transform'] = isset( $settings['title_text_transform'] ) && $settings['title_text_transform'] != '' ? esc_attr( $settings['title_text_transform'] ) : 'none';
681 $settings['text_transforms'] = $text_transforms;
682
683 // Title text decoration
684 $settings['title_text_decoration'] = isset( $settings['title_text_decoration'] ) && $settings['title_text_decoration'] != '' ? esc_attr( $settings['title_text_decoration'] ) : 'none';
685 $settings['text_decorations'] = $text_decorations;
686
687 // description color
688 $settings['description_color'] = isset( $settings['description_color'] ) && $settings['description_color'] != '' ? esc_attr( $settings['description_color'] ) : '#4c4c4c';
689
690 // description font size
691 $settings['description_font_size'] = isset( $settings['description_font_size'] ) && $settings['description_font_size'] != '' ? esc_attr( $settings['description_font_size'] ) : '16';
692
693 // description Bold text
694 $settings['description_bold'] = ( isset( $settings['description_bold'] ) && $settings['description_bold'] != '' ) ? esc_attr($settings['description_bold']) : 'off';
695 $settings['description_bold'] = isset( $settings['description_bold'] ) && $settings['description_bold'] == 'on' ? 'checked' : '';
696
697 // description text shadow
698 $settings['description_text_shadow'] = ( isset( $settings['description_text_shadow'] ) && $settings['description_text_shadow'] != '' ) ? esc_attr($settings['description_text_shadow']) : 'off';
699 $settings['description_text_shadow'] = isset( $settings['description_text_shadow'] ) && $settings['description_text_shadow'] == 'on' ? 'checked' : '';
700
701 // description color
702 $settings['description_shadow_color'] = isset( $settings['description_shadow_color'] ) && $settings['description_shadow_color'] != '' ? esc_attr( $settings['description_shadow_color'] ) : $settings['description_color'];
703
704 // description italic text
705 $settings['description_italic'] = ( isset( $settings['description_italic'] ) && $settings['description_italic'] != '' ) ? esc_attr($settings['description_italic']) : 'off';
706 $settings['description_italic'] = isset( $settings['description_italic'] ) && $settings['description_italic'] == 'on' ? 'checked' : '';
707
708 // description position
709 $settings['description_position'] = isset( $settings['description_position'] ) && $settings['description_position'] != '' ? esc_attr( $settings['description_position'] ) : 'left';
710
711 // description text transform
712 $settings['description_text_transform'] = isset( $settings['description_text_transform'] ) && $settings['description_text_transform'] != '' ? esc_attr( $settings['description_text_transform'] ) : 'none';
713
714 // description letter spacing
715 $settings['description_letter_spacing'] = isset( $settings['description_letter_spacing'] ) && $settings['description_letter_spacing'] != '' ? esc_attr( $settings['description_letter_spacing'] ) : 0;
716
717 // description text decoration
718 $settings['description_text_decoration'] = isset( $settings['description_text_decoration'] ) && $settings['description_text_decoration'] != '' ? esc_attr( $settings['description_text_decoration'] ) : 'none';
719
720 // Rotation degree
721 $settings['rotation_degree'] = isset( $settings['rotation_degree'] ) && $settings['rotation_degree'] != '' ? esc_attr( $settings['rotation_degree'] ) : '0';
722
723 // Is stacked
724 $settings['is_stacked'] = ( isset( $settings['is_stacked'] ) && $settings['is_stacked'] != '' ) ? $settings['is_stacked'] : 'off';
725 $settings['is_stacked'] = isset( $settings['is_stacked'] ) && $settings['is_stacked'] == 'on' ? 'checked' : '';
726
727 // Line width
728 $settings['line_width'] = isset( $settings['line_width'] ) && $settings['line_width'] != '' ? esc_attr( $settings['line_width'] ) : '2';
729
730 // Slice border color
731 $settings['slice_border_color'] = isset( $settings['slice_border_color'] ) && $settings['slice_border_color'] != '' ? esc_attr( $settings['slice_border_color'] ) : '#ffffff';
732
733 // Reverse categories
734 $settings['reverse_categories'] = ( isset( $settings['reverse_categories'] ) && $settings['reverse_categories'] != '' ) ? $settings['reverse_categories'] : 'off';
735 $settings['reverse_categories'] = isset( $settings['reverse_categories'] ) && $settings['reverse_categories'] == 'on' ? 'checked' : '';
736
737 // Slice text
738 $settings['slice_text'] = isset( $settings['slice_text'] ) && $settings['slice_text'] != '' ? esc_attr( $settings['slice_text'] ) : 'percentage';
739 $settings['slice_texts'] = $slice_texts;
740
741 // Tooltip trigger
742 $settings['tooltip_trigger'] = isset( $settings['tooltip_trigger'] ) && $settings['tooltip_trigger'] != '' ? esc_attr( $settings['tooltip_trigger'] ) : 'hover';
743 $settings['tooltip_trigger_options'] = $tooltip_trigger_options;
744
745 // Tooltip text
746 $settings['tooltip_text'] = isset( $settings['tooltip_text'] ) && $settings['tooltip_text'] != '' ? esc_attr( $settings['tooltip_text'] ) : 'both';
747 $settings['tooltip_text_options'] = $tooltip_text_options;
748
749 // Multiple data format
750 $settings['multiple_data_format'] = isset( $settings['multiple_data_format'] ) && $settings['multiple_data_format'] != '' ? esc_attr( $settings['multiple_data_format'] ) : 'auto';
751 $settings['multiple_data_format_options'] = $multiple_data_format_options;
752
753 // Data grouping settings
754 $settings['data_grouping_limit'] = isset( $settings['data_grouping_limit'] ) && $settings['data_grouping_limit'] != '' ? esc_attr( $settings['data_grouping_limit'] ) : '0.5';
755 $settings['data_grouping_label'] = isset( $settings['data_grouping_label'] ) && $settings['data_grouping_label'] != '' ? esc_attr( $settings['data_grouping_label'] ) : 'Other';
756 $settings['data_grouping_color'] = isset( $settings['data_grouping_color'] ) && $settings['data_grouping_color'] != '' ? esc_attr( $settings['data_grouping_color'] ) : '#ccc';
757
758 // Focus target
759 $settings['focus_target'] = isset( $settings['focus_target'] ) && $settings['focus_target'] != '' ? esc_attr( $settings['focus_target'] ) : 'datum';
760 $settings['focus_target_options'] = $focus_target_options;
761
762 // Show color code
763 $settings['show_color_code'] = ( isset( $settings['show_color_code'] ) && $settings['show_color_code'] != '' ) ? $settings['show_color_code'] : 'off';
764 $settings['show_color_code'] = isset( $settings['show_color_code'] ) && $settings['show_color_code'] == 'on' ? 'checked' : '';
765
766 // Italic text
767 $settings['tooltip_italic'] = ( isset( $settings['tooltip_italic'] ) && $settings['tooltip_italic'] != '' ) ? $settings['tooltip_italic'] : 'off';
768 $settings['tooltip_italic'] = isset( $settings['tooltip_italic'] ) && $settings['tooltip_italic'] == 'on' ? 'checked' : '';
769
770 // Bold text
771 $settings['tooltip_bold'] = isset( $settings['tooltip_bold'] ) && $settings['tooltip_bold'] != '' ? esc_attr( $settings['tooltip_bold'] ) : 'default';
772 $settings['tooltip_bold_options'] = $tooltip_bold_options;
773
774 // Tooltip text color
775 $settings['tooltip_text_color'] = isset( $settings['tooltip_text_color'] ) && $settings['tooltip_text_color'] != '' ? esc_attr( $settings['tooltip_text_color'] ) : '#000000';
776
777 // Tooltip font size
778 $settings['tooltip_font_size'] = isset( $settings['tooltip_font_size'] ) && intval($settings['tooltip_font_size']) > 0 ? esc_attr( $settings['tooltip_font_size'] ) : $settings['font_size'];
779
780 // Legend position
781 $settings['legend_position'] = isset( $settings['legend_position'] ) && $settings['legend_position'] != '' ? esc_attr( $settings['legend_position'] ) : 'right';
782 $settings['legend_positions'] = $legend_positions;
783
784 // Legend alignment
785 $settings['legend_alignment'] = isset( $settings['legend_alignment'] ) && $settings['legend_alignment'] != '' ? esc_attr( $settings['legend_alignment'] ) : 'start';
786 $settings['legend_alignments'] = $legend_alignments;
787
788 // Legend font color
789 $settings['legend_color'] = isset( $settings['legend_color'] ) && $settings['legend_color'] != '' ? esc_attr( $settings['legend_color'] ) : '#000000';
790
791 // Legend font size
792 $settings['legend_font_size'] = isset( $settings['legend_font_size'] ) && intval($settings['legend_font_size']) > 0 ? esc_attr( $settings['legend_font_size'] ) : $settings['font_size'];
793
794 // Legend Italic text
795 $settings['legend_italic'] = ( isset( $settings['legend_italic'] ) && $settings['legend_italic'] != '' ) ? $settings['legend_italic'] : 'off';
796 $settings['legend_italic'] = isset( $settings['legend_italic'] ) && $settings['legend_italic'] == 'on' ? 'checked' : '';
797
798 // Legend Bold text
799 $settings['legend_bold'] = ( isset( $settings['legend_bold'] ) && $settings['legend_bold'] != '' ) ? $settings['legend_bold'] : 'off';
800 $settings['legend_bold'] = isset( $settings['legend_bold'] ) && $settings['legend_bold'] == 'on' ? 'checked' : '';
801
802 // Opacity
803 $settings['opacity'] = isset( $settings['opacity'] ) && $settings['opacity'] != '' ? esc_attr( $settings['opacity'] ) : '1.0';
804
805 // Group width
806 $settings['group_width'] = isset( $settings['group_width'] ) && $settings['group_width'] != '' ? esc_attr( $settings['group_width'] ) : '61.8';
807 $settings['group_width_format'] = isset( $settings['group_width_format'] ) && $settings['group_width_format'] != '' ? esc_attr( $settings['group_width_format'] ) : '%';
808 $settings['group_width_format_options'] = $group_width_format_options;
809
810 // Show chart description
811 if (!isset($settings['show_description'])) {
812 $settings['show_description'] = 'checked';
813 } else {
814 $settings['show_description'] = ( $settings['show_description'] != '' ) ? $settings['show_description'] : 'off';
815 $settings['show_description'] = isset( $settings['show_description'] ) && $settings['show_description'] == 'on' ? 'checked' : '';
816 }
817
818 // Show chart title
819 if (!isset($settings['show_title'])) {
820 $settings['show_title'] = 'checked';
821 } else {
822 $settings['show_title'] = ( $settings['show_title'] != '' ) ? $settings['show_title'] : 'off';
823 $settings['show_title'] = isset( $settings['show_title'] ) && $settings['show_title'] == 'on' ? 'checked' : '';
824 }
825
826 // Enable interactivity
827 if (!isset($settings['enable_interactivity'])) {
828 $settings['enable_interactivity'] = 'checked';
829 } else {
830 $settings['enable_interactivity'] = ( $settings['enable_interactivity'] != '' ) ? $settings['enable_interactivity'] : 'off';
831 $settings['enable_interactivity'] = isset( $settings['enable_interactivity'] ) && $settings['enable_interactivity'] == 'on' ? 'checked' : '';
832 }
833
834 // Maximized view
835 $settings['maximized_view'] = ( isset( $settings['maximized_view'] ) && $settings['maximized_view'] != '' ) ? $settings['maximized_view'] : 'off';
836 $settings['maximized_view'] = isset( $settings['maximized_view'] ) && $settings['maximized_view'] == 'on' ? 'checked' : '';
837
838 // Multiple data selection
839 $settings['multiple_selection'] = ( isset( $settings['multiple_selection'] ) && $settings['multiple_selection'] != '' ) ? $settings['multiple_selection'] : 'off';
840 $settings['multiple_selection'] = isset( $settings['multiple_selection'] ) && $settings['multiple_selection'] == 'on' ? 'checked' : '';
841
842 // Point shape
843 $settings['point_shape'] = isset( $settings['point_shape'] ) && $settings['point_shape'] != '' ? esc_attr( $settings['point_shape'] ) : 'circle';
844 $settings['point_shape_options'] = $point_shape_options;
845
846 // Point size
847 $settings['point_size'] = isset( $settings['point_size'] ) && $settings['point_size'] != '' ? absint(esc_attr( $settings['point_size'] )) : '0';
848
849 // Crosshair trigger
850 $settings['crosshair_trigger'] = isset( $settings['crosshair_trigger'] ) && $settings['crosshair_trigger'] != '' ? esc_attr( $settings['crosshair_trigger'] ) : 'none';
851 $settings['crosshair_trigger_options'] = $crosshair_trigger_options;
852
853 // Crosshair orientation
854 $settings['crosshair_orientation'] = isset( $settings['crosshair_orientation'] ) && $settings['crosshair_orientation'] != '' ? esc_attr( $settings['crosshair_orientation'] ) : 'both';
855 $settings['crosshair_orientation_options'] = $crosshair_orientation_options;
856
857 // Crosshair opacity
858 $settings['crosshair_opacity'] = isset( $settings['crosshair_opacity'] ) && $settings['crosshair_opacity'] != '' ? esc_attr( $settings['crosshair_opacity'] ) : '1.0';
859
860 // Dash style
861 $settings['dash_style'] = isset( $settings['dash_style'] ) && $settings['dash_style'] != '' ? esc_attr( str_replace(' ', '', $settings['dash_style']) ) : '';
862
863 // Orientation
864 $settings['orientation'] = ( isset( $settings['orientation'] ) && $settings['orientation'] != '' ) ? $settings['orientation'] : 'off';
865 $settings['orientation'] = isset( $settings['orientation'] ) && $settings['orientation'] == 'on' ? 'checked' : '';
866
867 // Fill nulls
868 $settings['fill_nulls'] = ( isset( $settings['fill_nulls'] ) && $settings['fill_nulls'] != '' ) ? $settings['fill_nulls'] : 'off';
869 $settings['fill_nulls'] = isset( $settings['fill_nulls'] ) && $settings['fill_nulls'] == 'on' ? 'checked' : '';
870
871 // Font size for org chart
872 $settings['org_chart_font_size'] = isset( $settings['org_chart_font_size'] ) && $settings['org_chart_font_size'] != '' ? esc_attr( $settings['org_chart_font_size'] ) : 'medium';
873 $settings['org_chart_font_size_options'] = $org_chart_font_size_options;
874
875 // Donut hole size
876 $settings['donut_hole_size'] = isset( $settings['donut_hole_size'] ) && $settings['donut_hole_size'] != '' ? esc_attr( $settings['donut_hole_size'] ) : '0.4';
877
878 // Allow collapse
879 $settings['allow_collapse'] = ( isset( $settings['allow_collapse'] ) && $settings['allow_collapse'] != '' ) ? $settings['allow_collapse'] : 'off';
880 $settings['allow_collapse'] = isset( $settings['allow_collapse'] ) && $settings['allow_collapse'] == 'on' ? 'checked' : '';
881
882 // Org custom css class
883 $settings['org_classname'] = isset( $settings['org_classname'] ) && $settings['org_classname'] != '' ? esc_attr( $settings['org_classname'] ) : '';
884
885 $settings['org_node_background_color'] = isset( $settings['org_node_background_color'] ) && $settings['org_node_background_color'] != '' ? esc_attr( $settings['org_node_background_color'] ) : '#edf7ff';
886 $settings['org_node_padding'] = isset( $settings['org_node_padding'] ) && $settings['org_node_padding'] != '' ? esc_attr( $settings['org_node_padding'] ) : '2';
887 $settings['org_node_border_radius'] = isset( $settings['org_node_border_radius'] ) && $settings['org_node_border_radius'] != '' ? esc_attr( $settings['org_node_border_radius'] ) : '5';
888 $settings['org_node_border_width'] = isset( $settings['org_node_border_width'] ) && $settings['org_node_border_width'] != '' ? esc_attr( $settings['org_node_border_width'] ) : '0';
889 $settings['org_node_border_color'] = isset( $settings['org_node_border_color'] ) && $settings['org_node_border_color'] != '' ? esc_attr( $settings['org_node_border_color'] ) : '#b5d9ea';
890 $settings['org_node_text_color'] = isset( $settings['org_node_text_color'] ) && $settings['org_node_text_color'] != '' ? esc_attr( $settings['org_node_text_color'] ) : '#000000';
891 $settings['org_node_text_font_size'] = isset( $settings['org_node_text_font_size'] ) && $settings['org_node_text_font_size'] != '' ? esc_attr( $settings['org_node_text_font_size'] ) : '13';
892 $settings['org_node_description_font_color'] = isset( $settings['org_node_description_font_color'] ) && $settings['org_node_description_font_color'] != '' ? esc_attr( $settings['org_node_description_font_color'] ) : '#ff0000';
893 $settings['org_node_description_font_size'] = isset( $settings['org_node_description_font_size'] ) && $settings['org_node_description_font_size'] != '' ? esc_attr( $settings['org_node_description_font_size'] ) : '13';
894
895 // Org custom selected css class
896 $settings['org_selected_classname'] = isset( $settings['org_selected_classname'] ) && $settings['org_selected_classname'] != '' ? esc_attr( $settings['org_selected_classname'] ) : '';
897
898 $settings['org_selected_node_background_color'] = isset( $settings['org_selected_node_background_color'] ) && $settings['org_selected_node_background_color'] != '' ? esc_attr( $settings['org_selected_node_background_color'] ) : '#fff7ae';
899 $settings['org_selected_node_text_color'] = isset( $settings['org_selected_node_text_color'] ) && $settings['org_selected_node_text_color'] != '' ? esc_attr( $settings['org_selected_node_text_color'] ) : $settings['org_node_text_color'];
900
901
902 $settings['axes_text_positions'] = $axes_text_positions;
903 $settings['axes_format_options'] = $axes_format_options;
904 // Horizontal axis settings
905 $settings['haxis_title'] = isset( $settings['haxis_title'] ) && $settings['haxis_title'] != '' ? esc_attr( $settings['haxis_title'] ) : '';
906 $settings['haxis_label_font_size'] = isset( $settings['haxis_label_font_size'] ) && $settings['haxis_label_font_size'] != '' ? esc_attr( $settings['haxis_label_font_size'] ) : $settings['font_size'];
907 $settings['haxis_label_color'] = isset( $settings['haxis_label_color'] ) && $settings['haxis_label_color'] != '' ? esc_attr( $settings['haxis_label_color'] ) : '#000000';
908 $settings['haxis_text_position'] = isset( $settings['haxis_text_position'] ) && $settings['haxis_text_position'] != '' ? esc_attr( $settings['haxis_text_position'] ) : 'out';
909 $settings['haxis_direction'] = ( isset( $settings['haxis_direction'] ) && $settings['haxis_direction'] != '' ) ? $settings['haxis_direction'] : '1';
910 $settings['haxis_direction'] = isset( $settings['haxis_direction'] ) && $settings['haxis_direction'] == '-1' ? 'checked' : '';
911 $settings['haxis_text_color'] = isset( $settings['haxis_text_color'] ) && $settings['haxis_text_color'] != '' ? esc_attr( $settings['haxis_text_color'] ) : '#000000';
912 $settings['haxis_baseline_color'] = isset( $settings['haxis_baseline_color'] ) && $settings['haxis_baseline_color'] != '' ? esc_attr( $settings['haxis_baseline_color'] ) : '#000000';
913 $settings['haxis_text_font_size'] = isset( $settings['haxis_text_font_size'] ) && $settings['haxis_text_font_size'] != '' ? absint(esc_attr( $settings['haxis_text_font_size'] )) : $settings['font_size'];
914 $settings['haxis_slanted_options'] = $haxis_slanted_options;
915 $settings['haxis_slanted'] = isset( $settings['haxis_slanted'] ) && $settings['haxis_slanted'] != '' ? esc_attr( $settings['haxis_slanted'] ) : 'automatic';
916 $settings['haxis_slanted_text_angle'] = isset( $settings['haxis_slanted_text_angle'] ) && $settings['haxis_slanted_text_angle'] != '' && $settings['haxis_slanted_text_angle'] != '0' ? esc_attr( $settings['haxis_slanted_text_angle'] ) : '30';
917 $settings['haxis_show_text_every'] = isset( $settings['haxis_show_text_every'] ) && $settings['haxis_show_text_every'] != '' ? esc_attr( $settings['haxis_show_text_every'] ) : '0';
918 $settings['haxis_format'] = isset( $settings['haxis_format'] ) && $settings['haxis_format'] != '' ? esc_attr( $settings['haxis_format'] ) : '';
919 $settings['haxis_enable_divide_percent'] = ( isset( $settings['haxis_enable_divide_percent'] ) && $settings['haxis_enable_divide_percent'] != '' ) ? $settings['haxis_enable_divide_percent'] : 'off';
920 $settings['haxis_enable_divide_percent'] = isset( $settings['haxis_enable_divide_percent'] ) && $settings['haxis_enable_divide_percent'] == 'on' ? 'checked' : '';
921 $settings['haxis_max_value'] = isset( $settings['haxis_max_value'] ) && $settings['haxis_max_value'] != '' ? esc_attr( $settings['haxis_max_value'] ) : null;
922 $settings['haxis_min_value'] = isset( $settings['haxis_min_value'] ) && $settings['haxis_min_value'] != '' ? esc_attr( $settings['haxis_min_value'] ) : null;
923 $settings['haxis_gridlines_count'] = isset( $settings['haxis_gridlines_count'] ) && $settings['haxis_gridlines_count'] != '' ? esc_attr( $settings['haxis_gridlines_count'] ) : -1;$settings['haxis_italic'] = ( isset( $settings['haxis_italic'] ) && $settings['haxis_italic'] != '' ) ? $settings['haxis_italic'] : 'off';
924 $settings['haxis_italic'] = isset( $settings['haxis_italic'] ) && $settings['haxis_italic'] == 'on' ? 'checked' : '';
925 $settings['haxis_bold'] = ( isset( $settings['haxis_bold'] ) && $settings['haxis_bold'] != '' ) ? $settings['haxis_bold'] : 'off';
926 $settings['haxis_bold'] = isset( $settings['haxis_bold'] ) && $settings['haxis_bold'] == 'on' ? 'checked' : '';
927 $settings['haxis_title_italic'] = ( isset( $settings['haxis_title_italic'] ) && $settings['haxis_title_italic'] != '' ) ? $settings['haxis_title_italic'] : 'off';
928 $settings['haxis_title_italic'] = isset( $settings['haxis_title_italic'] ) && $settings['haxis_title_italic'] == 'on' ? 'checked' : '';
929 $settings['haxis_title_bold'] = ( isset( $settings['haxis_title_bold'] ) && $settings['haxis_title_bold'] != '' ) ? $settings['haxis_title_bold'] : 'off';
930 $settings['haxis_title_bold'] = isset( $settings['haxis_title_bold'] ) && $settings['haxis_title_bold'] == 'on' ? 'checked' : '';
931 $settings['haxis_gridlines_color'] = isset( $settings['haxis_gridlines_color'] ) && $settings['haxis_gridlines_color'] != '' ? esc_attr( $settings['haxis_gridlines_color'] ) : '#cccccc';
932 $settings['haxis_minor_gridlines_color'] = isset( $settings['haxis_minor_gridlines_color'] ) && $settings['haxis_minor_gridlines_color'] != '' ? esc_attr( $settings['haxis_minor_gridlines_color'] ) : $settings['haxis_gridlines_color'];
933
934 // Vertical axis settings
935 $settings['vaxis_title'] = isset( $settings['vaxis_title'] ) && $settings['vaxis_title'] != '' ? esc_attr( $settings['vaxis_title'] ) : '';
936 $settings['vaxis_label_font_size'] = isset( $settings['vaxis_label_font_size'] ) && $settings['vaxis_label_font_size'] != '' ? esc_attr( $settings['vaxis_label_font_size'] ) : $settings['font_size'];
937 $settings['vaxis_label_color'] = isset( $settings['vaxis_label_color'] ) && $settings['vaxis_label_color'] != '' ? esc_attr( $settings['vaxis_label_color'] ) : '#000000';
938 $settings['vaxis_text_position'] = isset( $settings['vaxis_text_position'] ) && $settings['vaxis_text_position'] != '' ? esc_attr( $settings['vaxis_text_position'] ) : 'out';
939 $settings['vaxis_direction'] = ( isset( $settings['vaxis_direction'] ) && $settings['vaxis_direction'] != '' ) ? $settings['vaxis_direction'] : '1';
940 $settings['vaxis_direction'] = isset( $settings['vaxis_direction'] ) && $settings['vaxis_direction'] == '-1' ? 'checked' : '';
941 $settings['vaxis_text_color'] = isset( $settings['vaxis_text_color'] ) && $settings['vaxis_text_color'] != '' ? esc_attr( $settings['vaxis_text_color'] ) : '#000000';
942 $settings['vaxis_baseline_color'] = isset( $settings['vaxis_baseline_color'] ) && $settings['vaxis_baseline_color'] != '' ? esc_attr( $settings['vaxis_baseline_color'] ) : '#000000';
943 $settings['vaxis_text_font_size'] = isset( $settings['vaxis_text_font_size'] ) && $settings['vaxis_text_font_size'] != '' ? absint(esc_attr( $settings['vaxis_text_font_size'] )) : $settings['font_size'];
944 $settings['vaxis_format'] = isset( $settings['vaxis_format'] ) && $settings['vaxis_format'] != '' ? esc_attr( $settings['vaxis_format'] ) : '';
945 $settings['vaxis_enable_divide_percent'] = ( isset( $settings['vaxis_enable_divide_percent'] ) && $settings['vaxis_enable_divide_percent'] != '' ) ? $settings['vaxis_enable_divide_percent'] : 'off';
946 $settings['vaxis_enable_divide_percent'] = isset( $settings['vaxis_enable_divide_percent'] ) && $settings['vaxis_enable_divide_percent'] == 'on' ? 'checked' : '';
947 $settings['vaxis_max_value'] = isset( $settings['vaxis_max_value'] ) && $settings['vaxis_max_value'] != '' ? esc_attr( $settings['vaxis_max_value'] ) : null;
948 $settings['vaxis_min_value'] = isset( $settings['vaxis_min_value'] ) && $settings['vaxis_min_value'] != '' ? esc_attr( $settings['vaxis_min_value'] ) : null;
949 $settings['vaxis_gridlines_count'] = isset( $settings['vaxis_gridlines_count'] ) && $settings['vaxis_gridlines_count'] != '' ? esc_attr( $settings['vaxis_gridlines_count'] ) : -1;
950 $settings['vaxis_italic'] = ( isset( $settings['vaxis_italic'] ) && $settings['vaxis_italic'] != '' ) ? $settings['vaxis_italic'] : 'off';
951 $settings['vaxis_italic'] = isset( $settings['vaxis_italic'] ) && $settings['vaxis_italic'] == 'on' ? 'checked' : '';
952 $settings['vaxis_bold'] = ( isset( $settings['vaxis_bold'] ) && $settings['vaxis_bold'] != '' ) ? $settings['vaxis_bold'] : 'off';
953 $settings['vaxis_bold'] = isset( $settings['vaxis_bold'] ) && $settings['vaxis_bold'] == 'on' ? 'checked' : '';
954 $settings['vaxis_title_italic'] = ( isset( $settings['vaxis_title_italic'] ) && $settings['vaxis_title_italic'] != '' ) ? $settings['vaxis_title_italic'] : 'off';
955 $settings['vaxis_title_italic'] = isset( $settings['vaxis_title_italic'] ) && $settings['vaxis_title_italic'] == 'on' ? 'checked' : '';
956 $settings['vaxis_title_bold'] = ( isset( $settings['vaxis_title_bold'] ) && $settings['vaxis_title_bold'] != '' ) ? $settings['vaxis_title_bold'] : 'off';
957 $settings['vaxis_title_bold'] = isset( $settings['vaxis_title_bold'] ) && $settings['vaxis_title_bold'] == 'on' ? 'checked' : '';
958 $settings['vaxis_gridlines_color'] = isset( $settings['vaxis_gridlines_color'] ) && $settings['vaxis_gridlines_color'] != '' ? esc_attr( $settings['vaxis_gridlines_color'] ) : '#cccccc';
959 $settings['vaxis_minor_gridlines_color'] = isset( $settings['vaxis_minor_gridlines_color'] ) && $settings['vaxis_minor_gridlines_color'] != '' ? esc_attr( $settings['vaxis_minor_gridlines_color'] ) : $settings['vaxis_gridlines_color'];
960
961 // Animation settings
962 $settings['enable_animation'] = ( isset( $settings['enable_animation'] ) && $settings['enable_animation'] != '' ) ? $settings['enable_animation'] : 'off';
963 $settings['enable_animation'] = isset( $settings['enable_animation'] ) && $settings['enable_animation'] == 'on' ? 'checked' : '';
964 $settings['animation_duration'] = isset( $settings['animation_duration'] ) && $settings['animation_duration'] != '' ? absint(esc_attr( $settings['animation_duration'] )) : '1000';
965 $settings['animation_startup'] = ( isset( $settings['animation_startup'] ) && $settings['animation_startup'] != '' ) ? $settings['animation_startup'] : 'on';
966 $settings['animation_startup'] = isset( $settings['animation_startup'] ) && $settings['animation_startup'] == 'on' ? 'checked' : '';
967 $settings['animation_easing_options'] = $animation_easing_options;
968 $settings['animation_easing'] = isset( $settings['animation_easing'] ) && $settings['animation_easing'] != '' ? esc_attr( $settings['animation_easing'] ) : 'linear';
969
970 $settings['enable_img'] = ( isset( $settings['enable_img'] ) && $settings['enable_img'] != '' ) ? $settings['enable_img'] : 'off';
971 $settings['enable_img'] = isset( $settings['enable_img'] ) && $settings['enable_img'] == 'on' ? 'checked' : '';
972
973 $counting_source = $source;
974
975 $count_slices = (isset($counting_source) && !is_null($counting_source) && count($counting_source) > 0) ? count($counting_source) - 1 : 0;
976 $count_series = (isset($counting_source[0]) && !is_null($counting_source[0]) && count($counting_source[0]) > 0) ? count($counting_source[0]) - 1 : 0;
977 $count_rows = (isset($counting_source) && !is_null($counting_source) && count($counting_source) > 0) ? count(array_column($counting_source, 0)) - 1 : 0;
978
979 // Slices settings
980 $settings['slice_colors_default'] = $chart_default_colors;
981 $settings['slice_color'] = isset( $settings['slice_color'] ) && $settings['slice_color'] != '' ? json_decode($settings['slice_color'], true) : array_slice($chart_default_colors, 0, $count_slices);;
982 $settings['slice_offset'] = isset( $settings['slice_offset'] ) && $settings['slice_offset'] != '' ? json_decode($settings['slice_offset'], true) : array_fill(0, $count_slices, 0);
983 $settings['slice_text_color'] = isset( $settings['slice_text_color'] ) && $settings['slice_text_color'] != '' ? json_decode($settings['slice_text_color'], true) : array_fill(0, $count_slices, '#ffffff');
984
985 // Series settings
986 $settings['series_colors_default'] = $chart_default_colors;
987 $settings['series_color'] = isset( $settings['series_color'] ) && $settings['series_color'] != '' ? json_decode($settings['series_color'], true) : array_slice($chart_default_colors, 0, $count_series);;
988 $settings['series_visible_in_legend'] = isset( $settings['series_visible_in_legend'] ) && $settings['series_visible_in_legend'] != '' ? json_decode($settings['series_visible_in_legend'], true) : array_fill(0, $count_series, 'on');
989 $settings['series_line_width'] = isset( $settings['series_line_width'] ) && $settings['series_line_width'] != '' ? json_decode($settings['series_line_width'], true) : array_fill(0, $count_series, $settings['line_width']);
990 $settings['series_point_size'] = isset( $settings['series_point_size'] ) && $settings['series_point_size'] != '' ? json_decode($settings['series_point_size'], true) : array_fill(0, $count_series, $settings['point_size']);
991 $settings['series_point_shape'] = isset( $settings['series_point_shape'] ) && $settings['series_point_shape'] != '' ? json_decode($settings['series_point_shape'], true) : array_fill(0, $count_series, $settings['point_shape']);
992 $settings['series_format'] = isset( $settings['series_format'] ) && $settings['series_format'] != '' ? json_decode($settings['series_format'], true) : array_fill(0, $count_series, '');
993
994 // Rows settings
995 $settings['enable_row_settings'] = ( isset( $settings['enable_row_settings'] ) && $settings['enable_row_settings'] != '' ) ? $settings['enable_row_settings'] : 'on';
996 $settings['enable_row_settings'] = isset( $settings['enable_row_settings'] ) && $settings['enable_row_settings'] == 'on' ? 'checked' : '';
997
998 $settings['rows_color'] = isset( $settings['rows_color'] ) && $settings['rows_color'] != '' ? json_decode($settings['rows_color'], true) : array_fill(0, $count_rows, '');
999 $settings['rows_opacity'] = isset( $settings['rows_opacity'] ) && $settings['rows_opacity'] != '' ? json_decode($settings['rows_opacity'], true) : array_fill(0, $count_rows, 1.0);
1000
1001 return $settings;
1002
1003 }
1004
1005 /**
1006 * Gets all settings of google charts for public area.
1007 *
1008 * @access public
1009 * @return array
1010 */
1011 public function get_chart_settings_google_public ($settings, $chartData) {
1012 $chart_default_colors = array('#3366cc','#dc3912','#ff9900','#109618', '#990099','#0099c6','#dd4477','#66aa00', '#b82e2e','#316395','#994499','#22aa99', '#aaaa11','#6633cc','#e67300','#8b0707', '#651067','#329262','#5574a6','#3b3eac', '#b77322','#16d620','#b91383','#f4359e', '#9c5935','#a9c413','#2a778d','#668d1c', '#bea413','#0c5922','#743411');
1013
1014 $position_styles = array(
1015 "left" => 'margin-left:0',
1016 "right" => 'margin-right:0',
1017 "center" => 'margin:auto',
1018 );
1019
1020 // Width
1021 $settings['width'] = isset( $settings['width'] ) && $settings['width'] != '' ? esc_attr( $settings['width'] ) : '100';
1022 $settings['width_format'] = isset( $settings['width_format'] ) && $settings['width_format'] != '' ? esc_attr( $settings['width_format'] ) : '%';
1023 $settings['responsive_width'] = ( isset( $settings['responsive_width'] ) && $settings['responsive_width'] != '' ) ? $settings['responsive_width'] : 'off';
1024 $settings['chart_width'] = isset($settings['responsive_width']) && $settings['responsive_width'] == 'on' ? '100%' : $settings['width'].$settings['width_format'];
1025
1026 // position
1027 $settings['position'] = isset( $settings['position'] ) && $settings['position'] != '' ? esc_attr( $settings['position'] ) : 'center';
1028 $settings['position'] = isset($position_styles[$settings['position']]) && $position_styles[$settings['position']] != '' ? $position_styles[$settings['position']] : 'margin:auto';
1029
1030 // height
1031 $settings['height'] = isset( $settings['height'] ) && $settings['height'] != '' ? esc_attr( $settings['height'] ) : '400';
1032 $settings['height_format'] = isset( $settings['height_format'] ) && $settings['height_format'] != '' ? esc_attr( $settings['height_format'] ) : 'px';
1033 $settings['chart_height'] = $settings['height'].$settings['height_format'];
1034
1035 // Font size
1036 $settings['font_size'] = isset( $settings['font_size'] ) && $settings['font_size'] != '' ? esc_attr( $settings['font_size'] ) : '15';
1037
1038 // Background color
1039 $settings['background_color'] = isset( $settings['background_color'] ) && $settings['background_color'] != '' ? esc_attr( $settings['background_color'] ) : '#ffffff';
1040
1041 // Transparent background
1042 $settings['transparent_background'] = isset( $settings['transparent_background'] ) && $settings['transparent_background'] != '' ? esc_attr( $settings['transparent_background'] ) : 'off';
1043
1044 // Box shadow
1045 $settings['box_shadow'] = isset( $settings['box_shadow'] ) && $settings['box_shadow'] != '' ? esc_attr( $settings['box_shadow'] ) : 'off';
1046 $settings['box_shadow'] = isset( $settings['box_shadow'] ) && $settings['box_shadow'] == 'on' ? 'checked' : '';
1047
1048 // Border width
1049 $settings['border_width'] = isset( $settings['border_width'] ) && $settings['border_width'] != '' ? esc_attr( $settings['border_width'] ) : '0';
1050
1051 // Border radius
1052 $settings['border_radius'] = isset( $settings['border_radius'] ) && $settings['border_radius'] != '' ? esc_attr( $settings['border_radius'] ) : '0';
1053
1054 // Border color
1055 $settings['border_color'] = isset( $settings['border_color'] ) && $settings['border_color'] != '' ? esc_attr( $settings['border_color'] ) : '#666666';
1056
1057 // Border style
1058 $settings['border_style'] = isset( $settings['border_style'] ) && $settings['border_style'] != '' ? esc_attr( $settings['border_style'] ) : 'solid';
1059
1060 // Border width with title
1061 $settings['border_width_with_title'] = isset( $settings['border_width_with_title'] ) && $settings['border_width_with_title'] != '' ? esc_attr( $settings['border_width_with_title'] ) : '0';
1062
1063 // Border radius with title
1064 $settings['border_radius_with_title'] = isset( $settings['border_radius_with_title'] ) && $settings['border_radius_with_title'] != '' ? esc_attr( $settings['border_radius_with_title'] ) : '0';
1065
1066 // Border color with title
1067 $settings['border_color_with_title'] = isset( $settings['border_color_with_title'] ) && $settings['border_color_with_title'] != '' ? esc_attr( $settings['border_color_with_title'] ) : '#000000';
1068
1069 // Border style with title
1070 $settings['border_style_with_title'] = isset( $settings['border_style_with_title'] ) && $settings['border_style_with_title'] != '' ? esc_attr( $settings['border_style_with_title'] ) : 'solid';
1071
1072 // Padding outer
1073 $settings['padding_outer'] = isset( $settings['padding_outer'] ) && $settings['padding_outer'] != '' ? esc_attr( $settings['padding_outer'] ) : '0';
1074
1075 // Box shadow color
1076 $settings['box_shadow_color'] = isset( $settings['box_shadow_color'] ) && $settings['box_shadow_color'] != '' ? esc_attr( $settings['box_shadow_color'] ) : $settings['border_color'];
1077
1078 // Chart Area background color
1079 $settings['chart_background_color'] = isset( $settings['chart_background_color'] ) && $settings['chart_background_color'] != '' ? esc_attr( $settings['chart_background_color'] ) : '#ffffff';
1080
1081 // Chart Area border width
1082 $settings['chart_border_width'] = isset( $settings['chart_border_width'] ) && $settings['chart_border_width'] != '' ? esc_attr( $settings['chart_border_width'] ) : '0';
1083
1084 // Chart Area border color
1085 $settings['chart_border_color'] = isset( $settings['chart_border_color'] ) && $settings['chart_border_color'] != '' ? esc_attr( $settings['chart_border_color'] ) : '#666666';
1086
1087 // Chart Area left margin
1088 $settings['chart_left_margin_for_js'] = isset( $settings['chart_left_margin'] ) && $settings['chart_left_margin'] != '' ? esc_attr( $settings['chart_left_margin'] ) : 'auto';
1089
1090 // Chart Area right margin
1091 $settings['chart_right_margin_for_js'] = isset( $settings['chart_right_margin'] ) && $settings['chart_right_margin'] != '' ? esc_attr( $settings['chart_right_margin'] ) : 'auto';
1092
1093 // Chart Area top margin
1094 $settings['chart_top_margin_for_js'] = isset( $settings['chart_top_margin'] ) && $settings['chart_top_margin'] != '' ? esc_attr( $settings['chart_top_margin'] ) : 'auto';
1095
1096 // Chart Area bottom margin
1097 $settings['chart_bottom_margin_for_js'] = isset( $settings['chart_bottom_margin'] ) && $settings['chart_bottom_margin'] != '' ? esc_attr( $settings['chart_bottom_margin'] ) : 'auto';
1098
1099 // Title color
1100 $settings['title_color'] = isset( $settings['title_color'] ) && $settings['title_color'] != '' ? esc_attr( $settings['title_color'] ) : '#000000';
1101
1102 // Title color
1103 $settings['title_shadow_color'] = isset( $settings['title_shadow_color'] ) && $settings['title_shadow_color'] != '' ? esc_attr( $settings['title_shadow_color'] ) : $settings['title_color'];
1104
1105 // Title font size
1106 $settings['title_font_size'] = isset( $settings['title_font_size'] ) && $settings['title_font_size'] != '' ? esc_attr( $settings['title_font_size'] ) : '30';
1107
1108 // title bold
1109 $settings['title_bold'] = ( isset( $settings['title_bold'] ) && $settings['title_bold'] != '' ) ? esc_attr($settings['title_bold']) : 'on';
1110 $settings['title_bold'] = isset( $settings['title_bold'] ) && $settings['title_bold'] != 'off'? 'bold' : 'normal';
1111
1112 // Title text shadow
1113 $settings['title_text_shadow'] = ( isset( $settings['title_text_shadow'] ) && $settings['title_text_shadow'] != '' ) ? esc_attr($settings['title_text_shadow']) : 'off';
1114 $settings['title_text_shadow'] = isset( $settings['title_text_shadow'] ) && $settings['title_text_shadow'] == 'on' ? 'checked' : '';
1115
1116 // title italic
1117 $settings['title_italic'] = ( isset( $settings['title_italic'] ) && $settings['title_italic'] != '' ) ? esc_attr($settings['title_italic']) : 'off';
1118 $settings['title_italic'] = isset( $settings['title_italic'] ) && $settings['title_italic'] != 'on'? 'normal' : 'italic';
1119
1120 // title gap
1121 $settings['title_gap'] = (isset( $settings['title_gap'] ) && $settings['title_gap'] != '') ? esc_attr( $settings['title_gap'] ) : '5';
1122
1123 // title gap
1124 $settings['title_gap_description'] = (isset( $settings['title_gap_description'] ) && $settings['title_gap_description'] != '') ? esc_attr( $settings['title_gap_description'] ) : '5';
1125
1126 // title letter spacing
1127 $settings['title_letter_spacing'] = (isset( $settings['title_letter_spacing'] ) && $settings['title_letter_spacing'] != '') ? esc_attr( $settings['title_letter_spacing'] ) : 0;
1128
1129 // title position
1130 $settings['title_position'] = isset( $settings['title_position'] ) && $settings['title_position'] != '' ? esc_attr( $settings['title_position'] ) : 'left';
1131
1132 // title text transform
1133 $settings['title_text_transform'] = isset( $settings['title_text_transform'] ) && $settings['title_text_transform'] != '' ? esc_attr( $settings['title_text_transform'] ) : 'none';
1134
1135 // title text decoration
1136 $settings['title_text_decoration'] = isset( $settings['title_text_decoration'] ) && $settings['title_text_decoration'] != '' ? esc_attr( $settings['title_text_decoration'] ) : 'none';
1137
1138 // description color
1139 $settings['description_color'] = isset( $settings['description_color'] ) && $settings['description_color'] != '' ? esc_attr( $settings['description_color'] ) : '#4c4c4c';
1140
1141 // description font size
1142 $settings['description_font_size'] = (isset( $settings['description_font_size'] ) && $settings['description_font_size'] != '') ? esc_attr( $settings['description_font_size'] ) : '16';
1143
1144 // description Bold text
1145 $settings['description_bold'] = ( isset( $settings['description_bold'] ) && $settings['description_bold'] != '' ) ? esc_attr($settings['description_bold']) : 'off';
1146 $settings['description_bold'] = isset( $settings['description_bold'] ) && $settings['description_bold'] != 'on'? 'normal' : 'bold';
1147
1148 // description text shadow
1149 $settings['description_text_shadow'] = ( isset( $settings['description_text_shadow'] ) && $settings['description_text_shadow'] != '' ) ? esc_attr($settings['description_text_shadow']) : 'off';
1150 $settings['description_text_shadow'] = isset( $settings['description_text_shadow'] ) && $settings['description_text_shadow'] == 'on' ? 'checked' : '';
1151
1152 // description color
1153 $settings['description_shadow_color'] = isset( $settings['description_shadow_color'] ) && $settings['description_shadow_color'] != '' ? esc_attr( $settings['description_shadow_color'] ) : $settings['description_color'];
1154
1155 // desctiption italic text
1156 $settings['description_italic'] = ( isset( $settings['description_italic'] ) && $settings['description_italic'] != '' ) ? esc_attr($settings['description_italic']) : 'off';
1157 $settings['description_italic'] = isset( $settings['description_italic'] ) && $settings['description_italic'] != 'on'? 'normal' : 'italic';
1158
1159 // description position
1160 $settings['description_position'] = isset( $settings['description_position'] ) && $settings['description_position'] != '' ? esc_attr( $settings['description_position'] ) : 'left';
1161
1162 // description text transform
1163 $settings['description_text_transform'] = isset( $settings['description_text_transform'] ) && $settings['description_text_transform'] != '' ? esc_attr( $settings['description_text_transform'] ) : 'none';
1164
1165 // description letter spacing
1166 $settings['description_letter_spacing'] = isset( $settings['description_letter_spacing'] ) && $settings['description_letter_spacing'] != '' ? esc_attr( $settings['description_letter_spacing'] ) : 0;
1167
1168 // description text decoration
1169 $settings['description_text_decoration'] = isset( $settings['description_text_decoration'] ) && $settings['description_text_decoration'] != '' ? esc_attr( $settings['description_text_decoration'] ) : 'none';
1170
1171 // Rotation degree
1172 $settings['rotation_degree'] = isset( $settings['rotation_degree'] ) && $settings['rotation_degree'] != '' ? esc_attr( $settings['rotation_degree'] ) : '0';
1173
1174 // Is stacked
1175 $settings['is_stacked'] = ( isset( $settings['is_stacked'] ) && $settings['is_stacked'] != '' ) ? $settings['is_stacked'] : 'off';
1176
1177 // Line width
1178 $settings['line_width'] = isset( $settings['line_width'] ) && $settings['line_width'] != '' ? esc_attr( $settings['line_width'] ) : '2';
1179
1180 // Slice border color
1181 $settings['slice_border_color'] = isset( $settings['slice_border_color'] ) && $settings['slice_border_color'] != '' ? esc_attr( $settings['slice_border_color'] ) : '#ffffff';
1182
1183 // Reverse categories
1184 $settings['reverse_categories'] = ( isset( $settings['reverse_categories'] ) && $settings['reverse_categories'] != '' ) ? $settings['reverse_categories'] : 'off';
1185
1186 // Slice text
1187 $settings['slice_text'] = isset( $settings['slice_text'] ) && $settings['slice_text'] != '' ? esc_attr( $settings['slice_text'] ) : 'percentage';
1188
1189 // Tooltip trigger
1190 $settings['tooltip_trigger'] = isset( $settings['tooltip_trigger'] ) && $settings['tooltip_trigger'] != '' ? esc_attr( $settings['tooltip_trigger'] ) : 'hover';
1191
1192 // Tooltip text
1193 $settings['tooltip_text'] = isset( $settings['tooltip_text'] ) && $settings['tooltip_text'] != '' ? esc_attr( $settings['tooltip_text'] ) : 'both';
1194
1195 // Multiple data format
1196 $settings['multiple_data_format'] = isset( $settings['multiple_data_format'] ) && $settings['multiple_data_format'] != '' ? esc_attr( $settings['multiple_data_format'] ) : 'auto';
1197
1198 // Data grouping settings
1199 $settings['data_grouping_limit'] = isset( $settings['data_grouping_limit'] ) && $settings['data_grouping_limit'] != '' ? esc_attr( $settings['data_grouping_limit'] ) : '0.5';
1200 $settings['data_grouping_label'] = isset( $settings['data_grouping_label'] ) && $settings['data_grouping_label'] != '' ? esc_attr( $settings['data_grouping_label'] ) : 'Other';
1201 $settings['data_grouping_color'] = isset( $settings['data_grouping_color'] ) && $settings['data_grouping_color'] != '' ? esc_attr( $settings['data_grouping_color'] ) : '#ccc';
1202
1203 // Focus target
1204 $settings['focus_target'] = isset( $settings['focus_target'] ) && $settings['focus_target'] != '' ? esc_attr( $settings['focus_target'] ) : 'datum';
1205
1206 // Show color code
1207 $settings['show_color_code'] = ( isset( $settings['show_color_code'] ) && $settings['show_color_code'] != '' ) ? $settings['show_color_code'] : 'off';
1208
1209 // Italic text
1210 $settings['tooltip_italic'] = ( isset( $settings['tooltip_italic'] ) && $settings['tooltip_italic'] != '' ) ? $settings['tooltip_italic'] : 'off';
1211
1212 // Bold text
1213 $settings['tooltip_bold'] = isset( $settings['tooltip_bold'] ) && $settings['tooltip_bold'] != '' ? esc_attr( $settings['tooltip_bold'] ) : 'default';
1214
1215 // Tooltip text color
1216 $settings['tooltip_text_color'] = isset( $settings['tooltip_text_color'] ) && $settings['tooltip_text_color'] != '' ? esc_attr( $settings['tooltip_text_color'] ) : '#000000';
1217
1218 // Tooltip font size
1219 $settings['tooltip_font_size'] = isset( $settings['tooltip_font_size'] ) && intval($settings['tooltip_font_size']) > 0 ? esc_attr( $settings['tooltip_font_size'] ) : $settings['font_size'];
1220
1221 // Legend position
1222 $settings['legend_position'] = isset( $settings['legend_position'] ) && $settings['legend_position'] != '' ? esc_attr( $settings['legend_position'] ) : 'right';
1223
1224 // Legend alignment
1225 $settings['legend_alignment'] = isset( $settings['legend_alignment'] ) && $settings['legend_alignment'] != '' ? esc_attr( $settings['legend_alignment'] ) : 'start';
1226
1227 // Legend font color
1228 $settings['legend_color'] = isset( $settings['legend_color'] ) && $settings['legend_color'] != '' ? esc_attr( $settings['legend_color'] ) : '#000000';
1229
1230 // Legend font size
1231 $settings['legend_font_size'] = isset( $settings['legend_font_size'] ) && intval($settings['legend_font_size']) > 0 ? esc_attr( $settings['legend_font_size'] ) : $settings['font_size'];
1232
1233 // Legend Italic text
1234 $settings['legend_italic'] = ( isset( $settings['legend_italic'] ) && $settings['legend_italic'] != '' ) ? $settings['legend_italic'] : 'off';
1235
1236 // Legend Bold text
1237 $settings['legend_bold'] = ( isset( $settings['legend_bold'] ) && $settings['legend_bold'] != '' ) ? $settings['legend_bold'] : 'off';
1238
1239 // Opacity
1240 $settings['opacity'] = isset( $settings['opacity'] ) && $settings['opacity'] != '' ? esc_attr( $settings['opacity'] ) : '1.0';
1241
1242 // Group width
1243 $settings['group_width'] = isset( $settings['group_width'] ) && $settings['group_width'] != '' ? esc_attr( $settings['group_width'] ) : '61.8';
1244 $settings['group_width_format'] = isset( $settings['group_width_format'] ) && $settings['group_width_format'] != '' ? esc_attr( $settings['group_width_format'] ) : '%';
1245
1246 // Show chart description
1247 $settings['show_description'] = isset( $settings['show_description'] ) && $settings['show_description'] != '' ? esc_attr( $settings['show_description'] ) : 'on';
1248
1249 // Show chart title
1250 $settings['show_title'] = isset( $settings['show_title'] ) && $settings['show_title'] != '' ? esc_attr( $settings['show_title'] ) : 'on';
1251
1252 // Enable interactivity
1253 $settings['enable_interactivity'] = isset( $settings['enable_interactivity'] ) && $settings['enable_interactivity'] != '' ? esc_attr( $settings['enable_interactivity'] ) : 'on';
1254
1255 // Maximized view
1256 $settings['maximized_view'] = ( isset( $settings['maximized_view'] ) && $settings['maximized_view'] != '' ) ? $settings['maximized_view'] : 'off';
1257
1258 // Multiple data selection
1259 $settings['multiple_selection'] = ( isset( $settings['multiple_selection'] ) && $settings['multiple_selection'] != '' ) ? $settings['multiple_selection'] : 'off';
1260
1261 // Point shape
1262 $settings['point_shape'] = isset( $settings['point_shape'] ) && $settings['point_shape'] != '' ? esc_attr( $settings['point_shape'] ) : 'circle';
1263
1264 // Point size
1265 $settings['point_size'] = isset( $settings['point_size'] ) && $settings['point_size'] != '' ? absint(esc_attr( $settings['point_size'] )) : '0';
1266
1267 // Crosshair trigger
1268 $settings['crosshair_trigger'] = isset( $settings['crosshair_trigger'] ) && $settings['crosshair_trigger'] != '' ? esc_attr( $settings['crosshair_trigger'] ) : 'none';
1269
1270 // Crosshair orientation
1271 $settings['crosshair_orientation'] = isset( $settings['crosshair_orientation'] ) && $settings['crosshair_orientation'] != '' ? esc_attr( $settings['crosshair_orientation'] ) : 'both';
1272
1273 // Crosshair opacity
1274 $settings['crosshair_opacity'] = isset( $settings['crosshair_opacity'] ) && $settings['crosshair_opacity'] != '' ? esc_attr( $settings['crosshair_opacity'] ) : '1.0';
1275
1276 // Dash style
1277 $settings['dash_style'] = isset( $settings['dash_style'] ) && $settings['dash_style'] != '' ? esc_attr( str_replace(' ', '', $settings['dash_style']) ) : '';
1278
1279 // Orientation
1280 $settings['orientation'] = ( isset( $settings['orientation'] ) && $settings['orientation'] != '' ) ? $settings['orientation'] : 'off';
1281
1282 // Fill nulls
1283 $settings['fill_nulls'] = ( isset( $settings['fill_nulls'] ) && $settings['fill_nulls'] != '' ) ? $settings['fill_nulls'] : 'off';
1284
1285 // Font size for org chart
1286 $settings['org_chart_font_size'] = isset( $settings['org_chart_font_size'] ) && $settings['org_chart_font_size'] != '' ? esc_attr( $settings['org_chart_font_size'] ) : 'medium';
1287
1288 // Allow collapse
1289 $settings['allow_collapse'] = ( isset( $settings['allow_collapse'] ) && $settings['allow_collapse'] != '' ) ? $settings['allow_collapse'] : 'off';
1290
1291 // Donut hole size
1292 $settings['donut_hole_size'] = isset( $settings['donut_hole_size'] ) && $settings['donut_hole_size'] != '' ? esc_attr( $settings['donut_hole_size'] ) : '0.4';
1293
1294 // Org custom css class
1295 $settings['org_classname'] = isset( $settings['org_classname'] ) && $settings['org_classname'] != '' ? esc_attr( $settings['org_classname'] ) : '';
1296
1297 $settings['org_node_background_color'] = isset( $settings['org_node_background_color'] ) && $settings['org_node_background_color'] != '' ? esc_attr( $settings['org_node_background_color'] ) : '#edf7ff';
1298 $settings['org_node_padding'] = isset( $settings['org_node_padding'] ) && $settings['org_node_padding'] != '' ? esc_attr( $settings['org_node_padding'] ) : '2';
1299 $settings['org_node_border_radius'] = isset( $settings['org_node_border_radius'] ) && $settings['org_node_border_radius'] != '' ? esc_attr( $settings['org_node_border_radius'] ) : '5';
1300 $settings['org_node_border_width'] = isset( $settings['org_node_border_width'] ) && $settings['org_node_border_width'] != '' ? esc_attr( $settings['org_node_border_width'] ) : '0';
1301 $settings['org_node_border_color'] = isset( $settings['org_node_border_color'] ) && $settings['org_node_border_color'] != '' ? esc_attr( $settings['org_node_border_color'] ) : '#b5d9ea';
1302 $settings['org_node_text_color'] = isset( $settings['org_node_text_color'] ) && $settings['org_node_text_color'] != '' ? esc_attr( $settings['org_node_text_color'] ) : '#000000';
1303 $settings['org_node_text_font_size'] = isset( $settings['org_node_text_font_size'] ) && $settings['org_node_text_font_size'] != '' ? esc_attr( $settings['org_node_text_font_size'] ) : '13';
1304 $settings['org_node_description_font_color'] = isset( $settings['org_node_description_font_color'] ) && $settings['org_node_description_font_color'] != '' ? esc_attr( $settings['org_node_description_font_color'] ) : '#ff0000';
1305 $settings['org_node_description_font_size'] = isset( $settings['org_node_description_font_size'] ) && $settings['org_node_description_font_size'] != '' ? esc_attr( $settings['org_node_description_font_size'] ) : '13';
1306
1307 // Org custom selected css class
1308 $settings['org_selected_classname'] = isset( $settings['org_selected_classname'] ) && $settings['org_selected_classname'] != '' ? esc_attr( $settings['org_selected_classname'] ) : '';
1309
1310 $settings['org_selected_node_background_color'] = isset( $settings['org_selected_node_background_color'] ) && $settings['org_selected_node_background_color'] != '' ? esc_attr( $settings['org_selected_node_background_color'] ) : '#fff7ae';
1311 $settings['org_selected_node_text_color'] = isset( $settings['org_selected_node_text_color'] ) && $settings['org_selected_node_text_color'] != '' ? esc_attr( $settings['org_selected_node_text_color'] ) : $settings['org_node_text_color'];
1312
1313
1314 // Horizontal axis settings
1315 $settings['haxis_title'] = isset( $settings['haxis_title'] ) && $settings['haxis_title'] != '' ? esc_attr( $settings['haxis_title'] ) : '';
1316 $settings['haxis_label_font_size'] = isset( $settings['haxis_label_font_size'] ) && $settings['haxis_label_font_size'] != '' ? esc_attr( $settings['haxis_label_font_size'] ) : $settings['font_size'];
1317 $settings['haxis_label_color'] = isset( $settings['haxis_label_color'] ) && $settings['haxis_label_color'] != '' ? esc_attr( $settings['haxis_label_color'] ) : '#000000';
1318 $settings['haxis_text_position'] = isset( $settings['haxis_text_position'] ) && $settings['haxis_text_position'] != '' ? esc_attr( $settings['haxis_text_position'] ) : 'out';
1319 $settings['haxis_direction'] = ( isset( $settings['haxis_direction'] ) && $settings['haxis_direction'] != '' ) ? $settings['haxis_direction'] : '1';
1320 $settings['haxis_text_color'] = isset( $settings['haxis_text_color'] ) && $settings['haxis_text_color'] != '' ? esc_attr( $settings['haxis_text_color'] ) : '#000000';
1321 $settings['haxis_baseline_color'] = isset( $settings['haxis_baseline_color'] ) && $settings['haxis_baseline_color'] != '' ? esc_attr( $settings['haxis_baseline_color'] ) : '#000000';
1322 $settings['haxis_text_font_size'] = isset( $settings['haxis_text_font_size'] ) && $settings['haxis_text_font_size'] != '' ? absint(esc_attr( $settings['haxis_text_font_size'] )) : $settings['font_size'];
1323 $settings['haxis_slanted'] = isset( $settings['haxis_slanted'] ) && $settings['haxis_slanted'] != '' ? esc_attr( $settings['haxis_slanted'] ) : 'automatic';
1324 $settings['haxis_slanted_text_angle'] = isset( $settings['haxis_slanted_text_angle'] ) && $settings['haxis_slanted_text_angle'] != '' && $settings['haxis_slanted_text_angle'] != '0' ? esc_attr( $settings['haxis_slanted_text_angle'] ) : '30';
1325 $settings['haxis_show_text_every'] = isset( $settings['haxis_show_text_every'] ) && $settings['haxis_show_text_every'] != '' ? esc_attr( $settings['haxis_show_text_every'] ) : '0';
1326 $settings['haxis_format'] = isset( $settings['haxis_format'] ) && $settings['haxis_format'] != '' ? esc_attr( $settings['haxis_format'] ) : '';
1327 $settings['haxis_enable_divide_percent'] = ( isset( $settings['haxis_enable_divide_percent'] ) && $settings['haxis_enable_divide_percent'] != '' ) ? $settings['haxis_enable_divide_percent'] : 'off';
1328 $settings['haxis_max_value'] = isset( $settings['haxis_max_value'] ) && $settings['haxis_max_value'] != '' ? esc_attr( $settings['haxis_max_value'] ) : null;
1329 $settings['haxis_min_value'] = isset( $settings['haxis_min_value'] ) && $settings['haxis_min_value'] != '' ? esc_attr( $settings['haxis_min_value'] ) : null;
1330 $settings['haxis_gridlines_count'] = isset( $settings['haxis_gridlines_count'] ) && $settings['haxis_gridlines_count'] != '' ? esc_attr( $settings['haxis_gridlines_count'] ) : -1;
1331 $settings['haxis_italic'] = ( isset( $settings['haxis_italic'] ) && $settings['haxis_italic'] != '' ) ? $settings['haxis_italic'] : 'off';
1332 $settings['haxis_bold'] = ( isset( $settings['haxis_bold'] ) && $settings['haxis_bold'] != '' ) ? $settings['haxis_bold'] : 'off';
1333 $settings['haxis_title_italic'] = ( isset( $settings['haxis_title_italic'] ) && $settings['haxis_title_italic'] != '' ) ? $settings['haxis_title_italic'] : 'off';
1334 $settings['haxis_title_bold'] = ( isset( $settings['haxis_title_bold'] ) && $settings['haxis_title_bold'] != '' ) ? $settings['haxis_title_bold'] : 'off';
1335 $settings['haxis_gridlines_color'] = isset( $settings['haxis_gridlines_color'] ) && $settings['haxis_gridlines_color'] != '' ? esc_attr( $settings['haxis_gridlines_color'] ) : '#cccccc';
1336 $settings['haxis_minor_gridlines_color'] = isset( $settings['haxis_minor_gridlines_color'] ) && $settings['haxis_minor_gridlines_color'] != '' ? esc_attr( $settings['haxis_minor_gridlines_color'] ) : $settings['haxis_gridlines_color'];
1337
1338 // Vertical axis settings
1339 $settings['vaxis_title'] = isset( $settings['vaxis_title'] ) && $settings['vaxis_title'] != '' ? esc_attr( $settings['vaxis_title'] ) : '';
1340 $settings['vaxis_label_font_size'] = isset( $settings['vaxis_label_font_size'] ) && $settings['vaxis_label_font_size'] != '' ? esc_attr( $settings['vaxis_label_font_size'] ) : $settings['font_size'];
1341 $settings['vaxis_label_color'] = isset( $settings['vaxis_label_color'] ) && $settings['vaxis_label_color'] != '' ? esc_attr( $settings['vaxis_label_color'] ) : '#000000';
1342 $settings['vaxis_text_position'] = isset( $settings['vaxis_text_position'] ) && $settings['vaxis_text_position'] != '' ? esc_attr( $settings['vaxis_text_position'] ) : 'out';
1343 $settings['vaxis_direction'] = ( isset( $settings['vaxis_direction'] ) && $settings['vaxis_direction'] != '' ) ? $settings['vaxis_direction'] : '1';
1344 $settings['vaxis_text_color'] = isset( $settings['vaxis_text_color'] ) && $settings['vaxis_text_color'] != '' ? esc_attr( $settings['vaxis_text_color'] ) : '#000000';
1345 $settings['vaxis_baseline_color'] = isset( $settings['vaxis_baseline_color'] ) && $settings['vaxis_baseline_color'] != '' ? esc_attr( $settings['vaxis_baseline_color'] ) : '#000000';
1346 $settings['vaxis_text_font_size'] = isset( $settings['vaxis_text_font_size'] ) && $settings['vaxis_text_font_size'] != '' ? absint(esc_attr( $settings['vaxis_text_font_size'] )) : $settings['font_size'];
1347 $settings['vaxis_format'] = isset( $settings['vaxis_format'] ) && $settings['vaxis_format'] != '' ? esc_attr( $settings['vaxis_format'] ) : '';
1348 $settings['vaxis_enable_divide_percent'] = ( isset( $settings['vaxis_enable_divide_percent'] ) && $settings['vaxis_enable_divide_percent'] != '' ) ? $settings['vaxis_enable_divide_percent'] : 'off';
1349 $settings['vaxis_max_value'] = isset( $settings['vaxis_max_value'] ) && $settings['vaxis_max_value'] != '' ? esc_attr( $settings['vaxis_max_value'] ) : null;
1350 $settings['vaxis_min_value'] = isset( $settings['vaxis_min_value'] ) && $settings['vaxis_min_value'] != '' ? esc_attr( $settings['vaxis_min_value'] ) : null;
1351 $settings['vaxis_gridlines_count'] = isset( $settings['vaxis_gridlines_count'] ) && $settings['vaxis_gridlines_count'] != '' ? esc_attr( $settings['vaxis_gridlines_count'] ) : -1;
1352 $settings['vaxis_italic'] = ( isset( $settings['vaxis_italic'] ) && $settings['vaxis_italic'] != '' ) ? $settings['vaxis_italic'] : 'off';
1353 $settings['vaxis_bold'] = ( isset( $settings['vaxis_bold'] ) && $settings['vaxis_bold'] != '' ) ? $settings['vaxis_bold'] : 'off';
1354 $settings['vaxis_title_italic'] = ( isset( $settings['vaxis_title_italic'] ) && $settings['vaxis_title_italic'] != '' ) ? $settings['vaxis_title_italic'] : 'off';
1355 $settings['vaxis_title_bold'] = ( isset( $settings['vaxis_title_bold'] ) && $settings['vaxis_title_bold'] != '' ) ? $settings['vaxis_title_bold'] : 'off';
1356 $settings['vaxis_gridlines_color'] = isset( $settings['vaxis_gridlines_color'] ) && $settings['vaxis_gridlines_color'] != '' ? esc_attr( $settings['vaxis_gridlines_color'] ) : '#cccccc';
1357 $settings['vaxis_minor_gridlines_color'] = isset( $settings['vaxis_minor_gridlines_color'] ) && $settings['vaxis_minor_gridlines_color'] != '' ? esc_attr( $settings['vaxis_minor_gridlines_color'] ) : $settings['vaxis_gridlines_color'];
1358
1359 // Animation settings
1360 $settings['enable_animation'] = ( isset( $settings['enable_animation'] ) && $settings['enable_animation'] != '' ) ? $settings['enable_animation'] : 'off';
1361 $settings['animation_duration'] = isset( $settings['animation_duration'] ) && $settings['animation_duration'] != '' ? absint(esc_attr( $settings['animation_duration'] )) : '1000';
1362 $settings['animation_startup'] = ( isset( $settings['animation_startup'] ) && $settings['animation_startup'] != '' ) ? $settings['animation_startup'] : 'on';
1363 $settings['animation_easing'] = isset( $settings['animation_easing'] ) && $settings['animation_easing'] != '' ? esc_attr( $settings['animation_easing'] ) : 'linear';
1364
1365 $settings['enable_img'] = ( isset( $settings['enable_img'] ) && $settings['enable_img'] != '' ) ? $settings['enable_img'] : 'off';
1366
1367 $count_slices = (isset($chartData['source']) && !is_null($chartData['source']) && count($chartData['source']) > 0) ? count($chartData['source']) - 1 : 0;
1368 $count_series = (isset($chartData['source'][0]) && !is_null($chartData['source'][0]) && count($chartData['source'][0]) > 0) ? count($chartData['source'][0]) - 1 : 0;
1369 $count_rows = (isset($chartData['source']) && !is_null($chartData['source']) && count($chartData['source']) > 0) ? count(array_column($chartData['source'], 0)) - 1 : 0;
1370
1371 // Slices settings
1372 $settings['slice_colors_default'] = $chart_default_colors;
1373 $settings['slice_color'] = isset( $settings['slice_color'] ) && $settings['slice_color'] != '' ? json_decode($settings['slice_color'], true) : $chart_default_colors;
1374 $settings['slice_offset'] = isset( $settings['slice_offset'] ) && $settings['slice_offset'] != '' ? json_decode($settings['slice_offset'], true) : array_fill(0, $count_slices, 0);
1375 $settings['slice_text_color'] = isset( $settings['slice_text_color'] ) && $settings['slice_text_color'] != '' ? json_decode($settings['slice_text_color'], true) : array_fill(0, $count_slices, '#ffffff');
1376
1377 // Series settings
1378 $settings['series_colors_default'] = $chart_default_colors;
1379 $settings['series_color'] = isset( $settings['series_color'] ) && $settings['series_color'] != '' ? json_decode($settings['series_color'], true) : $chart_default_colors;
1380 $settings['series_visible_in_legend'] = isset( $settings['series_visible_in_legend'] ) && $settings['series_visible_in_legend'] != '' ? json_decode($settings['series_visible_in_legend'], true) : array_fill(0, $count_series, 'on');
1381 $settings['series_line_width'] = isset( $settings['series_line_width'] ) && $settings['series_line_width'] != '' ? json_decode($settings['series_line_width'], true) : array_fill(0, $count_series, $settings['line_width']);
1382 $settings['series_point_size'] = isset( $settings['series_point_size'] ) && $settings['series_point_size'] != '' ? json_decode($settings['series_point_size'], true) : array_fill(0, $count_series, $settings['point_size']);
1383 $settings['series_point_shape'] = isset( $settings['series_point_shape'] ) && $settings['series_point_shape'] != '' ? json_decode($settings['series_point_shape'], true) : array_fill(0, $count_series, $settings['point_shape']);
1384 $settings['series_format'] = isset( $settings['series_format'] ) && $settings['series_format'] != '' ? json_decode($settings['series_format'], true) : array_fill(0, $count_series, '');
1385 // Rows settings
1386 $settings['enable_row_settings'] = ( isset( $settings['enable_row_settings'] ) && $settings['enable_row_settings'] != '' ) ? $settings['enable_row_settings'] : 'on';
1387
1388 $settings['rows_color'] = isset( $settings['rows_color'] ) && $settings['rows_color'] != '' ? json_decode($settings['rows_color'], true) : array_fill(0, $count_rows, '');
1389 $settings['rows_opacity'] = isset( $settings['rows_opacity'] ) && $settings['rows_opacity'] != '' ? json_decode($settings['rows_opacity'], true) : array_fill(0, $count_rows, 1.0);
1390
1391 return $settings;
1392
1393 }
1394
1395 /**
1396 * Gets all settings of chart.js charts for admin area.
1397 *
1398 * @access public
1399 * @return array
1400 */
1401 public function get_chart_settings_chartjs_admin ($settings) {
1402 $chart_default_colors = array('#36A2EB','#FF6384','#FF9F40','#FFCD56', '#4BC0C0','#0099c6','#dd4477','#66aa00', '#b82e2e','#316395','#994499','#22aa99', '#aaaa11','#6633cc','#e67300','#8b0707', '#651067','#329262','#5574a6','#3b3eac', '#b77322','#16d620','#b91383','#f4359e', '#9c5935','#a9c413','#2a778d','#668d1c', '#bea413','#0c5922','#743411');
1403
1404 $title_positions = array(
1405 "left" => __("Left", "chart-builder"),
1406 "right" => __("Right", "chart-builder"),
1407 "center" => __("Center", "chart-builder")
1408 );
1409
1410 $text_transforms = array(
1411 "uppercase" => __("Uppercase", "chart-builder"),
1412 "lowercase" => __("Lowercase", "chart-builder"),
1413 "capitalize" => __("Capitalize", "chart-builder"),
1414 "none" => __("None", "chart-builder"),
1415 );
1416
1417 $text_decorations = array(
1418 "overline" => __("Overline", "chart-builder"),
1419 "underline" => __("Underline", "chart-builder"),
1420 "line-through" => __("Line through", "chart-builder"),
1421 "none" => __("None", "chart-builder"),
1422 );
1423
1424 $border_styles = array(
1425 "solid" => __("Solid", "chart-builder"),
1426 "dashed" => __("Dashed", "chart-builder"),
1427 "dotted" => __("Dotted", "chart-builder"),
1428 "double" => __("Double", "chart-builder"),
1429 "groove" => __("Groove", "chart-builder"),
1430 "inset" => __("Inset", "chart-builder"),
1431 "outset" => __("Outset", "chart-builder"),
1432 "ridge" => __("Ridge", "chart-builder")
1433 );
1434
1435 $legend_positions = array(
1436 "top" => __("Above the chart", "chart-builder"),
1437 "bottom" => __("Below the chart", "chart-builder"),
1438 "left" => __("Left of the chart", "chart-builder"),
1439 "right" => __("Right of the chart", "chart-builder"),
1440 );
1441
1442 $legend_alignments = array(
1443 "start" => __("Start", "chart-builder"),
1444 "center" => __("Center", "chart-builder"),
1445 "end" => __("End", "chart-builder"),
1446 );
1447
1448 // Title color
1449 $settings['title_color'] = isset( $settings['title_color'] ) && $settings['title_color'] != '' ? esc_attr( $settings['title_color'] ) : '#000000';
1450
1451 // Title color
1452 $settings['title_shadow_color'] = isset( $settings['title_shadow_color'] ) && $settings['title_shadow_color'] != '' ? esc_attr( $settings['title_shadow_color'] ) : $settings['title_color'];
1453
1454 // Title font size
1455 $settings['title_font_size'] = isset( $settings['title_font_size'] ) && $settings['title_font_size'] != '' ? esc_attr( $settings['title_font_size'] ) : '30';
1456
1457 // Title Bold text
1458 $settings['title_bold'] = ( isset( $settings['title_bold'] ) && $settings['title_bold'] != '' ) ? esc_attr($settings['title_bold']) : 'on';
1459 $settings['title_bold'] = isset( $settings['title_bold'] ) && $settings['title_bold'] == 'on' ? 'checked' : '';
1460
1461 // Title text shadow
1462 $settings['title_text_shadow'] = ( isset( $settings['title_text_shadow'] ) && $settings['title_text_shadow'] != '' ) ? esc_attr($settings['title_text_shadow']) : 'off';
1463 $settings['title_text_shadow'] = isset( $settings['title_text_shadow'] ) && $settings['title_text_shadow'] == 'on' ? 'checked' : '';
1464
1465 // Title italic text
1466 $settings['title_italic'] = ( isset( $settings['title_italic'] ) && $settings['title_italic'] != '' ) ? esc_attr($settings['title_italic']) : 'off';
1467 $settings['title_italic'] = isset( $settings['title_italic'] ) && $settings['title_italic'] == 'on' ? 'checked' : '';
1468
1469 // Title gap
1470 $settings['title_gap'] = isset( $settings['title_gap'] ) && $settings['title_gap'] != '' ? esc_attr( $settings['title_gap'] ) : '5';
1471
1472 // Title gap
1473 $settings['title_gap_description'] = isset( $settings['title_gap_description'] ) && $settings['title_gap_description'] != '' ? esc_attr( $settings['title_gap_description'] ) : '5';
1474
1475 // Title letter spacing
1476 $settings['title_letter_spacing'] = isset( $settings['title_letter_spacing'] ) && $settings['title_letter_spacing'] != '' ? esc_attr( $settings['title_letter_spacing'] ) : 0;
1477
1478 // Title position
1479 $settings['title_position'] = isset( $settings['title_position'] ) && $settings['title_position'] != '' ? esc_attr( $settings['title_position'] ) : 'left';
1480 $settings['title_positions'] = $title_positions;
1481
1482 // Title text transform
1483 $settings['title_text_transform'] = isset( $settings['title_text_transform'] ) && $settings['title_text_transform'] != '' ? esc_attr( $settings['title_text_transform'] ) : 'none';
1484 $settings['text_transforms'] = $text_transforms;
1485
1486 // Title text decoration
1487 $settings['title_text_decoration'] = isset( $settings['title_text_decoration'] ) && $settings['title_text_decoration'] != '' ? esc_attr( $settings['title_text_decoration'] ) : 'none';
1488 $settings['text_decorations'] = $text_decorations;
1489
1490 // description color
1491 $settings['description_color'] = isset( $settings['description_color'] ) && $settings['description_color'] != '' ? esc_attr( $settings['description_color'] ) : '#4c4c4c';
1492
1493 // description font size
1494 $settings['description_font_size'] = isset( $settings['description_font_size'] ) && $settings['description_font_size'] != '' ? esc_attr( $settings['description_font_size'] ) : '16';
1495
1496 // description Bold text
1497 $settings['description_bold'] = ( isset( $settings['description_bold'] ) && $settings['description_bold'] != '' ) ? esc_attr($settings['description_bold']) : 'off';
1498 $settings['description_bold'] = isset( $settings['description_bold'] ) && $settings['description_bold'] == 'on' ? 'checked' : '';
1499
1500 // description text shadow
1501 $settings['description_text_shadow'] = ( isset( $settings['description_text_shadow'] ) && $settings['description_text_shadow'] != '' ) ? esc_attr($settings['description_text_shadow']) : 'off';
1502 $settings['description_text_shadow'] = isset( $settings['description_text_shadow'] ) && $settings['description_text_shadow'] == 'on' ? 'checked' : '';
1503
1504 // description color
1505 $settings['description_shadow_color'] = isset( $settings['description_shadow_color'] ) && $settings['description_shadow_color'] != '' ? esc_attr( $settings['description_shadow_color'] ) : $settings['description_color'];
1506
1507 // description italic text
1508 $settings['description_italic'] = ( isset( $settings['description_italic'] ) && $settings['description_italic'] != '' ) ? esc_attr($settings['description_italic']) : 'off';
1509 $settings['description_italic'] = isset( $settings['description_italic'] ) && $settings['description_italic'] == 'on' ? 'checked' : '';
1510
1511 // description position
1512 $settings['description_position'] = isset( $settings['description_position'] ) && $settings['description_position'] != '' ? esc_attr( $settings['description_position'] ) : 'left';
1513
1514 // description text transform
1515 $settings['description_text_transform'] = isset( $settings['description_text_transform'] ) && $settings['description_text_transform'] != '' ? esc_attr( $settings['description_text_transform'] ) : 'none';
1516
1517 // description letter spacing
1518 $settings['description_letter_spacing'] = isset( $settings['description_letter_spacing'] ) && $settings['description_letter_spacing'] != '' ? esc_attr( $settings['description_letter_spacing'] ) : 0;
1519
1520 // description text decoration
1521 $settings['description_text_decoration'] = isset( $settings['description_text_decoration'] ) && $settings['description_text_decoration'] != '' ? esc_attr( $settings['description_text_decoration'] ) : 'none';
1522
1523 // Box shadow
1524 $settings['box_shadow'] = isset( $settings['box_shadow'] ) && $settings['box_shadow'] != '' ? esc_attr( $settings['box_shadow'] ) : 'off';
1525 $settings['box_shadow'] = isset( $settings['box_shadow'] ) && $settings['box_shadow'] == 'on' ? 'checked' : '';
1526
1527 // Border width
1528 $settings['border_width'] = isset( $settings['border_width'] ) && $settings['border_width'] != '' ? esc_attr( $settings['border_width'] ) : '0';
1529
1530 // Border radius
1531 $settings['border_radius'] = isset( $settings['border_radius'] ) && $settings['border_radius'] != '' ? esc_attr( $settings['border_radius'] ) : '0';
1532
1533 // Border color
1534 $settings['border_color'] = isset( $settings['border_color'] ) && $settings['border_color'] != '' ? esc_attr( $settings['border_color'] ) : '#000000';
1535
1536 // Background color
1537 $settings['background_color_chart'] = isset( $settings['background_color_chart'] ) && $settings['background_color_chart'] != '' ? esc_attr( $settings['background_color_chart'] ) : '#ffffff';
1538
1539 // Border width with title
1540 $settings['border_width_with_title'] = isset( $settings['border_width_with_title'] ) && $settings['border_width_with_title'] != '' ? esc_attr( $settings['border_width_with_title'] ) : '0';
1541
1542 // Border radius with title
1543 $settings['border_radius_with_title'] = isset( $settings['border_radius_with_title'] ) && $settings['border_radius_with_title'] != '' ? esc_attr( $settings['border_radius_with_title'] ) : '0';
1544
1545 // Border color with title
1546 $settings['border_color_with_title'] = isset( $settings['border_color_with_title'] ) && $settings['border_color_with_title'] != '' ? esc_attr( $settings['border_color_with_title'] ) : '#000000';
1547
1548 // Border style with title
1549 $settings['border_style_with_title'] = isset( $settings['border_style_with_title'] ) && $settings['border_style_with_title'] != '' ? esc_attr( $settings['border_style_with_title'] ) : 'solid';
1550 $settings['border_styles'] = $border_styles;
1551
1552 //Box shadow color
1553 $settings['box_shadow_color'] = isset( $settings['box_shadow_color'] ) && $settings['box_shadow_color'] != '' ? esc_attr( $settings['box_shadow_color'] ) : $settings['border_color'];
1554
1555 // Border style
1556 $settings['border_style'] = isset( $settings['border_style'] ) && $settings['border_style'] != '' ? esc_attr( $settings['border_style'] ) : 'solid';
1557 $settings['border_styles'] = $border_styles;
1558
1559 // slice_spacing
1560 $settings['slice_spacing'] = isset( $settings['slice_spacing'] ) && $settings['slice_spacing'] != '' ? esc_attr( absint($settings['slice_spacing']) ) : 1;
1561
1562 // outer_radius
1563 $settings['outer_radius'] = isset( $settings['outer_radius'] ) && $settings['outer_radius'] != '' ? esc_attr( absint($settings['outer_radius']) ) : 100;
1564
1565 // Padding outer
1566 $settings['padding_outer'] = isset( $settings['padding_outer'] ) && $settings['padding_outer'] != '' ? esc_attr( $settings['padding_outer'] ) : '0';
1567
1568 // circumference
1569 $settings['circumference'] = isset( $settings['circumference'] ) && $settings['circumference'] != '' ? esc_attr( absint($settings['circumference']) ) : 360;
1570
1571 // start_angle
1572 $settings['start_angle'] = isset( $settings['start_angle'] ) && $settings['start_angle'] != '' ? esc_attr( absint($settings['start_angle']) ) : 0;
1573
1574 // Show chart description
1575 if (!isset($settings['show_description'])) {
1576 $settings['show_description'] = 'checked';
1577 } else {
1578 $settings['show_description'] = ( $settings['show_description'] != '' ) ? $settings['show_description'] : 'off';
1579 $settings['show_description'] = isset( $settings['show_description'] ) && $settings['show_description'] == 'on' ? 'checked' : '';
1580 }
1581
1582 // Show chart title
1583 if (!isset($settings['show_title'])) {
1584 $settings['show_title'] = 'checked';
1585 } else {
1586 $settings['show_title'] = ( $settings['show_title'] != '' ) ? $settings['show_title'] : 'off';
1587 $settings['show_title'] = isset( $settings['show_title'] ) && $settings['show_title'] == 'on' ? 'checked' : '';
1588 }
1589
1590 $count_slices = (isset($counting_source) && !is_null($counting_source) && count($counting_source) > 0) ? count($counting_source) - 1 : 0;
1591
1592 // Slices settings
1593 $settings['slice_colors_default'] = $chart_default_colors;
1594 $settings['slice_color'] = isset( $settings['slice_color'] ) && $settings['slice_color'] != '' ? json_decode($settings['slice_color'], true) : array_slice($chart_default_colors, 0, $count_slices);;
1595
1596 // Slice border color
1597 $settings['slice_border_color'] = isset( $settings['slice_border_color'] ) && $settings['slice_border_color'] != '' ? esc_attr( $settings['slice_border_color'] ) : '#ffffff';
1598
1599 // Slices border width
1600 $settings['slice_border_width'] = isset( $settings['slice_border_width'] ) && $settings['slice_border_width'] != '' ? esc_attr( $settings['slice_border_width'] ) : '1';
1601
1602 // Tooltip text color
1603 $settings['tooltip_text_color'] = isset( $settings['tooltip_text_color'] ) && $settings['tooltip_text_color'] != '' ? esc_attr( $settings['tooltip_text_color'] ) : '#fff';
1604
1605 // Legend font color
1606 $settings['legend_color'] = isset( $settings['legend_color'] ) && $settings['legend_color'] != '' ? esc_attr( $settings['legend_color'] ) : '#000000';
1607
1608 // Legend font size
1609 $settings['legend_font_size'] = isset( $settings['legend_font_size'] ) && intval($settings['legend_font_size']) > 0 ? esc_attr( $settings['legend_font_size'] ) : 12;
1610
1611 // Legend position
1612 $settings['legend_position'] = isset( $settings['legend_position'] ) && $settings['legend_position'] != '' ? esc_attr( $settings['legend_position'] ) : 'top';
1613 $settings['legend_positions'] = $legend_positions;
1614
1615 // Legend alignment
1616 $settings['legend_alignment'] = isset( $settings['legend_alignment'] ) && $settings['legend_alignment'] != '' ? esc_attr( $settings['legend_alignment'] ) : 'start';
1617 $settings['legend_alignments'] = $legend_alignments;
1618
1619 // Legend Italic text
1620 $settings['legend_italic'] = ( isset( $settings['legend_italic'] ) && $settings['legend_italic'] != '' ) ? $settings['legend_italic'] : 'off';
1621 $settings['legend_italic'] = isset( $settings['legend_italic'] ) && $settings['legend_italic'] == 'on' ? 'checked' : '';
1622
1623 // Legend Bold text
1624 $settings['legend_bold'] = ( isset( $settings['legend_bold'] ) && $settings['legend_bold'] != '' ) ? $settings['legend_bold'] : 'off';
1625 $settings['legend_bold'] = isset( $settings['legend_bold'] ) && $settings['legend_bold'] == 'on' ? 'checked' : '';
1626
1627 // Legend reverse
1628 $settings['legend_reverse'] = ( isset( $settings['legend_reverse'] ) && $settings['legend_reverse'] != '' ) ? $settings['legend_reverse'] : 'off';
1629 $settings['legend_reverse'] = isset( $settings['legend_reverse'] ) && $settings['legend_reverse'] == 'on' ? 'checked' : '';
1630
1631 return $settings;
1632
1633 }
1634
1635 /**
1636 * Gets all settings of chart.js charts for public area.
1637 *
1638 * @access public
1639 * @return array
1640 */
1641 public function get_chart_settings_chartjs_public ($settings) {
1642 $chart_default_colors = array('#36A2EB','#FF6384','#FF9F40','#FFCD56', '#4BC0C0','#0099c6','#dd4477','#66aa00', '#b82e2e','#316395','#994499','#22aa99', '#aaaa11','#6633cc','#e67300','#8b0707', '#651067','#329262','#5574a6','#3b3eac', '#b77322','#16d620','#b91383','#f4359e', '#9c5935','#a9c413','#2a778d','#668d1c', '#bea413','#0c5922','#743411');
1643 // Show chart description
1644 $settings['show_description'] = isset( $settings['show_description'] ) && $settings['show_description'] != '' ? esc_attr( $settings['show_description'] ) : 'on';
1645
1646 // Show chart title
1647 $settings['show_title'] = isset( $settings['show_title'] ) && $settings['show_title'] != '' ? esc_attr( $settings['show_title'] ) : 'on';
1648
1649 // Title color
1650 $settings['title_color'] = isset( $settings['title_color'] ) && $settings['title_color'] != '' ? esc_attr( $settings['title_color'] ) : '#000000';
1651
1652 // Title color
1653 $settings['title_shadow_color'] = isset( $settings['title_shadow_color'] ) && $settings['title_shadow_color'] != '' ? esc_attr( $settings['title_shadow_color'] ) : $settings['title_color'];
1654
1655 // Title font size
1656 $settings['title_font_size'] = isset( $settings['title_font_size'] ) && $settings['title_font_size'] != '' ? esc_attr( $settings['title_font_size'] ) : '30';
1657
1658 // title bold
1659 $settings['title_bold'] = ( isset( $settings['title_bold'] ) && $settings['title_bold'] != '' ) ? esc_attr($settings['title_bold']) : 'on';
1660 $settings['title_bold'] = isset( $settings['title_bold'] ) && $settings['title_bold'] != 'off'? 'bold' : 'normal';
1661
1662 // Title text shadow
1663 $settings['title_text_shadow'] = ( isset( $settings['title_text_shadow'] ) && $settings['title_text_shadow'] != '' ) ? esc_attr($settings['title_text_shadow']) : 'off';
1664 $settings['title_text_shadow'] = isset( $settings['title_text_shadow'] ) && $settings['title_text_shadow'] == 'on' ? 'checked' : '';
1665
1666 // title italic
1667 $settings['title_italic'] = ( isset( $settings['title_italic'] ) && $settings['title_italic'] != '' ) ? esc_attr($settings['title_italic']) : 'off';
1668 $settings['title_italic'] = isset( $settings['title_italic'] ) && $settings['title_italic'] != 'on'? 'normal' : 'italic';
1669
1670 // title gap
1671 $settings['title_gap'] = (isset( $settings['title_gap'] ) && $settings['title_gap'] != '') ? esc_attr( $settings['title_gap'] ) : '5';
1672
1673 // title gap
1674 $settings['title_gap_description'] = (isset( $settings['title_gap_description'] ) && $settings['title_gap_description'] != '') ? esc_attr( $settings['title_gap_description'] ) : '5';
1675
1676 // title letter spacing
1677 $settings['title_letter_spacing'] = (isset( $settings['title_letter_spacing'] ) && $settings['title_letter_spacing'] != '') ? esc_attr( $settings['title_letter_spacing'] ) : 0;
1678
1679 // title position
1680 $settings['title_position'] = isset( $settings['title_position'] ) && $settings['title_position'] != '' ? esc_attr( $settings['title_position'] ) : 'left';
1681
1682 // title text transform
1683 $settings['title_text_transform'] = isset( $settings['title_text_transform'] ) && $settings['title_text_transform'] != '' ? esc_attr( $settings['title_text_transform'] ) : 'none';
1684
1685 // title text decoration
1686 $settings['title_text_decoration'] = isset( $settings['title_text_decoration'] ) && $settings['title_text_decoration'] != '' ? esc_attr( $settings['title_text_decoration'] ) : 'none';
1687
1688 // description color
1689 $settings['description_color'] = isset( $settings['description_color'] ) && $settings['description_color'] != '' ? esc_attr( $settings['description_color'] ) : '#4c4c4c';
1690
1691 // description font size
1692 $settings['description_font_size'] = (isset( $settings['description_font_size'] ) && $settings['description_font_size'] != '') ? esc_attr( $settings['description_font_size'] ) : '16';
1693
1694 // description Bold text
1695 $settings['description_bold'] = ( isset( $settings['description_bold'] ) && $settings['description_bold'] != '' ) ? esc_attr($settings['description_bold']) : 'off';
1696 $settings['description_bold'] = isset( $settings['description_bold'] ) && $settings['description_bold'] != 'on'? 'normal' : 'bold';
1697
1698 // description text shadow
1699 $settings['description_text_shadow'] = ( isset( $settings['description_text_shadow'] ) && $settings['description_text_shadow'] != '' ) ? esc_attr($settings['description_text_shadow']) : 'off';
1700 $settings['description_text_shadow'] = isset( $settings['description_text_shadow'] ) && $settings['description_text_shadow'] == 'on' ? 'checked' : '';
1701
1702 // description color
1703 $settings['description_shadow_color'] = isset( $settings['description_shadow_color'] ) && $settings['description_shadow_color'] != '' ? esc_attr( $settings['description_shadow_color'] ) : $settings['description_color'];
1704
1705 // desctiption italic text
1706 $settings['description_italic'] = ( isset( $settings['description_italic'] ) && $settings['description_italic'] != '' ) ? esc_attr($settings['description_italic']) : 'off';
1707 $settings['description_italic'] = isset( $settings['description_italic'] ) && $settings['description_italic'] != 'on'? 'normal' : 'italic';
1708
1709 // description position
1710 $settings['description_position'] = isset( $settings['description_position'] ) && $settings['description_position'] != '' ? esc_attr( $settings['description_position'] ) : 'left';
1711
1712 // description text transform
1713 $settings['description_text_transform'] = isset( $settings['description_text_transform'] ) && $settings['description_text_transform'] != '' ? esc_attr( $settings['description_text_transform'] ) : 'none';
1714
1715 // description letter spacing
1716 $settings['description_letter_spacing'] = isset( $settings['description_letter_spacing'] ) && $settings['description_letter_spacing'] != '' ? esc_attr( $settings['description_letter_spacing'] ) : 0;
1717
1718 // description text decoration
1719 $settings['description_text_decoration'] = isset( $settings['description_text_decoration'] ) && $settings['description_text_decoration'] != '' ? esc_attr( $settings['description_text_decoration'] ) : 'none';
1720
1721 // Box shadow
1722 $settings['box_shadow'] = isset( $settings['box_shadow'] ) && $settings['box_shadow'] != '' ? esc_attr( $settings['box_shadow'] ) : 'off';
1723 $settings['box_shadow'] = isset( $settings['box_shadow'] ) && $settings['box_shadow'] == 'on' ? 'checked' : '';
1724
1725 // Border width
1726 $settings['border_width'] = isset( $settings['border_width'] ) && $settings['border_width'] != '' ? esc_attr( $settings['border_width'] ) : '0';
1727
1728 // Border radius
1729 $settings['border_radius'] = isset( $settings['border_radius'] ) && $settings['border_radius'] != '' ? esc_attr( $settings['border_radius'] ) : '0';
1730
1731 // Border color
1732 $settings['border_color'] = isset( $settings['border_color'] ) && $settings['border_color'] != '' ? esc_attr( $settings['border_color'] ) : '#000000';
1733
1734 //Box shadow color
1735 $settings['box_shadow_color'] = isset( $settings['box_shadow_color'] ) && $settings['box_shadow_color'] != '' ? esc_attr( $settings['box_shadow_color'] ) : $settings['border_color'];
1736
1737 // Border style
1738 $settings['border_style'] = isset( $settings['border_style'] ) && $settings['border_style'] != '' ? esc_attr( $settings['border_style'] ) : 'solid';
1739
1740 // Background color
1741 $settings['background_color_chart'] = isset( $settings['background_color_chart'] ) && $settings['background_color_chart'] != '' ? esc_attr( $settings['background_color_chart'] ) : '#ffffff';
1742
1743 // Border width with title
1744 $settings['border_width_with_title'] = isset( $settings['border_width_with_title'] ) && $settings['border_width_with_title'] != '' ? esc_attr( $settings['border_width_with_title'] ) : '0';
1745
1746 // Border radius with title
1747 $settings['border_radius_with_title'] = isset( $settings['border_radius_with_title'] ) && $settings['border_radius_with_title'] != '' ? esc_attr( $settings['border_radius_with_title'] ) : '0';
1748
1749 // Border color with title
1750 $settings['border_color_with_title'] = isset( $settings['border_color_with_title'] ) && $settings['border_color_with_title'] != '' ? esc_attr( $settings['border_color_with_title'] ) : '#000000';
1751
1752 // Border style with title
1753 $settings['border_style_with_title'] = isset( $settings['border_style_with_title'] ) && $settings['border_style_with_title'] != '' ? esc_attr( $settings['border_style_with_title'] ) : 'solid';
1754
1755 // Padding outer
1756 $settings['padding_outer'] = isset( $settings['padding_outer'] ) && $settings['padding_outer'] != '' ? esc_attr( $settings['padding_outer'] ) : '0';
1757
1758 // outer_radius
1759 $settings['outer_radius'] = isset( $settings['outer_radius'] ) && $settings['outer_radius'] != '' ? esc_attr( absint($settings['outer_radius']) ) : 100;
1760
1761 // slice_spacing
1762 $settings['slice_spacing'] = isset( $settings['slice_spacing'] ) && $settings['slice_spacing'] != '' ? esc_attr( absint($settings['slice_spacing']) ) : 1;
1763
1764 // circumference
1765 $settings['circumference'] = isset( $settings['circumference'] ) && $settings['circumference'] != '' ? esc_attr( absint($settings['circumference']) ) : 360;
1766
1767 // start_angle
1768 $settings['start_angle'] = isset( $settings['start_angle'] ) && $settings['start_angle'] != '' ? esc_attr( absint($settings['start_angle']) ) : 0;
1769
1770 $count_slices = (isset($chartData['source']) && !is_null($chartData['source']) && count($chartData['source']) > 0) ? count($chartData['source']) - 1 : 0;
1771 // Slices settings
1772 $settings['slice_colors_default'] = $chart_default_colors;
1773 $settings['slice_color'] = isset( $settings['slice_color'] ) && $settings['slice_color'] != '' ? json_decode($settings['slice_color'], true) : $chart_default_colors;
1774
1775 // Slice border color
1776 $settings['slice_border_color'] = isset( $settings['slice_border_color'] ) && $settings['slice_border_color'] != '' ? esc_attr( $settings['slice_border_color'] ) : '#ffffff';
1777
1778 // Slices border width
1779 $settings['slice_border_width'] = isset( $settings['slice_border_width'] ) && $settings['slice_border_width'] != '' ? esc_attr( $settings['slice_border_width'] ) : '1';
1780
1781 // Tooltip text color
1782 $settings['tooltip_text_color'] = isset( $settings['tooltip_text_color'] ) && $settings['tooltip_text_color'] != '' ? esc_attr( $settings['tooltip_text_color'] ) : '#fff';
1783
1784 // Legend font color
1785 $settings['legend_color'] = isset( $settings['legend_color'] ) && $settings['legend_color'] != '' ? esc_attr( $settings['legend_color'] ) : '#000000';
1786
1787 // Legend font size
1788 $settings['legend_font_size'] = isset( $settings['legend_font_size'] ) && intval($settings['legend_font_size']) > 0 ? esc_attr( $settings['legend_font_size'] ) : 12;
1789
1790 // Legend position
1791 $settings['legend_position'] = isset( $settings['legend_position'] ) && $settings['legend_position'] != '' ? esc_attr( $settings['legend_position'] ) : 'top';
1792
1793 // Legend Italic text
1794 $settings['legend_italic'] = ( isset( $settings['legend_italic'] ) && $settings['legend_italic'] != '' ) ? $settings['legend_italic'] : 'off';
1795
1796 // Legend Bold text
1797 $settings['legend_bold'] = ( isset( $settings['legend_bold'] ) && $settings['legend_bold'] != '' ) ? $settings['legend_bold'] : 'off';
1798
1799 // Legend reverse
1800 $settings['legend_reverse'] = ( isset( $settings['legend_reverse'] ) && $settings['legend_reverse'] != '' ) ? $settings['legend_reverse'] : 'off';
1801
1802 return $settings;
1803
1804 }
1805 }
1806 }
1807
1808 if( ! function_exists( 'CBFunctions' ) ){
1809 /**
1810 * Function for quick access to Chart_Builder_Functions class
1811 *
1812 * @since 1.0.0
1813 * @return Chart_Builder_Functions
1814 */
1815 function CBFunctions(){
1816
1817 static $instance = null;
1818
1819 if( $instance === null ){
1820 $instance = Chart_Builder_Functions::get_instance( CHART_BUILDER_NAME );
1821 }
1822
1823 if( $instance instanceof Chart_Builder_Functions ){
1824 return $instance;
1825 }
1826
1827 return Chart_Builder_Functions::get_instance( CHART_BUILDER_NAME );
1828 }
1829 }