victory icon indicating copy to clipboard operation
victory copied to clipboard

labels property not evaluating in VictoryBar when data objects contain a "label" property

Open Cadrach opened this issue 1 year ago • 0 comments

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}/>

2023-05-22 11_29_15-MyGeo Next - prototype

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}/>

2023-05-22 11_28_48-MyGeo Next - prototype

Cadrach avatar May 22 '23 09:05 Cadrach