Thanks for the effort in this, nice implementation IMO.

Following on the example module, which was all pie charts, I was unable to create a vertical chart - the titles and colors wouldn't work. Colors for example were all the same color even when I double checked. Is this just me?

Comments

tjholowaychuk’s picture

Thanks! The bar charts are a little counter-intuitive when it comes to coloring, since Google envisioned every bar chart as being an array of datasets. If you look at the "Bar sizing & color mapping" example near the bottom of http://code.google.com/p/drupal-chart-api/wiki/Examples I think that might clear things up a bit.

For example with the node count pie chart, this will switch it to a bar chart (labels will be messed):

Before:

      while ($result = db_fetch_array($results)){
        $chart['#data'][]        = $result['count'];
        $chart['#labels'][]      = $result['type'].': '.$result['count'];
        $chart['#data_colors'][] = chart_unique_color($result['type']);
      }                     
      
      $chart['#chart_id'] = $type;
      $chart['#title']    = chart_title($title);
      $chart['#type']     = CHART_TYPE_PIE;
      $chart['#size']     = chart_size(600, 350); 

After:

      while ($result = db_fetch_array($results)){
        $chart['#data'][]        = array($result['count']); // Changed
        $chart['#labels'][]      = $result['type'].': '.$result['count'];
        $chart['#data_colors'][] = chart_unique_color($result['type']);
      }                     
      
      $chart['#chart_id'] = $type;
      $chart['#title']    = chart_title($title);
      $chart['#type']     = CHART_TYPE_BAR_V; // Changed
      $chart['#size']     = chart_size(600, 350); 
boombatower’s picture

Status: Active » Fixed

Please re-open if still having issues.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.