Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Dynamic coloring a result(how to change the font color by parameter.)
Dynamic coloring a result [message #871200] Fri, 11 May 2012 12:04 Go to next message
Filipe Apóstolo is currently offline Filipe Apóstolo
Messages: 4
Registered: May 2012
Junior Member
Hello,

I have a xml file which contains in one of its parameters an item and a color value in hexadecimal format.

And I want to List the items, but I would like that the font color of each item was the color of the value which results in color colum.

Example:
....
<myitem color= "#0080ff"> myitemNameA </myitem>
<myitem color= "#990000"> myitemNameB </myitem>

I retrive the columns ItemName and ItemColor (OK), and i want to generate the following output:
Items List
Name Other item properties
myitemNameA
myitemNameB

But i can't find hoe to place an expression in the color font.

Is it possible to do this? I could use styles however I had to create a style for each possible colors (it wold take me some hours,lol)

Is there any solution out there?
Re: Dynamic coloring a result [message #871269 is a reply to message #871200] Fri, 11 May 2012 17:26 Go to previous message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Use an onCreate script on the data item with something like the following:


//get the column binding for the font color
var fc = this.getRowData().getColumnValue("FontColor");
this.getStyle().color= fc;

Jason


On 5/11/2012 8:04 AM, Filipe Apóstolo wrote:
> Hello,
>
> I have a xml file which contains in one of its parameters an item and a
> color value in hexadecimal format.
>
> And I want to List the items, but I would like that the font color of
> each item was the color of the value which results in color colum.
>
> Example:
> ....
> <myitem color= "#0080ff"> myitemNameA </myitem>
> <myitem color= "#990000"> myitemNameB </myitem>
>
> I retrive the columns ItemName and ItemColor (OK), and i want to
> generate the following output: Items List
> Name Other item properties
> myitemNameA
> myitemNameB
>
> But i can't find hoe to place an expression in the color font.
>
> Is it possible to do this? I could use styles however I had to create a
> style for each possible colors (it wold take me some hours,lol)
>
> Is there any solution out there?
>
Previous Topic:Report max generation time
Next Topic:How to display zero value
Goto Forum:
  


Current Time: Fri Oct 24 13:46:49 GMT 2014

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

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