ナビゲーション

v2.1.0
比較

レーダーチャート

共通の指標で測った複数の対象を、同じ中心を囲む輪郭で表します。

このページの内容

レーダーチャートでは、共通の指標で複数の対象を一目で比較できます。例えば、2つのリリースを6項目のスコアで比較し、それぞれの特徴を把握できます。各系列の輪郭の内側を同系色で淡く塗るため、重なっても両方が見えます。各指標は同じ目盛りを使うので、上限が分かっている場合は max を指定します。放射状の軸にポインターを重ねると、その指標についてすべての系列の値を確認できます。

レーダー

<div class="card max-w(520) mx-auto">  <div class="card-header">    <h3 class="card-title">Releases</h3>    <p class="card-description">2.4 against 2.3, out of 100</p>  </div>  <figure class="chart" id="releases" style="--chart-height: 15rem"></figure></div><script>addEventListener('DOMContentLoaded', function () {MasterUI.chart(document.getElementById('releases'), {  type: 'radar',  max: 100,  label: 'Scores of two releases on six measures, out of 100',  labels: ['Speed', 'Stability', 'Accessibility', 'Size', 'Docs', 'Security'],  series: [    { name: '2.4', values: [82, 91, 74, 68, 88, 79] },    { name: '2.3', values: [70, 78, 81, 74, 62, 85] }  ]})})</script><script type="module">  import { attach } from '@master/ui/behaviors'  attach()</script>
import { Chart } from './ui/chart'<div className="card max-w(520) mx-auto">  <div className="card-header">    <h3 className="card-title">Releases</h3>    <p className="card-description">2.4 against 2.3, out of 100</p>  </div>  <Chart    id="releases"    style={{ '--chart-height': '15rem' } as React.CSSProperties}    type="radar"    max={100}    label="Scores of two releases on six measures, out of 100"    labels={['Speed', 'Stability', 'Accessibility', 'Size', 'Docs', 'Security']}    series={[      { name: '2.4', values: [82, 91, 74, 68, 88, 79] },      { name: '2.3', values: [70, 78, 81, 74, 62, 85] }    ]}  /></div>
<script>  import Chart from './ui/Chart.svelte'</script><div class="card max-w(520) mx-auto">  <div class="card-header">    <h3 class="card-title">Releases</h3>    <p class="card-description">2.4 against 2.3, out of 100</p>  </div>  <Chart    id="releases"    style="--chart-height: 15rem"    type="radar"    max={100}    label="Scores of two releases on six measures, out of 100"    labels={['Speed', 'Stability', 'Accessibility', 'Size', 'Docs', 'Security']}    series={[      { name: '2.4', values: [82, 91, 74, 68, 88, 79] },      { name: '2.3', values: [70, 78, 81, 74, 62, 85] }    ]}  /></div>
<script setup>import Chart from './ui/Chart.vue'</script><template>  <div class="card max-w(520) mx-auto">    <div class="card-header">      <h3 class="card-title">Releases</h3>      <p class="card-description">2.4 against 2.3, out of 100</p>    </div>    <Chart      id="releases"      style="--chart-height: 15rem"      type="radar"      :max="100"      label="Scores of two releases on six measures, out of 100"      :labels="['Speed', 'Stability', 'Accessibility', 'Size', 'Docs', 'Security']"      :series="[        { name: '2.4', values: [82, 91, 74, 68, 88, 79] },        { name: '2.3', values: [70, 78, 81, 74, 62, 85] }      ]"    />  </div></template>

レーダーチャートは、2〜3系列、5〜8指標にすると読み取りやすくなります。正確なスコアは横に表を添えて示します。

#1系列

1系列のグラフは既定の描画色で描画され、系列に category を指定した場合にのみカテゴリの色が適用されます。

1系列

<div class="card max-w(520) mx-auto">  <div class="card-header">    <h3 class="card-title">Profile</h3>    <p class="card-description">A review, out of 10</p>  </div>  <figure class="chart" id="profile" style="--chart-height: 15rem"></figure></div><script>addEventListener('DOMContentLoaded', function () {MasterUI.chart(document.getElementById('profile'), {  type: 'radar',  max: 10,  ticks: 5,  label: 'Scores of a review on five measures, out of 10',  labels: ['Design', 'Code', 'Writing', 'Research', 'Speaking'],  series: [{ name: 'Score', values: [9, 7, 8, 5, 6] }]})})</script><script type="module">  import { attach } from '@master/ui/behaviors'  attach()</script>
import { Chart } from './ui/chart'<div className="card max-w(520) mx-auto">  <div className="card-header">    <h3 className="card-title">Profile</h3>    <p className="card-description">A review, out of 10</p>  </div>  <Chart    id="profile"    style={{ '--chart-height': '15rem' } as React.CSSProperties}    type="radar"    max={10}    ticks={5}    label="Scores of a review on five measures, out of 10"    labels={['Design', 'Code', 'Writing', 'Research', 'Speaking']}    series={[{ name: 'Score', values: [9, 7, 8, 5, 6] }]}  /></div>
<script>  import Chart from './ui/Chart.svelte'</script><div class="card max-w(520) mx-auto">  <div class="card-header">    <h3 class="card-title">Profile</h3>    <p class="card-description">A review, out of 10</p>  </div>  <Chart    id="profile"    style="--chart-height: 15rem"    type="radar"    max={10}    ticks={5}    label="Scores of a review on five measures, out of 10"    labels={['Design', 'Code', 'Writing', 'Research', 'Speaking']}    series={[{ name: 'Score', values: [9, 7, 8, 5, 6] }]}  /></div>
<script setup>import Chart from './ui/Chart.vue'</script><template>  <div class="card max-w(520) mx-auto">    <div class="card-header">      <h3 class="card-title">Profile</h3>      <p class="card-description">A review, out of 10</p>    </div>    <Chart      id="profile"      style="--chart-height: 15rem"      type="radar"      :max="10"      :ticks="5"      label="Scores of a review on five measures, out of 10"      :labels="['Design', 'Code', 'Writing', 'Research', 'Speaking']"      :series="[{ name: 'Score', values: [9, 7, 8, 5, 6] }]"    />  </div></template>

#オプション

オプション既定値
labelなしグラフが何をどの単位で示すかを伝える、プロットのアクセシブルな名前
labels[]目盛りに沿って、またはレーダーチャートの周囲に並ぶ名前
series[]各系列に name と、values、扇形1つまたはリング1本に対応する value、散布図の points のいずれかを指定。category、type、リングの max は任意
min, max, ticksデータに合わせる、4目盛りの下限と上限、およその目盛り数。散布図の横軸には xMin、xMax、xTicks を使用
format, tickFormatロケールに従う値と目盛りの表示形式。散布図の横軸には xFormat を使用
legend, toggle2系列の場合、true凡例を表示するか、凡例の各項目をチェックボックスにするか

値表示、キー操作、凡例、色、目盛りはすべてのグラフ形式で共通です。チャートに、すべてのオプション、クラス、カスタムプロパティとあわせて記載しています。