ナビゲーション

v2.1.0
比較

範囲グラフ

2つの値の間の範囲を、始点と終点で示します。

このページの内容

範囲グラフは、月ごとの最低気温と最高気温、店の営業時間、給与の範囲などを、始点から終点まで伸びる棒で表します。系列の ranges の各要素は値のペアです。棒は始点の位置から描かれ、両端に丸みが付きます。棒の長さが表すのは2つの値の差なので、目盛りの範囲はゼロを起点にせず、各区間に合わせて決まります。

範囲グラフ

<div class="card max-w(560) mx-auto">  <div class="card-header">    <h3 class="card-title">Temperature</h3>    <p class="card-description">Lowest and highest by month, in degrees Celsius</p>  </div>  <figure class="chart" id="temperature"></figure></div><script>addEventListener('DOMContentLoaded', function () {MasterUI.chart(document.getElementById('temperature'), {  type: 'range',  label: 'Lowest and highest temperature by month, in degrees Celsius',  labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],  series: [{ name: 'Tokyo', ranges: [[2, 10], [3, 11], [5, 14], [10, 19], [15, 23], [19, 26], [23, 30], [24, 31], [21, 27], [15, 22], [9, 17], [4, 12]] }],  format: function (value) { return value + '°' }})})</script><script type="module">  import { attach } from '@master/ui/behaviors'  attach()</script>
import { Chart } from './ui/chart'<div className="card max-w(560) mx-auto">  <div className="card-header">    <h3 className="card-title">Temperature</h3>    <p className="card-description">Lowest and highest by month, in degrees Celsius</p>  </div>  <Chart    id="temperature"    type="range"    label="Lowest and highest temperature by month, in degrees Celsius"    labels={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']}    series={[{ name: 'Tokyo', ranges: [[2, 10], [3, 11], [5, 14], [10, 19], [15, 23], [19, 26], [23, 30], [24, 31], [21, 27], [15, 22], [9, 17], [4, 12]] }]}    format={function (value) { return value + '°' }}  /></div>
<script>  import Chart from './ui/Chart.svelte'</script><div class="card max-w(560) mx-auto">  <div class="card-header">    <h3 class="card-title">Temperature</h3>    <p class="card-description">Lowest and highest by month, in degrees Celsius</p>  </div>  <Chart    id="temperature"    type="range"    label="Lowest and highest temperature by month, in degrees Celsius"    labels={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']}    series={[{ name: 'Tokyo', ranges: [[2, 10], [3, 11], [5, 14], [10, 19], [15, 23], [19, 26], [23, 30], [24, 31], [21, 27], [15, 22], [9, 17], [4, 12]] }]}    format={function (value) { return value + '°' }}  /></div>
<script setup>import Chart from './ui/Chart.vue'</script><template>  <div class="card max-w(560) mx-auto">    <div class="card-header">      <h3 class="card-title">Temperature</h3>      <p class="card-description">Lowest and highest by month, in degrees Celsius</p>    </div>    <Chart      id="temperature"      type="range"      label="Lowest and highest temperature by month, in degrees Celsius"      :labels="['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']"      :series="[{ name: 'Tokyo', ranges: [[2, 10], [3, 11], [5, 14], [10, 19], [15, 23], [19, 26], [23, 30], [24, 31], [21, 27], [15, 22], [9, 17], [4, 12]] }]"      :format="function (value) { return value + '°' }"    />  </div></template>

複数の系列は、棒グラフと同様にラベルごとの区画に並べて表示されます。horizontal を指定すると、ラベルが縦に、目盛りが横に並びます。時間の範囲や、縦棒では収まりきらない長いラベルを表示する場合に適しています。計画上の期間を利用者が移動したり長さを変えたりできるようにするには、ガントチャートを使います。

#オプション

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

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