ChartJs を使用してドーナツチャートの厚さを変更する方法
バージョン2以降、フィールドの名前はcutoutPercentageに変更されました。
カットアウト
数値50-ドーナツの場合、0-パイの場合
中央から切り取られたチャートの割合。
詳細はこちら http://www.chartjs.org/docs/#doughnut-pie-chart-chart-options
var options = {
cutoutPercentage: 70
};
var options = {
percentageInnerCutout: 40
};
myNewChart = new Chart(ct).Doughnut(data, options);
デモ:: jsFiddle
Angular via ng2-charts でchart.jsを使用している場合、component.htmlファイルで次のようなことを行います。
// 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
そして、component.tsファイルで次のようなことを行います。
//component.ts file
chartOptions = {
cutoutPercentage: 80
};
役立つ情報源: 使用可能なチャートディレクティブ および [options]ディレクティブの構成オプション