Dynamic colors for bar charts? [message #88589] |
Mon, 07 November 2005 19:59  |
Eclipse User |
|
|
|
Originally posted by: jaredburns.no.spam.acm.org
Are there plans to add support for dynamic colors in bar charts for the
2.0 release?
For example, I might want bars to appear red for a value in the range
0-33, yellow for 34-66, or green if the value is 67-100.
I wasn't able to find a bug report for this request, but I could just be
missing it.
|
|
|
Re: Dynamic colors for bar charts? [message #88647 is a reply to message #88589] |
Tue, 08 November 2005 02:25   |
Eclipse User |
|
|
|
About version 2.0 I cannot say, but you can use scripting, to achieve want
you want.
Go to the report builder into the scripts area and enter following function:
function beforeDrawElement(dataPointHints, fill)
{
val = dataPointHints.getOrthogonalValue(); // get orthogonal value of each
bar
if ((val >= 0) && (val <= 33))
fill.set(255, 0, 0); // red
else if ((val >= 34) && (val <= 66))
fill.set(255, 255, 0); // yellow
else if ((val >= 67) && (val <= 100))
fill.set(0, 255, 0); // green
}
The bar color will change for each bar depending on the orthogonal value.
hth,
Mr. Burns
|
|
|
Re: Dynamic colors for bar charts? [message #90337 is a reply to message #88647] |
Fri, 11 November 2005 17:51   |
Eclipse User |
|
|
|
Originally posted by: jaredburns.no.spam.acm.org
Thanks for the tip. That sounds good, but it's not working for me. Just
to make sure I'm putting this script code in the right place...
I'm double-clicking my chart on the Layout tab of the report editor.
This brings up a dialog with a "Scripts" page. Is this the area I should
place this script? If so, do I need to adjust the normal color setting
for the bars somehow so the script will take precedence?
Thanks,
- Jared
Mr. Burns wrote:
> About version 2.0 I cannot say, but you can use scripting, to achieve want
> you want.
>
> Go to the report builder into the scripts area and enter following function:
>
> function beforeDrawElement(dataPointHints, fill)
> {
> val = dataPointHints.getOrthogonalValue(); // get orthogonal value of each
> bar
>
> if ((val >= 0) && (val <= 33))
> fill.set(255, 0, 0); // red
> else if ((val >= 34) && (val <= 66))
> fill.set(255, 255, 0); // yellow
> else if ((val >= 67) && (val <= 100))
> fill.set(0, 255, 0); // green
> }
>
> The bar color will change for each bar depending on the orthogonal value.
>
> hth,
>
> Mr. Burns
>
>
|
|
|
Re: Dynamic colors for bar charts? [message #90454 is a reply to message #90337] |
Mon, 14 November 2005 03:16  |
Eclipse User |
|
|
|
Hello,
yes, what you wrote is the place where you should add the script.
And yes, you must set the color of the label first, otherwise the script has
no effect.
The color you can change under chart builder Attributes-->Y-Series-->Labels
then click the [...] button on the right side of the font text box.
If you not set the color first, a XML attribute is missing in the
*.rptdesign (XML) file and the script has no effect!
For details see also my post:
Subject: After update to 2.0 still problems with color
Date: Wednesday, 9. November 2005 11:03
Hope that helps!
|
|
|
Powered by
FUDForum. Page generated in 0.03231 seconds