score:0
Accepted answer
dashboardcardcomponent.ts
//@input() card: any;
@input() card$: observable<any>;
tap the observable to fetch data and subsequent changes
ngoninit() {
//if (this.card.type === 'line') {
// this.linechartdata.push(this.card.value);
//}
this.card$.pipe(
tap(data=>this.linechartdata.push(data.value))
.subscribe() // either unsubscribe in ondestroy or use async pipe in html
}
in your calling component generalstatscomponent
subject card = new subject() // from rsjx
card.next( ... data... ) // data fetched from api or your selection logic
generalstatscomponent.html
<app-dashboard-card [card$]='card' ...>
above is just a pseudo code .. syntax needs to be reviewed.
Source: stackoverflow.com
Related Query
- Update Chart js chart dynamically in angular 2 from data getting from nodejs service
- Chart.js and Angular 8 - Dynamically updating Chart.js labels and data from *ngfor
- Dynamically updating Chart.js data in angular
- Dynamically updating time data in chart.js freezes the chart
- Chartjs random colors for each part of pie chart with data dynamically from database
- Chart.js Dynamically Updating Chart with X Axis Time
- Show data dynamically in line chart - ChartJS
- How to update data Chart in async way in Angular Chart.js?
- Angular chart how to show the legend data value by default along with legend name
- Change Angular js charts.js chart type dynamically
- Angular Charts.js: Can't refresh chart with data
- Angular / ng2-charts: Fetching json data in chart object showing: Cannot read property 'length' of undefined
- Angular ChartJS 2.9.4 issue updating chart
- Chart isn't updating with Response data (Chart.js 3.2.1, ng2-charts 3.0.0-beta.9)
- How to send data to chart js using angular
- Updating a Pie Chart in React as Data is Entered
- Chart.js animations when updating chart data
- How to destroy chart object in order to change chart data dynamically (Chart.js)?
- Angular 9 chartJs is not updating view after data update
- Data updating but chart isn't
- dynamically update Chart.js draw line chart dataset data
- Add data dynamically to chart
- How to add data dynamically to primevue Line chart from vuejs3?
- angular 4 line chart data is not showing data from http get
- Dynamically set chart type with Angular Chart?
- Dynamically loaded chart data not showing Chartjs React
- Live updating chart with data from database with Chart.js
- How to dynamically update data of line chart used with chart Js?
- (Lifecycle problem?) React Chart js-2 not updating data from componentDidMount
- Update Chart JS data dynamically and add new data, remove old data to create timeline "like" chart
More Query from same tag
- Adding new data to empty Chart.js chart does not render new data correctly
- How to create a chart with chartjs.org with data from an array?
- In chart.js, how to know if a yAxes tick is bumping/rendering over/into another
- problem with chart js pie chart dataset data
- How to set different colors in each stacked bar chart cell?
- The chart is not getting shown when page is loaded
- How do I import chartjs as an es6 module?
- How to show label at right side of Y axis same as left side of Y Axis ChartJS
- Node.js How to save data from pg database into variable
- ChartJS remove vertical grid lines one on two
- Is there a way to insert multiple lines, with labels, dynamically, into a ChartJS Line chart?
- how to format date string for x axis labels in chartjs?
- Angular2 ng2-chart customizations?
- Django + Chart.js Am I Doing This Right? Nothing is being rendered
- Chart.js canvas is empty / white in node.js
- How to make a max value in doughnut chart
- Passing data from a controller to ChartJS - Laravel
- Annotation problem with ng2-charts in Angular 11
- Getting chart js bar chart to fill window
- Populating a chartJS with data from API through axios (VueJS)
- Updating chart.js with a dataset of different size not working
- Angular 2 chart - change point radius
- Render chartjs and export image to data not in the DOM
- How do I connect to a PostgreSQL database on Heroku server and use Chart.js?
- Testing Chart.js Plugin with React and Jest/Enzyme
- How to use Chart.js in Nodejs?
- Update chart axis labels after hover - chart.js
- React using fetch returns undefined until save
- Issues with ng2-charts
- Show value on Mixed chart, Charts.js