FormidableLabs / FormidableLabs/victory
labels property not evaluating in VictoryBar when data objects contain a "label" property
- Dominant language
- TypeScript
- Stars
- 11.2k
- Forks
- 536
- PR merge metrics
- No merged PRs in 30d
Description
**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",
}
```

**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",
}
```

Contributor guide
Research direction
Start by reproducing the provided VictoryBar example with data objects using the `label` property, then trace label evaluation from the VictoryBar entry point. Compare it with the working `name` example and verify that the callback produces "Hello World" for both bars.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- data-visualization, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100