Skip to content
+

Charts - Label

Customize how series and data points are labeled in charts.

A label is the text that identifies a series or data point in a chart, appearing in locations such as the legend, tooltip, or directly on chart elements.

You can set a series label by passing a string to the label property of a series. The label appears in different locations such as the legend and tooltip.

  • label 1
Press Enter to start editing

Conditional formatting

The label property accepts a function that lets you change the label content based on location. The function receives location as its first argument, which can have the following values:

  • 'legend': Format the label in the Legend
  • 'tooltip': Format the label in the Tooltip
  • simple label
  • legend label
Press Enter to start editing

Pie chart labels

The Pie chart behaves differently due to its nature. It has labels per slice instead of per series, and provides one additional location where labels can be rendered. Instead of receiving the label as part of the series, it receives it as part of the data set inside a series.

The location argument can have the following values:

  • 'legend': Format the label in the Legend
  • 'tooltip': Format the label in the Tooltip
  • 'arc': Format the Arc label when arcLabel is set to 'label'
  • legend+A
  • legend+B
  • legend+C
arc+Aarc+Barc+C
Press Enter to start editing

API

See the documentation below for a complete reference to all of the props and classes available to the components mentioned here.