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.

line-chart-plan

Source table
Year Sales Basic targets Optimistic targets
January 2019 209K 200K 210K
February 2019 194K 205K 220K
March 2019 333K 250K 280K
April 2019 359K 260K 290K
May 2019 394K 270K 300K
June 2019 477K 300K 350K
July 2019 557K 350K 400K
August 2019 685K 400K 450K
September 2019 609K 500K 550K
October 2019 665K 530K 570K
November 2019 724K 600K 670K
December 2019 869K 700K 800K

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.

line-chart-2measures-2y

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.

line-chart-groupped

Source table
Year Home appliances Household goods Household cleaners
January 2019 128K 55K 26K
February 2019 97K 79K 18K
March 2019 187K 105K 41K
April 2019 188K 137K 34K
May 2019 230K 121K 43K
June 2019 256K 162K 59K
July 2019 284K 206K 67K
August 2019 409K 204K 72K
September 2019 314K 209K 86K
October 2019 324K 262K 79K
November 2019 385K 238K 101K
December 2019 451K 307K 111K

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 only use one dimension from the X axis. Affects the sorting of the X axis. The sorting direction is marked with an icon next to the field: for ascending or for descending. To change the sorting direction, click the icon.
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.
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:

  1. Go to the DataLens home page. In the left-hand panel, select Collections and workbooks.
  2. Open the workbook, click Create in the top-right corner, and select the appropriate object.

Follow the guide from step 4.

  1. Go to the DataLens home page.
  2. In the left-hand panel, select Charts.
  3. Click Create chartChart.
  4. At the top left, click Select dataset and specify the dataset to visualize.
  5. Select Line chart as your chart type.
  6. 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.
  7. Drag one or more measures from the dataset to the Y section. The values will be displayed as a chart on the Y axis.
  8. Drag one or more measures from the dataset to the Y2 section. The values are displayed as a chart on the second Y axis.
  9. Drag a dimension to the Color section. The measure value is divided by color depending on the selected dimension.
  10. Drag a dimension or measure from the dataset to the Filters section. The field can be empty. In this case, no filters are applied.

Configuring the display of nullvalues

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:

  1. 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).
  2. In Empty values (null), select Display as 0.
  3. 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

    line-chart-proportions

  • 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

    line-chart-signatures-1

    If multiple measures are added to the Y or Y2 section, drag Measure Values to this section.

    Chart example

    line-chart-signatures-2

    You can also sign the last value on the chart only. To do this, add a calculated field with the MAX function.

  • 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

    line-chart-split

  • 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.

    Sample measure settings

    line-chart-measure-settings