victory
victory copied to clipboard
labels property not evaluating in VictoryBar when data objects contain a "label" property
Describe the bug When using VictoryBar, the labels property is not evaluated properly when the "data" property does not follow a specific structure.
Victory version Which npm version are you using?
To Reproduce
const data = [
{label: "A", value: 1},
{label: "B", value: 2},
];
const barProps = {
x: "label",
y: "value",
data,
labels: () => "Hello World",
}
<VictoryBar {...barProps}/>
Expected behavior Labels should be "Hello World"
Additional context This works:
const data = [
{name: "A", value: 1},
{name: "B", value: 2},
];
const barProps = {
x: "name",
y: "value",
data,
labels: () => "Hello World",
}
<VictoryBar {...barProps}/>