Legends container CSS selector
Optionalorientation: "vertical" | "horizontal"Optionally indicates whether captions are displayed horizontally or vertically.
By default, the value of the legend.orient option in Apache ECharts will be used.
If legend.orient does not exist, the default value will be 'horizontal'.
OptionalseriesRef: string[]Array referencing the series whose legends are to be displayed in this legend container.
The reference can be the series name, the series label or simply the stack name in the case of stacked bars.
If seriesRef is absent, this container will be the default container for non-referenced legends.
OptionalpostItemContent: This option defines HTML content that will be displayed after each individual legend item. It can be:
Example with dynamic content based on legend information:
postItemContent: (legendLabel, legendName, legendIndex, color, colorIndex) => {
if (legendLabel === 'Sales') {
return `<div class="mt-2 p-2 bg-light rounded border-start border-3 border-primary">
<small class="text-muted">${legendName} (${legendIndex + 1})</small>
</div>`;
}
if (legendLabel === 'Profit') {
return '<div class="mt-1 alert alert-info py-1"><small>Net profit after adjustments</small></div>';
}
return '';
}
Example with object mapping:
postItemContent: {
'Sales': '<div class="mt-1 badge bg-primary-subtle text-primary-emphasis">Revenue data includes taxes</div>',
'Profit': '<div class="mt-1 badge bg-success-subtle text-success-emphasis">Net profit after adjustments</div>'
}
Example with array:
postItemContent: [
'<div class="mt-1 text-muted small">Contenu pour la première légende</div>',
'<div class="mt-1 text-muted small">Contenu pour la deuxième légende</div>'
]
OptionalafterLegendContent: stringThis option defines HTML content that will be displayed after all legend items. It should be a string containing HTML content that will be added at the end of the legend group.
Example:
afterLegendContent: '<div class="legend-footer">Last updated: October 2025</div>'
OptionalafterThis option defines HTML content that will be displayed after all legend items. It should be a string containing HTML content that will be added at the end of the legend group.
Example:
afterLegendContent: '<div class="legend-footer">Last updated: October 2025</div>'
Legends container CSS selector
OptionalorientationOptionally indicates whether captions are displayed horizontally or vertically.
By default, the value of the legend.orient option in Apache ECharts will be used.
If legend.orient does not exist, the default value will be 'horizontal'.
OptionalpostThis option defines HTML content that will be displayed after each individual legend item. It can be:
Example with dynamic content based on legend information:
postItemContent: (legendLabel, legendName, legendIndex, color, colorIndex) => {
if (legendLabel === 'Sales') {
return `<div class="mt-2 p-2 bg-light rounded border-start border-3 border-primary">
<small class="text-muted">${legendName} (${legendIndex + 1})</small>
</div>`;
}
if (legendLabel === 'Profit') {
return '<div class="mt-1 alert alert-info py-1"><small>Net profit after adjustments</small></div>';
}
return '';
}
Example with object mapping:
postItemContent: {
'Sales': '<div class="mt-1 badge bg-primary-subtle text-primary-emphasis">Revenue data includes taxes</div>',
'Profit': '<div class="mt-1 badge bg-success-subtle text-success-emphasis">Net profit after adjustments</div>'
}
Example with array:
postItemContent: [
'<div class="mt-1 text-muted small">Contenu pour la première légende</div>',
'<div class="mt-1 text-muted small">Contenu pour la deuxième légende</div>'
]
OptionalseriesArray referencing the series whose legends are to be displayed in this legend container.
The reference can be the series name, the series label or simply the stack name in the case of stacked bars.
If seriesRef is absent, this container will be the default container for non-referenced legends.
Definition of a container used to display legends, refer to ODSChartsTheme.externalizeLegends.
Example of use with a single vertical legend container:
Example of use with a several legend containers:
Example of use with postItemContent:
Example of use with afterLegendContent: