bar chart coloring depending on variables

Hi,
currently i’m struggeling with color management at my latest views.
I want to use custom colors at a bar chart depending on values OR column name. :smiling_face_with_tear:

Since a new data set is added every month, the coloring always changes.
grafik

In this Example i colored the Rows by hand. I would like to plot 2022 versus 2023 on a monthly basis.
2022 = grey
2023 = blue (company color)

I tried to manipulate the color model but coudln’t find a solution.
grafik

Coloring via Variables also didn’t work because the input changes…
grafik

So i ran out of ideas…

Hello @StarkKlumppp , welcome to the KNIME forum.

The Bar Chart node works best, if you reshape your data to have one column per year (i.e. group). I guess that would than be one row per month in your case, but I am just guessing here.
Then you can use the Color Manager node to assign colors to the column names. Finally, in the Bar Chart node, set Bar groups to Category values.

I hope this helps. If not, example data always helps to understand problems. Feel free to paste an exemplar table or a small workflow.

Best regards,
nan

1 Like

Hello nan,
thanks for your reply.

Here is an Example:Example_Chart_coloring.knwf (121.5 KB)

I would like to design my workflow in such a way that the end user can choose the year of the display themselves. In the example I have defined everything for 2024.
2024 = blue
2023 = grey
(the previous year should always be displayed in grey)

But if the user now selects 2023 then it should be blue and 2022 should be gray.

Thank’s for your help!

Best regards
Andy

Ok, this is a bit difficult. The simplest way to solve this specific case (which came to my mind) is to assign a color only to the currently selected year and use the default color for the previous year.


Example_Chart_coloring.knwf (97.9 KB)

As a side note, we started to think about how to make cases like this easier with flow variables. This will take some time, but your use case is great input.

P.S. I noted that the Table View uses a different default color than all the other views and opened a ticket to fix this (internal reference UIEXT-1583).

1 Like

Hallo nan,

i found a nice workaround.

Since this report is only intended to compare two years, the number of possible color combinations is manageable. I aggregate my values with an pivot node and the result is much easier to handle. Two columns for two years and i created an “paralell dummy” where i could color my colums like i want and append the correkt color scheme to the report data.
Example_Chart_coloring_solution.knwf (149.2 KB)

This report also displays many creditors which use the same or overlapping ledger accounts. bevor i used the color manager and sometimes the colors differed due to the different number of columns. Now I simply color every possible column and then apply the color scheme to the report data. :yum:

Thank you very much for your help and support in finding ideas for my workaround.

Best regards
Andy

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.