OPF
SpecDefinition referenceView source

Chart Data Labels

Data label settings. A label shows the selected content parts in the fixed order category, value, percent, joined by the separator.

Metadata

Definition
#/$defs/ChartDataLabels
Form
object
Source
spec/schemas/opf.schema.json

Field index

FieldTypeReq.Description
contentarray<enum>—Which parts a label shows. Defaults to ['value']. 'percent' is the share of the total and exists only on pie and doughnut charts; 'category' shows the category name (the X value on a scatter chart). A part a chart type cannot show is dropped with a 'chart-option-adapted' diagnostic.
content[] · Allowed values
"value""percent""category"
positionenum—Where a label sits relative to its mark. 'auto' (the default) is the type's default: outside-end for clustered columns and bars, pie slices and the histogram, pareto and waterfall constructs; center for stacked columns and bars; above for line and scatter points. Clustered columns and bars and the histogram, pareto and waterfall constructs take center, inside-end, inside-base and outside-end; stacked columns and bars take center, inside-end and inside-base; pie takes center, inside-end and outside-end; line and scatter points take above, below, left, right and center. Area, doughnut and radar charts and the funnel and treemap constructs take only 'auto' (the box-and-whisker and map constructs have no data labels). A combo chart places the labels of its column series like clustered columns and those of its line series like line points; a position only one part takes applies to that part, and the other part keeps its default (outside-end, above). An unsupported position falls back to 'auto' with a 'chart-option-adapted' diagnostic.
position · Allowed values
"auto""center""inside-end""inside-base""outside-end""above""below""left""right"
separatorstring—Text between the parts of a label that shows more than one. Defaults to ', '.

content

typearray<enum>requirednodefault—

Which parts a label shows. Defaults to ['value']. 'percent' is the share of the total and exists only on pie and doughnut charts; 'category' shows the category name (the X value on a scatter chart). A part a chart type cannot show is dropped with a 'chart-option-adapted' diagnostic.

content[] · Allowed values
"value""percent""category"

position

typeenumrequirednodefault—

Where a label sits relative to its mark. 'auto' (the default) is the type's default: outside-end for clustered columns and bars, pie slices and the histogram, pareto and waterfall constructs; center for stacked columns and bars; above for line and scatter points. Clustered columns and bars and the histogram, pareto and waterfall constructs take center, inside-end, inside-base and outside-end; stacked columns and bars take center, inside-end and inside-base; pie takes center, inside-end and outside-end; line and scatter points take above, below, left, right and center. Area, doughnut and radar charts and the funnel and treemap constructs take only 'auto' (the box-and-whisker and map constructs have no data labels). A combo chart places the labels of its column series like clustered columns and those of its line series like line points; a position only one part takes applies to that part, and the other part keeps its default (outside-end, above). An unsupported position falls back to 'auto' with a 'chart-option-adapted' diagnostic.

position · Allowed values
"auto""center""inside-end""inside-base""outside-end""above""below""left""right"
Field fragment · position.json
{
  "position": "auto"
}

separator

typestringrequirednodefault—

Text between the parts of a label that shows more than one. Defaults to ', '.

Field fragment · separator.json
{
  "separator": ", "
}
Complete definition constraints
Exact schema constraints
{
  "type": "object",
  "additionalProperties": false,
  "description": "Data label settings. A label shows the selected content parts in the fixed order category, value, percent, joined by the separator.",
  "properties": {
    "content": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "value",
          "percent",
          "category"
        ]
      },
      "minItems": 1,
      "uniqueItems": true,
      "description": "Which parts a label shows. Defaults to ['value']. 'percent' is the share of the total and exists only on pie and doughnut charts; 'category' shows the category name (the X value on a scatter chart). A part a chart type cannot show is dropped with a 'chart-option-adapted' diagnostic."
    },
    "position": {
      "type": "string",
      "enum": [
        "auto",
        "center",
        "inside-end",
        "inside-base",
        "outside-end",
        "above",
        "below",
        "left",
        "right"
      ],
      "description": "Where a label sits relative to its mark. 'auto' (the default) is the type's default: outside-end for clustered columns and bars, pie slices and the histogram, pareto and waterfall constructs; center for stacked columns and bars; above for line and scatter points. Clustered columns and bars and the histogram, pareto and waterfall constructs take center, inside-end, inside-base and outside-end; stacked columns and bars take center, inside-end and inside-base; pie takes center, inside-end and outside-end; line and scatter points take above, below, left, right and center. Area, doughnut and radar charts and the funnel and treemap constructs take only 'auto' (the box-and-whisker and map constructs have no data labels). A combo chart places the labels of its column series like clustered columns and those of its line series like line points; a position only one part takes applies to that part, and the other part keeps its default (outside-end, above). An unsupported position falls back to 'auto' with a 'chart-option-adapted' diagnostic."
    },
    "separator": {
      "type": "string",
      "description": "Text between the parts of a label that shows more than one. Defaults to ', '.",
      "examples": [
        ", ",
        "; "
      ]
    }
  }
}