score:0
you can try
const hometowncount = apicallresult.reduce((acc, it) => {
acc[it.hometown] = (acc[it.hometown] || 0) + 1;
return acc;
}, {});
hope this helps.
score:0
after a quick search, i found out i was on the right track. i needed object.keys(hometown)
and object.values(hometown)
to put in chartjs for things to work.
cheers
Source: stackoverflow.com
Related Query
- Count all distinct values from JSON in javascript for ChartJS
- django chart.js - Query to get count of all distinct values for particular column
- How can I show JSON data in Chart.js with Javascript if static values are working but dynamic from mySQL are not?
- convert csv to json for javascript plotting library chartjs in Python or PHP
- javascript count daily occurrencies from a datatable for the creation of a linechart
- build a javascript callback function from php for chartjs
- Chartjs random colors for each part of pie chart with data dynamically from database
- Side effects from Chartjs for only *some* clients
- Chartjs - Donut Chart label for small values not visible
- Javascript function to check for missing dates on JSON object
- How do I add time sourced from an external source as an X axis to a ChartJS graph?
- Setting Common labels and background color common for all the charts in ChartJs
- Chartjs stacked bar separate tooltip for all stacked
- format JSON data for chart.js from Angular 4 observable
- Chartjs not working with d3 from csv source
- how can i send a list of numbers from views.py to a chartjs file im using for the front?
- Calling external Chartjs chart from a javascript file into HTML in Flask
- Iterating over an IEnumerable in Javascript for Chartjs
- how can i reset chartjs object all instances and recreate it from scratch?
- Passing an Array from a Flask view to the javascript code of another view
- How to create a custom tooltip for chartJS graph with data in JSON array in JavaScript?
- Map JSON for Chartjs with Angular 7
- chartjs xaxis ticks with round values from shifted input data
- Passing JSON data from PHP array into ChartJS
- How to display k as thousand for the values of chart.js - Javascript
- How to fetch all data from API files and assign their values to chart?
- Javascript and Chart.JS - issue with getting unique text in 3 donut hole charts - same text showing for all 3 donut holes
- How to write better code in es6 for formatting an object with array values
- Parsing values from external JSON file with Chart.js
- Resize Chart Independently From Legend in ChartJS for Canvas Download
More Query from same tag
- Chart.JS removing data stuck in loop
- Dynamically Setting Height of Chart
- findOne returns undefined in onRendered
- Display Json from Node.js in Chart.js with React
- How to update Chartjs chart (react-chartjs-2) with dynamic data?
- chart.js tooltip position, tooltip not displayed
- How to set minimum value to Radar Chart in chart js
- How to add gradient background to Line Chart [vue-chart.js]
- How to create spacing between Charts and Legends in Chart.js
- Chart.js remove the first vertical line
- Remove tooltip if has no label
- Get access to the chart.js component instance in React
- Showing border for columns in barchart of chart js on hover?
- Plot a multi-line graph from grouped JSON object using Charts.js
- Displaying the first value of the array in datasets.label Chartjs
- Chart JS dataset disabled by default
- How to clear the data for a angular-chart
- Angular 13, Chart.js, ng2-chart Update data from API dynamically
- ChartJS: How to dynamically create data arrays
- Chartjs bar chart appears empty when page loads
- chart.js 3 stacked bar chart - tooltip showing for zero values
- HorizontalBar chart is displayed below canvas when I set height with style attribute for chart div (Chart.js 2.9.4)
- How do I get a different label for each bar in a bar chart in ChartJS?
- Chart.js: colouring tooltip labels
- Delay animation of chart.js
- Chart js background color changes on click
- Changing Chart.js chart type doesn't remove older axis
- Chart.js zoom plugin: Unexpected identifier error in console
- How to use two Y axes in Chart.js v2?
- How to add external scripts and css in latest angular-cli