Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Pie Chart Legend Auto-Size?
Pie Chart Legend Auto-Size? [message #368384] Wed, 27 May 2009 10:37 Go to next message
Andrew Walmsley is currently offline Andrew WalmsleyFriend
Messages: 12
Registered: July 2009
Junior Member
Hi,
I have a pie chart where the legend doesn't fit.

I found the following in the news archive
http://dev.eclipse.org/newslists/news.eclipse.birt/msg17809. html
"David Michonneau" <dmichonneau@xxxxxxxxxxx> wrote in message
news:etobgi$vra$1@xxxxxxxxxxxxxxxxxxxx
> You don't see all legend entries, because there is no space for them. you
> can reduce the font size of your legend entries if you don't want to make
> the chart bigger.
However, I have a variable number of categories that will appear in the
report, and would prefer not to make the standard chart large enough to hold
all possible values.Is there a way to make the size of chart expand to the
legend size?(The Pie chart is a report on sales from source over a set
period, so several sources may not have sold anything over the period being
charted.)eclipse 3.4.2 (and about to update to the latest as I just
discovered it isn't auto-updating!)ThanksAndrew Walmsley
Re: Pie Chart Legend Auto-Size? [message #368398 is a reply to message #368384] Wed, 27 May 2009 17:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.windstream.net

Andrew,

You should be able to add some script to resize based on data points.
Take a look at this post:
http://birtworld.blogspot.com/2008/04/birt-resizing-charts.h tml

In BIRT 2.5 you can also control the percentage of chart space devoted
to the plot. Take a look at:
http://www.eclipse.org/birt/phoenix/project/notable2.5M6.php #jump_2


Jason

Andrew Walmsley wrote:
> Hi,
> I have a pie chart where the legend doesn't fit.
>
> I found the following in the news archive
> http://dev.eclipse.org/newslists/news.eclipse.birt/msg17809. html
> "David Michonneau" <dmichonneau@xxxxxxxxxxx> wrote in message
> news:etobgi$vra$1@xxxxxxxxxxxxxxxxxxxx
>> You don't see all legend entries, because there is no space for them. you
>> can reduce the font size of your legend entries if you don't want to make
>> the chart bigger.
> However, I have a variable number of categories that will appear in the
> report, and would prefer not to make the standard chart large enough to hold
> all possible values.Is there a way to make the size of chart expand to the
> legend size?(The Pie chart is a report on sales from source over a set
> period, so several sources may not have sold anything over the period being
> charted.)eclipse 3.4.2 (and about to update to the latest as I just
> discovered it isn't auto-updating!)ThanksAndrew Walmsley
>
>
Re: Pie Chart Legend Auto-Size? [message #368416 is a reply to message #368398] Thu, 28 May 2009 09:33 Go to previous message
Andrew Walmsley is currently offline Andrew WalmsleyFriend
Messages: 12
Registered: July 2009
Junior Member
Thanks, that did it.

I need to play with the numbers and actually make it check font size etc.
but the below works for my mickey mouse test case.

function beforeGeneration( chart, icsc )

{

seriesDefArray = chart.getSeriesForLegend();

seriesDef=seriesDefArray[0];

runSeries = seriesDef.getRunTimeSeries()[0];

list = runSeries.getDataSet().getValues();

defaultHeight = 200;

//units are pixels????

//1 line of text is 10 px ish

lineHeight = 10;

// 8 list items fit into a 200 tall chart

increaseBy=lineHeight*(list.length-8);

if(increaseBy>0){

increaseTo=defaultHeight+increaseBy;

chart.getBlock().getBounds().setHeight(increaseTo);

}

else{

chart.getBlock().getBounds().setHeight(defaultHeight);

}

}




"Jason Weathersby" <jasonweathersby@windstream.net> wrote in message
news:gvjri5$vrn$1@build.eclipse.org...
> Andrew,
>
> You should be able to add some script to resize based on data points. Take
> a look at this post:
> http://birtworld.blogspot.com/2008/04/birt-resizing-charts.h tml
>
> In BIRT 2.5 you can also control the percentage of chart space devoted to
> the plot. Take a look at:
> http://www.eclipse.org/birt/phoenix/project/notable2.5M6.php #jump_2
>
>
> Jason
>
> Andrew Walmsley wrote:
>> Hi,
>> I have a pie chart where the legend doesn't fit.
>>
>> I found the following in the news archive
>> http://dev.eclipse.org/newslists/news.eclipse.birt/msg17809. html
>> "David Michonneau" <dmichonneau@xxxxxxxxxxx> wrote in message
>> news:etobgi$vra$1@xxxxxxxxxxxxxxxxxxxx
>>> You don't see all legend entries, because there is no space for them.
>>> you
>>> can reduce the font size of your legend entries if you don't want to
>>> make
>>> the chart bigger.
>> However, I have a variable number of categories that will appear in the
>> report, and would prefer not to make the standard chart large enough to
>> hold all possible values.Is there a way to make the size of chart expand
>> to the legend size?(The Pie chart is a report on sales from source over a
>> set period, so several sources may not have sold anything over the period
>> being charted.)eclipse 3.4.2 (and about to update to the latest as I just
>> discovered it isn't auto-updating!)ThanksAndrew Walmsley
Previous Topic:A strange bug when using many tables
Next Topic:Interactivity on a SWT Chart Viewer
Goto Forum:
  


Current Time: Fri Apr 26 20:41:53 GMT 2024

Powered by FUDForum. Page generated in 0.02769 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top