- 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.
推薦閱讀
- Software Defined Networking with OpenFlow
- Apache Oozie Essentials
- 軟件項目管理(第2版)
- Microsoft Application Virtualization Cookbook
- Visual Basic程序設(shè)計教程
- Processing互動編程藝術(shù)
- Backbone.js Blueprints
- 微信小程序入門指南
- 利用Python進行數(shù)據(jù)分析(原書第3版)
- ASP.NET程序開發(fā)范例寶典
- 寫給程序員的Python教程
- BeagleBone Robotic Projects(Second Edition)
- ASP.NET Core and Angular 2
- Fast Data Processing with Spark 2(Third Edition)
- Cadence Concept-HDL & Allegro原理圖與電路板設(shè)計(第2版)