- 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.
推薦閱讀
- Getting Started with React
- Windows系統管理與服務配置
- INSTANT Mercurial SCM Essentials How-to
- FFmpeg入門詳解:音視頻原理及應用
- Hands-On Enterprise Automation with Python.
- 劍指MySQL:架構、調優與運維
- 學習正則表達式
- 領域驅動設計:軟件核心復雜性應對之道(修訂版)
- Building Android UIs with Custom Views
- Java面向對象程序設計
- 一本書講透Java線程:原理與實踐
- Hands-On JavaScript for Python Developers
- 人人都能開發RPA機器人:UiPath從入門到實戰
- Java高級程序設計
- Learning TypeScript