From 5853af2a4cbd5fe4244f83e904b6fa05912e134d Mon Sep 17 00:00:00 2001 From: Pierre Vriens <pierre.vriens@inpetto.be> Date: Wed, 11 Feb 2015 16:23:16 +0100 Subject: [PATCH] #2353511-12 Add 'tooltips' and 'data_labels' to Views UI --- includes/charts.pages.inc | 25 +++++++++++++++++++++++++ views/charts_plugin_style_chart.inc | 2 ++ 2 files changed, 27 insertions(+) diff --git a/includes/charts.pages.inc b/includes/charts.pages.inc index 8433966..88c28fd 100644 --- a/includes/charts.pages.inc +++ b/includes/charts.pages.inc @@ -129,6 +129,30 @@ function charts_settings_form($form, $defaults = array(), $field_options = array '#parents' => array_merge($parents, array('title_position')), ); + $form['display']['tooltips'] = array( + '#title' => t('Tooltips'), + '#type' => 'select', + '#options' => array( + '' => t('Disabled'), + 'TRUE' => t('Enabled'), + ), + '#description' => t('Show data details on mouse over? Note: unavailable for print or on mobile devices.'), + '#default_value' => $options['tooltips'], + '#parents' => array_merge($parents, array('tooltips')), + ); + + $form['display']['data_labels'] = array( + '#title' => t('Data labels'), + '#type' => 'select', + '#options' => array( + '' => t('Disabled'), + 'TRUE' => t('Enabled'), + ), + '#default_value' => $options['data_labels'], + '#description' => t('Show data details as labels on chart? Note: recommended for print or on mobile devices.'), + '#parents' => array_merge($parents, array('data_labels')), + ); + $form['display']['legend_position'] = array( '#title' => t('Legend position'), '#type' => 'select', @@ -361,6 +385,7 @@ function charts_default_settings() { $defaults['field_colors'] = NULL; $defaults['title'] = ''; $defaults['title_position'] = 'out'; + $defaults['data_labels'] = FALSE; $defaults['legend'] = TRUE; $defaults['legend_position'] = 'right'; $defaults['colors'] = charts_default_colors(); diff --git a/views/charts_plugin_style_chart.inc b/views/charts_plugin_style_chart.inc index 2e45b5f..4338540 100644 --- a/views/charts_plugin_style_chart.inc +++ b/views/charts_plugin_style_chart.inc @@ -165,6 +165,8 @@ class charts_plugin_style_chart extends views_plugin_style { '#id' => drupal_clean_css_identifier('chart_' . $chart_id), '#title' => $this->options['title_position'] ? $this->options['title'] : FALSE, '#title_position' => $this->options['title_position'], + '#tooltips' => $this->options['tooltips'], + '#data_labels' => $this->options['data_labels'], '#colors' => $this->options['colors'], '#background' => $this->options['background'] ? $this->options['background'] : 'transparent', '#legend' => $this->options['legend_position'] ? TRUE : FALSE, -- GitLab