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

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.

主站蜘蛛池模板: 沽源县| 石城县| 朝阳市| 德钦县| 阳信县| 成安县| 通渭县| 陆良县| 丹江口市| 江城| 谢通门县| 浏阳市| 大埔区| 连州市| 肥西县| 遂川县| 墨玉县| 乳山市| 松桃| 门源| 汽车| 高平市| 迁安市| 莱芜市| 东明县| 云安县| 繁昌县| 溧阳市| 兴城市| 奇台县| 奉新县| 辽阳市| 中宁县| 周至县| 进贤县| 大丰市| 白银市| 和平县| 吴江市| 金川县| 禹城市|