How to Vary the Thickness of Doughnut Chart in Chart.js ? Last Updated : 29 Jul, 2024 Comments Improve Suggest changes Like Article Like Report Doughnut charts are widely used for representing data in a circular format that allows users to compare the proportions of different categories. We can use the cutout percentage property to accomplish this task.ChartJS CDN Link:To use Chart.js you have to include the CDN link in your HTML.<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>Cutout PercentageThe thickness of a doughnut chart can be controlled by adjusting the size of the central cutout. This cutout is essentially an empty circle in the center of the doughnut. You can use this property by assigning a value to the cutout property inside the chart options.Syntax:options: { cutout: 60, // other properties} Example 1: In this example, we change the thickness of doughnut using cutout property that changes the center cutout of doughnut. HTML <!DOCTYPE html> <html> <head> <title>Vary Doughnut Thickness in Chart.js</title> <script src= "https://cdn.jsdelivr.net/npm/[email protected]"> </script> </head> <body> <div> <h1 style="color:green;"> GeeksforGeeks </h1> <h3>Chart.js Doughnut Chart</h3> <div> <canvas id="doughnutChartID"></canvas> </div> </div> <script> new Chart(document.getElementById("doughnutChartID"), { type: 'doughnut', data: { datasets: [{ data: [30, 70], backgroundColor: ['green', 'yellow'], }], labels: ['Red', 'Blue'], }, options: { cutout: 150,// Adjust the cutout percentage here radius: 190, } }); </script> </body> </html> Output:Example 2: In this example, we change the thickness of pie chart using cutout property that changes the center cutout of pie chart. HTML <!DOCTYPE html> <html> <head> <title> Customizing Pie Chart in Chart.js </title> <script src= "https://cdn.jsdelivr.net/npm/[email protected]"> </script> </head> <body> <div> <h1 style="color:green; text-align: center;"> GeeksforGeeks </h1> <h3 style="text-align: center;"> Customized Pie Chart </h3> <div> <canvas id="pieChartID"></canvas> </div> </div> <script> new Chart(document.getElementById("pieChartID"), { type: 'pie', data: { labels: ['Category 1', 'Category 2', 'Category 3'], datasets: [{ data: [40, 60, 30], backgroundColor: ['blue', 'orange', 'green'], borderColor: 'white', borderWidth: 2 }] }, options: { cutout: '40%', radius: '50%', } }); </script> </body> </html> Output: Comment More infoAdvertise with us Next Article How to Customize the Legend in Chart.js ? R raushanpavwbi Follow Improve Article Tags : JavaScript Web Technologies Geeks Premier League Chart.js Geeks Premier League 2023 +1 More Similar Reads How to Set Height and Width of a Chart in Chart.js ? Chart.js is a popular JavaScript library that allows developers to create interactive and visually appealing charts for web applications. One of the key aspects of chart customization is controlling its dimensions. In this article, we'll explore how to set the height and width of a Chart.js chart.Ch 4 min read How to Show Values on Top of Bars in Chart.js ? In this article, we will learn how to show values on top of bars for a chart using the ChartJS CDN library.ApproachUse the <canvas> tag to show the bar graph in the HTML template.In the script section of the code, instantiate the ChartJS object by setting the type, data, and options properties 2 min read How to Customize the Legend in Chart.js ? In this article, we will learn how to customize the legend of a chart using the Chart JS CDN library. The chart legend displays data about the datasets that are appearing on the chart. This legend is customizable as per the users' requirements to enhance the look and feel of the chart in conjunction 5 min read How to Dynamically Update Values of a Chart in ChartJS ? Chart.js is an open-source free JavaScript library that is used to visualize data-informed charts. Dynamic chart updates are useful in creating interactive and real-time data visualizations. In this article, we will learn about how to dynamically update the values of charts. Using update() methodCha 5 min read How to Add Text Inside the Doughnut Chart Using Chart.js ? In Chart.JS, we have a doughnut chart to represent the data in slice forms for a more visual and attractive appearance. In the Doughnut Chart, we can place a custom text inside the doughnut chart to make the chart more informative and also help the readers understand the purpose or data doughnut cha 4 min read How to Hide the X-Axis Label/text that is Displayed in Chart.js ? Chart.js is a popular JavaScript library for creating interactive and visually appealing charts and graphs. By default, Chart.js displays text labels for both the x and y axes but in this article, we will see the different approaches to hiding the x-axis label/text that is displayed in chart.js.Char 3 min read How to Format X Axis Time Scale Values in ChartJS ? In Chart.js, formatting the x-axis time values involves searching for ways to present temporal data effectively. By default, Chart.js supports time series data and provides powerful options to customize the appearance of time labels on the x-axis. There are several approaches to format x-axis time s 4 min read How to Create a Horizontal Scrolling Chart.js Line Chart with a Locked Y Axis ? We will learn how to create a horizontal scrolling Chart.js line chart with a locked y-axis using the ChartJS CDN library.ApproachIn the HTML template, use two <canvas> tags: one to show the y-axis which should be locked in place, and the other to show the line chart itself.Create one <div 4 min read How to Hide y Axis Line in ChartJs ? In Chart.JS we can display our information in visual forms. For the customization of the chart, we can remove or hide the Y-axis line from the Chart appearance as per the requirement. We can use two different approaches to hide the y-axis line in the Chart.JS. We will see the practical implementatio 3 min read How to Show Labels on Pie Chart in ChartJS ? Pie charts are an attractive way to represent data in an easy-to-understand manner. In the pie chart, the labels are very useful because, with the help of the labels, we can understand what type of data is represented in the chart. Below are the different approaches to show labels on a pie chart: Ta 5 min read Like