Skip to content

Commit ae637f1

Browse files
authored
feat(bar): use custom label for legends (#1371)
1 parent dbc0aed commit ae637f1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/bar/src/compute/legends.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const getLegendDataForKeys = (bars, layout, direction, groupMode, reverse
1212
const data = uniqBy(
1313
bars.map(bar => ({
1414
id: bar.data.id,
15-
label: bar.data.id,
15+
label: bar.data.label || bar.data.id,
1616
color: bar.color,
1717
fill: bar.data.fill,
1818
})),
@@ -36,7 +36,7 @@ export const getLegendDataForIndexes = bars => {
3636
return uniqBy(
3737
bars.map(bar => ({
3838
id: bar.data.indexValue,
39-
label: bar.data.indexValue,
39+
label: bar.data.label || bar.data.indexValue,
4040
color: bar.color,
4141
fill: bar.data.fill,
4242
})),

0 commit comments

Comments
 (0)