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

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.

主站蜘蛛池模板: 文化| 墨竹工卡县| 屏东县| 仙游县| 永清县| 中江县| 兴化市| 乐清市| 寿光市| 北票市| 东源县| 滨州市| 新化县| 青阳县| 新巴尔虎右旗| 治多县| 洪湖市| 扬中市| 凤阳县| 郓城县| 独山县| 正定县| 武城县| 沁源县| 英德市| 杭州市| 共和县| 永昌县| 贺州市| 余干县| 华安县| 梅河口市| 中方县| 全南县| 南丹县| 乐都县| 桐梓县| 雅江县| 台山市| 斗六市| 西华县|