整體的組成
多環圖
呈現少量數值,每個數值各用一環顯示占自身總量的比例。
本頁內容
多環圖呈現少量各有總量的數值,例如三項目標或一項計畫中的各項配額。各環由外向內依序排列,從頂端起按數值占上限的比例填色。上限 max 預設為 100,圖表或資料序列可另行設定。各環以自身色調的淡色呈現未填滿的部分,表示同一目標尚未達成的量。
多環圖
<div class="card max-w(480) mx-auto"> <div class="card-header"> <h3 class="card-title">Today</h3> <p class="card-description">Three goals</p> </div> <figure class="chart chart-split" id="goals" style="--chart-size: 10rem"></figure></div><script>addEventListener('DOMContentLoaded', function () {MasterUI.chart(document.getElementById('goals'), { type: 'rings', label: 'Progress of three goals today, in percent', center: { value: '72%', label: 'Move' }, format: function (value) { return value + '%' }, series: [ { name: 'Move', value: 72 }, { name: 'Exercise', value: 45 }, { name: 'Stand', value: 90 } ]})})</script><script type="module"> import { attach } from '@master/ui/behaviors' attach()</script>import { Chart } from './ui/chart'<div className="card max-w(480) mx-auto"> <div className="card-header"> <h3 className="card-title">Today</h3> <p className="card-description">Three goals</p> </div> <Chart className="chart-split" id="goals" style={{ '--chart-size': '10rem' } as React.CSSProperties} type="rings" label="Progress of three goals today, in percent" center={{ value: '72%', label: 'Move' }} format={function (value) { return value + '%' }} series={[ { name: 'Move', value: 72 }, { name: 'Exercise', value: 45 }, { name: 'Stand', value: 90 } ]} /></div><script> import Chart from './ui/Chart.svelte'</script><div class="card max-w(480) mx-auto"> <div class="card-header"> <h3 class="card-title">Today</h3> <p class="card-description">Three goals</p> </div> <Chart class="chart-split" id="goals" style="--chart-size: 10rem" type="rings" label="Progress of three goals today, in percent" center={{ value: '72%', label: 'Move' }} format={function (value) { return value + '%' }} series={[ { name: 'Move', value: 72 }, { name: 'Exercise', value: 45 }, { name: 'Stand', value: 90 } ]} /></div><script setup>import Chart from './ui/Chart.vue'</script><template> <div class="card max-w(480) mx-auto"> <div class="card-header"> <h3 class="card-title">Today</h3> <p class="card-description">Three goals</p> </div> <Chart class="chart-split" id="goals" style="--chart-size: 10rem" type="rings" label="Progress of three goals today, in percent" :center="{ value: '72%', label: 'Move' }" :format="function (value) { return value + '%' }" :series="[ { name: 'Move', value: 72 }, { name: 'Exercise', value: 45 }, { name: 'Stand', value: 90 } ]" /> </div></template>儀表圖只顯示單一數值,以及它有多接近上限。
#選項
| 選項 | 預設值 | |
|---|---|---|
label | 無 | 繪圖區的無障礙名稱,說明圖表呈現的內容與使用的單位 |
series | [] | 每個資料序列都有 name,並依圖表類型提供 values、扇區或圓環用的 value,或散佈圖用的 points。也可選擇提供 category、type,以及環的 max |
min, max, ticks | 自動配合,4 | 刻度範圍的兩端與大致的刻度數。xMin、xMax 和 xTicks 用於散佈圖的水平刻度 |
format, tickFormat | 依地區設定 | 數值與刻度標籤的顯示格式。xFormat 用於散佈圖的水平刻度 |
hole, center | .7、無 | 圓環圖的中空區域,以及圓環圖或多環圖中央顯示的內容 |
legend, toggle | 有兩個資料序列時顯示、true | 是否顯示圖例,以及圖例項目是否為核取方塊 |
所有圖表類型共用數值提示、鍵盤操作、圖例、色彩和刻度。圖表列出這些共用功能,以及所有選項、類別和自訂屬性。