FormidableLabs / FormidableLabs/victory

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

Open
#2,598 0 comments 0 reactions 0 assignees View on GitHub
Issue: Accepted Type: Bug :bug:
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",
}

```
![2023-05-22 11_29_15-MyGeo Next - prototype](https://github.com/FormidableLabs/victory/assets/142103/d14cc82f-fc8b-4d08-b4e5-6e38acc10d78)

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

```
![2023-05-22 11_28_48-MyGeo Next - prototype](https://github.com/FormidableLabs/victory/assets/142103/cd2d5ff6-18cf-432f-aa84-490d11f3e6ab)

Contributor guide

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.