| 
| dynamically change bar filling [message #195335] | Fri, 13 October 2006 06:25  |  | 
| Eclipse User  |  |  |  |  | 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  |  | 
| Eclipse User  |  |  |  |  | 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,
 >
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.02685 seconds