0👍
Based on your code and comments, this is what I think you’re trying to achieve:
import React, {Component} from 'react';
import {Line} from 'react-chartjs-2';
class LineChart extends Component {
render() {
const labels = this.props.GraphData.data.map(point => point.x)
const data = this.props.GraphData.data.map(point => point.y)
return (
<div>
<Line
data={{
labels,
datasets: [{
data,
backgroundColor: this.props.GraphData.color,
fill: false,
lineTension: 0.4
}]
}} />
</div>
)
}
}
- Chartjs-How to Push data dynamically from firebase to bar graph in angular
- Chartjs-Draw vertical and horizonal lines on the radar chart (like x-y axes)
Source:stackexchange.com