'boxWidth' => 'chart_legend_box_width', 'fontFamily' => 'chart_legend_font_family', 'fontSize' => 'chart_legend_font_size', 'fontStyle' => array( 'chart_legend_font_style', 'chart_legend_font_weight' ), 'fontColor' => 'chart_legend_font_color', ); if ( $legend_display ) { foreach ( $legend_style_dictionary as $style_property => $setting_name ) { if ( is_array( $setting_name ) ) { $style_value = $this->get_chart_font_style_string( $setting_name ); if ( ! empty( $style_value ) ) { $legend_style[ $style_property ] = $style_value; } } else { if ( ! empty( $settings[ $setting_name ] ) ) { if ( is_array( $settings[ $setting_name ] ) ) { if ( ! empty( $settings[ $setting_name ]['size'] ) ) { $legend_style[ $style_property ] = $settings[ $setting_name ]['size']; } } else { $legend_style[ $style_property ] = $settings[ $setting_name ]; } } } } if ( ! empty( $legend_style ) ) { $options['legend']['labels'] = $legend_style; } } $tooltip_style_dictionary = array( 'backgroundColor' => 'chart_tooltip_bg_color', 'bodyFontFamily' => 'chart_tooltip_font_family', 'bodyFontSize' => 'chart_tooltip_font_size', 'bodyFontStyle' => array( 'chart_tooltip_font_style', 'chart_tooltip_font_weight' ), 'bodyFontColor' => 'chart_tooltip_font_color', ); if ( $tooltips_enabled ) { foreach ( $tooltip_style_dictionary as $style_property => $setting_name ) { if ( is_array( $setting_name ) ) { $style_value = $this->get_chart_font_style_string( $setting_name ); if ( ! empty( $style_value ) ) { $options['tooltips'][ $style_property ] = $style_value; } } else { if ( ! empty( $settings[ $setting_name ] ) ) { if ( is_array( $settings[ $setting_name ] ) ) { if ( ! empty( $settings[ $setting_name ]['size'] ) ) { $options['tooltips'][ $style_property ] = $settings[ $setting_name ]['size']; } } else { $options['tooltips'][ $style_property ] = $settings[ $setting_name ]; } } } } } return $options; } /** * Get font style string. * * @param array $settings_names Settings names. * * @return string */ public function get_chart_font_style_string( $settings_names = array() ) { if ( ! is_array( $settings_names ) ) { return ''; } $settings = $this->get_settings_for_display(); $font_styles = array(); foreach ( $settings_names as $setting_name ) { if ( ! empty( $settings[ $setting_name ] ) ) { $font_styles[] = $settings[ $setting_name ]; } } if ( empty( $font_styles ) ) { return ''; } $font_styles = array_unique( $font_styles ); return join( ' ', $font_styles ); } /** * Get chart title. * * @return string */ public function get_chart_title() { $settings = $this->get_settings_for_display(); $title_format = apply_filters( 'jet-elements/pie-chart/title-format', '