Dynamic colors for bar charts? [message #88589] |
Tue, 08 November 2005 00: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 07:25 |
mr. burns Messages: 402 Registered: July 2009 |
Senior Member |
|
|
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 22: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
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.04282 seconds