Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Use same colour for series in multi-bar chart
Use same colour for series in multi-bar chart [message #1257579] Wed, 26 February 2014 15:37 Go to next message
Eclipse UserFriend
Hi,

I'm using the BIRT chart API in Eclipse. I've created a multi-bar chart using two series (i.e. {1, 2, 3, 4} and {4, 5, 6, 3} as the y-values for some x-values). The chart is attached as image1 and shown here.

index.php/fa/17574/0/

As you can see, the bars for each x-value have the same colour! What I want is for the bars for each series to have the same colour. In other words, the first bar for each x-value would be blue and the second bar for each x-value would be red. See attached "correctimage".

index.php/fa/17576/0/

I have tried everything to get this to work but have not had any luck. Specifically:

- I can get all the bars to be the exact same colour by setting the entries in seriesPalette for the x-axis series definition to be the same (attached as image2):

sdX.getSeriesPalette().getEntries().clear();
sdX.getSeriesPalette().getEntries().add(ColorDefinitionImpl.create(100, 0, 0, 210));
sdX.getSeriesPalette().getEntries().add(ColorDefinitionImpl.create(100, 0, 0, 210));

index.php/fa/17575/0/

- I have tried to use multiple x-axes, multiple y-axes, but no luck.
- I have to tried to call "sdY.getSeriesPalette().update(f)" as I've seen in some places, but no luck.

How does one do this?!

Thanks for your help.
  • Attachment: image1.png
    (Size: 18.47KB, Downloaded 1881 times)
  • Attachment: image2.png
    (Size: 20.43KB, Downloaded 1665 times)
  • Attachment: correctimage.png
    (Size: 88.26KB, Downloaded 1725 times)
Re: Use same colour for series in multi-bar chart [message #1257618 is a reply to message #1257579] Wed, 26 February 2014 16:27 Go to previous messageGo to next message
Eclipse UserFriend
It seems your chart is setup to color items by category. There is an option which allows to color by series:

index.php/fa/17577/0/

I hope it helps

[Updated on: Wed, 26 February 2014 16:28] by Moderator

Report message to a moderator

Re: Use same colour for series in multi-bar chart [message #1257699 is a reply to message #1257618] Wed, 26 February 2014 18:01 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Thank you for your response. As I mentioned, I'm using the BIRT API in Eclipse (Java code) and not the BIRT report/chart tool...

Would you know what API would let me change how the series is coloured (i.e. instead of by category, use by "value series"?

Thanks.
Re: Use same colour for series in multi-bar chart [message #1257737 is a reply to message #1257699] Wed, 26 February 2014 18:47 Go to previous messageGo to next message
Eclipse UserFriend
I found this API to setColorByCategory, but this is in IChart in the script.api package... My Chart object is an instance of IChartObject in the org.eclipse.birt.chart.model package.

http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.birt.chart.doc.isv%2Fchartscript%2Fapi%2Forg%2Feclipse%2Fbirt%2Fchart%2Fscript%2Fapi%2FIChart.html
Re: Use same colour for series in multi-bar chart [message #1257937 is a reply to message #1257737] Wed, 26 February 2014 23:42 Go to previous messageGo to next message
Eclipse UserFriend
I don't know much about the design engine API sorry, i hope someone else will be able to help
Re: Use same colour for series in multi-bar chart [message #1258643 is a reply to message #1257937] Thu, 27 February 2014 15:48 Go to previous message
Eclipse UserFriend
SUCCESS!!!

chart.getLegend().setItemType(LegendItemType.SERIES_LITERAL);

LegendItemType controls the same setting you showed in your drop-down. The two choices are SERIES_LITERAL or CATEGORIES_LITERAL.

All is well with the world.
Previous Topic:BIRT download link doesnt work..is there any work around?
Next Topic:Report Runs in Kepler But Not in Birt Viewer
Goto Forum:
  


Current Time: Thu Feb 13 10:48:58 GMT 2025

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

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

Back to the top