1👍
It should work if you define the Image
inside the component constructor
…
constructor() {
super();
const myImage = new Image(25, 35);
myImage.src = "/img/myimage.svg";
and create the Scatter
chart inside the render
method.
render() {
return (
<div>
<Scatter
data={this.state.chartData }
options={this.state.chartOptions}
...
/>
</div>
);
}
Please have a look at this StackBlitz.
- [Chartjs]-Accessing a slice of a react-chartjs Pie chart
- [Chartjs]-Why i have this error Utils is not defined when i want create a chart from chart.js
Source:stackexchange.com