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

CommentFileSizeAuthor
#4 bar_sizing-324133-4.patch2 KB13rac1

Comments

zwoop’s picture

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,  
     );
 }
shrthnd’s picture

thanks zwoop! your solution worked like a charm.

giorgio79’s picture

I would need this in Views integration as well, Bar charts look very weird with those small spacing

Example
Weird Bar Chart with this module

As I understand it may be possible to rotate as well the titles?

13rac1’s picture

Version: 6.x-1.2 » 6.x-1.x-dev
Component: Miscellaneous » Code
Status: Active » Patch (to be ported)
StatusFileSize
new2 KB

Patch for code already committed to 7.x-1.x is attached. Includes constants specified in #345550: Support for absolute/relative chart bar sizing. No views support yet.

13rac1’s picture

Status: Patch (to be ported) » Fixed

Manually applied to 6.x-1.x-dev.

Status: Fixed » Closed (fixed)

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