Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » How to control the color of line chart?
How to control the color of line chart? [message #369037] Wed, 22 July 2009 08:28 Go to next message
zhen yang is currently offline zhen yangFriend
Messages: 3
Registered: July 2009
Junior Member
Hi,

In our project, we need to change the line color based on Y axis value,
e.g. when the Y axis value less then 80, the color of the corresponding
part of line is green, when the y axis value greater then 80, the color of
the corresponding part of line is red, so that at last, the line will be
make up of 2 colors. Not sure if it's possible to implement with BIRT?

Really appreciated if you could help on this!!

Thanks
Zhen Yang
Re: How to control the color of line chart? [message #369069 is a reply to message #369037] Sun, 26 July 2009 14:29 Go to previous messageGo to next message
zhen yang is currently offline zhen yangFriend
Messages: 3
Registered: July 2009
Junior Member
Not sure if I described clearly, is anybody have any idea on this?
Re: How to control the color of line chart? [message #369070 is a reply to message #369069] Mon, 27 July 2009 00:01 Go to previous message
Eclipse UserFriend
Originally posted by: johnw.innoventsolutions.com

Sorry, I thought I posted a reply.

Yes, if you override the beforeDrawDataPoint, you can conditionally
color chart elements. You can do the same thing with lines as well.
Below is an example, taken from
http://marklorenz.blogspot.com/2006/02/birt-tips-for-java-de velopers.html,
but its for Bar Charts. The same idea should apply to line charts as well.

function beforeDrawDataPoint(
dataPointHints, fill, scriptContext ){
val = dataPointHints.getOrthogonalValue();
chart = scriptContext.getChartInstance();
marker =
chart.getAxes().get(0).getAssociatedAxes().get(0).getMarkerL ines().get(0).getValue().getValue();
if (val > marker) //crosses marker?
fill.set(255, 0, 0); //yes - display in red
else
fill.set(0, 0, 255); //no - display in blue
}

zhen yang wrote:
> Not sure if I described clearly, is anybody have any idea on this?
>
Previous Topic:chart sample on birt 2.3.1 and eclipse 3.4.1
Next Topic:Bug or noskilled?
Goto Forum:
  


Current Time: Tue Apr 16 23:22:24 GMT 2024

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

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

Back to the top