PluginProbe
Chartify – WordPress Chart Plugin / 3.0.0
Chartify – WordPress Chart Plugin v3.0.0
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.0.0, at includes/class-chart-builder-functions.php

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