Bar chart, spacing between sets

jackbrace - October 21, 2008 - 11:37
Project:Chart API
Version:6.x-1.2
Component:Miscellaneous
Category:feature request
Priority:minor
Assigned:Unassigned
Status:active
Description

hello,

i'm trying to create a bar chart, but i can't get the grid and the bars to align. This is because every set of bars has a spacing of about 8px, while the spacing between the bars themselves can be manualy been set i cannot find an option to set this other spacing. what can i do to set this spacing? (or rather have it take the value of the bar spacing)

thanks, kevin

#1

zwoop - December 23, 2008 - 17:55

Fwiw, I wanted to achieve the same thing, here's a small patch that I came up with

--- chart.module.orig   2008-12-23 09:53:48.000000000 -0800
+++ chart.module        2008-12-23 09:52:01.000000000 -0800
@@ -549,7 +549,7 @@
      
     // Bar chart bar sizing
     case 'chbh':
-      $data[$attr] .= implode(',', array($value['#size'], $value['#spacing']));
+      $data[$attr] .= implode(',', array($value['#size'], $value['#spacing'], $value['#group_spacing']));
       break;
      
      // Mixed axis positions, labels and styles
@@ -1028,10 +1028,11 @@
*
* @return array
*/
-function chart_bar_size($size = 40, $spacing = 20) {
+function chart_bar_size($size = 40, $spacing = 20, $group_spacing = 30) {
   return array(      
       '#size'    => $size, 
       '#spacing' => $spacing, 
+      '#group_spacing' => $group_spacing, 
     );
}

 
 

Drupal is a registered trademark of Dries Buytaert.