score:0
updating to the latest v2 (2.9.4) version of chart.js will resolve your issue:
// chart colors
var colors = ['#007bff', '#28a745', '#333333', '#c3e6cb'];
var donutoptions = {
cutoutpercentage: 65,
responsive: true,
legend: {
position: 'right',
padding: 2,
labels: {
pointstyle: 'circle',
usepointstyle: true,
}
}
};
// donut 1
var chdonutdata1 = {
labels: ['product 1', 'product 2', 'product 3', 'product 4'],
datasets: [{
backgroundcolor: colors.slice(0, 4),
borderwidth: 2,
data: [74, 11, 40, 20]
}],
};
var chdonut1 = document.getelementbyid("chdonut1");
if (chdonut1) {
new chart(chdonut1, {
type: 'pie',
data: chdonutdata1,
options: donutoptions
});
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/2.9.4/chart.js"></script>
<div class="">
<canvas id="chdonut1"></canvas>
</div>
Source: stackoverflow.com
Related Query
- Legend position is not vertically in middle in Donut chart
- Javascript not showing up total value in middle of Oracle APEX Donut chart
- Chartjs - Donut Chart label for small values not visible
- Legend not displaying on Line or Bar chart - React-Chartjs-2
- I cant get Legend to work for my chartjs donut chart
- Legend color not working with randomly generated background colors in chartjs pie chart
- Doughnut chart from Chart.js, custom legend and call of original handler not works as expected
- chart.js legend not working for pie chart
- what is wrong with my code ? java script chart position
- ChartJS Bar Chart not respecting disabled legend when using cdn
- chart.js line chart and "correct" spacing between points? (i.e. horizontal position based on percent of width, not fixed)
- donut chart not rendering with csv data chart.js
- How to increase the size of the donut or pie chart and keep the legend next to it in chart JS?
- ChartJS: Custom legend not showing Labels for Multi-Pie chart
- React-chart does not render the legend for PIE chart
- I am using chart js to draw a chart. I did everything right but i don't know why the x axis and y axis label is not comming in chart. code below
- Position of the x-axis labels is not in sync with the line chart data points
- chartjs bar chart align the legend to left position
- Donut Chart : Trigger legend or pie click event while selecting outside filter state change
- how to not repeat code while creating multiple charts in chart js
- Chart.js - Increase spacing between legend and chart
- Pie Chart Legend - Chart.js
- ReferenceError: Chart is not defined - chartjs
- Change legend position of ng-charts (using angular2)
- Chart.js: bar chart first bar and last bar not displaying in full
- Chartjs Bar Chart Legend
- Chart.js responsive option - Chart not filling container
- show label in tooltip but not in x axis for chartjs line chart
- chart js how to fill legend box with colour
- Html chart does not fit a small Android WebView
More Query from same tag
- Click event using Chart.js with AngularJS
- Chart js space above bar graph
- Chartjs show labels but not ticks
- Connecting Two Datasets in Chart.js Into a Single Line
- Chart.js How to make more space between doughnut inside doughnut?
- Chart.js 2 - Always display only some tooltips in bubble chart
- How to fetch data from Json file on charts(bar-chart/pie chart etc) in angular?
- change axis scale to be round numbers instead of decimal - chart.js
- chart.js not accepting data in dataset which stored in local storage
- Problem with changing string to date with time
- Chart.js - Increase spacing between bottom legend and chart
- ChartJS - Adding legend title into tooltip title
- How to take data from an API and create a chart on that using Chart.js and Angular 8?
- Create chart using one of the given javascript libraries
- ChartJs line chart - display permanent icon above some data points with text on hover
- How to display final point value in charts.js
- NuxtJS ChartJS Gradient Color doesnt apply
- chart.js show no charts in IE11
- How to generate PDF with Chart.js
- Chart.js Line chart Option does not disable gridlines
- How to set max smaller than min in ChartJS
- Resize chart.js canvas for printing
- Update chartjs chart within random data once per second
- Change Axis Line color in Chart created using chart.js
- How to represent MySQL data in the form of charts
- ChartJS multichart graph not showing correctly legends
- Chart with Time axis only displaying first grid line and tick label (unitStepSize)
- how to use chart.js with knockout.js to create dynamic charts
- Chart.js - Setting max Y axis value and keeping steps correct
- How do I update the chart to reflect local storage values?