Cookies on ons.gov.uk

Cookies are small files stored on your device when you visit a website. We use some essential cookies to make this website work.

We would like to set additional cookies to remember your settings and understand how you use the site. This helps us to improve our services.

You have accepted all additional cookies. You have rejected all additional cookies. You can change your cookie preferences at any time.

Skip to main content

This website no longer supports your browser. You can upgrade your browser to the latest version.

BETA

This is a new service. To help us improve it, give feedback

Charts Area charts

Overview

An area chart uses coloured areas to show the size of components in continuous data.

Important information:

The code to build the chart examples are provided in this page. If you’re looking for guidance on chart types, colours and build specs, please head to the data visualisation section.

Area chart

Example Area Chart contents

Nunjucks

{% from "components/chart/_macro.njk" import onsChart %}

{{
    onsChart({
        "chartType": "area",
        "description": "Area chart showing the annual rate of inflation for the Consumer Prices Index including owner occupiers’ housing costs (CPIH) and its components.",
        "theme": "alternate",
        "title": "Sales volumes and values saw moderate growth in July 2024",
        "subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
        "id": "id",
        "headingLevel": 4,
        "caption": "Source: Monthly Business Survey, Retails Sales Inquiry from the Office for National Statistics",
        "download": {
            'title': 'Download Figure 1 data',
            'itemsList': [
            {
                "text": "Excel spreadsheet (XLSX format, 18KB)",
                "url": "#"
            },
            {
                "text": "Simple text file (CSV format, 25KB)",
                "url": "#"
            },
            {

                "text": "Image (PNG format, 25KB)",
                "url": "#"
            }
        ]},
        "legend": "true",
        "series": [
        {
                "data": [
                    39.2, 47.1, 44.0, 46, 65.3, 53.2, 49.1, 49.3, 50.4, 48.1,
                    43.9, 41.8
                ],
                "name": "Test series 3"
            },
            {
                "data": [
                    28.8, 23.2, 33.0, 25.8, 20.8, 39.8, 37.9, 28.2, 37.6, 46.7,
                    43.9, 41.8
                ],
                "name": "Test series 2"
            },
            {
                "data": [
                    37.8, 41.0, 43.0, 42.9, 41.8, 39.8, 37.9, 38.2, 37.6, 36.7,
                    33.9, 31.8
                ],
                "name": "Test series 1"
            }
        ],
        "xAxis": {
            "categories": [
                "Mar 1901", "Mar 1902", "Mar 1903", "Mar 1904", "Mar 1905", "Mar 1906", "Mar 1907", "Mar 1908", "Mar 1909", "Mar 1910",
                "Mar 1911", "Mar 1912"
            ],
            "title":  "Years",
            "type": "linear"
        },
        "yAxis": {
            "title": "Y axis title"
        },
        "percentageHeightDesktop": 50,
        "percentageHeightMobile": 120,
        "fallbackImageUrl": '/img/small/area-chart-screenshot.png'
    })
}}

Nunjucks macro options

NameTypeRequiredDescription
chartTypestringtrue if iframe not setThe type of chart to render. Supported types include: 'line', 'bar', 'column', 'scatter', 'columnrange', 'boxplot' and 'area'. Will be ignored if an iframe url is set.
unsupportedChartTextstringfalseOptional text override to display after the chart type when it's not supported. Defaults to "chart type - chart type is not supported"
instructionsstringfalseInstructions for keyboard users on how to interact with the chart. This text will be read aloud by screen readers to guide navigation and interaction.
themestringfalseThe theme to apply to the chart. Either primary or alternate. Defaults to primary. Will be ignored if an iframe url is set.
headingLevelnumberfalseNumber used to determine the heading level of the title. Use to ensure the title has a correct semantic order on the page. Accepts a value between 1 and 4, defaulting to 2 if not provided.
titlestringtrueThe main title of the chart.
subtitlestringfalseA subtitle that appears under the main title.
idstringtrueA unique identifier for the chart instance or iframe.
captionstringfalseA caption providing additional context for the chart.
descriptionstringtrueA textual description of the chart for screen readers.
downloadobjectfalseObject for (download)[#download] options.
legendbooleanfalseWhether the legend is displayed. Defaults to true. Note that legends are automatically hidden for single series charts. Will be ignored if an iframe url is set.
yAxisobjecttrue if iframe not setDefines the vertical axis y-axis configuration parameters. Will be ignored if an iframe url is set.
xAxisobjecttrue if iframe not setDefines the horizontal axis x-axis configuration parameters. Will be ignored if an iframe url is set.
seriesarraytrue if iframe not setThe data series to be plotted, including labels and values. Will be ignored if an iframe url is set. Note: The number of series is limited by the selected theme - up to 6 series for the primary theme and 5 series for the alternate theme. Any additional series beyond these limits will be ignored and not displayed.
useStackedLayoutbooleanfalseDetermines whether the chart should use a stacked layout. It is useful only for bar and column charts. Will be ignored if an iframe url is set.
percentageHeightDesktopintegerfalseSets the percentage plot height at desktop, relative to the width. If undefined the chart will fall back to the default height of 400px at desktop. Does not apply to bar charts. Will be ignored if an iframe url is set.
percentageHeightMobileintegerfalseSets the percentage plot height at mobile, relative to the width. If undefined the chart will fall back to the default height of 400px at mobile. Does not apply to bar charts. Will be ignored if an iframe url is set.
annotationsarrayfalseAn array of point annotations. Will be ignored if an iframe url is set.
rangeAnnotationsarrayfalseAn array of range annotations. Will be ignored if an iframe url is set.
referenceLineAnnotationsarrayfalseAn array of reference line annotations. Will be ignored if an iframe url is set.
estimateLineLabelstringfalseLabel for the estimate line in the legend. Used in column charts with confidence intervals. Will be ignored if an iframe url is set.
uncertaintyRangeLabelstringfalseLabel for the confidence interval in the legend. Used in column charts showing uncertainty ranges. Will be ignored if an iframe url is set.
iframeUrlstringfalseA url for a visualisation to display in an iframe instead of displaying a Highcharts chart.
footnotesObject<Footnotes>falseFootnotes to appear below the chart in a 'details' element
fallbackImageUrlstringfalseA url for a fallback image to display instead of the chart or iframe visualisation if JavaScript is disabled. If a fallback image is passed with an iframeUrl parameter, the iframe will be hidden for non-JavaScript users. If it is not passed, it is assumed the iframe content will provide a fallback image to be displayed inside the iframe.
fallbackImageAltstringfalseAlt text for the fallback image - a short description only, as the description field describes the chart for screen readers. Defaults to "Fallback image for the chart as JavaScript is disabled"
iframeAspectRatiostringfalseSets the aspect ratio for iframe charts. Only applicable when using an iframe chart. Acceptable values are 16-9, 4-3, 21-9, 1-1, 3-2, and 9-16. The value must be provided in the x-y format (e.g. 16-9). If an unsupported value is provided or a value is not provided, the aspect ratio will default to 16-9.
Download
PropertyTypeRequiredDescription
titlestringfalseThe title displayed above the download options.
itemsListarrayfalseAn array of items available for download, each described by a (DownloadItem)[#DownloadItem].
DownloadItem
PropertyTypeRequiredDescription
textstringtrueThe label or description of the downloadable item.
urlstringtrueThe URL to the downloadable resource.
Y_Axis
NameTypeRequiredDescription
titlestringtrueThe title text displayed on the y-axis. Note that for any chart type apart from bar charts, a maximum character limit of 50 characters is recommended to avoid the axis title being cut off at mobile.
labelFormatstringfalseA format string for the axis label. Examples of string formats can be found in these docs (opens in a new tab) .
tickIntervalMobilenumberfalseThe interval of the tick marks in axis units at mobile. Useful when you want to space out the labels (e.g. show every 2nd or 5th label).
tickIntervalDesktopnumberfalseThe interval of the tick marks in axis units at desktop. Useful when you want to space out the labels (e.g. show every 2nd or 5th label).
customReferenceLineValuefloat or intfalseA custom value to display a darker reference line. If not supplied, the darker will appear at zero. The custom value is only used for column charts and line charts - for other chart types it will be ignored, and the darker line will appear at zero.
minnumberfalseSets the minimum value for the Y-axis. Relevant for Line, bar, area, column chart, column-range, boxplot and scatter charts.
maxnumberfalseSets the maximum value for the Y-axis. Relevant for Line, bar, area, column chart, column-range, boxplot and scatter charts.
startOnTickbooleanfalseAlign the axis to start on a tick. Relevant for Line, bar, area, column chart, column-range, boxplot and scatter charts.
endOnTickbooleanfalseAlign the axis to end on a tick. Relevant for Line, bar, area, column chart, column-range, boxplot and scatter charts.
X_Axis
NameTypeRequiredDescription
titlestringfalseThe title text displayed on the x-axis. Note: x-axis titles are not supported for bar chart types.
labelFormatstringfalseA format string for the x-axis label. Examples of string formats can be found in these docs (opens in a new tab) .
categoriesarrayfalseLabels for each tick mark along the x-axis.
typestringfalseThe type of axis. Can be one of linear, logarithmic, datetime or category. Defaults to linear.
tickIntervalMobilenumberfalseThe interval of the tick marks in axis units at mobile. Useful when you want to space out the labels (e.g. show every 2nd or 5th label).
tickIntervalDesktopnumberfalseThe interval of the tick marks in axis units at desktop. Useful when you want to space out the labels (e.g. show every 2nd or 5th label).
minnumberfalseSets the minimum value for the X-axis. Relevant only for scatter charts.
maxnumberfalseSets the maximum value for the X-axis. Relevant only for scatter charts.
startOnTickbooleanfalseAlign the axis to start on a tick. Relevant only for scatter charts.
endOnTickbooleanfalseAlign the axis to end on a tick. Relevant only for scatter charts.
Series
NameTypeRequiredDescription
namestringtrueThe name of the series.
dataarraytrueThe data values for the series. Each value corresponds to a category on the x-axis.
dataLabelsbooleanfalseOptions for whether the DataLabel is displayed. Defaults to false. This option is only available for bar chart and clustered bar charts with two or fewer series, and 20 or fewer data points in any series.
markerbooleanfalseOptions for whether the Marker is displayed on the data points. Defaults to false. This option is only available for line charts.
typestringfalseSpecifies the configuration type to apply to the series. Supported types include 'line' and 'scatter'. By default, it aligns with the chart type. This is used when combining multiple chart types within a single chart. Note: Only the following chart type combinations are supported: "column with line" and "columnrange with scatter". For column with line, only one line series is supported. Additional line series will be ignored.
connectNullsbooleanfalseWhether to connect lines that have a data point missing. Only relevant for line charts.
Point annotations
NameTypeRequiredDescription
textstringtrueThe annotation text.
pointobjectfalseThe x and y coordinates for the annotation
labelOffsetX (px)inttrueThe x offset in px of the label from the annotation point
labelOffsetY (px)inttrueThe y offset in px of the label from the annotation point
Point
NameTypeRequiredDescription
xValuefloat or inttrueThe x axis value of the annotation. For category axes this is the zero based index of the x axis categories array. It must be an integer in this scenario.
yValuefloattrueThe y axis value of the annotation
Range annotations
NameTypeRequiredDescription
textstringtrueThe annotation text.
rangeObjecttrueThe xValue or yValue coordinates for the annotation
axisstringtrueThe axis the range annotation should be applied to. Should be one of 'x' or 'y'. Note that for bar charts 'x' will be the vertical axis, and 'y' will be the horizontal axis.
labelInsidebooleantrueWhether the label for the range sits inside or outside the shaded area
labelOffsetX (px)intfalseThe horizontal offset in px of the label from it's default position. Ignored if labelInside is true.
labelOffsetY (px)intfalseThe vertical offset in px of the label from it's default position. Ignored if labelInside is true.
labelWidth (px)intfalseThe width of the label in pixels - the label text will wrap if it is wider than this value. If undefined, the label will be set to 150px wide.
Range
NameTypeRequiredDescription
axisValue1float or inttrueThe starting point on the axis for the annotation. For category axes this is the zero based index of the categories array. It must be an integer in this scenario.
axisValue2float or inttrueThe ending pont on the axis for the annotation. For category axes this is the zero based index of the axis categories array. It must be an integer in this scenario.
Reference line annotations
NameTypeRequiredDescription
textstringtrueThe annotation text.
valuefloat or inttrueThe x axis or y axis value for the annotation. For category axes this is the zero based index of the categories array. It must be an integer in this scenario.
axisstringtrueThe axis the range annotation should be applied to. Should be one of 'x' or 'y'. Note that for bar charts 'x' will be the vertical axis, and 'y' will be the horizontal axis.
labelWidth (px)intfalseThe width of the label in pixels - the label text will wrap if it is wider than this value. If undefined, the label will be set to 150px wide.
labelOffsetX (px)intfalseThe horizontal offset in px of the label from it's default position.
labelOffsetY (px)intfalseThe vertical offset in px of the label from it's default position.
Footnotes
NameTypeRequiredDescription
titlestringtrueThe title text for the footnotes heading
contentstringtrueHTML content for the footnotes

HTML

<div data-highcharts-base-chart data-highcharts-type="area" data-highcharts-theme="alternate"
  data-highcharts-title="Sales volumes and values saw moderate growth in July 2024" data-highcharts-id="id"
  data-highcharts-percentage-height-desktop="50" data-highcharts-percentage-height-mobile="120">
  <figure class="ons-chart" aria-describedby="chart-audio-description-id">
    <h4 class="ons-chart__title">Sales volumes and values saw moderate growth in July 2024</h4>
    <h5 class="ons-chart__subtitle">Figure 6: Upward contribution from housing and household services (including energy)
      saw the annual CPIH inflation rate rise</h5>
    <p class="ons-u-vh" id="chart-audio-description-id">Area chart showing the annual rate of inflation for the Consumer
      Prices Index including owner occupiers’ housing costs (CPIH) and its components.</p>
    <div data-highcharts-chart-container class="ons-chart__container" tabindex="0" role="region"
      aria-label="chart container" aria-describedby="chart-instructions-id">
      <div id="chart-instructions-id" class="ons-u-vh">Use the Tab key to move focus into the chart. Once inside, use
        the arrow keys to navigate between data points. As you move, tooltips will be announced to describe each point.
        Touch device users, explore by touch or with swipe gestures.</div>
      <div data-highcharts-chart class="ons-chart__chart"></div>
    </div>
    <noscript id="fallback-image--id">
      <img src="/img/small/area-chart-screenshot.png" alt="Fallback image for the chart as JavaScript is disabled"
        class="ons-chart__fallback-image" />
    </noscript>
    <figcaption class="ons-chart__caption">Source: Monthly Business Survey, Retails Sales Inquiry from the Office for
      National Statistics</figcaption>
  </figure>
  <h6 class="ons-chart__download-title">Download Figure 1 data</h6>
  <ol class="ons-list">
    <li class="ons-list__item">
      <a href="#" class="ons-list__link">Excel spreadsheet (XLSX format, 18KB)</a>
    </li>
    <li class="ons-list__item">
      <a href="#" class="ons-list__link">Simple text file (CSV format, 25KB)</a>
    </li>
    <li class="ons-list__item">
      <a href="#" class="ons-list__link">Image (PNG format, 25KB)</a>
    </li>
  </ol>
  <!-- Set scripts to pass the config values as json to the JavaScript -->
  <!-- prettier-ignore-start -->
  <script type="application/json" data-highcharts-config--id>
    {
      "chart": {
        "type": "area"
      },
      "legend": {
        "enabled": true
      },
      "yAxis": {
        "title": {
          "text": "Y axis title"
        },
        "labels": {}
      },
      "xAxis": {
        "title": {
          "text": "Years"
        },
        "categories": ["Mar 1901", "Mar 1902", "Mar 1903", "Mar 1904", "Mar 1905", "Mar 1906", "Mar 1907", "Mar 1908",
          "Mar 1909", "Mar 1910", "Mar 1911", "Mar 1912"
        ],
        "type": "linear",
        "labels": {}
      },
      "series": [{
        "name": "Test series 3",
        "data": [39.2, 47.1, 44, 46, 65.3, 53.2, 49.1, 49.3, 50.4, 48.1, 43.9, 41.8],
        "marker": {
          "enabled": false
        },
        "dataLabels": {
          "enabled": false
        },
        "connectNulls": false,
        "type": "area"
      }, {
        "name": "Test series 2",
        "data": [28.8, 23.2, 33, 25.8, 20.8, 39.8, 37.9, 28.2, 37.6, 46.7, 43.9, 41.8],
        "marker": {
          "enabled": false
        },
        "dataLabels": {
          "enabled": false
        },
        "connectNulls": false,
        "type": "area"
      }, {
        "name": "Test series 1",
        "data": [37.8, 41, 43, 42.9, 41.8, 39.8, 37.9, 38.2, 37.6, 36.7, 33.9, 31.8],
        "marker": {
          "enabled": false
        },
        "dataLabels": {
          "enabled": false
        },
        "connectNulls": false,
        "type": "area"
      }]
    }
  </script>
  <!-- prettier-ignore-end -->
</div>

When to use this component

Use an area chart to show trends of cumulative totals or to emphasise the magnitude of change over time, especially when comparing part-to-whole relationships within a total value.

Options

There are additional options that you can add to your charts.

Area chart with axis min and max values

Use this when you require axis minimum and maximum values on your area charts.

Example Area Chart With Axis Min And Max Values contents

Nunjucks

{% from "components/chart/_macro.njk" import onsChart %}

{{
    onsChart({
        "chartType": "area",
        "description": "Area chart showing the annual rate of inflation for the Consumer Prices Index including owner occupiers’ housing costs (CPIH) and its components.",
        "theme": "primary",
        "title": "Sales volumes and values saw moderate growth in July 2024",
        "subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
        "id": "id",
        "headingLevel": 4,
        "caption": "Source: Monthly Business Survey, Retails Sales Inquiry from the Office for National Statistics",
        "download": {
            'title': 'Download Figure 1 data',
            'itemsList': [
            {
                "text": "Excel spreadsheet (XLSX format, 18KB)",
                "url": "#"
            },
            {
                "text": "Simple text file (CSV format, 25KB)",
                "url": "#"
            },
            {

                "text": "Image (PNG format, 25KB)",
                "url": "#"
            }
        ]},
        "legend": "true",
        "series": [
        {
                "data": [
                    39.2, 47.1, 44.0, 46, 65.3, 53.2, 49.1, 49.3, 50.4, 48.1,
                    43.9, 41.8
                ],
                "name": "Test series 3"
            },
            {
                "data": [
                    28.8, 23.2, 33.0, 25.8, 20.8, 39.8, 37.9, 28.2, 37.6, 46.7,
                    43.9, 41.8
                ],
                "name": "Test series 2"
            },
            {
                "data": [
                    37.8, 41.0, 43.0, 42.9, 41.8, 39.8, 37.9, 38.2, 37.6, 36.7,
                    33.9, 31.8
                ],
                "name": "Test series 1"
            }
        ],
        "xAxis": {
            "categories": [
                "Mar 1901", "Mar 1902", "Mar 1903", "Mar 1904", "Mar 1905", "Mar 1906", "Mar 1907", "Mar 1908", "Mar 1909", "Mar 1910",
                "Mar 1911", "Mar 1912"
            ],
            "title":  "Years",
            "type": "linear"
        },
        "yAxis": {
            "title": "Y axis title",
            "min": -25,
            "max": 150,
            "startOnTick": true,
            "endOnTick": false
        },
        "percentageHeightDesktop": 50,
        "percentageHeightMobile": 120
    })
}}

Nunjucks macro options

NameTypeRequiredDescription
chartTypestringtrue if iframe not setThe type of chart to render. Supported types include: 'line', 'bar', 'column', 'scatter', 'columnrange', 'boxplot' and 'area'. Will be ignored if an iframe url is set.
unsupportedChartTextstringfalseOptional text override to display after the chart type when it's not supported. Defaults to "chart type - chart type is not supported"
instructionsstringfalseInstructions for keyboard users on how to interact with the chart. This text will be read aloud by screen readers to guide navigation and interaction.
themestringfalseThe theme to apply to the chart. Either primary or alternate. Defaults to primary. Will be ignored if an iframe url is set.
headingLevelnumberfalseNumber used to determine the heading level of the title. Use to ensure the title has a correct semantic order on the page. Accepts a value between 1 and 4, defaulting to 2 if not provided.
titlestringtrueThe main title of the chart.
subtitlestringfalseA subtitle that appears under the main title.
idstringtrueA unique identifier for the chart instance or iframe.
captionstringfalseA caption providing additional context for the chart.
descriptionstringtrueA textual description of the chart for screen readers.
downloadobjectfalseObject for (download)[#download] options.
legendbooleanfalseWhether the legend is displayed. Defaults to true. Note that legends are automatically hidden for single series charts. Will be ignored if an iframe url is set.
yAxisobjecttrue if iframe not setDefines the vertical axis y-axis configuration parameters. Will be ignored if an iframe url is set.
xAxisobjecttrue if iframe not setDefines the horizontal axis x-axis configuration parameters. Will be ignored if an iframe url is set.
seriesarraytrue if iframe not setThe data series to be plotted, including labels and values. Will be ignored if an iframe url is set. Note: The number of series is limited by the selected theme - up to 6 series for the primary theme and 5 series for the alternate theme. Any additional series beyond these limits will be ignored and not displayed.
useStackedLayoutbooleanfalseDetermines whether the chart should use a stacked layout. It is useful only for bar and column charts. Will be ignored if an iframe url is set.
percentageHeightDesktopintegerfalseSets the percentage plot height at desktop, relative to the width. If undefined the chart will fall back to the default height of 400px at desktop. Does not apply to bar charts. Will be ignored if an iframe url is set.
percentageHeightMobileintegerfalseSets the percentage plot height at mobile, relative to the width. If undefined the chart will fall back to the default height of 400px at mobile. Does not apply to bar charts. Will be ignored if an iframe url is set.
annotationsarrayfalseAn array of point annotations. Will be ignored if an iframe url is set.
rangeAnnotationsarrayfalseAn array of range annotations. Will be ignored if an iframe url is set.
referenceLineAnnotationsarrayfalseAn array of reference line annotations. Will be ignored if an iframe url is set.
estimateLineLabelstringfalseLabel for the estimate line in the legend. Used in column charts with confidence intervals. Will be ignored if an iframe url is set.
uncertaintyRangeLabelstringfalseLabel for the confidence interval in the legend. Used in column charts showing uncertainty ranges. Will be ignored if an iframe url is set.
iframeUrlstringfalseA url for a visualisation to display in an iframe instead of displaying a Highcharts chart.
footnotesObject<Footnotes>falseFootnotes to appear below the chart in a 'details' element
fallbackImageUrlstringfalseA url for a fallback image to display instead of the chart or iframe visualisation if JavaScript is disabled. If a fallback image is passed with an iframeUrl parameter, the iframe will be hidden for non-JavaScript users. If it is not passed, it is assumed the iframe content will provide a fallback image to be displayed inside the iframe.
fallbackImageAltstringfalseAlt text for the fallback image - a short description only, as the description field describes the chart for screen readers. Defaults to "Fallback image for the chart as JavaScript is disabled"
iframeAspectRatiostringfalseSets the aspect ratio for iframe charts. Only applicable when using an iframe chart. Acceptable values are 16-9, 4-3, 21-9, 1-1, 3-2, and 9-16. The value must be provided in the x-y format (e.g. 16-9). If an unsupported value is provided or a value is not provided, the aspect ratio will default to 16-9.
Download
PropertyTypeRequiredDescription
titlestringfalseThe title displayed above the download options.
itemsListarrayfalseAn array of items available for download, each described by a (DownloadItem)[#DownloadItem].
DownloadItem
PropertyTypeRequiredDescription
textstringtrueThe label or description of the downloadable item.
urlstringtrueThe URL to the downloadable resource.
Y_Axis
NameTypeRequiredDescription
titlestringtrueThe title text displayed on the y-axis. Note that for any chart type apart from bar charts, a maximum character limit of 50 characters is recommended to avoid the axis title being cut off at mobile.
labelFormatstringfalseA format string for the axis label. Examples of string formats can be found in these docs (opens in a new tab) .
tickIntervalMobilenumberfalseThe interval of the tick marks in axis units at mobile. Useful when you want to space out the labels (e.g. show every 2nd or 5th label).
tickIntervalDesktopnumberfalseThe interval of the tick marks in axis units at desktop. Useful when you want to space out the labels (e.g. show every 2nd or 5th label).
customReferenceLineValuefloat or intfalseA custom value to display a darker reference line. If not supplied, the darker will appear at zero. The custom value is only used for column charts and line charts - for other chart types it will be ignored, and the darker line will appear at zero.
minnumberfalseSets the minimum value for the Y-axis. Relevant for Line, bar, area, column chart, column-range, boxplot and scatter charts.
maxnumberfalseSets the maximum value for the Y-axis. Relevant for Line, bar, area, column chart, column-range, boxplot and scatter charts.
startOnTickbooleanfalseAlign the axis to start on a tick. Relevant for Line, bar, area, column chart, column-range, boxplot and scatter charts.
endOnTickbooleanfalseAlign the axis to end on a tick. Relevant for Line, bar, area, column chart, column-range, boxplot and scatter charts.
X_Axis
NameTypeRequiredDescription
titlestringfalseThe title text displayed on the x-axis. Note: x-axis titles are not supported for bar chart types.
labelFormatstringfalseA format string for the x-axis label. Examples of string formats can be found in these docs (opens in a new tab) .
categoriesarrayfalseLabels for each tick mark along the x-axis.
typestringfalseThe type of axis. Can be one of linear, logarithmic, datetime or category. Defaults to linear.
tickIntervalMobilenumberfalseThe interval of the tick marks in axis units at mobile. Useful when you want to space out the labels (e.g. show every 2nd or 5th label).
tickIntervalDesktopnumberfalseThe interval of the tick marks in axis units at desktop. Useful when you want to space out the labels (e.g. show every 2nd or 5th label).
minnumberfalseSets the minimum value for the X-axis. Relevant only for scatter charts.
maxnumberfalseSets the maximum value for the X-axis. Relevant only for scatter charts.
startOnTickbooleanfalseAlign the axis to start on a tick. Relevant only for scatter charts.
endOnTickbooleanfalseAlign the axis to end on a tick. Relevant only for scatter charts.
Series
NameTypeRequiredDescription
namestringtrueThe name of the series.
dataarraytrueThe data values for the series. Each value corresponds to a category on the x-axis.
dataLabelsbooleanfalseOptions for whether the DataLabel is displayed. Defaults to false. This option is only available for bar chart and clustered bar charts with two or fewer series, and 20 or fewer data points in any series.
markerbooleanfalseOptions for whether the Marker is displayed on the data points. Defaults to false. This option is only available for line charts.
typestringfalseSpecifies the configuration type to apply to the series. Supported types include 'line' and 'scatter'. By default, it aligns with the chart type. This is used when combining multiple chart types within a single chart. Note: Only the following chart type combinations are supported: "column with line" and "columnrange with scatter". For column with line, only one line series is supported. Additional line series will be ignored.
connectNullsbooleanfalseWhether to connect lines that have a data point missing. Only relevant for line charts.
Point annotations
NameTypeRequiredDescription
textstringtrueThe annotation text.
pointobjectfalseThe x and y coordinates for the annotation
labelOffsetX (px)inttrueThe x offset in px of the label from the annotation point
labelOffsetY (px)inttrueThe y offset in px of the label from the annotation point
Point
NameTypeRequiredDescription
xValuefloat or inttrueThe x axis value of the annotation. For category axes this is the zero based index of the x axis categories array. It must be an integer in this scenario.
yValuefloattrueThe y axis value of the annotation
Range annotations
NameTypeRequiredDescription
textstringtrueThe annotation text.
rangeObjecttrueThe xValue or yValue coordinates for the annotation
axisstringtrueThe axis the range annotation should be applied to. Should be one of 'x' or 'y'. Note that for bar charts 'x' will be the vertical axis, and 'y' will be the horizontal axis.
labelInsidebooleantrueWhether the label for the range sits inside or outside the shaded area
labelOffsetX (px)intfalseThe horizontal offset in px of the label from it's default position. Ignored if labelInside is true.
labelOffsetY (px)intfalseThe vertical offset in px of the label from it's default position. Ignored if labelInside is true.
labelWidth (px)intfalseThe width of the label in pixels - the label text will wrap if it is wider than this value. If undefined, the label will be set to 150px wide.
Range
NameTypeRequiredDescription
axisValue1float or inttrueThe starting point on the axis for the annotation. For category axes this is the zero based index of the categories array. It must be an integer in this scenario.
axisValue2float or inttrueThe ending pont on the axis for the annotation. For category axes this is the zero based index of the axis categories array. It must be an integer in this scenario.
Reference line annotations
NameTypeRequiredDescription
textstringtrueThe annotation text.
valuefloat or inttrueThe x axis or y axis value for the annotation. For category axes this is the zero based index of the categories array. It must be an integer in this scenario.
axisstringtrueThe axis the range annotation should be applied to. Should be one of 'x' or 'y'. Note that for bar charts 'x' will be the vertical axis, and 'y' will be the horizontal axis.
labelWidth (px)intfalseThe width of the label in pixels - the label text will wrap if it is wider than this value. If undefined, the label will be set to 150px wide.
labelOffsetX (px)intfalseThe horizontal offset in px of the label from it's default position.
labelOffsetY (px)intfalseThe vertical offset in px of the label from it's default position.
Footnotes
NameTypeRequiredDescription
titlestringtrueThe title text for the footnotes heading
contentstringtrueHTML content for the footnotes

HTML

<div data-highcharts-base-chart data-highcharts-type="area" data-highcharts-theme="primary"
  data-highcharts-title="Sales volumes and values saw moderate growth in July 2024" data-highcharts-id="id"
  data-highcharts-percentage-height-desktop="50" data-highcharts-percentage-height-mobile="120">
  <figure class="ons-chart" aria-describedby="chart-audio-description-id">
    <h4 class="ons-chart__title">Sales volumes and values saw moderate growth in July 2024</h4>
    <h5 class="ons-chart__subtitle">Figure 6: Upward contribution from housing and household services (including energy)
      saw the annual CPIH inflation rate rise</h5>
    <p class="ons-u-vh" id="chart-audio-description-id">Area chart showing the annual rate of inflation for the Consumer
      Prices Index including owner occupiers’ housing costs (CPIH) and its components.</p>
    <div data-highcharts-chart-container class="ons-chart__container" tabindex="0" role="region"
      aria-label="chart container" aria-describedby="chart-instructions-id">
      <div id="chart-instructions-id" class="ons-u-vh">Use the Tab key to move focus into the chart. Once inside, use
        the arrow keys to navigate between data points. As you move, tooltips will be announced to describe each point.
        Touch device users, explore by touch or with swipe gestures.</div>
      <div data-highcharts-chart class="ons-chart__chart"></div>
    </div>
    <figcaption class="ons-chart__caption">Source: Monthly Business Survey, Retails Sales Inquiry from the Office for
      National Statistics</figcaption>
  </figure>
  <h6 class="ons-chart__download-title">Download Figure 1 data</h6>
  <ol class="ons-list">
    <li class="ons-list__item">
      <a href="#" class="ons-list__link">Excel spreadsheet (XLSX format, 18KB)</a>
    </li>
    <li class="ons-list__item">
      <a href="#" class="ons-list__link">Simple text file (CSV format, 25KB)</a>
    </li>
    <li class="ons-list__item">
      <a href="#" class="ons-list__link">Image (PNG format, 25KB)</a>
    </li>
  </ol>
  <!-- Set scripts to pass the config values as json to the JavaScript -->
  <!-- prettier-ignore-start -->
  <script type="application/json" data-highcharts-config--id>
    {
      "chart": {
        "type": "area"
      },
      "legend": {
        "enabled": true
      },
      "yAxis": {
        "title": {
          "text": "Y axis title"
        },
        "labels": {},
        "min": -25,
        "max": 150,
        "startOnTick": true,
        "endOnTick": false
      },
      "xAxis": {
        "title": {
          "text": "Years"
        },
        "categories": ["Mar 1901", "Mar 1902", "Mar 1903", "Mar 1904", "Mar 1905", "Mar 1906", "Mar 1907", "Mar 1908",
          "Mar 1909", "Mar 1910", "Mar 1911", "Mar 1912"
        ],
        "type": "linear",
        "labels": {}
      },
      "series": [{
        "name": "Test series 3",
        "data": [39.2, 47.1, 44, 46, 65.3, 53.2, 49.1, 49.3, 50.4, 48.1, 43.9, 41.8],
        "marker": {
          "enabled": false
        },
        "dataLabels": {
          "enabled": false
        },
        "connectNulls": false,
        "type": "area"
      }, {
        "name": "Test series 2",
        "data": [28.8, 23.2, 33, 25.8, 20.8, 39.8, 37.9, 28.2, 37.6, 46.7, 43.9, 41.8],
        "marker": {
          "enabled": false
        },
        "dataLabels": {
          "enabled": false
        },
        "connectNulls": false,
        "type": "area"
      }, {
        "name": "Test series 1",
        "data": [37.8, 41, 43, 42.9, 41.8, 39.8, 37.9, 38.2, 37.6, 36.7, 33.9, 31.8],
        "marker": {
          "enabled": false
        },
        "dataLabels": {
          "enabled": false
        },
        "connectNulls": false,
        "type": "area"
      }]
    }
  </script>
  <!-- prettier-ignore-end -->
</div>

Help improve this page

Let us know how we could improve this page, or share your user research findings. Discuss this page on GitHub (opens in a new tab)