From 47e6f475735213f825b0624447294fee0f2f93a8 Mon Sep 17 00:00:00 2001 From: Nathan Haug <nate@lullabot.com> Date: Mon, 17 Mar 2014 19:21:01 -0700 Subject: [PATCH] Revert "Issue #2203421 by stella: Ignore chart add-ons that don't produce results." This reverts commit 31a47799b3ba882d8b2013de6e08c9b1144b4e39. --- charts.module | 9 ----- includes/charts.examples.inc | 33 ------------------- includes/charts.pages.inc | 13 -------- modules/charts_google/charts_google.inc | 12 +------ .../charts_highcharts/charts_highcharts.inc | 24 -------------- views/charts_plugin_style_chart.inc | 7 ---- 6 files changed, 1 insertion(+), 97 deletions(-) diff --git a/charts.module b/charts.module index 6cd199f..6f7674c 100644 --- a/charts.module +++ b/charts.module @@ -103,7 +103,6 @@ function charts_element_info() { '#max' => NULL, // Integer max value on this axis. '#min' => NULL, // Integer minimum value on this axis. '#opposite' => FALSE, // Display axis on opposite normal side. - '#continuous' => FALSE, // Options: FALSE, TRUE, or 'date'. ); $info['chart_xaxis'] = array( ) + $axis_properties; @@ -414,14 +413,6 @@ function charts_cast_element_integer_values(&$element) { } } -/** - * Given a date value, attempt to standardize the input. - */ -function charts_convert_date_value($date_string) { - $timezone = new DateTimeZone('UTC'); - $date = new DateTime($date_string, $timezone); - return $date->format('U'); -} /** * Output the chart renderable as a string. diff --git a/includes/charts.examples.inc b/includes/charts.examples.inc index 3220ca5..8cd56dd 100644 --- a/includes/charts.examples.inc +++ b/includes/charts.examples.inc @@ -161,39 +161,6 @@ function _charts_examples_bar_simple() { return $example; } -function _charts_examples_line() { - $chart = array( - '#type' => 'chart', - '#chart_type' => 'line', - '#title' => t('Line with discrete axis'), - ); - // Test with a gap in the data. - $chart['male'] = array( - '#type' => 'chart_data', - '#title' => t('Male'), - '#data' => array(array(0, 0), array(20, 40), array(22, 30), array(36, 30), array(40, 40)), - ); - $chart['female'] = array( - '#type' => 'chart_data', - '#title' => t('Female'), - '#data' => array(array(0, 5), array(20, 14), array(22, 16), array(36, 36), array(40, 48)), - ); - - $example['chart'] = $chart; - - return $example; -} - -function _charts_examples_line_continuous() { - $example = _charts_examples_line(); - $example['chart']['#title'] = t('Line with continuous axis'); - $example['chart']['xaxis'] = array( - '#type' => 'chart_xaxis', - '#continuous' => TRUE, - ); - return $example; -} - function _charts_examples_line_gap() { $chart = array( '#type' => 'chart', diff --git a/includes/charts.pages.inc b/includes/charts.pages.inc index bdad86c..8433966 100644 --- a/includes/charts.pages.inc +++ b/includes/charts.pages.inc @@ -209,18 +209,6 @@ function charts_settings_form($form, $defaults = array(), $field_options = array '#default_value' => $options['xaxis_title'], '#parents' => array_merge($parents, array('xaxis_title')), ); - $form['xaxis']['continuous'] = array( - '#title' => t('Axis data type'), - '#type' => 'radios', - '#options' => array( - 0 => t('Discrete'), - 1 => t('Continuous'), - 2 => t('Continuous date') - ), - '#default_value' => $options['xaxis_continuous'], - '#description' => t('A continuous axis will space points based on their values. See <a href="https://developers.google.com/chart/interactive/docs/customizing_axes#Discrete_vs_Continuous">these examples</a> that elaborate on the different axis types.'), - '#parents' => array_merge($parents, array('xaxis_continuous')), - ); $form['xaxis']['labels_rotation'] = array( '#title' => t('Labels rotation'), '#type' => 'select', @@ -383,7 +371,6 @@ function charts_default_settings() { $defaults['height'] = NULL; $defaults['xaxis_title'] = ''; - $defaults['xaxis_continuous'] = 0; $defaults['xaxis_labels_rotation'] = 0; $defaults['yaxis_title'] = ''; diff --git a/modules/charts_google/charts_google.inc b/modules/charts_google/charts_google.inc index 13d15db..36a83cc 100644 --- a/modules/charts_google/charts_google.inc +++ b/modules/charts_google/charts_google.inc @@ -114,17 +114,7 @@ function _charts_google_populate_chart_axes($chart, $chart_definition) { // In Google, the row column of data is used as labels. if ($chart[$key]['#labels'] && $chart[$key]['#type'] === 'chart_xaxis') { foreach ($chart[$key]['#labels'] as $label_key => $label) { - if ($chart[$key]['#continuous']) { - if ($chart[$key]['#continuous'] === 'date') { - $chart_definition['data'][$label_key + 1][0] = charts_convert_date_value($label); - } - else { - $chart_definition['data'][$label_key + 1][0] = $label + 0; - } - } - else { - $chart_definition['data'][$label_key + 1][0] = $label; - } + $chart_definition['data'][$label_key + 1][0] = $label; } } $axis['textStyle']['color'] = $chart[$key]['#labels_color']; diff --git a/modules/charts_highcharts/charts_highcharts.inc b/modules/charts_highcharts/charts_highcharts.inc index 215715c..0aaacc9 100644 --- a/modules/charts_highcharts/charts_highcharts.inc +++ b/modules/charts_highcharts/charts_highcharts.inc @@ -152,14 +152,6 @@ function _charts_highcharts_populate_chart_axes($chart, $chart_definition) { $axis['min'] = $chart[$key]['#min']; $axis['opposite'] = $chart[$key]['#opposite']; - // Change axis_type to datetime and delete categories when needed. - if ($chart[$key]['#continuous']) { - $axis['categories'] = ''; - if ($chart[$key]['#continuous'] === 'date') { - $axis['type'] = 'datetime'; - } - } - // Dealing with axis rotation in a reasonable manner is complicated in // Highcharts. We want the label to be reasonably positioned on the // outside of the chart when labels are rotated. @@ -214,22 +206,6 @@ function _charts_highcharts_populate_chart_data(&$chart, $chart_definition) { $series['yAxis'] = $axis_index; } - // Change data string to number when continuous axis is needed. - foreach (element_children($chart) as $axis_key) { - if ($chart[$axis_key]['#type'] === 'chart_xaxis') { - if (!empty($chart[$axis_key]['#continuous'])) { - foreach ($chart[$axis_key]['#labels'] as $label_index => $label) { - if ($chart[$axis_key]['#continuous'] === 'date') { - $series['data'][$label_index][0] = 'U' . charts_convert_date_value($label); - } - else { - $series['data'][$label_index][0] = $label + 0; - } - } - } - } - } - // Allow data to provide the labels. This will override the axis settings. if ($chart[$key]['#labels']) { foreach ($chart[$key]['#labels'] as $label_index => $label) { diff --git a/views/charts_plugin_style_chart.inc b/views/charts_plugin_style_chart.inc index 547e4ee..7efb891 100644 --- a/views/charts_plugin_style_chart.inc +++ b/views/charts_plugin_style_chart.inc @@ -197,7 +197,6 @@ class charts_plugin_style_chart extends views_plugin_style { $chart['xaxis'] = array( '#type' => 'chart_xaxis', '#title' => $this->options['xaxis_title'] ? $this->options['xaxis_title'] : FALSE, - '#continuous' => $this->options['xaxis_continuous'], '#labels_rotation' => $this->options['xaxis_labels_rotation'], ); $chart['yaxis'] = array( @@ -266,12 +265,6 @@ class charts_plugin_style_chart extends views_plugin_style { // Execute the subview and get the result. $subview->pre_execute(); $subview->execute(); - - // If there's no results, don't attach the subview. - if (empty($subview->result)) { - continue; - } - $subchart = $subview->style_plugin->render($subview->result); $subview->post_execute(); unset($subview); -- GitLab