Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » How to design a bubble chart (Data points with a same measure value are merged)
How to design a bubble chart [message #1136313] Sun, 13 October 2013 20:35 Go to next message
donino donino is currently offline donino doninoFriend
Messages: 183
Registered: July 2011
Senior Member
Hi,

I want to create an economical report using BIRT bubble chart. For example with these indicators:
Bubble size = GDP (current $)
Y-Axis = GDP Growth (%)
X-axis = Trade (%)

With libreoffice i get exactly what i want:

index.php/fa/16452/0/

With BIRT here is what i get:

index.php/fa/16453/0/

Firstly, although the country name is in the dataset used by the chart, it seems it is not possible to display it as a bubble label. We can only display measure values.

Much more nasty, as you can see USA and Japan have been merged in a huge single bubble (17640=12992 billions (USA)+4648 billions (JPN), because they have exactly the same "trade" value on x-axis. This is definitely not what we need! I tried to set the countryID as Y-optional-grouping but it didn't help: with this Y grouping all bubbles had a 0 value for Y-axis.

Is it possible to avoid bubbles to be merged when they have the same value on x-axis?

Thanks


  • Attachment: bubble.png
    (Size: 38.19KB, Downloaded 2134 times)
  • Attachment: bubble-birt.png
    (Size: 10.77KB, Downloaded 2102 times)
Re: How to design a bubble chart [message #1142127 is a reply to message #1136313] Thu, 17 October 2013 12:10 Go to previous messageGo to next message
donino donino is currently offline donino doninoFriend
Messages: 183
Registered: July 2011
Senior Member
Hi, i didn't find a workaround yet. Please has anyone implemented a bubble chart, or know where i could find a simple example? Is it possible to avoid bubbles to be merged when they have the same value on x-axis?
Re: How to design a bubble chart [message #1143045 is a reply to message #1142127] Fri, 18 October 2013 01:19 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Sorry for the delay. What you'll need to do is go to the select data tab of the chart editor, select the sorting and grouping button next to the x-axis field, and deselect grouping. Next, you need to go to the format chart tab and choose the x-axis category on the left side, then deselect the is category axis check box. That should do it.

Michael

Developer Evangelist, Silanis
Re: How to design a bubble chart [message #1147124 is a reply to message #1143045] Sun, 20 October 2013 17:16 Go to previous messageGo to next message
donino donino is currently offline donino doninoFriend
Messages: 183
Registered: July 2011
Senior Member
Great!

Thanks to your help i was able to get a very satisfactory result. Furthermore i have set bubble labels using the approach you described in this topic.

However it is hard to control the size of bubbles, i would like to reduce this overlapping:

index.php/fa/16505/0/

i tried the script suggested by Jason here: it helped to reduce the difference between the largest bubble and the others, but we can't make bubbles smaller here: for example if we divide all sizes by half with a such script it won't change anything, bubble areas are automatically adjusted consequently.

Is there any tip through chart scripting to control the size of displayed bubbles?

It would be great if we could set through Eclipse designer the diameter in pixels of the max bubble, and then the chart engine would compute all other bubble diameters accordingly Smile

[Updated on: Sun, 20 October 2013 18:07]

Report message to a moderator

Re: How to design a bubble chart [message #1148626 is a reply to message #1147124] Mon, 21 October 2013 16:39 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Do you happen to have an example I can run with the overlap that I can test on? If not, what's your BIRT version and I'll look into it closer.

Michael

Developer Evangelist, Silanis
Re: How to design a bubble chart [message #1701612 is a reply to message #1148626] Tue, 14 July 2015 12:43 Go to previous messageGo to next message
Michael Reiter is currently offline Michael ReiterFriend
Messages: 6
Registered: June 2015
Junior Member
Greetings,

I have the same problem, that I want to plot a text in the bubble.
Quote:
Thanks to your help i was able to get a very satisfactory result. Furthermore i have set bubble labels using the approach you described in this topic.


Unfortunately the topic is no longer active: /forum/index.php?/topic/19874-customize-series-labels-in-bubble-chart/

Can you help me?
Thank you!
Michael
Re: How to design a bubble chart [message #1701774 is a reply to message #1701612] Wed, 15 July 2015 14:02 Go to previous message
donino donino is currently offline donino doninoFriend
Messages: 183
Registered: July 2011
Senior Member
I had a look at the report-design of the sample mentionned above. First a comma-separated list of labels is built in a global variable, using the onCreate script of a hidden table:

if (countries == ""){
	countries = row["countryID"];
}
else{
	countries+=","+row["countryID"]
}



This global var is stored in a persistent variable, so that it can be accessed in chart scripts.

Then, in "beforeDrawDataPointLabel" event of the chart we update labels using this comma-separated list. "countries" and "nameIDX" are initialized at the beginning of "onRender" script of the chart.

nameIDX=0;
countries=null;

function beforeDrawDataPointLabel( dph, label, icsc )
{
	if (countries==null){
		countries = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("countries");
		countries = countries.split(",");
	}

	label.getCaption().setValue(countries[nameIDX]);
	nameIDX++;

}


BTW, it was necessary to use a square root function on values to get a correct bubble sizing. In the "size" property of the chart:

Math.sqrt(row["value1"]);


This example is available here.

[Updated on: Thu, 16 July 2015 06:20]

Report message to a moderator

Previous Topic:Multiple Values to Display in a row
Next Topic:HTML Entities in Private Font Area
Goto Forum:
  


Current Time: Wed Sep 25 10:15:36 GMT 2024

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

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

Back to the top