diff --git a/sites/all/modules/views_simplechart/plugins/views_simplechart_plugin_style.inc b/sites/all/modules/views_simplechart/plugins/views_simplechart_plugin_style.inc index 11aa590..a1a96c3 100644 --- a/sites/all/modules/views_simplechart/plugins/views_simplechart_plugin_style.inc +++ b/sites/all/modules/views_simplechart/plugins/views_simplechart_plugin_style.inc @@ -45,10 +45,24 @@ class ViewsSimplechartPluginStyle extends views_plugin_style { '#size' => '60', '#default_value' => $this->options['chart_axis_mapping'], ); + $form['chart_axis_mapping_label'] = array( + '#title' => t('Chart Axis Mapping labels'), + '#type' => 'textfield', + '#description' => t('Each axis label need to be placed as comma(,) separtor.'), + '#size' => '60', + '#default_value' => $this->options['chart_axis_mapping_label'], + ); + $form['chart_axis_mapping_type'] = array( + '#title' => t('Chart Axis Mapping type'), + '#type' => 'textfield', + '#description' => t('Each axis data type need to be placed as comma(,) separtor.'), + '#size' => '60', + '#default_value' => $this->options['chart_axis_mapping_type'], + ); $form['chart_type'] = array( '#type' => 'radios', '#title' => t('Chart type'), - '#options' => array('BarChart' => t('Bar Chart'),'PieChart' => t('Pie Chart'),'ColumnChart' => t('Column Chart'),'Timeline' => t('Timeline'),'OrgChart' => t('Organization Chart')), + '#options' => array('BarChart' => t('Bar Chart'),'Calendar' => t('Calendar'),'PieChart' => t('Pie Chart'),'ColumnChart' => t('Column Chart'),'Timeline' => t('Timeline'),'OrgChart' => t('Organization Chart')), '#default_value' => $this->options['chart_type'], ); $form['chart_type_stacked'] = array( @@ -77,15 +91,23 @@ class ViewsSimplechartPluginStyle extends views_plugin_style { '#default_value' => $this->options['chart_height'], ); } - + function render() { $barchart = $this->render_fields($this->view->result); - $chartdata[] = explode(',', $this->options['chart_axis_mapping']); + $label = explode(',', $this->options['chart_axis_mapping_label']); + $type = explode(',', $this->options['chart_axis_mapping_type']); + for ($n = 0;$n < count($label); $n++) { + $chartdata_columns[] = array( + 'label' => $label[$n], + 'type' => $type[$n] + ); + } + $chartdata[] = $chartdata_columns; foreach($barchart as $row) { $chartdata[] = array_values($row); } $chartdata = json_encode($chartdata, JSON_NUMERIC_CHECK); - if ($this->options['chart_type'] == 'Timeline') { + if ($this->options['chart_type'] == 'Timeline' || $this->options['chart_type'] == 'Calendar') { $chartdata = preg_replace('/"(\d+)-(\d+)-(\d+)"/i', 'new Date(\'$1-$2-$3\')', $chartdata); } return theme('views_simplechart_graph', array('barchart' => $chartdata, 'metadata' => $this->options)); diff --git a/sites/all/modules/views_simplechart/views-simplechart-graph.tpl.php b/sites/all/modules/views_simplechart/views-simplechart-graph.tpl.php index 4012c04..5157901 100644 --- a/sites/all/modules/views_simplechart/views-simplechart-graph.tpl.php +++ b/sites/all/modules/views_simplechart/views-simplechart-graph.tpl.php @@ -1,5 +1,7 @@ +
-
\ No newline at end of file + diff --git a/sites/all/modules/views_simplechart/views_simplechart.info b/sites/all/modules/views_simplechart/views_simplechart.info index 95a206b..a7ea16e 100644 --- a/sites/all/modules/views_simplechart/views_simplechart.info +++ b/sites/all/modules/views_simplechart/views_simplechart.info @@ -8,4 +8,3 @@ version = "7.x-1.1" core = "7.x" project = "views_simplechart" datestamp = "1479888543" - diff --git a/sites/all/modules/views_simplechart/views_simplechart.module b/sites/all/modules/views_simplechart/views_simplechart.module index 9d06f2f..6d2d4dc 100644 --- a/sites/all/modules/views_simplechart/views_simplechart.module +++ b/sites/all/modules/views_simplechart/views_simplechart.module @@ -22,11 +22,3 @@ function views_simplechart_theme(){ ), ); } - -/** - * Implements hook_html_head_alter(). - */ -function views_simplechart_html_head_alter(&$head_elements) { - drupal_add_js('https://www.gstatic.com/charts/loader.js', 'external'); - drupal_add_js('jQuery(document).ready(function () { google.charts.load(\'current\', {\'packages\':[\'corechart\',\'timeline\',\'orgchart\']}); });', 'inline'); -} \ No newline at end of file