Table - Row Color

I have a table with the parameters of a graph (pens).
In a cell, the color of the pen is displayed, format : color(xxx,xxx,xxx,xxx)

Is there any way to colorize the row or the cell with the value of the cell ?

Here is what you can do:

  1. Add a dynamic property to the table called bgColorList that is a string.

  2. Add the following propertyChange event script to the table component:[code]if event.propertyName == “data”:
    data = system.dataset.toPyDataSet(event.newValue)
    bgColorList = “”

    for row in data:
    color = row[“Color”]
    bgColorList += “%s%s” % (color, color)

    bgColorList += “”

    event.source.bgColorList = bgColorList[/code]Replace the row[“Color”] with your color column name

  3. Lastly, bind the Column Attributes Data dataset property of the table to a Cell Update binding. Select the bgcolorMap column from the row that is your color column. Press the green + to add a new row below. Select the row and click on the property link to the right hand side to bind it to the bgColorList property of the table.

That’s it! Try it out and let us know if you have any questions.

the script does not work.

In the table, the value of the cell is : color(xxx,xxx,xxx,xxx).
In the Background Columm List, the value is : java.awt.Color[r=xxx,g=xxx,b=xxx].

How to convert the value ?

The keys in your mapping should be the exact same value as in the table. When we set the bgColorList we are using the value from the table cell which is color(x,x,x,x). I don’t know how you got a string with java.awt.Color…

My only guess is that the value in the table is not what we think. If you click on the table view button next to the data property of the table what is the data type of the column with the color? Just click on the column to see the data type below.