pChart 2.x forum
http://wiki.pchart.net/forum/

Pie chart legend size
http://wiki.pchart.net/forum/viewtopic.php?f=1&t=2250
Page 1 of 1

Author:  rossati [ Sat Nov 19, 2011 2:51 am ]
Post subject:  Pie chart legend size

Hello

The getLegendSize function return the size of the data series name, wich is not useful for the pie chart legend.
How can I obtain the size of pie chart legend?

best regards

John Rossati

Author:  rossati [ Fri Nov 25, 2011 11:34 pm ]
Post subject:  Re: Pie chart legend size

Thanks Dan

I would the width of drawPieLegend for adjust to right (how you are suggesting).

best regards

John Rossati

Author:  rossati [ Fri Dec 02, 2011 2:33 pm ]
Post subject:  Re: Pie chart legend size

Hello

I work around in this way:

Code:
      $legParms = array("Style"=>LEGEND_ROUND,"Mode"=>LEGEND_VERTICAL);
      $maxLabelWidth = 0;      // search legend width
      foreach($dt->getValues("Labels") as $v) {
         $dt->setSerieDescription($legend,$v);
         $Size = $graph->getLegendSize($legParms);
         $maxLabelWidth = max($maxLabelWidth,$Size["Width"]);
      }      
      $dt->setSerieDescription($legend,$legend);      // Restore original legend

$legend is a variable wich contains the data name

this fragment is part of my pChart "wrapper"

best regards

John Rossati

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/