score:1
you can not do it that way. here in the documentation there are some examples
one of the simple ways to set the data for a chart can be done that way:
data: {
labels: ['finance', 'technique'],
datasets: [{
data: [1, 2],
backgroundcolor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)'
],
bordercolor: [
'rgba(255, 99, 132, 1)',
'rgba(54, 162, 235, 1)'
],
borderwidth: 1
}]
},
working fiddle example
Source: stackoverflow.com
Related Query
- How to populate a charts.js pie chart using json array
- How to save Chart JS charts as image without black background using blobs and filesaver?
- How to access labels array using chart plugin (Chart.pluginService.register) in Chartjs 2.x?
- How to create single value Doughnut or Pie chart using Chart.js?
- How to create a gantt chart using Chart.js and populate dates?
- How to show percentage (%) using chartjs-plugin-labels ( Pie chart ) in angular 2/8
- How to map json array to two different array for chart
- how to add percentage value to legend field in pie chart using chart.js
- How to display chart using Chartjs with JSON data in Laravel
- How to create two pie charts using Chart.js API?
- How to show slice value inside of slice in pie chart using chart.js
- Chart JS - How to output JSON objects into PIE variant
- How to plot chart from external JSON and format X-AXIS to show time using Chart.JS?
- How to make dynamic chart js using JSON in Codeigniter?
- How to display the values inside the pie chart of PrimeNG (chart) using JavaScript or Angular
- Javascript How to give color using conditional statement based on json array state value
- How to set up a simple pie chart using React in ChartJS on codesandbox
- How can I show "No Data" message in Pie Chart when there is no data using VueJS?
- Create a pie chart using an array from a data table in chart.js
- How to create an array of objects dynamically in javascript for a pie chart
- Pie Chart using chart.js not showing up but bar charts are?
- How do I make a pie chart showing number of people in an age group with JSON and ChartJS?
- How to display Json object in chart js consisting of lists created using Django rest framework in angular application
- How can I build some chart with Chart.js and ng2-charts using an array of revenus & budgets per month date as Data source?
- How to run Chart.js samples using source code
- How to make the size of pie chart fixed without using canvas (chart.js)
- Create a chartjs pie chart using json data
- Displaying JSON data into a pie chart using chart.js
- Dynamic Pie Chart With Json Data using chart.js
- How to make pie chart from array values?
More Query from same tag
- Creating and Updating Graph in HTML and Javascript
- Socket.io is not sending data to frontend as intended
- How to remove square label from tooltip and make its information in one line?
- Using chart.js version 1.0.2 and 2.0 together
- I want to change color of individual bar of bar graph
- How to set static value in y-axis in chart.js?
- Bubble Chart in Chartjs not working
- Why wont the json_encoded data show
- "Type of import (".../charjs/types/indexsm" has no construct signatures issue on Vue3 and ChartJS?
- Why i lost my chart.js when i do a new render
- Display dataset values on bar ChartJs 2.1.6
- AngularJS hide and show a char
- Chart.js 2 - Always display only some tooltips in bubble chart
- Dynamically created linechart holds previous data value
- Chart js footer
- Django Chart.js ajax javascript "string data parsing error"
- How to change orientation of the main y-axis label in charts.js?
- Show point values in Radar Chart using chart.js
- Chart.js axes always show zero
- Chart.JS Get Json data for chart and return dataset where a type equals a certain type
- Custom tooltip styling in Chart.js
- How to align Chart JS "legend" on right-center
- Why does one chart overlays another (chart.js)?
- ChartJs shows the wrong labels
- Chart.js V2 formatting / styling labels
- I am Creating pie chart using Chartjs 2.6.0. I want to show label on Slices
- Chart.js - How do I dynamically change bar's stack
- Update all Chart.js instances in order to apply changed defaults?
- How update reload chart.js
- chart.js break line in a label with a tooltip callback