esnet / esnet/react-timeseries-charts

Default min/max y-axis values for BandCharts

Open
#344 1 comment 0 reactions 0 assignees View on GitHub
:question: question :sparkles: enhancement
Dominant language
JavaScript
Stars
876
Forks
279
PR merge metrics
No merged PRs in 30d

Description

I'm using the BandChart (pulled from the current master branch), and when panning or zooming the chart I get a lot of these:

```
Error: attribute d: Expected number, "…491151407752467,NaNL0.0296717327…".
```

For some reason it seems that the [areaGenerator](https://github.com/esnet/react-timeseries-charts/blob/master/src/components/BandChart.js#L429) frequently produces NaNs for my data, all of which is between 0 and 1. I hacked together a solution for myself by providing default values for the yaxis of 0 and 1:

const areaGenerator = area()
.curve(curves[this.props.interpolation])
.x(d => d.x0)
.y0(d => d.y0 || 0)
.y1(d => d.y1 || 1);

Should there be a way to specify min/max values for the y axis here? Perhaps there's a better approach to this. If so, I'd be happy to help contribute.

In case it helps I'm constructing my data with something like this:

const series = new TimeSeries({
name: "Data",
columns: ['index', 'value', 'bands'],
points: [
["1s-1438527040", 0.3, [0.2, 0.3, 0.4]],
...
]
})

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.