Closed openmohan closed 6 years ago
Initialise chart in componentDidMount()
For E.g
componentDidMount(){ var ctx= document.getElementById("test"); var myBarChart = new Chart(ctx, { type: 'horizontalBar', data: data, options: options }); } }
Sorry, can't indent properly
Thanks @ashutoshjha1409 . Forgot that completely
This will be available in react-chartjs 2.0
once we have a stable version. Please see branch chartjs-v2
.
render(){ var ctx= document.getElementById("test") var myBarChart = new Chart(ctx, { type: 'horizontalBar', data: data, options: options }); } return (
)Even though I give this , the code in the component get executed before the document gets loaded . So "ctx" will be null . I need to use without Jquery plugin.