Color manager doesn't work for bar chart

Hi community !

I have a dataset of numbers according to categories.
It is filtered and then sorted.
I used the “Color Manager” node to color the bar from the bar chart.
I want to map the color from 5.001 (min of number) to 5.999 (max of number).
When I plug the color node to the bar chart node, it doesn’t display my colors on the plot :frowning_face:

Here is a part of the workflow :

The plot (with its ugly gray)

The color manager :

First problem : color should go from yellow to orange… (it is grey)
Second problem : range should be from number to 5.001 to 5.999 (it goes from 1 to 6)

I don’t know what to do, please help me :cry:

Hi @NS_Kyllian welcome to the forum !

Pease take a look a this couple of resources developed by KNIME members:

Build a Data App: Create an Interactive Dashboard in Three Steps with KNIME Analytics Platform | KNIME

They will guide you in how to treat your data in order to assign colors to charts.

Hint: Use Extract Table Spec between your Sorter and Color Manager to add a color to each category of your barchar !

Hope it helps !

1 Like

Hi !
Thanks for sharing !
I tried to use Extract Table Spec between the Sorter and Color Manager.
I choosed the “possible values as collection” but then in Color Manager, it doesn’t display the possible values :confused:

Welcome to the forum, @NS_Kyllian.

I have a dataset of numbers according to categories.
It is filtered and then sorted. […]
Second problem : range should be from number to 5.001 to 5.999 (it goes from 1 to 6)

Can you share the workflow, or at least some data for us to work with?

When I plug the color node to the bar chart node, it doesn’t display my colors on the plot :frowning_face:

If you want to assign colors to a record based on its numerical value (as one would do in a scatter plot), then the simplest way is to follow the Color Manager node with a GroupBy Bar Chart node. Make sure that the Use row color option is selected.

If you don’t like the way that chart looks, then I think that we need to take a step back.

The description of the Bar Chart node for input port 1 says:

Data table containing one column with the column names of table which has in addition a color assigned.

The Color Manager node alone does not satisfy this requirement. Therefore, we need to create this table which is essentially a (column header, column color) map to apply to the chart. Each column must have a color associated with it. The application of this is usually for applying colors to all the bars belonging to the same category, as a means of differentiating between categories, and the Extract Table Spec > Color Manager node approach suggested by @eamendola works fine for this.

However, since you want to assign colors to a record based on its numerical value, this approach will not work. We have to do some extra creative steps to get your data in an appropriate format.

The workflow below should get you started:

2 Likes

Hi!

Can you share the workflow, or at least some data for us to work with?

Sure, here is the data that I want to plot:

This data is processed from this one:

And here is the workflow:

I did a GroupBy Bar Chart, but for some reasons, the colors don’t represent the gradient for the numbers. :sweat_smile:
Also, the X axis should display the name of each category and it dosen’t

I selected the Use row color option but then all the bars became grey again:

I also tried to reproduce the workflow that you showed @elsamuel for option 2, but I struggle with it, is it possible to explain a little bit more how it works ? :grin:

Sure, here is the data that I want to plot […] And here is the workflow

@NS_Kyllian, can you share an actual data file and/or the workflow file? As an example, I uploaded my workflow to the KNIME hub so that everyone can access it. An alternative route would be to upload the files directly in a post here. We can’t really use screenshots; no one is going to re-type it all. Help us help you.

I did a GroupBy Bar Chart, but for some reasons, the colors don’t represent the gradient for the numbers. […] I selected the Use row color option but then all the bars became grey again:

If you upload the workflow, we can take a look at the configuration and see if there’s anything missing.

Also, the X axis should display the name of each category and it dosen’t

As I showed in my previous post, that’s not how the GroupBy Bar Chart works

I also tried to reproduce the workflow that you showed @elsamuel for option 2, but I struggle with it, is it possible to explain a little bit more how it works ?

Can you be more descriptive? Are you able to download and run the workflow? What was your result? What exactly are you struggling with? I gave an overview of the logic in my last post. Which aspect should I have done better at explaining? I’ve updated the workflow and simplified the part that assigns colors to the values.

Oh sorry I didn’t noticed that it’s possible to download the workflow…

Here it is, it’s in french, sorry about that :grimacing:

The data are from a Kaggle project:

I downloaded and understand how the workflow works, but still the plot is grey :frowning:
I “copied” your workflow in the right end corner of my workflow.

Thanks for the workflow. I’ve been trying to practice my French, so that wasn’t an issue.

A few things:

  1. Like I mentioned in my last post, I’ve simplified the part of the workflow that assigns colors to the values
    image

  2. In this joiner node
    image

    you need to exclude all the columns from the Top Input.

  3. This is the real key: the column names used in the Bar Chart node must match the category names exactly. Otherwise the Bar Chart node will not be able to look up the categories in the color table.

    These are the category names in the color map:

    This is what you have

    This is what it should be

    This is controlled by the Pivoting node.

    You need this

    instead of this

Final result:

IT_Jobs_skills_explorer(updated).knwf (91.7 KB)

We’re basically tricking the bar chart node into doing what we want.

The bar chart node can only plot aggregated data from table columns.

The color manager does not provide the input that the bar chart node requires for assigning colors to individual bars.

Therefore, we create a color map that assigns a color to each value. Separately, we create a table that has a single column for the class/category, and a separate column for each data point. Each column only has 1 value in it.

You can now tell the bar chart node to use the class/category column as the x-axis, and to use all the columns for plotting. Since there’s only one value in each column, using the “stacked” option gives us a single bar with the appropriate value, and the node can look up the color assigned to that category from the color map table.

3 Likes

Oh I understand why it wasn’t working !

Thank you @elsamuel ! :grin:

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