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... :)

CommentFileSizeAuthor
#6 pie5.patch1.59 KBredndahead
#1 piechart.gif3.57 KBAlpha42

Comments

Alpha42’s picture

StatusFileSize
new3.57 KB

Gah, I forgot to attach. :)

redndahead’s picture

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.

Alpha42’s picture

No love, changed line 25 of open_flash_chart_api.module to:

$this->title_style = '{font-size:20px;}';

and same effect. :(

redndahead’s picture

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

Alpha42’s picture

replacing function pie as shown in #4 seems to have done it for me. ;) Many thanks!

redndahead’s picture

StatusFileSize
new1.59 KB

attaching patches.

redndahead’s picture

Well looks like for some reason the d6 patch won't attach. argh look at the d5 and figure it out.

redndahead’s picture

Status: Active » Fixed
redndahead’s picture

Component: Documentation » Code
Category: support » bug
Anonymous’s picture

Status: Fixed » Closed (fixed)

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

ionmedia’s picture

Title: Pie Charts: No font size setting for labels? » Pie Charts label size feature
Version: 6.x-2.6 » 6.x-2.10
Category: bug » support
Status: Closed (fixed) » Active

patch works fine in d6

but how we can separetly change whis value in each pie chart, builded from view chart's function ?

pedrorocha’s picture

The version you said to have this question are old(we are now in 2.12). Are you still needing support?