官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 元朗区| 武宁县| 梁河县| 洛浦县| 元氏县| 陇川县| 巨野县| 肥城市| 敖汉旗| 三穗县| 万载县| 普洱| 浦城县| 裕民县| 南通市| 都匀市| 成安县| 京山县| 资阳市| 游戏| 松原市| 遂宁市| 三门县| 昭通市| 黄大仙区| 台州市| 蒙阴县| 阿鲁科尔沁旗| 红安县| 镇巴县| 山东| 河东区| 裕民县| 雅江县| 揭西县| 桂平市| 高密市| 汶上县| 原平市| 延吉市| 本溪市|