Bar chart
The bar chart is suitable for comparing multiple values. The dimension axis shows the category items that are compared, and the measure axis shows the value for each category item.
In the image, the dimension values are different regions: Nordic, USA, Japan, UK, Spain, and Germany. Each region represents a dimension value, and has a corresponding bar. The bar height corresponds to the measure value (sales) for the different regions.
You can make more complex comparisons of data by using grouped or stacked bars. This requires using two dimensions and one measure. The two example charts use the same two dimensions and the same measure:
Grouped bars: With grouped bars, you can easily compare two or more items in the same categorical group.
Stacked bars: With stacked bars it is easier to compare the total quantity between different months. Stacked bars combine bars of different groups on top of each other and the total height of the resulting bar represents the combined result.
The bar chart can be displayed horizontally or vertically, as in the example below:
When to use it
Grouping and stacking bars makes it easy to visualize grouped data. The bar chart is also useful when you want to compare values side by side, for example sales compared to forecast for different years, and when the measures (in this case sales and forecast) are calculated using the same unit.
Advantages: The bar chart is easy to read and understand. You get a good overview of values when using bar charts.
Disadvantages: The bar chart does not work so well with many dimension values due to the limitation of the axis length. If the dimensions do not fit, you can scroll using the scroll bar, but then you might not get the full picture.
Creating a bar chart
You can create a simple bar chart on the sheet you are editing.
Do the following:
- From the assets panel, drag an empty bar chart to the sheet.
- Click Add dimension and select a dimension or a field.
- Click Add measure and select a measure or create a measure from a field.
In a bar chart you need at least one measure.
You can include up to two dimensions and one measure, or one dimension and up to 15 measures in a bar chart. Each bar corresponds to a dimension, and the values of the measures determine the height or length of the bars.
You can also create a bar chart with no dimension and up to 15 measures. In this case, one bar is displayed for every measure. The value of the measure determines the height or length of a bar.
Dimensions | Measures | Result |
---|---|---|
1 dimension | 1 measure | A simple bar chart with one bar for each dimension value. |
2 dimensions | 1 measure | A grouped or a stacked bar chart with one bar for each value of the two dimensions. |
No dimension | up to 15 measures | A simple bar chart with one bar for each measure. |
1 dimension | up to 15 measures | A grouped or a stacked bar chart with one bar for each value of each measure. |
When you have created the bar chart, you may want to adjust its appearance and other settings in the properties panel. For information about styling, see Styling the bar chart. For information about customizing other aspects of the chart's appearance, see Changing the appearance of a visualization.
Styling the bar chart
You have a number of styling options available under Appearance in the properties panel.
Click Styling under Appearance > Presentation to further customize the styling of the chart. The styling panel contains various sections under the General and Chart tabs.
You can reset your styles by clicking next to each section. Clicking Reset all resets styles for all available tabs in the styling panel.
For general information about styling an individual visualization, see Applying custom styling to a visualization.
Customizing the text
You can set the text for the title, subtitle, and footnote under Appearance > General. To hide these elements, turn off Show titles.
The visibility of the different labels on the chart depends on chart-specific settings and label display options. These can be configured in the properties panel.
You can style the text that appears in the chart.
Do the following:
-
In the properties panel, expand the Appearance section.
-
Under Appearance > Presentation, click Styling.
-
On the General tab, set the font, emphasis style, font size, and color for the following text elements:
-
Title
-
Subtitle
-
Footnote
-
-
On the Chart tab, set the font, font size, and color for the following text elements:
-
Axis title: Style the titles on the axes.
-
Axis label: Style the labels on the axes.
-
Value labels: Style the labels which display the measure value for each dimension value.
When using the Stacked presentation option, this setting controls Segment labels (measure values for each dimension value) and Total labels (combines the measure values for each dimension value).
-
Legend title: Style the title of the legend.
-
Legend labels: Style the labels of the individual legend items.
-
Customizing the background
You can customize the background of the chart. The background can be set by color and image.
Do the following:
-
In the properties panel, expand the Appearance section.
-
Under Appearance > Presentation, click Styling.
-
On the General tab of the styling panel, you can select a background color (single color or expression). You can also set the background to an image from your media library or from a URL.
When using a background color, use the slider to adjust the opacity of the background.
When using a background image, you can adjust image sizing and position.
Customizing the bar segment outline and bar width
You can adjust the outline surrounding each bar segment in the chart, as well as the width of the bars.
Do the following:
-
In the properties panel, expand the Appearance section.
-
Under Appearance > Presentation, click Styling.
-
On the Chart tab of the styling panel, under Outline, set the thickness and color of the outlines.
-
Adjust the slider for Bar width to set the width of the bars.
Customizing the border and shadow
You can customize the border and shadow of the chart.
Do the following:
-
In the properties panel, expand the Appearance section.
-
Under Appearance > Presentation, click Styling.
-
On the General tab of the styling panel, under Border, adjust the Outline size to increase or decrease the border lines around the chart.
-
Select a color for the border.
-
Adjust the Corner radius to control the roundness of the border.
-
Under Shadow in the General tab, select a shadow size and color. Select None to remove the shadow.
Adding trend lines
You can add trend lines to the chart. Use trend lines to visualize how data changes over time.
For more information about trend lines, see Trend lines.
Do the following:
-
In the properties panel, expand the Data section.
-
Under Measures, expand the measure for which you are adding trend lines.
-
Under Trend lines, click Add trend line.
-
Define the Label and Type for the trend line.
-
Use the Colors slider to define Custom or Auto coloring.
-
Use the checkbox to toggle a Dashed appearance on or off.
Showing or hiding dimensions and measures depending on a condition
You can show or hide a dimension or measure depending on if a condition is true or false. This is known as a show condition, and is entered as an expression. The dimension or measure is only shown if the expression is evaluated as true. If this field is empty, the dimension or measure is always shown. Expand the dimension or measure in the Data section of the properties panel and enter an expression under Show dimension if or Show measure if.
Custom tooltips are disabled for a bar chart if any of the dimensions in the chart are using a show condition.
Let's say you have a dataset with the fields City, Manager, and Sales, among others. You could configure your bar chart so that aggregated sales are displayed along a dimension called City. You can add a second dimension, Manager, but only organize the data by this dimension if there are more than three manager names associated with your sales data.
Do the following:
-
In edit mode, turn on the advanced options.
-
Drag a bar chart from the assets panel onto the sheet.
-
Add City as a dimension.
-
Add Manager as a second dimension from the properties panel.
-
Add Sum(Sales) as a measure.
-
In the properties panel, expand the dimension Manager. Under Show dimension if, add the following expression:
Count(distinct Manager)>3
If your data only contains two manager names, the bar chart will not organize sales by manager, since the expression is evaluated as false. If the data contains three or more unique Manager values, sales will be organized by both City and Manager.
Display limitations
Displaying large numbers of dimension values
When the number of dimension values exceeds the width of the visualization, a mini chart with a scroll bar is displayed. You can scroll by using the scroll bar in the mini chart, or, depending on your device, by using the scroll wheel or by swiping with two fingers. When a large number of values are used, the mini chart no longer displays all the values. Instead, a condensed version of the mini chart (with the items in gray) displays an overview of the values, but the very low and the very high values are still visible.
Displaying out of range values
In the properties panel, under Appearance, you can set a limit for the measure axis range. Without a limit, the range is automatically set to include the highest positive and lowest negative value, but if you set a limit you may have values that exceed that limit. A bar that exceeds the limit will be cut diagonally to show that it is out of range.
When a reference line is out of range, an arrow is displayed together with the number of reference lines that are out of range.
Displaying large amounts of data in a stacked bar chart
When displaying large amounts of data in a stacked bar chart, there may be cases when not each dimension value within a bar is displayed with correct color and size. These remaining values will instead be displayed as a gray, striped area. The size and total value of the bar will still be correct, but not all dimension values in the bar will be explicit.
To remove the gray areas, you can either make a selection or use dimension limits in the properties panel.
The approximate limit for how many stacked bars that can be displayed without gray areas is 5000 bars, assuming that each bar consists of 10 inner dimension values and one dimension value and one measure value for the whole bar.
The initial data load is 500 dimension values or dimension stacks. (The value 500 refers to the outer dimension values, not each dimension value in a stack.) When you have scrolled past those 500 values, an incremental load is performed, where values are instead loaded based on the current view or scroll position.
Displaying large amounts of data in a bar chart with continuous scale
If the chart uses a continuous scale, a maximum of 2000 data points can be displayed. The actual maximum number of data points in the chart is affected by the distribution of the data. Above that number, data points are neither displayed, nor included in selections made in the chart. Additionally, only twelve dimension values are displayed for the second dimension in a chart with two dimensions and continuous scale.
To avoid displaying limited data sets, you can either make a selection or use dimension limits in the properties panel.
Colors and legend
When coloring by dimension is used in this chart, a maximum of 100 unique dimension values and 100 unique colors can be plotted on the legend.
Stacked bar charts and number formatting by measure expression
Stacked bar charts ignore number formatting by measure expression and instead will always us the default formatting to make it consistent with the formatting of totals.