score:3
Accepted answer
The canvas
element will not be rendered (written to the DOM) until chart
is true
<div *ngIf="chart">
<canvas #canvas></canvas>
</div>
Because chart
is initially undefined
, the canvas ViewChild does not exist, which explains why "this.canvas is undefined".
Try removing *ngIf="chart" to test your chart.
<canvas #canvas></canvas>
Source: stackoverflow.com
Related Query
- ERROR TypeError: "this.canvas is undefined" | Problem with creating a chart with angular and chart.js
- Chart js error in angular: Canvas is already in use. Chart with ID '0' must be destroyed before the canvas can be reused. Fix?
- Cannot read properties of undefined with react-chartjs-2 and chart js problem
- Problem creating chart out of GET request with Angular
- Why does nuxt give me this error with vue-chartjs?
- Problem for display a chart with Chart.js and Angular
- Error with Chart.js : TypeError: t is undefined
- Creating dropdown options with Chart.js using select tag and multiple canvas
- React chart : prevent chart's canvas scaling with height and width
- Canvas is already in use. Chart with ID '0' must be destroyed before the canvas can be reused. chat.JS
- How to use JSON data in creating a chart with chartjs?
- <Canvas is already in use. Chart with ID '18' must be destroyed before the canvas can be reused> in react
- Problem with script src for Chart.js. The CDN for Chart.js funtions fine, so my code is ok. Somehow I'm not linking the file correctly
- facing problem to solve Uncaught TypeError while using chart js
- HorizontalBar chart is displayed below canvas when I set height with style attribute for chart div (Chart.js 2.9.4)
- Chart JS Error : Uncaught TypeError: Cannot read property 'top' of undefined
- Eror: chart.min.js:13 Uncaught (in promise) Error: Canvas is already in use. Chart with ID '0' must be destroyed before the canvas can be reused
- what is wrong with my code ? java script chart position
- (Chart.js) Is there a way to compare one chart with another so as not to have this inconsistent effect of small values being as big as big values?
- Creating mixed Bar Chart with ReactJS using recharts or react-chartjs-2
- How do I destroy/update Chart Data in this chart.js code example?
- Chart.js - creating time series freqency chart with JSON data
- Canvas line chart on this graph stretch beyond the assigned lengths
- problem with chart js pie chart dataset data
- Is it possible with Chart js or which chart Library can provide this type of chart?
- How to make dynamic chart with the next view? What libraries allows to customise exactly this like in my design?
- Problem in making chart with Chart.js in wix?
- Chart.js - Creating a single bar chart with states
- e.labels.map is not a function when creating a chart with chart.js
- how to not repeat code while creating multiple charts in chart js
More Query from same tag
- Chart.js Plugin Not Recognized as Options Property in Angular
- multiple horizontal bar charts to display in same row
- Angular-chartjs Data labels over bar chart
- Chartjs populate data with Axios response
- How to set prop data for chart.js in React?
- How to get onClick Event for a Label in ChartJS and React?
- vue.js vue-chartjs chart not updating when chartData replaced, updated etc
- chart.js plotting timeseries
- Chart.js: Combined Line and Bar Data
- Django - rendering two dimensional dictionary data to template
- trouble with legend on chartjs
- Click on chart to expand more information - Chart.js
- Chartjs: I only want left and right padding in pie chart
- Draw a mathematical function in chartjs
- How to set minimum value to Radar Chart in chart js
- ChartJS glitches
- chart.js radar pointLabel options not working
- chart.js:4 Uncaught ReferenceError: require is not defined in ionic 2
- Chart.js canvas : can't center it
- Limit data in Chart.js with Flask/SQLAlchemy in python
- Chart.js, change color of specific ticks
- How to scale label size radar chart chart.js
- Chart.js coming up as blank
- How to improve PDF rasterization quality in PhantomJS?
- Increase space between legend and chart
- CharJS : Is it possible to display stacked bar chart with positive scale on both sides of 0 index
- Chart js - Line chart - How to hide the data label on the line?
- How to hide tooltip for selected datasets? - Chart.js v2.8
- Trying to create something from chart.js
- Accessing data from the callback function of a bar chart using chart js