비교
덤벨 차트
항목별로 두 값을 선으로 연결해 차이를 보여 줍니다.
이 페이지의 내용
덤벨 차트는 항목마다 전후, 두 연도, 두 집단처럼 두 값을 비교합니다. 각 계열의 값은 점으로 표시하고, 같은 항목에 속한 점은 선으로 연결합니다. 두 값의 차이와 어느 쪽이 더 큰지 한눈에 볼 수 있습니다. 나란히 놓은 두 막대와 같은 정보를 훨씬 적은 면적으로 보여 주며, 축을 0부터 시작할 필요가 없습니다.
덤벨 차트
<div class="card max-w(560) mx-auto"> <div class="card-header"> <h3 class="card-title">Pay</h3> <p class="card-description">Median by role, 2019 and 2024</p> </div> <figure class="chart" id="pay"></figure></div><script>addEventListener('DOMContentLoaded', function () {MasterUI.chart(document.getElementById('pay'), { type: 'dumbbell', horizontal: true, label: 'Median pay by role in 2019 and 2024, in thousands of dollars', labels: ['Design', 'Engineering', 'Product', 'Support', 'Sales'], series: [ { name: '2019', values: [62, 84, 78, 41, 55] }, { name: '2024', values: [81, 112, 96, 52, 74] } ], format: function (value) { return '$' + value + 'k' }})})</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">Pay</h3> <p className="card-description">Median by role, 2019 and 2024</p> </div> <Chart id="pay" type="dumbbell" horizontal label="Median pay by role in 2019 and 2024, in thousands of dollars" labels={['Design', 'Engineering', 'Product', 'Support', 'Sales']} series={[ { name: '2019', values: [62, 84, 78, 41, 55] }, { name: '2024', values: [81, 112, 96, 52, 74] } ]} format={function (value) { return '$' + value + 'k' }} /></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">Pay</h3> <p class="card-description">Median by role, 2019 and 2024</p> </div> <Chart id="pay" type="dumbbell" horizontal label="Median pay by role in 2019 and 2024, in thousands of dollars" labels={['Design', 'Engineering', 'Product', 'Support', 'Sales']} series={[ { name: '2019', values: [62, 84, 78, 41, 55] }, { name: '2024', values: [81, 112, 96, 52, 74] } ]} format={function (value) { return '$' + value + 'k' }} /></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">Pay</h3> <p class="card-description">Median by role, 2019 and 2024</p> </div> <Chart id="pay" type="dumbbell" horizontal label="Median pay by role in 2019 and 2024, in thousands of dollars" :labels="['Design', 'Engineering', 'Product', 'Support', 'Sales']" :series="[ { name: '2019', values: [62, 84, 78, 41, 55] }, { name: '2024', values: [81, 112, 96, 52, 74] } ]" :format="function (value) { return '$' + value + 'k' }" /> </div></template>덤벨 차트는 보통 horizontal: true로 가로로 배치해 항목 이름이 목록처럼 읽히게 합니다. 두 값의 차이나 한쪽 값을 기준으로 항목을 정렬한 뒤 전달합니다. 정렬 순서도 차트가 전달하는 정보의 일부입니다. 계열이 세 개 이상이면 항목마다 계열별 점을 표시하고 최솟값에서 최댓값까지 선을 긋습니다.
#옵션
| 옵션 | 기본값 | |
|---|---|---|
label | 없음 | 차트가 보여 주는 내용과 단위를 설명하는 플롯의 접근성 이름 |
labels | [] | 축을 따라, 레이더 차트 둘레에, 또는 히트맵 열 위에 표시하는 이름 |
series | [] | 각 계열에 name과 차트 형태에 맞는 데이터인 values, value, points, ranges 또는 children을 지정합니다. category, type, low와 high, 링의 max는 선택 사항입니다. |
horizontal | false | 막대, 범위, 덤벨, 상자를 가로로 배치합니다. |
min, max, ticks | 데이터에 맞춤, 4 | 척도의 양 끝값과 대략적인 눈금 구간 수. 산점도의 가로축에는 xMin, xMax, xTicks를 사용합니다. |
format, tickFormat | 로캘 기본 형식 | 값과 눈금의 표시 형식. 산점도의 가로축에는 xFormat을 사용합니다. |
current | 없음 | aria-current로 표시할 점의 인덱스 |
legend, toggle | 계열이 두 개일 때, true | 범례 표시 여부와 범례 항목의 체크박스 표시 여부 |
값 표시, 키보드 조작, 범례, 색상, 척도는 모든 차트 형태에 공통으로 적용됩니다. 차트에서 자세한 설명과 모든 옵션, CSS 클래스, 사용자 지정 속성을 확인할 수 있습니다.