- Expert Data Visualization
- Jos Dirksen
- 106字
- 2021-07-09 18:22:48
Adding a y-axis with absolute income
For this axis, we don't do anything special:
function addAxis(yIncomeScale, yIndexedScale, xScale, xRangeAdjusted) {
...
var rightAxis = d3.axisRight().scale(yIncomeScale).ticks(20);
var rightAxisSVG = chart.append("g")
.attr('transform', 'translate( ' + (width + 4) + ')')
.call(rightAxis);
...
}
We just create d3.axisRight based on the yIncomeScale, and ask for twenty ticks. When we add this axis, we position the axis using the transform attribute and position it a little bit farther to the right to leave some room for the labels of the x-axis.
The axis on the left side will take some more work, since we're going to customize that a bit.
推薦閱讀
- Redis Applied Design Patterns
- LabVIEW程序設計基礎與應用
- Java Web基礎與實例教程
- Visual FoxPro程序設計
- Learning Unity 2D Game Development by Example
- Serverless computing in Azure with .NET
- Julia for Data Science
- Python 3.7從入門到精通(視頻教學版)
- Microsoft 365 Certified Fundamentals MS-900 Exam Guide
- C語言程序設計簡明教程:Qt實戰
- Instant GLEW
- 零基礎學SQL(升級版)
- Google Adsense優化實戰
- MySQL核心技術與最佳實踐
- Python人工智能項目實戰