Line chart
This chart displays a change to one or more measures over a time interval. It indicates trends, seasonality, dynamics, and a ratio of multiple measures in a single point in time. A chart is built using points with (X, Y) coordinates that are then connected by a line.
It can show multiple measures with different lines. For example, the basic sales targets, optimistic sales targets, and actual sales can be represented as a dotted, dashed, and solid line, respectively.
Source table
Year | Sales | Basic targets | Optimistic targets |
---|---|---|---|
January 2019 | 209К | 200К | 210К |
February 2019 | 194К | 205К | 220К |
March 2019 | 333К | 250К | 280К |
April 2019 | 359К | 260К | 290К |
May 2019 | 394К | 270К | 300К |
June 2019 | 477К | 300К | 350К |
July 2019 | 557К | 350К | 400К |
August 2019 | 685К | 400К | 450К |
September 2019 | 609К | 500К | 550К |
October 2019 | 665К | 530К | 570К |
November 2019 | 724К | 600К | 670К |
December 2019 | 869К | 700К | 800К |
If measure values differ significantly, you can place them on different Y axes. In this case, the values of each measure will be plotted on their own axis. For example, a chart for sales and customer count.
Source table
Year | Sales | Number of customers |
---|---|---|
January 2019 | 298450 | 64 |
February 2019 | 498052 | 84 |
March 2019 | 629201 | 99 |
April 2019 | 895075 | 147 |
May 2019 | 998557 | 166 |
June 2019 | 1050330 | 161 |
July 2019 | 1350246 | 244 |
August 2019 | 1452550 | 255 |
September 2019 | 1716182 | 273 |
October 2019 | 1670980 | 300 |
November 2019 | 1743450 | 326 |
December 2019 | 1935377 | 345 |
This chart lets you compare multiple categories by a single measure. Each category's line has its own color and form. For example, the sales amount for different product categories.
Source table
Year | Home appliances | Household goods | Household cleaners |
---|---|---|---|
January 2019 | 128К | 55К | 26К |
February 2019 | 97К | 79К | 18К |
March 2019 | 187К | 105К | 41К |
April 2019 | 188К | 137К | 34К |
May 2019 | 230К | 121К | 43К |
June 2019 | 256К | 162К | 59К |
July 2019 | 284К | 206К | 67К |
August 2019 | 409К | 204К | 72К |
September 2019 | 314К | 209К | 86К |
October 2019 | 324К | 262К | 79К |
November 2019 | 385К | 238К | 101К |
December 2019 | 451К | 307К | 111К |
Wizard sections
Wizard section |
Description |
---|---|
X | Dimension. You can only specify one field here. This dimension is usually a date. If this is the case, make sure to specify the Date data type for this field in the dataset. This is required for correct sorting and signature display. For better visualization, you can group dates into weeks, months, and years. For more information, see Field settings. |
Y | Measure. You can specify multiple measures. If you add more than one measure to a section, the Colors section will contain a dimension named Measure Names. |
Y2 | Measure. Use it to add a second Y axis to a chart. You can specify multiple measures. If you add more than one measure to a section, the Colors section will contain a dimension named Measure Names. |
Colors | Measure Names dimension or field. Affects the color of lines. To delete Measure Names, click the cross icon or remove measures from the Y axis. |
Forms | Measure Names dimension or field. Affects the shape of lines. |
Sorting | Dimension. You can use only one X axis dimension. Affects the sorting of the X axis. The sorting direction is marked with an icon next to the field: |
Labels | Measure. Displays measure values on the chart. If multiple measures are added to the Y or Y2 section, drag Measure Values to this section. Markup functions are supported. For String type fields, you can configure using basic Markdown syntax: click the icon before the field name and enable Markdown. |
Split | Dimension. Splits a chart horizontally by the selected dimension's values. The maximum number of splits per chart is 25. |
Filters | Dimension or measure. Used as a filter. |
Creating a line chart
To create a line chart:
Warning
If you use a new DataLens object model with workbooks and collections:
- Go to the DataLens home page
. In the left-hand panel, select Collections and workbooks. - Open the workbook, click Create in the top-right corner, and select the appropriate object.
Follow the guide from step 4.
- Go to the DataLens home page
. - In the left-hand panel, select
Charts. - Click Create chart → Chart.
- At the top left, click
Select dataset and specify the dataset to visualize. - Select Line chart as your chart type.
- Drag a dimension from the dataset to the X section. The values will be displayed in the lower part of the chart on the X axis.
- Drag one or more measures from the dataset to the Y section. The values will be displayed as a chart on the Y axis.
- Drag one or more measures from the dataset to the Y2 section. The values will be displayed as a chart on the second Y axis.
- Drag a dimension to the Color section. The measure value is divided by color depending on the selected dimension.
- Drag a dimension or measure from the dataset to the Filters section. The field can be empty. In this case, no filters are applied.
null
values
Configuring display of If the source data includes a row where the measure value is null
, the chart will not be built for that point at default settings. For example, if the source has a row with a date (20.07.2022
) but the sales amount for it is missing.
You can configure how the chart will display null values in the chart section settings:
- In the section with a measure whose values you want to show, in the top-right corner, click
(the icon appears when you hover over the section). - In Empty values (null), select
Display as 0
. - Click Apply.
Now, the chart will use 0
instead of null
.
If a row is missing from the source data completely, the chart section settings will not change the way the chart is presented. For example, if the source does not have a row with a certain date (20.07.2022
), nothing will be shown for this date on the chart.
For more information, see Configuring the display of null values.
Recommendations
-
The perception of data on a line chart depends on its proportions. An upward or downward trend may intensify if the chart is contracted and be less evident if it's spread.
Chart examples
-
If the values of the categories contain a large amount of text, try to reduce it. Then the signatures on the diagram will look more accurate. You can use string functions in the calculated fields or conditional operators CASE.
-
When visualizing multiple measures, select colors carefully. They should be distinguishable and contrasting. We recommend using no more than 3-5 colors per chart. If you want to emphasize one certain measure above the others, highlight it in some bright color.
-
Disable the Sum in tooltips option in the chart settings if the chart lines represent different entities. For example, the sales amount and the number of customers.
-
Sign measure values on the chart. To do this, drag a measure from the dataset to the Signatures section. The chart will display its values.
Chart example
If multiple measures are added to the Y or Y2 section, drag Measure Values to this section.
Chart example
You can also sign only the last value on the chart by adding a calculated field with the
MAX
function. For more information, see Demo dashboard . -
You can split a chart by dimension into a number of small charts that are convenient to compare to one another. To do this, drag a dimension from the dataset to the Split section.
Chart example
-
For better visualization, use formatting in the dimension and measure setup window. Check the data type for correct sorting and comparison of values. Specify additional parameters. For example, the format and units for numeric data and the number of decimal places for fractions.
Example of measure settings