esnet / esnet/react-timeseries-charts

LineChart error - TypeError: this.props.series.events is not a function

Open
#462 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
876
Forks
279
PR merge metrics
No merged PRs in 30d

Description

I try to create a simple LineChart and every time I get this error trying to include a LineChart:
**TypeError: this.props.series.events is not a function**

```javascript
var chart =


if (this.state.data){
chart =











}
```

I create this.state.data like this:
```javascript
const resultData = result.map((item) => { return [item.TIMESTAMP*1000, item.TEMP, item.HUM]});
this.setState({
isLoaded: true,
data: timeSeries( {
name: "sensor_"+this.state.sensorid,
columns: ["time", "temp", "hum"],
points: resultData
})
});
```

and result variable looks like this:
```javascript
const result = [
{ ID: 1, SENSORID: '1', TIMESTAMP: 1611047447, TEMP: 25, HUM: 50 },
{ ID: 2, SENSORID: '1', TIMESTAMP: 1611047448, TEMP: 26, HUM: 50 },
{ ID: 3, SENSORID: '1', TIMESTAMP: 1610881200, TEMP: 25, HUM: 50 },
{ ID: 4, SENSORID: '1', TIMESTAMP: 1610881200, TEMP: 25, HUM: 50 }
]
```

Complete error:
```
Uncaught (in promise) TypeError: this.props.series.events is not a function
renderLine LineChart.js:318
wrappedMethod react-hot-loader.development.js:555
renderLines LineChart.js:301
map Underscore
renderLines LineChart.js:300
wrappedMethod react-hot-loader.development.js:555
render LineChart.js:408
hotComponentRender react-hot-loader.development.js:592
proxiedRender react-hot-loader.development.js:600
React 13
sqlQuery chart.js:54
promise callback*sqlQuery chart.js:48
wrappedMethod react-hot-loader.development.js:555
componentDidMount chart.js:30
wrappedMethod react-hot-loader.development.js:545
React 7
unstable_runWithPriority scheduler.development.js:255
React 32
js index.js:9
Webpack 7
LineChart.js:318
React 7
sqlQuery chart.js:54
(Asíncrono: promise callback)
sqlQuery chart.js:48
wrappedMethod react-hot-loader.development.js:555
componentDidMount chart.js:30
wrappedMethod react-hot-loader.development.js:545
React 7
unstable_runWithPriority scheduler.development.js:255
React 7
dispatchInteractiveEvent self-hosted:1208
React 25
js index.js:9
Webpack 7
```

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.