score:0
you're subscribing to two observable
obtained from datasvc.getusers
and datasvc.getparts
, corresponding results will be delivered asynchronously, certainly after the invocation of the constructor
has finished. therefore, if with given code, you would invoke createchart()
at the end of the constructor
only, you would see two empty charts because userslabels
, usersamount
, partslabels
and partsamount
are still empty arrays at this point.
it's however needless to recreate both charts each time any observable
delivers new data. you better split createchart()
into separate methods, one for each chart. also instead of using chart.destroy()
, you should better simply update the existing chart data
and invoke chart.update()
afterwards. please take a look at the section adding or removing data of the chart.js documentation.
Source: stackoverflow.com
Related Query
- chartjs angular update order
- Update charts in chartjs and angular
- Order and hide items of legend by value with Chartjs Angular
- Angular 9 chartJs is not updating view after data update
- Angular 6: chartjs value not updating with dynamic value update
- ChartJS Line Chart - Points Connected out of order for Timeseries in Angular 6
- My Chartjs is not updating after setstate full code attached Reactjs Update
- Dynamically update values of a chartjs chart
- Dynamically update the options of a chart in chartjs using Javascript
- Why isn't my Angular 4 ChartJS component rendering?
- Chartjs doesn't update dataset label on tooltips
- Create a rounded bar graph with Angular and chartJS
- ChartJS Update callbacks
- How to update data Chart in async way in Angular Chart.js?
- Angular 8 & ChartJs change color in pie chart
- Make y-axis sticky when having horizontal scroll on chartJS and Angular
- How to add ChartJS code in Html2Pdf to view image
- Chartjs in Reactjs - how can I update data dynamically?
- How to use an Addon with ChartJS on Angular 4
- dynamically update the scale type of chartjs graph
- How do I add time sourced from an external source as an X axis to a ChartJS graph?
- chartjs - how to set the order in which the different charts are displayed
- Ionic 3 Angular Chart.js update data
- ChartJs events in Angular
- Chartjs not working with d3 from csv source
- how to hide specific dataset based on condition chartjs angular
- Remove moment from chartjs in angular app
- ChartJS update chart with multiple datasets
- ChartJS v2.6 update breaks custom line-with-area-range (stripe) chart
- Automatically update ChartJS with Knockout data-bind
More Query from same tag
- chart js, loading data dynamically
- Chart.js flickering
- vue-chart.js doesn't show data
- Chart.js padding not working for ScaleLabel
- Hide chart labels
- chart js showing some weird data at top of charts
- ChartJS V3 Radar chart Label Font Size
- Chart JS - How to display Label over Slices instead of text on hover
- Add chart using chart.js in codeigniter
- change axis scale to be round numbers instead of decimal - chart.js
- Bar chart with two sets of labels in Quickchart
- Which scenarios might make Chart.js's canvas element resize?
- Is it possible to add a javascript chart in a webview in Xamari.Forms
- Which type of chart is this in Chart.js?
- Angular 8 and ng2 charts - Updating labels and data
- ChartJs events in Angular
- Sort a Chart from Lowest to Highest Value in Chart JS
- ChartJs Horizontal line
- Values on Y-axis disappear (hide under labels)
- Why won't this html page run, Devexpress documentation ChartJS
- Dynamically loaded chart data not showing Chartjs React
- ChartJS set default options only to specific Canvas, not globally
- Reducing Y-axis in chart.js
- Formatting Data With Charts.JS
- Legend for only specific datasets - chart.js
- Angular-Chart.js chart doesn't shown, if data added automatically
- Update of options for PrimeNG Chart needs two calls instead of one
- Can't generate multi-axis combo chart (bar/line) using chart.js 2.7
- ERROR TypeError: Cannot read properties of undefined (reading 'skip') Typescript/Api
- How to sum the array value in javascript like chartjs data array and input value sum