score:2
Accepted answer
The syntax has changed since 1.0. Your javascript in 2.2.1 should be:
var data = {
labels: [
"Java",
"Scala",
"PHP",
"HTML"
],
datasets: [
{
data: [25, 10, 30, 35],
backgroundColor: [
"#811BD6",
"#9CBABA",
"#D18177",
"#6AE128"
]
}]
};
var ctx = document.getElementById("my-chart");
var myPieChart = new Chart(ctx,{
type: 'pie',
data: data
});
Source: stackoverflow.com
Related Query
- Chart.js version 2.2.1 wont show chart
- Chart.js Show labels on Pie chart
- chart.js: Show labels outside pie chart
- Chart.js how to show cursor pointer for labels & legends in line chart
- show label in tooltip but not in x axis for chartjs line chart
- chartjs show dot point on hover over line chart
- Chart JS Show HTML in Tooltip
- chart js tooltip how to control the data that show
- How to show percentage (%) in chart js
- Show X axis on top and bottom in line chart rendered with Chart.js 2.4.0
- Chart looks only grey, does not show the color - Chartjs,discordjs
- Chart JS show multiple data points for the same label
- Show data dynamically in line chart - ChartJS
- Chartjs - show elements in all datasets on hover using bar chart
- How to create a gradient fill line chart in latest Chart JS version (3.3.2)?
- Remove the label and show only value in tooltips of a bar chart
- Chart Js Show the old data on mouse hover
- ChartJS: Show all labels of a mixed chart in the tooltip
- Show all values in Chart js y axis
- PrimeNg bar chart how to show a label for the y-axis
- Show "No Data" message for Pie chart with no data
- Show data on top of bar chart in Chart.js v 2.7.1
- Show labels on each sector to polar chart using angular js chart
- How to show data values in top of bar chart and line chart in chart.js 3
- Chart.js - How to show loading animation before plotting chart
- Show point values in Radar Chart using chart.js
- Chart js doesn't show chart
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- Angular chart how to show the legend data value by default along with legend name
- How to show percentage (%) using chartjs-plugin-labels ( Pie chart ) in angular 2/8
More Query from same tag
- ChartJS for 1 and 0 values display true or false
- How to add an input box next to Chart.js y axis label?
- Chartjs 2.7.3: Set Y data at the correct X position axis
- Configuring a Radar Chart w/Chart.js
- React-Chart-JS-2 ^3.0.5 | TypeError: Cannot read properties of undefined (reading 'visible') at Chart._getSortedDatasetMetas
- Make a chart clickable when placed under another SVG <View>
- How to set additional options for Chart.js BarCharts using React-Chartkick
- Chart not rendering w/Chart.js on button click
- Iterating over an IEnumerable in Javascript for Chartjs
- Chart Js + Angular
- Chart.js animation triggered only on hover?
- How to draw Horizontal line on Bar Chart Chartjs
- Chart.js not to be begin in Y-Axis
- Equal distance grouped bar chart irrespective of scale - chart.js
- Display PHP Array in Chart.js tooltip
- How to remove x axis scale labels Chart.Js
- How to get rid of old data and of old graph in Chart.js?
- Chart.JS fixing maximum and minumum to a location on screen
- Django and Chart.js Not Rendering Graph Correctly
- Responsive Chart.js Doughnut Chart with minimum height
- Canvas is not defined for simple chart
- Page break in Angular with Chartjs and tables
- I need a PHP query to grab data from the database and use in my bar charts for results
- How to get the bands to implement in Chart.js the band extension?
- how to customize tool tip while mouse go over bars on Chart js bar chart
- Chart.js canvas resize of pie / doughnut chart
- Chart.js is always increasing height on chart.resize()
- How to show only the data points that have a change in Chartjs?
- How to remove strikethrough from label once click on legend
- How to show percentage (%) using chartjs-plugin-labels ( Pie chart ) in angular 2/8