score:0
This issue was happening on Firefox but not on Chrome,
In any case i am displaying the chart only when the data is ready
<p-chart *ngIf="data" type="line" [data]="data" [options]="options"></p-chart>
Note: p-chart is a component from Prime NG that wraps Chart.js
score:0
The references to these 3 arrays
allTitles = [];
allSets = [];
allColors = [];
which are used in the chart are not update when getExercisesByPlan
happens and the ANgular ChangeDetector does not know grasp that it need to detect changes and possibly update the markup.You change the elements of arrays, but the properties still have the same references inside.
Don't worry much if it is hard to understand - back then, c++ references and pointers were the main reasons why students decided to change their's career path and gave up software development :D you will get it from the solutions below.
Possible solution is to create a new array:
this.allTitles = [...this.neighbourCounter, plan.title];
this.allSets = [...this.neighbourCounter, this.neighbourSetsCounter];
this.allColors = [...this.neighbourCounter, plan.color];
You also can trigger change detection manually: Triggering change detection manually in Angular
score:0
After you've finished updating the data in the arrays, call this.chart.update()
;
score:0
I found the same issue.
I solved it like this:
myChart.update();
myChart.updateDataset();
So, basically, update()
method is not triggering updateDataset()
and you have to do it manually.
Francesc Manresa
score:1
//Fix by setting the time function
setTimeout(() => {
//charts data here
}, 1000);
Source: stackoverflow.com
Related Query
- Chart.js Chart in Angular does not load until resizing browser window
- Css style not working well when resizing chart height in angular application
- Charts.js does not render chart until I open the console
- ChartJs does not render chart when binding canvas id in Angular
- Edge browser does not render chart using chart js
- Chart js does not load on page
- Angular Chart color does not change
- Chart in Angular not displayed until windows resize
- Html chart does not fit a small Android WebView
- Chart looks only grey, does not show the color - Chartjs,discordjs
- Angular-chart.js - Make line chart does not curve
- Series Details Not Showing in Angular Chart with Charts.js
- angular chart.js not resizing (shinking) in a flexbox
- Chart.js is not rendered until zoom in in angular 8
- My pie chart (chartJs) does not appear
- Chart.js chart does not display when inside an ngIf.
- chart annotations not showing in Angular 2
- Bar Chart of ChartJS does not Render
- Adding object data to data structure of chart.js chart does not show any data
- Chart does not display on webpage in Django app (with Chart.js)
- Javascript chart fills up the entire browser window
- Chartjs does not render chart when set responsive option to true
- Chart.js in Angular 10: Specified colors not shown in multi-series bar chart (instead random colors)
- When I added a funnel chart to chartjs all the charts are load compressed until resize page
- ChartJs Memory Leak | Garbage Collection does not clean Chart Object or Arrays after render
- fill: 'origin' property does not work for my chart
- Angular-Charts bar chart does not update when I change the data, series, labels
- $scope variable do not respond to the onClick function of angular chart
- Chart.js not rendering properly until window resize or toggling line in legend
- My chart is not shown on browser screen using chart.js in meteor
More Query from same tag
- How to take data from an API and create a chart on that using Chart.js and Angular 8?
- Nesting directives and using the data inside the local scope
- Error in created hook (Promise/async): "TypeError: Cannot read property 'position' of undefined"
- How to hide some points inside my line graphic in React ChartJS 2?
- Uncaught Error: [$injector:modulerr] (Error came up when I included chart.js)
- How to loop over Chart.js with Django list view
- animation of a graph of an equation javascript
- Draw chart.js as svg
- ChartJS display legend
- Change section element every 20 seconds
- ChartJS radar scale points
- Chart.js 3+, Firefox 68 and Angular: "ReferenceError: "ResizeObserver is not defined"
- Array is not being updated in useState hook?
- hh:mm in chart.js on X-axis and text labels on the Y-axis
- How to fix [<br /> when trying to enter data through php in data (chart.js)
- Chart.js Auto Fit Failing
- Drawing line chart in chart.js placing dots only when value changes
- ChartJS non overlapping lines
- How to set defaults for scales in ChartJS?
- Javascript function to check for missing dates on JSON object
- Uprading to chart.js@3.x with Angular 8
- Chart.js not working properly to draw lines when is only 1 bar
- Want to show the dataset labels
- chartjs update() not updating
- Custom tooltip on Chart.js is coming undefined
- Chart.js turn off all y axis and toggle them on / off
- Negative bar chart of highcharts in chartjs
- angular 4 line chart data is not showing data from http get
- base chart slice color on series value?
- Chartjs2 set data 0 to type doughnut