Dynamic number of bar charts

Hi,

Is there any way to create multiple bar charts (using knime native bar chart nodes) based on the number of columns in the input data? The main point is number of columns can vary. For eg. if there are 5 columns in the data then we need 5 bar charts. If the input data has 4 columns then 4 bar charts should be plotted. Thus, number of columns in the input data is not fixed.
Is there any way to achieve this flexibility in the workflow?

Thanks,

Hi Astha,

I would “unpivot” the data columns into 2 columns with labels and values… and then feed them to the bar chart. You might need to play with unpivot column filters to get the right columns if you don’t know the name apriori.

L.

Thanks zioludo!
It would be great if you could provide a sample workflow for that if that is handy. Also, the requirement is that I want a separate bar chart for each data column.

Here you go…

Key points:

  1. Unpivot the arbitrary number of value columns (use exclude to keep the labels)
  2. Use loop to group data by “ColumnNames” and generate the charts

Simple data but you can get the idea.
You can customize chart look and titles playing with flow variables.

I use this kind of tecnique quite a lot to make jpg I then paste in Powerpoint via VisualBasic macro.

Hope it helps…

Ludo

3 Likes

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