Line chart
The line chart is used to show trends over time. The dimension is always on the x-axis, and the measures are always on the y-axis.
Your data set must consist of at least two data points to draw a line. A data set with a single value is displayed as a point.
If you have a data set where data is missing for a certain month, you have the following options for showing the missing values:
- As gaps
- As connections
- As zeros
When a month is not present at all in the data source, it is also excluded from the presentation.
When to use it
The line chart is primarily suitable when you want to visualize trends and movements over time, where the dimension values are evenly spaced, such as months, quarters, or fiscal years.
Advantages
The line chart is easy to understand and gives an instant perception of trends.
Disadvantages
Using more than a few lines in a line chart makes the line chart cluttered and hard to interpret. For this reason, avoid using more than two or three measures.
Creating a line chart
You can create a line chart on the sheet you are editing.
Do the following:
- From the assets panel, drag an empty line 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 line chart you need at least one dimension and one measure.
You can include up to two dimensions and one measure, or one dimension and up to 15 measures in a line chart.
Dimensions | Measures | Result |
---|---|---|
1 dimension | 1 measure | A simple line chart with a single line. |
2 dimensions | 1 measure | A line chart with the first dimension on the X-axis, and a line for each value of the second dimension. |
1 dimension | up to 15 measures | A line chart with one line for each measure. |
When you have created the line chart, you may want to adjust its appearance and other settings in the properties panel. For information about styling, see Styling the line chart. For information about customizing other aspects of the chart's appearance, see Changing the appearance of a visualization.
Styling the line chart
You have a number of styling options available in the properties panel. Click Styling under Appearance > Presentation to style the text, background, data point size, and lines at the chart level (for the entire 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. Any customization you apply here overrides the styling set in the app theme.
You can also set line styling options individually for each measure in the chart. These options are available for each measure in the Data section of the properties panel. When you style an individual measure, the settings you choose override both the chart-level settings and the app theme for that specific measure only.
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 label: Style the labels for the measure values that are configured as Lines.
-
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 data points at the chart level
You can set the size of the data points. The settings defined here apply to all measures in the chart.
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 Data point size, adjust the slider to change the size of the data points in the chart.
Customizing the measure lines at the chart level
You can customize the appearance of the lines in the chart. The settings defined here apply to all measures in the chart.
Do the following:
-
In the properties panel, expand the Appearance section.
-
Under Appearance > Presentation, click Styling.
-
Switch to the Chart tab of the styling panel.
-
In the Line options section, adjust the line thickness, line type (solid or dashed), and line curve (linear or monotone).
Styling each measure individually
Each measure line in the chart can be styled with separate settings. For each measure, you can customize the data point size, line thickness, line type, and line curve.
Do the following:
-
In the properties panel, expand the Data section.
-
Click the measure you want to customize.
-
Under Styling, click Add.
-
Adjust the data point size, line thickness, line type (solid or dashed), and line curve (linear or monotone).
Repeat these steps for each individual measure you need to customize separately from the app theme or chart-level style settings.
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.
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.
Let's say you have a dataset with the fields Sales, Quarter, Year, and Order Number, among others. You could configure your chart so that sales are displayed along a time-based dimension for yearly aggregations. You can add a second dimension for quarterly aggregations but only organize the data by this dimension if the total number of orders received by your company has reached a target goal of 100,000.
Do the following:
-
In edit mode, turn on the advanced options.
-
Drag a line chart from the assets panel onto the sheet.
-
Add Quarter as a dimension.
-
Add Year as a second dimension from the properties panel.
Each distinct year in the data model becomes a separate line in the chart.
-
Add Sum(Sales) as a measure.
-
In the properties panel, expand the dimension Manager. Under Show dimension if, add the following expression:
Count([Order Number])>100000
If your data contains 50,000 order records, the chart will not organize sales by quarter, since the expression is evaluated as false. If the data contains 100,000 or more order records, sales will be organized by both Year and Quarter.
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.
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. Note that for line charts with two dimensions, the mini chart is only available in stacked area mode.
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. When a data point value cannot be displayed, due to the range limits, an arrow indicates the direction of the value.
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 line chart
If the chart uses a continuous scale, you can set the maximum number of visible points and lines. In the properties panel, go to Presentation. Then adjust the following:
-
Max visible points: Set the maximum number of points that will be displayed. The default is 2,000. The maximum is 50,000. If you set a number less than 1,000, the line chart will behave as if the maximum is 1,000 visible points. The actual maximum number of data points in the chart is affected by the distribution of the data, and could be lower than the value you configure with this setting. When there are more data points than the value you have set, data points are neither displayed, nor included in selections made in the chart.
- Max visible lines: Set the maximum number of lines that will be displayed. The default is 12. The maximum is 1,000.
If there are more data points than the number set in Max visible points, you will not see any points, only lines. If there are more than 5,000 visible points, then labels will not be shown. If you have a large number of lines, not all lines will be displayed, or lines may overlap.
If you have a large number of points or lines, it may take your chart longer to render when you zoom or pan. You cannot make selections when the line chart is rendering.
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.