Summary
Steps
1. 자료의 누적분 연산
stack()으로 누적된 계열을 상대적 양을 하나의 자료형, 여기서는 annotatedData 혹은 stackData에 담는 단계까지는 누적 막대 그래프를 그리는 과정과 동일하다.
2. 영역 그리기를 위해 누적분의 상대 좌표 계산
// x 축이 시간축, y축이 키값의 축(계열축)이라고 가정한다.
d3.area()
.x( d=> xScale (d.xValue)) // 시간축(x축) 위에서 해당 데이터의 위치
.y0(d => ySCale(d.yValue0)) // 계열축(y축) 위에서 해당 데이터의 시작점
.y1(d => ySCale(d.yValue1)) // 계열축(y축) 위에서 해당 데이터의 끝점
“Figure 5.16 The area generator d3.area() is combined with three or more accessor functions. When employed in combination with the stack layout for a streamgraph, it uses the lower and upper boundaries (y0 and y1) of each data point to calculate the d attribute of the areas.” (Meeks, 2024, p. 176) (pdf)
Troubleshooting
Log
- 2026-08-24 Page created.