Chart.js ポーラーエリアチャート
ポーラーエリアチャートは円グラフに似ていますが、各データセットは同じ角度を持ち、線分の半径は指定された値に応じて異なります。
混合グラフtype属性はpolarArea。
const config = {
type: 'polarArea',
data: data,
options: {}
};
次に、簡単なポーラーエリアチャートを作成します:
例
const ctx = document.getElementById('myChart');
const data = {
labels: [
'Red',
'Green',
'Yellow',
'Grey',
'Blue'
],
datasets: [{
label: 'ポーラーエリアチャートの例',
data: [11, 16, 7, 3, 14],
backgroundColor: [
'rgb(255, 99, 132)',
'rgb(75, 192, 192)',
'rgb(255, 205, 86)',
'rgb(201, 203, 207)',
'rgb(54, 162, 235)'
]
}]
};
const config = {
type: 'polarArea',
data: data,
options: {
responsive: true, // グラフをレスポンシブに設定し、画面ウィンドウの変化に応じて変化するようにします
maintainAspectRatio: false,// グラフの元の比率を保ちます
}
};
const myChart = new Chart(ctx, config);
const data = {
labels: [
'Red',
'Green',
'Yellow',
'Grey',
'Blue'
],
datasets: [{
label: 'ポーラーエリアチャートの例',
data: [11, 16, 7, 3, 14],
backgroundColor: [
'rgb(255, 99, 132)',
'rgb(75, 192, 192)',
'rgb(255, 205, 86)',
'rgb(201, 203, 207)',
'rgb(54, 162, 235)'
]
}]
};
const config = {
type: 'polarArea',
data: data,
options: {
responsive: true, // グラフをレスポンシブに設定し、画面ウィンドウの変化に応じて変化するようにします
maintainAspectRatio: false,// グラフの元の比率を保ちます
}
};
const myChart = new Chart(ctx, config);
試してみる »
上記の例の出力結果は次のとおりです:
その他の拡張