score:2
Accepted answer
so what happen here is you only call this function once cause you made a promise. what you have to do is use an observer. an observer will return the value and the changed value of the socket with the valuechanges option of firebase. to do this you have to change your services:
fetchhourlymessages(orgname:string){
return this.db.list(orgname + '/stats/messages/hourly/', ref => ref.orderbychild("messages").limittolast(12))
}
and on your ngoninit:
this.datasvc.fetchhourlymessages(this.core.orgname).valuechanges().subscribe((resp: any) => {
for(let key of object.keys(resp)){
this.chartdata[0].data.push(resp[key].messages)
let hour = resp[key].hour
this.chartlabels.push(hour)
}
this.chart.chart.update()
});
Source: stackoverflow.com
Related Query
- Creating a real time line chart using chartjs and firebase realtime db
- Can't Draw Horizontal Line on Graph Using ChartJS Annotation Plugin and Primevue Chart
- ChartJs line chart time cartesian axis number of ticks and wierd offset
- How to add vertical line in bar chart using chartJs and ng2-charts?
- Display line chart with connected dots using chartJS
- Chartjs 2 - Stacked bar and unstacked line on same chart with same y axis
- Category scale on Y-axis and time on x-axis in bubble chart in Chartjs
- ChartJS Line chart cut off at the top and bottom
- ChartJS line chart drag and zoom
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- Create Chart using Reactjs Chartjs and axios
- Grouped Bar Chart from mySQL database using ChartJS and PHP
- Chart.js Date and Time Bar Chart Not Rendering - Line Works Though
- How to update a chart using VueJS and ChartJS
- How to plot chart from external JSON and format X-AXIS to show time using Chart.JS?
- how can i use chart.js to create a chart that has one time series line and one linear line on it at the same time?
- create Chart using Chartjs and PHP
- how to increase space between legend and chart in chartjs (ng2charts ) using angular
- Line Chart using Chart js with time data
- How to take a set of Date objects and display the frequency based on time of day using ChartJS
- Creating charts dynamically using ChartJS and AngularJS
- ChartJS : Hook before values are given to doughnut (absolute value in chart and real values in the tooltips)
- Chart with Time axis only displaying first grid line and tick label (unitStepSize)
- How do you set x and y axis and Title for a line chart using charts.js?
- Real-time line chart with ChartJS using Ajax data
- Chartjs draw line chart where line go back and forth (by chronological order)
- How to remove old chart and append new chart to div using chartjs
- How to plot a line chart which has both the start and points outside the canvas area using Chart.js
- How to start the chart from specific time and offest hour and then show the data on chart from target datetime in chartjs
- Google Charts, HighCharts or ChartJS Dual Axis Gantt Chart and Line Chart Visualization
More Query from same tag
- Making my website interactive with the size of the screen/browser
- Interactive chart via ChartJS
- Non numeric for x-axis in scatter chart in CHART.js
- On hover bar is overlapped by label chartjs
- How to draw outer labels for polar chart using ng2-charts and chart.js at fixed positions outside the rings?
- build dynamic array for charts.js
- Can I use a variable as index in for loop in python?
- Django Serializers - Return the sum of values by filter
- Chart.js horizontal bar width
- Adding label inside multiseries doughnut chart through chart.js
- How to add a vertical line on Chart.js when hover a point?
- Detect if the click is in bar or outside of bar in ChartJS
- ChartJS - How can I skip certain minutes on the X-Axis
- Chart.js Types of property 'type' are incompatible. Type 'string' is not assignable to type '"line" | "bar" | "scatter"
- How to rotate datalabels in Charts.js with plugins?
- Chart.js : Multiple colors for tooltipFontColor
- ChartJS - Bottom labels displayed vertically
- Chart Js V2 draw Horizontal Bar(Average) Over Vertical Bar
- Is there way to get counts of every day of week by created_at in laravel php
- How to hide a dataset with your own button?
- Calling external Chartjs chart from a javascript file into HTML in Flask
- How to remove the Chart.js x Axis bottom line?
- Line graph - ChartJS
- generateLegend() Chart.JS V2
- Trouble getting Axis Labels to show up in Chart.js
- 'barradius' for Barchart in ChartJS is not working
- Not all date data shows on x axis line chart
- Show highest value untop of a bars when dataset is stacked (chartjs)
- Chart.js v3 after using of zoom plugin instance persist in memory
- Chart.js draw y-axis only up to point