| Project: | Open Flash Chart API |
| Version: | 6.x-2.10 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
I'm tinkering a bit with all of the various drupal charting modules right now, and well, to be honest, Open flash chart seems to be the way to go.. :)
A huge part of my needs is going to be regurgitating various data in charts that look alot a like, so I decided to whip up little wrappers for my own use (yes, I know, a wrappers, around your API.. the levels of fun..)
Anyway, I have something such as:
function my_util_chart_pie($opts){
// My wrapper, function to make line charts a bit easier to manage in code..
// Build an array (passed here as $opts), containing all the various data/title/labels/etc
// and this does the rest.
$g = new open_flash_chart_api();
$g->set_title($opts['#title'], '{font-size: 14px; color: #ffffff}' );
if ($opts['#width']){ $g->set_width($opts['#width']); } else { $g->set_width(400); }
if ($opts['#height']){ $g->set_height($opts['#height']); } else { $g->set_height(200); }
$g->set_bg_colour('#2b477c');
$g->pie(75,'#ffffff','#6699cc');
$g->pie_values($opts['#values'],$opts['#labels'],$opts['#links']);
$g->pie_slice_colours($opts['#colors']);
return $g->render();
}I've already done a few bar charts using a similar function, and that one works great. The problem I have with pie charts is, I cant seem to figure out how to set the font size for the labels that are passed as part of $g->pie_values. My pie charts all have very little teeny tiny labels in black text. :(
Attached is an example. The labels ("Past Due" and "Open") are there, but veeeery small and black.. I can't figure out how to change that (adjusting the size of the graph makes no difference).
I'm assuming there's a way to do this, but I'm not finding it in any of the documention, and the open flash docs just confuse me further when I try to look to them for guidance... :)
Comments
#1
Gah, I forgot to attach. :)
#2
On line 25 of the module see if this fixes it.
$this->title_style = '{font-size:20px;}';
There's a missing brace at the end of the font-size value.
#3
No love, changed line 25 of open_flash_chart_api.module to:
$this->title_style = '{font-size:20px;}';
and same effect. :(
#4
Ok on line 826 is the function for the pie chart. It doesn't work. You need to replace the function with this one.
function pie($alpha, $line_colour, $label_colour = '#000000', $fontsize = 14){$this->pie = $alpha .','. $line_colour .',{font-size: '. $fontsize . 'px; color: '. $label_colour .'}';
}
Then your call to the pie should work the same.
I'll attach a patch to this issue and probably commit it if you verify it's working for you.
red
#5
replacing function pie as shown in #4 seems to have done it for me. ;) Many thanks!
#6
attaching patches.
#7
Well looks like for some reason the d6 patch won't attach. argh look at the d5 and figure it out.
#8
#9
#10
Automatically closed -- issue fixed for two weeks with no activity.
#11
patch works fine in d6
but how we can separetly change whis value in each pie chart, builded from view chart's function ?
#12
The version you said to have this question are old(we are now in 2.12). Are you still needing support?