Bar Chart & Pie Chat | Formatting the axis labels

Hello,

i have a bar chart and and apie chart (see below).

How can i formatting the label of the axis in the bar chart
and how can I customize the labeling for the circle diagram (pie chart) segments.

I hope if i use the CSS-Node, i can fix it:
CSS-Node

I’m not sure l’m on the right track there. :thinking:
And if this is the right node for it, which command sysntax are the right
ones for my concern?

/* example style rule */
.knime-title {
font-size: 20px;
font-weight: bold;
color: #898989;
fill: #000000;
}
.knime-axis-label {
font-size: 20px;
font-weight: bold;
color: #898989;
fill: #000000;
}

CSS Style

Thank you in advance

greetings

Hello there,
In most cases using CSS can help us only with styling what is surrounding the visualization, not the inside of it. This has to do with whether you are styling HTML tags rather than many SVG tags with no unique class. There might be a few exceptions to this (see below title inside of donut chart).

Bar Chart :

is the bar Chart view opened in a single window or in a composite view within a component?
Does the label issue happens in both cases?
If it is a single view does resizing the windows fixes anything? If in the composite view does changing the layout settings (position of views in columns and rows via the layout panel) improve the issue?

try using the node setting “Show maximum value” to fix the y axis range. Does this fix the issue for both axis?

Pie Chart:

Did you try using the sunburst node instead? It is usually better designed but you need to edit it’s settings to only visualize a single categorical value and compute the number of occurrences rather than something else.

If you stick with the Pie/Donut Chart View node this should help you:

  1. Labels on slices:
    use node setting “Label Threshold” which manages how large a slice needs to be in order to have a label.

  2. Styling title in middle of donut chart:
    unfortunately not all the available classes are listed in the documentation. You might need to find out on your by looking at the code via browser dev tools. Not really user-friendly but it works. In this case this is the CSS code you need:

CSS code:

.nv-pie-title {
	font-size: 20px !important;
	font-weight: bold !important;
	color: #898989 !important;
	fill: #898989 !important; 
}

workflow here:

3 Likes

@paolotamag wow - thank you very much for the detailed instructions.

The bar-chart & the Pie-chart

Both are displayed in a component-node together in a dashboard which is then
saved as HTML file and open in the Frefox browser. But the problem also occurs
with the single graphics.

Display maximum value are enabled.
Bar-Cahrt-Max Value

Pie/Donut Chart View
It works better :+1: perfect

Now there is only the problem with the bar chart and the legend title of
the vertical axis.

I have another question about the bar chart:
How do I get colored bars - like the segments are in the pie chart?

greetings

Hi @USCHUKN1ME

Regarding the bar chart issue with y axis label issue:
the x axis looks good now
I am opening a bug ticket on our end.
While we fix this please try to use vertical mode OR use shorter labels.
Currently you use “24.02.2021”. Try “24.02.21” for example.

Regarding colors of bar chart
You need to learn how to use the optional color port of the bar chart and a color manager with the right palette. Example here in the lower branch:

Besides that you need to use a groupby before the color manager to precompute the exact values the bar chart will display. Also a transpose node should help flipping the table as described below.

The BarChart input table should look like this:

  • 1 row

  • 1 numerical column for each bar

  • the height of the bar in each cell

  • an additional categorial column with some string value as placeholder

then configure the bar chart to do partitions based on the placeholder categorical column and compute the average on the numerical columns with only one value. It is a bit of a painful workaround but it should work. Do you need an example?

1 Like

Hi @paolotamag ,

thank you !!

Following my Bar-Chart-Configure:

y-axis “LIEFERDATUM!” - i changed that into “L-Datum”, but changed nothing in the view.

I will try your bar cahrt examples - thank you very much for that.

Greetings

Hi @USCHUKN1ME ,
sorry for not being clearer but i was not talking about the label that is the title on the y axis, rather about making shorter the labels appearing for each bar (timestamp with dates). Those need to be made shorter with a rule engine node before the actual bar chart node.

Try first the colored version of the bar chart and only then solve this shortening of the categorical values. Quite a bit will change when you will transpose the data like that and maybe it won’t be necessary anymore.

Hello @paolotamag ,

ok i set the color-manager.

Result:

Colormanager Einteilung Farben je Lieferdatum

Colormanager geht in die Component-Node

Something is still wrong in my configuration :thinking:

In your example i didn´t understand how you manage the last bar-chart node ?
I don’t see any connection to the Colormanager ?

Your example:

Greetings

I thougt the result of the Color manager Node (table with color) is the way i want it.
Each delivery date “Column Lieferdatum” has been assigned its own color.

But the Bar-Chart Node ignored the colors.

I guess i need a special NOde between the color manager and the bar chart node.

Hi @USCHUKN1ME
There is an optional port in the bar chart that you are not using.

I made an example for you. Unfortunately this is the only way in KNIME to add custom colors for each date/bar.

The bar chart then has a legend which is interactive but you might prefer to have the dates on the left.

1 Like

Thank you very much. NI try this out right away and get in touch.

Is it a combination between a bar chart and a pie chart?

Sum date 15.02.2021
2021-02-05 10_51_11-Processed data - 0_121_0_10 - RowID

Actual production times on 15. 02. 2021
Summen 15.02.2021

Component node open with the new Bar-Chart workflow

Configs of the new placed nodes
Groupby1

ROW ID Node

Transpose Node

constant value column node

color-manager-node

Bar-Chart-Node-configure

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