Yandex Cloud
  • Services
  • Solutions
  • Why Yandex Cloud
  • Blog
  • Pricing
  • Documentation
  • Contact us
Get started
Language / Region
Yandex project
© 2023 Yandex.Cloud LLC
Yandex DataLens
  • Getting started
  • Practical guidelines
    • All tutorials
    • Visualizing data from a CSV file
    • Creating and publishing a chart with a map of Moscow from a CSV file
    • Analyzing a retail chain's sales from a ClickHouse database
    • Analyzing public data on road accidents in Russia
    • Analyzing sales and locations of pizzerias based on data from ClickHouse DB and Marketplace
    • Web analytics with a connection to Yandex Metrica
    • Web analytics with funnels and cohorts calculated based on Yandex Metrica data
    • Mobile app analytics based on AppMetrica data
    • Analyzing Yandex Music podcast statistics (for podcasters)
    • Visualizing data with a QL chart
    • Visualizing data using parameters
    • Visualizing Yandex Monitoring data
    • Building customer journey charts based on AppMetrica data
  • Concepts
    • Service overview
    • Organizations in DataLens
    • Connection
    • Data types
    • Datasets
      • Overview
      • Data model
      • Dataset settings
    • Charts
      • Overview
      • Chart settings
      • Measure Values and Measure Names
    • Dashboards
    • Joining data
    • Using Markdown in DataLens
    • DataLens Public
    • Calculated fields
      • Overview
      • Formula syntax
    • Parameterization
    • Marketplace
    • Backups
    • Caching
    • Quotas and limits
  • Step-by-step instructions
    • All instructions
    • Working with connections
      • Creating a ClickHouse connection
      • Creating a connection to a file
      • Creating a Google Sheets connection
      • Creating a MySQL connection
      • Creating a PostgreSQL connection
      • Creating a SQL Server connection
      • Creating a BigQuery connection
      • Creating an Oracle Database connection
      • Creating a YDB connection
      • Creating a Greenplum® connection
      • Creating a Prometheus connection
      • Creating a Yandex Monitoring connection
      • Creating a Yandex Metrica API connection
      • Creating an AppMetrica connection
      • Creating a Yandex Cloud Billing connection
      • Managing connection access
    • Working with datasets
      • Creating a dataset
      • Combining data from multiple tables
      • Creating a data field
      • Creating a calculated data field
      • Creating a default filter for new charts
      • Updating fields in datasets
      • Describing a dataset via a source SQL query
      • Managing dataset access
      • Managing access to data rows
      • Adding parameters to a dataset
    • Working with charts
      • Creating a chart
      • Creating a QL chart
      • Creating a multi-dataset chart
      • Adding a hierarchy
      • Configuring the navigator
      • Publishing a chart
      • Managing chart access
      • Adding ID as a parameter
      • Adding parameters to a chart
      • Configuring the display of null values
    • Working with dashboards
      • Creating dashboards
      • Adding charts to dashboards
      • Adding selectors to dashboards
      • Creating an alias
      • Deleting an alias field
      • Publishing dashboards
      • Managing dashboard access
      • Adding parameters to a dashboard
      • Dashboard auto-update
      • Widget display order on a mobile device
    • Working with permissions
      • Granting permissions
      • Deleting permissions
      • Request permissions
    • Working with DataLens Marketplace
      • Adding a product from Marketplace
      • Removing a product from Marketplace
      • Creating and connecting a connector (for partners)
    • Working with organizations
      • Switching between DataLens instances
  • Access management
    • Managing access to DataLens
    • Managing access at the data row level
  • Pricing policy
  • Visualization reference
    • All visualizations
    • Line chart
    • Stacked area chart
    • Normalized stacked area chart
    • Column chart
    • Normalized column chart
    • Bar chart
    • Normalized bar chart
    • Scatter chart
    • Pie chart
    • Indicator
    • Tree chart
    • Donut chart
    • Table
    • Pivot table
    • Map
      • Overview
      • Point map
      • Point map with clusters
      • Polyline map
      • Choropleth map
      • Heat map
    • Combined chart
  • Function reference
    • All Functions
    • Aggregate functions
      • Overview
      • ALL_CONCAT
      • ANY
      • ARG_MAX
      • ARG_MIN
      • AVG
      • AVG_IF
      • COUNT
      • COUNTD
      • COUNTD_APPROX
      • COUNTD_IF
      • COUNT_IF
      • MAX
      • MEDIAN
      • MIN
      • QUANTILE
      • QUANTILE_APPROX
      • STDEV
      • STDEVP
      • SUM
      • SUM_IF
      • TOP_CONCAT
      • VAR
      • VARP
    • Array functions
      • Overview
      • ARRAY
      • ARR_AVG
      • ARR_MAX
      • ARR_MIN
      • ARR_PRODUCT
      • ARR_REMOVE
      • ARR_STR
      • ARR_SUM
      • CAST_ARR_FLOAT
      • CAST_ARR_INT
      • CAST_ARR_STR
      • CONTAINS
      • COUNT_ITEM
      • GET_ITEM
      • REPLACE
      • SLICE
      • STARTSWITH
      • UNNEST
    • Date/Time functions
      • Overview
      • DATEADD
      • DATEPART
      • DATETRUNC
      • DAY
      • DAYOFWEEK
      • HOUR
      • MINUTE
      • MONTH
      • NOW
      • QUARTER
      • SECOND
      • TODAY
      • WEEK
      • YEAR
    • Logical functions
      • Overview
      • CASE
      • IF
      • IFNULL
      • ISNULL
      • ZN
    • Mathematical functions
      • Overview
      • ABS
      • ACOS
      • ASIN
      • ATAN
      • ATAN2
      • CEILING
      • COMPARE
      • COS
      • COT
      • DEGREES
      • DIV
      • EXP
      • FLOOR
      • GREATEST
      • LEAST
      • LN
      • LOG
      • LOG10
      • PI
      • POWER
      • RADIANS
      • ROUND
      • SIGN
      • SIN
      • SQRT
      • SQUARE
      • TAN
    • Operators
      • Overview
      • AND
      • Addition and concatenation (+)
      • BETWEEN
      • Comparison
      • Division (/)
      • IN
      • IS FALSE
      • IS TRUE
      • LIKE
      • Modulo (%)
      • Multiplication (*)
      • NOT
      • Negation (-)
      • OR
      • Power (^)
      • Subtraction (-)
    • String functions
      • Overview
      • ASCII
      • CHAR
      • CONCAT
      • CONTAINS
      • ENDSWITH
      • FIND
      • ICONTAINS
      • IENDSWITH
      • ISTARTSWITH
      • LEFT
      • LEN
      • LOWER
      • LTRIM
      • REGEXP_EXTRACT
      • REGEXP_EXTRACT_NTH
      • REGEXP_MATCH
      • REGEXP_REPLACE
      • REPLACE
      • RIGHT
      • RTRIM
      • SPACE
      • SPLIT
      • STARTSWITH
      • SUBSTR
      • TRIM
      • UPPER
      • UTF8
    • Text markup functions
      • Overview
      • BOLD
      • ITALIC
      • MARKUP
      • URL
    • Time series functions
      • Overview
      • AGO
      • AT_DATE
    • Type conversion functions
      • Overview
      • BOOL
      • DATE
      • DATETIME
      • DATETIME_PARSE
      • DATE_PARSE
      • DB_CAST
      • FLOAT
      • GEOPOINT
      • GEOPOLYGON
      • INT
      • STR
    • Window functions
      • Overview
      • AVG
      • AVG_IF
      • COUNT
      • COUNT_IF
      • FIRST
      • LAG
      • LAST
      • MAVG
      • MAX
      • MCOUNT
      • MIN
      • MMAX
      • MMIN
      • MSUM
      • RANK
      • RANK_DENSE
      • RANK_PERCENTILE
      • RANK_UNIQUE
      • RAVG
      • RCOUNT
      • RMAX
      • RMIN
      • RSUM
      • SUM
      • SUM_IF
    • Function Availability
  • Function tutorials
    • Aggregate functions
    • Window functions
    • LOD expressions and filtering in aggregate functions
  • Public materials
    • Educational projects
    • Webinars and conferences
    • Articles and publications
    • Public dashboards and charts
  • Troubleshooting
    • Questions and answers
    • DataLens errors
  1. Visualization reference
  2. Bar chart

Bar chart

Written by
Yandex Cloud
  • Types of bar charts
    • With grouping
    • Stacked
  • Sections in the wizard
  • Creating a bar chart
    • Creating a grouped bar chart
    • Adding a bar color based on a measure
    • Configuring the display of nullvalues
  • Recommendations

This chart displays the values of one or more measures by each category, using horizontal bars. The length of a bar determines the measure value: the longer the bar, the larger the value. For example, you can compare sales of products by their subcategory.

horizontal-bar-chart

Source table
Subcategory Sales
Beauty and health products 44K
Kitchenware 1392K
Kitchen products 1120K
Detergents 405K
Health and beauty equipment 1760K
Non-essential goods 827K
Cleaners 304K

Types of bar charts

  • With grouping
  • Stacked

With grouping

A chart with grouping by dimension lets you compare two or more categories by a single measure. For example, with grouping by delivery type you can compare the cost of products delivered by a courier to those with pickup. Categories are highlighted in different colors and the length of the bar indicates the measure value.

horizontal-bar-chart-groupped-1

Source table
Subcategory Delivery Pickup
Beauty and health products 12K 32K
Kitchenware 394K 998K
Kitchen products 371K 749K
Detergents 127K 278K
Health and beauty equipment 497K 1263K
Non-essential goods 268K 560K

Use a chart with grouping to compare two or more measures, such as the number of orders and the number of products. The bar length corresponds to the measure value.

horizontal-bar-chart-groupped-2

Source table
Subcategory Orders Number of products
Beauty and health products 481 1470
Kitchenware 758 2402
Kitchen products 480 1371
Detergents 835 2551
Health and beauty equipment 863 2705
Non-essential goods 705 2152
Cleaners 770 2460

Stacked

A stacked chart shows a ratio of internal segments to the total value. Segments are placed one after another: the beginning of each subsequent segment is the outermost boundary of the previous one.
This type of chart is used to see the contribution of each measure to the total value by period or category. For example, to view the percentage of different expenses in the total budget amount.

horizontal-bar-chart-stacked

Source table
Month Gasoline Rent Food Utility bills
January 2019 100 600 300 500
February 2019 150 600 250 700
March 2019 100 600 450 400
April 2019 120 600 370 510
May 2019 100 600 300 530
June 2019 130 600 310 600
July 2019 150 600 330 510
August 2019 120 600 250 550
September 2019 110 650 380 500
October 2019 120 650 300 550
November 2019 130 650 310 540
December 2019 100 650 400 550

Sections in the wizard

Section
in the wizard
Description
Y Dimensions. One or two dimensions can be specified.
X Measure. You can specify multiple measures. If you add more than one measure to a section, the Colors section contains a dimension named Measure Names. You may move Measure Names to the Y-axis.
Colors Dimension or the Measure Names field. Affects the color of bars. Measure Names is deleted by clicking the cross icon or removing measures from the X-axis.
Sorting Dimension or measure. Affects the sorting of columns.
Signatures Measure. Displays measure values on the chart. If multiple measures are added to the Y section, drag Measure Values to this section.
Chart filters Dimension or measure. Used as a filter.

Creating a bar chart

To create a bar chart:

  1. On the Yandex DataLens home page, click Create chart.
  2. Under Dataset, select a dataset for visualization.
  3. Select Bar chart as the chart type.
  4. Drag one or more dimensions from the dataset to the Y section. The values are displayed on the Y-axis.
  5. Drag one or more measures from the dataset to the X section.
  6. Drag a dimension from the dataset or the Measure Names field to the Colors section.

A stacked column chart is displayed by default.

Creating a grouped bar chart

To display an Y-axis grouped bar chart:

  1. Go to the bar chart that you created.

  2. Depending on the number of measures in the X section, follow these steps:

    One measure
    Two or more measures
    1. Check if there is a dimension in the Colors section.
    2. Duplicate this dimension in the Y section. The sequence of dimensions affects the grouping order.
    1. Drag the Measure Names dimension to the Colors section.
    2. Drag the Measure Names dimension to the Y section. The sequence of dimensions affects the grouping order.

Adding a bar color based on a measure

To color columns in a chart based on the value of a measure:

  1. Go to the column chart that you created.

  2. Depending on the number of measures in the X section, follow the steps below:

    One measure
    Two or more measures

    Copy the measure from the X section to the Colors section.

    Columns in the chart will take on colors as a function of the measure values.

    image

    Drag the Measure Values measure to the Colors section.

    The columns on the chart will take on colors depending on the values of all the measures listed in section X.

    image

  3. Configure a color gradient for the measure as well. To do this, in the top right-hand corner of the Colors section, click (the icon is displayed when you mouse over the section).

  4. In the color settings, specify:

    • Gradient type: Select 2 or 3 colors.
    • Gradient color: Select a color palette for the gradient from the list.
    • Gradient direction: Change the gradient direction using the icon.
    • Set threshold values: Set numeric thresholds for each color. Works if the X section contains a single value.

Configuring the display of nullvalues

If the source data includes a row where the measure value is null, this point won't be shown on the chart at default settings. For example, if the source includes a row with a date (20.07.2022) but the sales amount is missing for it.

You can use settings for chart sections to show null values:

  1. In the section with a measure whose values you want to show, in the upper-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 in the source data, the chart section settings won't affect the measure display on the chart. For example, if the source data doesn't 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

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

  • Place segments inside bars so that the largest or most important categories are located to the left, closer to the chart's Y-axis. This makes it easier to compare the values.
  • 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.

Was the article helpful?

Language / Region
Yandex project
© 2023 Yandex.Cloud LLC
In this article:
  • Types of bar charts
  • With grouping
  • Stacked
  • Sections in the wizard
  • Creating a bar chart
  • Creating a grouped bar chart
  • Adding a bar color based on a measure
  • Configuring the display of nullvalues
  • Recommendations