Skip to main content



      Home
Home » Archived » BIRT » dynamically change bar filling
dynamically change bar filling [message #195335] Fri, 13 October 2006 06:25 Go to next message
Eclipse UserFriend
Hello,
I'm changing my bars' color with this script :

previousFill = new Object();// used for restoring the fill for the next
element

function beforeDrawDataPoint(dataPointHints, fill, context) {
previousFill.r = fill.getRed();
previousFill.g = fill.getGreen();
previousFill.b = fill.getBlue();

[... dynamic condition]
if (condition) fill.set(255, 0, 0);
}
function afterDrawDataPoint(dataPointHints, fill, context) {
fill.set(previousFill.r, previousFill.g, previousFill.b);
}

How can I change more in the bars' aspect ? I like to set the color (here
red) as a gradient end, rather than a full filling.

Something like this ?
var red = new fill(255, 0, 0);
if (condition) fill.setGradient(previousFill, red);

Thanks for any help,
Re: dynamically change bar filling [message #196220 is a reply to message #195335] Wed, 18 October 2006 10:46 Go to previous message
Eclipse UserFriend
You need to set a gradient from the beginning as your color in the original
chart model's palette. Scripting can't change the class types at runtime.

Then the fill will be a org.eclipse.birt.chart.model.attribute.Gradient
instance with a start and end color.

Thanks,

David

"Thomas Escolan" <thomas_escolan@yahoo.fr> wrote in message
news:4d1571ecb6f63f50ace81805cfd4f97f$1@www.eclipse.org...
> Hello,
> I'm changing my bars' color with this script :
>
> previousFill = new Object();// used for restoring the fill for the next
> element
>
> function beforeDrawDataPoint(dataPointHints, fill, context) {
> previousFill.r = fill.getRed();
> previousFill.g = fill.getGreen();
> previousFill.b = fill.getBlue();
>
> [... dynamic condition]
> if (condition) fill.set(255, 0, 0);
> }
> function afterDrawDataPoint(dataPointHints, fill, context) {
> fill.set(previousFill.r, previousFill.g, previousFill.b);
> }
>
> How can I change more in the bars' aspect ? I like to set the color (here
> red) as a gradient end, rather than a full filling.
>
> Something like this ?
> var red = new fill(255, 0, 0);
> if (condition) fill.setGradient(previousFill, red);
>
> Thanks for any help,
>
Previous Topic:Create step-line chart
Next Topic:arbitrary string label for scatter data point, instead of values
Goto Forum:
  


Current Time: Wed Apr 30 19:45:00 EDT 2025

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

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

Back to the top