꺾은선 차트
연속된 값을 점에서 점으로 이어 선으로 표시합니다.
이 페이지의 내용
월별 지연 시간이나 일별 가격처럼 순서대로 이어지는 값을 선으로 나타냅니다. 차트에 막대가 없으면 선은 플롯의 한쪽 끝에서 다른 쪽 끝까지 이어집니다. 포인터를 올리면 가는 기준선이 해당 위치를 표시하고, 그 위에 각 계열의 값이 점으로 표시됩니다.
꺾은선
<div class="card max-w(560) mx-auto"> <div class="card-header"> <h3 class="card-title">Latency</h3> <p class="card-description">Median by region, in milliseconds</p> </div> <figure class="chart" id="latency"></figure></div><script>addEventListener('DOMContentLoaded', function () {MasterUI.chart(document.getElementById('latency'), { type: 'line', label: 'Median latency per month by region, in milliseconds', labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], series: [ { name: 'Tokyo', values: [42, 44, 41, 47, 52, 49, 46, 44, 48, 53, 51, 47] }, { name: 'Frankfurt', values: [61, 58, 63, 66, 62, 59, 57, 60, 64, 69, 66, 61] }, { name: 'Virginia', values: [78, 74, 71, 75, 80, 86, 83, 79, 76, 81, 85, 82] } ]})})</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">Latency</h3> <p className="card-description">Median by region, in milliseconds</p> </div> <Chart id="latency" type="line" label="Median latency per month by region, in milliseconds" labels={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']} series={[ { name: 'Tokyo', values: [42, 44, 41, 47, 52, 49, 46, 44, 48, 53, 51, 47] }, { name: 'Frankfurt', values: [61, 58, 63, 66, 62, 59, 57, 60, 64, 69, 66, 61] }, { name: 'Virginia', values: [78, 74, 71, 75, 80, 86, 83, 79, 76, 81, 85, 82] } ]} /></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">Latency</h3> <p class="card-description">Median by region, in milliseconds</p> </div> <Chart id="latency" type="line" label="Median latency per month by region, in milliseconds" labels={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']} series={[ { name: 'Tokyo', values: [42, 44, 41, 47, 52, 49, 46, 44, 48, 53, 51, 47] }, { name: 'Frankfurt', values: [61, 58, 63, 66, 62, 59, 57, 60, 64, 69, 66, 61] }, { name: 'Virginia', values: [78, 74, 71, 75, 80, 86, 83, 79, 76, 81, 85, 82] } ]} /></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">Latency</h3> <p class="card-description">Median by region, in milliseconds</p> </div> <Chart id="latency" type="line" label="Median latency per month by region, in milliseconds" :labels="['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']" :series="[ { name: 'Tokyo', values: [42, 44, 41, 47, 52, 49, 46, 44, 48, 53, 51, 47] }, { name: 'Frankfurt', values: [61, 58, 63, 66, 62, 59, 57, 60, 64, 69, 66, 61] }, { name: 'Virginia', values: [78, 74, 71, 75, 80, 86, 83, 79, 76, 81, 85, 82] } ]" /> </div></template>#선의 형태
curve는 점과 점을 잇는 방식을 지정합니다. 기본값인 smooth는 데이터에 없는 봉우리나 골이 생기지 않도록 값을 넘지 않는 부드러운 곡선을 그립니다. linear는 점을 직선으로 잇고, step은 다음 값이 나오기 전까지 현재 값을 유지하므로 요금제의 좌석 수나 가격처럼 한 번에 바뀌는 값에 적합합니다.
계단형
<div class="card max-w(560) mx-auto"> <div class="card-header"> <h3 class="card-title">Seats</h3> <p class="card-description">On the plan, this year</p> </div> <figure class="chart" id="seats" style="--chart-height: 11rem"></figure></div><script>addEventListener('DOMContentLoaded', function () {MasterUI.chart(document.getElementById('seats'), { type: 'line', curve: 'step', label: 'Seats on the plan per month', labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], series: [{ name: 'Seats', values: [12, 12, 12, 20, 20, 20, 20, 32, 32, 32, 40, 40] }], max: 40})})</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">Seats</h3> <p className="card-description">On the plan, this year</p> </div> <Chart id="seats" style={{ '--chart-height': '11rem' } as React.CSSProperties} type="line" curve="step" label="Seats on the plan per month" labels={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']} series={[{ name: 'Seats', values: [12, 12, 12, 20, 20, 20, 20, 32, 32, 32, 40, 40] }]} max={40} /></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">Seats</h3> <p class="card-description">On the plan, this year</p> </div> <Chart id="seats" style="--chart-height: 11rem" type="line" curve="step" label="Seats on the plan per month" labels={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']} series={[{ name: 'Seats', values: [12, 12, 12, 20, 20, 20, 20, 32, 32, 32, 40, 40] }]} max={40} /></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">Seats</h3> <p class="card-description">On the plan, this year</p> </div> <Chart id="seats" style="--chart-height: 11rem" type="line" curve="step" label="Seats on the plan per month" :labels="['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']" :series="[{ name: 'Seats', values: [12, 12, 12, 20, 20, 20, 20, 32, 32, 32, 40, 40] }]" :max="40" /> </div></template>#빈 구간과 점
값이 null이면 해당 구간의 선이 끊기고, 해당 위치의 값 표시에는 값이 있는 계열만 나옵니다. dots: true를 설정하면 포인터 아래의 점을 포함해 선의 모든 점을 표시합니다. 점이 몇 개 없는 선에 사용합니다.
빈 구간과 점
<div class="card max-w(560) mx-auto"> <div class="card-header"> <h3 class="card-title">Uptime</h3> <p class="card-description">Percent per month; no reading in May</p> </div> <figure class="chart" id="uptime" style="--chart-height: 11rem"></figure></div><script>addEventListener('DOMContentLoaded', function () {MasterUI.chart(document.getElementById('uptime'), { type: 'line', curve: 'linear', dots: true, min: 99, max: 100, label: 'Uptime per month, in percent', labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug'], series: [{ name: 'Uptime', values: [99.92, 99.97, 99.81, 99.95, null, 99.64, 99.9, 99.98] }], 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">Uptime</h3> <p className="card-description">Percent per month; no reading in May</p> </div> <Chart id="uptime" style={{ '--chart-height': '11rem' } as React.CSSProperties} type="line" curve="linear" dots min={99} max={100} label="Uptime per month, in percent" labels={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug']} series={[{ name: 'Uptime', values: [99.92, 99.97, 99.81, 99.95, null, 99.64, 99.9, 99.98] }]} 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">Uptime</h3> <p class="card-description">Percent per month; no reading in May</p> </div> <Chart id="uptime" style="--chart-height: 11rem" type="line" curve="linear" dots min={99} max={100} label="Uptime per month, in percent" labels={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug']} series={[{ name: 'Uptime', values: [99.92, 99.97, 99.81, 99.95, null, 99.64, 99.9, 99.98] }]} 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">Uptime</h3> <p class="card-description">Percent per month; no reading in May</p> </div> <Chart id="uptime" style="--chart-height: 11rem" type="line" curve="linear" dots :min="99" :max="100" label="Uptime per month, in percent" :labels="['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug']" :series="[{ name: 'Uptime', values: [99.92, 99.97, 99.81, 99.95, null, 99.64, 99.9, 99.98] }]" :format="function (value) { return value + '%' }" /> </div></template>#값의 범위
계열에 레이블마다 low와 high를 하나씩 지정하면 예측값이 가질 수 있는 범위나 두 번의 실행 결과 사이의 폭을 나타낼 수 있습니다. 선 뒤에 선과 같은 색의 옅은 띠로 그리며, 값 표시에는 수치 뒤에 범위를 함께 표시합니다.
범위 띠
<div class="card max-w(560) mx-auto"> <div class="card-header"> <h3 class="card-title">Sessions</h3> <p class="card-description">Thousands per month, with the range the forecast allows</p> </div> <figure class="chart" id="forecast"></figure></div><script>addEventListener('DOMContentLoaded', function () {MasterUI.chart(document.getElementById('forecast'), { type: 'line', label: 'Sessions per month with the range of the forecast, in thousands', labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], series: [{ name: 'Sessions', values: [320, 360, 340, 410, 460, 440, 520, 560, 540, 610, 680, 720], low: [300, 335, 310, 370, 410, 385, 450, 470, 440, 490, 540, 560], high: [340, 385, 372, 452, 512, 498, 592, 650, 640, 730, 820, 880] }]})})</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">Sessions</h3> <p className="card-description">Thousands per month, with the range the forecast allows</p> </div> <Chart id="forecast" type="line" label="Sessions per month with the range of the forecast, in thousands" labels={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']} series={[{ name: 'Sessions', values: [320, 360, 340, 410, 460, 440, 520, 560, 540, 610, 680, 720], low: [300, 335, 310, 370, 410, 385, 450, 470, 440, 490, 540, 560], high: [340, 385, 372, 452, 512, 498, 592, 650, 640, 730, 820, 880] }]} /></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">Sessions</h3> <p class="card-description">Thousands per month, with the range the forecast allows</p> </div> <Chart id="forecast" type="line" label="Sessions per month with the range of the forecast, in thousands" labels={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']} series={[{ name: 'Sessions', values: [320, 360, 340, 410, 460, 440, 520, 560, 540, 610, 680, 720], low: [300, 335, 310, 370, 410, 385, 450, 470, 440, 490, 540, 560], high: [340, 385, 372, 452, 512, 498, 592, 650, 640, 730, 820, 880] }]} /></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">Sessions</h3> <p class="card-description">Thousands per month, with the range the forecast allows</p> </div> <Chart id="forecast" type="line" label="Sessions per month with the range of the forecast, in thousands" :labels="['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']" :series="[{ name: 'Sessions', values: [320, 360, 340, 410, 460, 440, 520, 560, 540, 610, 680, 720], low: [300, 335, 310, 370, 410, 385, 450, 470, 440, 490, 540, 560], high: [340, 385, 372, 452, 512, 498, 592, 650, 640, 730, 820, 880] }]" /> </div></template>#막대 위에 선 표시
막대 차트에서 계열에 type: 'line'을 지정하면 막대와 같은 척도를 사용해 막대 위에 선을 그립니다. 목표값이나 이동 평균을 표시할 때 사용합니다.
#옵션
| 옵션 | 기본값 | |
|---|---|---|
label | 없음 | 차트가 보여 주는 내용과 단위를 설명하는 플롯의 접근성 이름 |
labels | [] | 축을 따라, 레이더 차트 둘레에, 또는 히트맵의 열 위에 표시하는 이름 |
series | [] | 각 계열의 name과 차트 유형에 따라 사용하는 values, value, points, ranges 또는 children입니다. category, type, low와 high, 링의 max도 지정할 수 있습니다. |
curve | 'smooth' | smooth, linear 또는 step |
min, max, ticks | 데이터에 맞춤, 4 | 축의 양 끝값과 대략적인 눈금 수입니다. 산점도의 가로축에는 xMin, xMax, xTicks를 사용합니다. |
format, tickFormat | 로캘에 따름 | 값과 눈금 레이블의 표시 형식입니다. 산점도의 가로축에는 xFormat을 사용합니다. |
dots, values | false | 선의 모든 점을 표시하고 각 막대에 값을 표시할지 지정합니다. |
legend, toggle | 계열이 두 개일 때 표시, true | 범례를 표시할지, 범례 항목을 체크박스로 표시할지 지정합니다. |
값 표시, 키보드 조작, 범례, 색상, 척도는 모든 차트 유형에 공통으로 적용됩니다. 차트에서 공통 동작과 모든 옵션, 클래스, 사용자 지정 속성을 확인할 수 있습니다.