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

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.

主站蜘蛛池模板: 襄城县| 沙湾县| 姜堰市| 阜康市| 疏附县| 大港区| 门源| 沅江市| 亚东县| 道真| 天水市| 皮山县| 深水埗区| 连江县| 开鲁县| 宜章县| 渑池县| 红原县| 陕西省| 札达县| 米林县| 东莞市| 滦南县| 长岛县| 廉江市| 买车| 商水县| 仪征市| 天水市| 吐鲁番市| 沙坪坝区| 绥阳县| 交城县| 马山县| 乌拉特后旗| 彰武县| 永登县| 宣化县| 和平区| 大荔县| 北安市|