How to change JFreeChart Line Chart color

Hi,

The Line Chart (JFree Chart) node by default plots a red line. If you feed it with multiple columns the lines get different colors. But is it possible to change the color of a single line plot? I know coloring information can be fed somehow in the lower port but a unsure how to do this for a single line (column).

Any tips appreciated!

Thanks/Evert

Hi Evert,

At moment I just find this method: use the following two nodes:

"table creator" + "color manage" => the second port of the "Line Chart(JFree Chart)"

"table creator": you create a table just with one column, the column values are your to be plotted column names.

"color manage": set your colors. :)

Best Regards,

Ying

Hi,

it is a little bit easier with the following method (from the node description of the LineChart)

The second in-port provides the possibility to specify colors for the different lines/columns in the plot. Therefore append a Extract Column Header and Transpose node to the data table which should be plotted in this node. Afterwards use the Color Manager to append the colors based on the individual column names. The node automatically selects the column from the Color Manager and assigns the color values to the plotted columns. 

 

Cheers, Iris 

 

Hi,

Thanks for this. The thing is that I need to plot multiple single line plots (one after another, in separate plots), which works fine with a column list loop.

But how can I achieve that the color of the line in each graph is set to black?

The flow based on the image below stalls att the color manager.

Thanks/Evert

Use the Regex Column Rename to rename the current column to “Current Target” or whatever (set the find to be the current column in flow variables). Then change the color of that column via the color manager - that way the color manager specs don’t change through the loop. Finally, use another Regex Column Rename to change the name of the column back to the current iteration.

1 Like

Hi,

How can I set a fixed color for a column containing double values in the Color Manager?

Thanks/Evert

You can only set colors based on nominal values. The color would be assigned to the categories to which these values belong row-wise. If they are from different classes, you will need to bring that class column into the loop. If you are classifying the doubles (e.g. above or below 0), you will need to use a numeric binner node to assign these doubles into categories, then apply colors.

1 Like