How Do I Create and Customize a Categorical Stacked Bar Chart or Clustered Bar Chart?

In a bar chart, we often want to compare several values of one data set. Soley Studio allows you to combine multiple bar series or multiple bars of one bar series in four different ways:

  • Clustered Bar Chart
  • Stacked Bar Chart
  • Stacked 100% Bar Chart

Each of these views is an extended version of the standard bar chart view. The creation of a standard bar chart view is explained here. In the following the options for creating clustered and stacked bar chart views are explained using the product portfolio analysis example presented in our tutorial.

Multiple bar series

Let us assume we want to plot the number of carry-over parts vs. the number of exclusive parts for each Product element. The sum of both values is the number of different parts a product is built from. Start with creating a simple bar chart as explained here. Select the Product node class as data set, the name property as Category (= horizontal axis value) and the nbCOParts as Value (= vertical axis value). This results in a standard bar chart with one bar series. Then add a second bar series using the Add… drop-down menu next to the Product class in the View Manager, as depicted on the left of Figure 1.

Adding new bar series
Figure 1: Adding further bar series in the View Manager window

Now select the new bar series in the View Manager window. It will be highlighted in blue and you can now edit the properties in the Properties pad (see the center and right picture in Figure 1). First, change the color of the bar series either in the View Manager or in the Properties pad using the view property Color. Random properties are chosen by the system for Category and Value. This results in two bar series that are plotted sequentially but without relation to each other. To align the two bars of each product the Category setting needs to be the same for both bar series. In our example, select the “name” property as Category for the second series. As value, select “nbDiffExclParts” (number of different exclusive parts). For the first series, you already selected “nbCOParts” (number of different carry-over parts) upon the initial creation of the view.

Cluster – Show multiple bar series next to each other in one bar chart

In order to show the bars of multiple bar series next to each other in a combined view, we need to select “Cluster” as Combine Mode view property in the Properties pad for each bar series (see the red square in Figure 2). This is also the default setting. As a result, the bars of the different series will be shown next to each other. This shows the absolute numbers of different common parts and different exclusive parts as two grouped bars per product.

Showing multiple bar series next to each other using the cluster combine mode
Figure 2: Showing multiple bar series next to each other using the cluster combine mode

Stack – Create a stack bar chart with absolute values

In order to combine multiple bar series in a stacked bar chart, we need to select “Stack” as Combine Mode view property for each bar series (see the red square in Figure 3). This shows the absolute and combined numbers of different common parts and different exclusive parts per product.

Combined stack bar view
Figure 3: Showing multiple bar series in one stack bar chart (absolute values)

Stack 100 – Create a stack bar chart with relative values (percentage values)

In order to combine multiple bar series in a stack bar chart, we need to select “Stack 100” as combine mode view property in the Properties pad for each bar series (see the red square in figure 4).

Combined stack bar chart stack 100
Figure 4: Showing multiple bar series in one stack bar chart (relative values)

On our horizontal axis, we selected “name” as the category for each bar series, while the value which is plotted on the vertical axis differs for each series. Figure 3 shows the relative numbers of different common parts and different exclusive parts of our products.

General tips & tricks:

  • You can change the order of the bar segments (from left to right for Cluster or bottom to top for Stack). First, hide all bar series by clicking on the crossed-out eye symbol in the View Manager. Then show the bar series again using the eye symbol in the View Manager in the order you would like the bar segments to appear.
  • When adding a bar series, the legend text is set according to the default data property values. Any modifications done to the data properties setting in the Properties pad are not automatically taken over by the legend text. Thus, you may want to adjust the Legend Title in the view properties section of the Properties pad for the respective bar series.
  • To adjust the axis titles, click on the canvas and adapt them in the properties pad.

Plotting multiple bar series in relation to each other is not the only way to make use of the Combine Mode property. Sometimes it might be necessary to put values of one bar series into relation, grouped by the Category property. Let us assume you want to plot the number of carry-over parts for each Product node. Start with creating a simple bar chart as explained here. Select the Product node class as data set, the name property as Category (= horizontal axis value) and the nbCOParts as Value (= vertical axis value). This results in a standard bar chart with one bar series as depicted on the left side of the following image.

Stacked Bar Chart
Figure 5: Bar Chart with one bar series where (left) each bar has a different category value (here: name) or (right) some bars have the same category value (here: family)

As every Product has a different name, one bar is plotted for each product showing the nbCOParts as y-value. Now select the bar series in the View Manager and go to the Properties pad. Change the view property Combine Mode to None, Cluster or Stack. You will see no effect to the bar chart. If you select Stack 100 every bar will have the same maximum height. As there is no other value to relate to, this is the expected behavior.

Next, change the Category data property to family. You will see that the bars are now grouped into 3 groups where every group has one family value (Special Bikes, MTB, Street Bikes). This is depicted on the right side of Figure 5. Each of these groups consists of a different number of products. The Special Bikes family, for example, only contains one product, while the Street Bikes family contains four products. If you now go through the different Combine Mode settings, you can see a difference:

Stacked Bar Chart
Figure 6: Combined bar charts of one bar series with recurring category values

On the top left of Figure 6, we see the None Combined Mode setting. In this setting, the bars that have the same category value (here: family value) are just stapled on top of each other. One bar is selected in the image (dark blue) to show this. For this type of plot, the None setting hardly makes sense. On the top right of Figure 2, we see the Cluster Combined Mode setting in which the bars with the same family value are plotted next to each other. This allows for a quick comparison of absolute values within one and among different families. On the bottom left of Figure 2, we see the Stack Combined Mode setting. This setting stacks the bars per family group. This allows you to see the share per family and the combined total in comparison to the other families. Finally, on the bottom right of Figure 2, we see the Stack 100 Combined Mode setting. With this setting, the value of each bar and bar segment is shown in relation to 100 percent. Without an individual colorization of each bar segment (= each product node) this view also makes little sense. However, with customized colors, it can give a good relative comparison of the product families.

Group stacked bars

Another feature stacked bar charts offer are grouped stacks. For instance, one could compare data properties of products by visualizing the number of exclusive and the number of carry-over parts as one stacked bar and the costs for exclusive and costs for carry-over parts in another stacked bar right next to it. The result could look like figure 7.

Grouped stacked bar chart
Figure 7: Grouped stacked bar chart

The first step to visualize this graph is to create a new categorical bar chart. Afterwards add more bar series for each stack you want to visualize.  To create the view shown in figure 7 we need four bar series in total. Now adapt the category and value property via the Properties Pad for each series. The category should be the same for all series (name) and the value needs to be set individually (nbExclParts, nbCOParts, costsExclPartsSum, costsCOPartsSum). Next, mark all bar series in the View Manager and set their Combine Mode attribute to Stack or Stack100. Finally, select those series which shall be visualized as one stacked bar in the View Manager and define a Group Name attribute. Bar series with the same Group Name attribute will be plotted on top of each other, series with different Group Names next to each other. In the example, the two bar series plotting the numbers would have the same Group Name (e.g. “Numbers”) and the two series plotting the costs would have another (e.g. “Costs”).

 

Was this article helpful?

Related Articles