How to vary the thickness of doughnut chart, using ChartJs.?

前端 未结 4 2019
独厮守ぢ
独厮守ぢ 2020-12-18 18:29

How to vary the thickness of doughnut chart, using ChartJs

相关标签:
4条回答
  • 2020-12-18 18:46

    use, percentageInnerCutout, like:

    var options = {        
        percentageInnerCutout: 40
    };
    myNewChart = new Chart(ct).Doughnut(data, options);
    

    Demo:: jsFiddle

    0 讨论(0)
  • 2020-12-18 18:53

    If you are using chart.js for Angular via ng2-charts you would do something like this in your component.html file:

    // component.html file
    
    <canvas baseChart [options]='chartOptions'>
    </canvas>
    
    // Do note that other required directives are missing in this example, but that I chose to highlight the 'options' directive
    
    

    And do something like this in your component.ts file:

    //component.ts file
    
    chartOptions = {
      cutoutPercentage: 80
    };
    
    

    A helpful source of information: available chart directives and config options for the [options] directive

    0 讨论(0)
  • 2020-12-18 18:57
    var options = {        
         cutoutPercentage: 70
    };
    
    0 讨论(0)
  • 2020-12-18 19:00

    since version 2 the field has been renamed to cutoutPercentage.

    cutoutPercentage
    Number 50 - for doughnut, 0 - for pie
    The percentage of the chart that is cut out of the middle.

    It can be used like this

    var options = {        
        cutoutPercentage: 40
    };
    

    more details here http://www.chartjs.org/docs/#doughnut-pie-chart-chart-options

    0 讨论(0)
提交回复
热议问题