Hi, all,

I have write a small module that integrate Google Visualization API with charts module, LIneChart, BarChart, ColumnChart are supported.

The code is in the attachment. I hope this will be included in the future version of charts module.

Comments

brmassa’s picture

Assigned: Unassigned » brmassa

李凌,

i will take a better look into this code soon, probably next week. Its a great addon. Remember that i will make some changes on Charts schema, but it will be on the next release.

regards,

massa

brmassa’s picture

Status: Needs review » Closed (fixed)

李凌,

the code simply doesnt work.

regards,

massa

hazzadous’s picture

Its still using I presume an old API, for example _chartsinfo hook should be _charts_info plus it takes an op arg. Looks like it would be easy to amend. I've only just glanced over the Charts API, but am keen to see this in a branch. Its a must for Flashphodic types. This, and plotr looks good, although it looks like there could be a namespace clash with jquery and prototype?

abhiabhi’s picture

i m new to drupal.

I want to know how to use this module???
like which function need to be called when to print a bar-chart & with what parameters?

Thank you.

sakiland’s picture

Version: 6.x-1.0-alpha4 » 6.x-1.x-dev
Status: Closed (fixed) » Needs review
StatusFileSize
new11.07 KB

I hava made a new module for Google visualization. For now, it only work for Line chart.

It's need '#id' key to work. Here is example code

  $h_axis = array('2011-09-01', '2011-09-02');
  $v_axis = array(20.5, 30.2);
  $chart = array(
    '#id' => 'chart-id',
    '#plugin' => 'google_visualization', // Google Charts API will be used
    '#type' => 'line2D', // To show a simple 2D line chart
    '#height' => 100, // in pixels
    '#width' => 150, // in pixels
    '#color' => '336699', // background color, in RRGGBB format
    '#title' => t('Title'), // The chart title
    $h_axis, $v_axis,
  );
  $output = charts_chart($chart);
  
  // This function draw all charts.
  google_visualization_charts_draw_all();

I have problem with drawing more than one chart on same page. I has involved google_visualization_charts_draw_all() function that cache all charts, and drawing at the end. Problem is when more modules want to draw charts on same page. I'm looking for better solution. If someone get same idea it would be great.

sakiland’s picture

StatusFileSize
new11.13 KB

Here's new code with #options enabled for Google Visualization api. You can use any of following http://code.google.com/apis/chart/interactive/docs/gallery/linechart.htm...

Example code

  // Set options.
  $options = array(
    'hAxis' => array('title' => 'Horizontal axis title'),
    'vAxis' => array('title' => 'Vertical axis title'),
  );

  $h_axis = array('#legend' => array('Legend for first column.'), '2011-09-01', '2011-09-02');
  $v_axis = array('#legend' => array('Legend for second column.'), 20.5, 30.2);
  $chart = array(
    '#id' => 'chart-id', // This must be unique if you have more charts per page.
    '#plugin' => 'google_visualization', // Google Charts API will be used
    '#type' => 'line2D', // To show a simple 2D line chart
    '#height' => 100, // in pixels
    '#width' => 150, // in pixels
    '#color' => '336699', // background color, in RRGGBB format
    '#title' => t('Title'), // The chart title
    $h_axis, $v_axis,
  );
  $output = charts_chart($chart);
  
  // This function draw all charts.
  google_visualization_charts_draw_all();
budda’s picture

Will there ever be a final Visualisation API implementation released?

quicksketch’s picture

Status: Needs review » Closed (fixed)

The D6 version of the module is no longer being updated. The 7.x-2.x version of the module provides Google Visualization support out-of-the-box.