FormidableLabs / FormidableLabs/victory-native-xl

How to create multi line chart with dynamic data?

Open
#533 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.2k
Forks
109
Avg merge
1d 15h
Merged PRs (30d)
3

Description

### Question

In victory native legacy I created a Multi Line Chart that would map over a datasets of line data inside `VictoryChart`

```
const data = [
[{x: 0, y: 10}, {x: 1, y: 11}, {x: 2, y: 12}], // <-- first line
[{x: 0, y: 20}, {x: 1, y: 21}, {x: 2, y: 23}], // <-- second line
[{x: 0, y: 30}, {x: 1, y: 31}, {x: 2, y: 33}], // <-- third line
]
```

but now with victory native xl I need to create data array like this
```
const data = [
{x: 0, y1: 10, y2: 20, y3: 30},
{x: 1, y1: 11, y2: 21, y3: 31},
....]
```
How can I map over the points array inside `CartesianChart` if I don't know how many lines there will be? In my use case it depends on how many data endpoints the user will select (one or more).

I tried to map over the keys of points from `CartesianChartRenderArg` but I got nothing.
```
{({points, chartBounds}) => (
<>
{Object.keys(points).map((k) => {
return (

);
})}

)}

```

Contributor guide

Open the contributing guide

Research direction

Start with the CartesianChartRenderArg type and the CartesianChart render callback shown in the issue. Reproduce the case with one and multiple selected endpoints, then clarify the supported data shape and how completion should be verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
data-visualization, mobile-dev
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.