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

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.

主站蜘蛛池模板: 高密市| 玛曲县| 涞源县| 伊宁市| 东乡县| 炉霍县| 唐海县| 红安县| 吴忠市| 七台河市| 晴隆县| 凯里市| 定州市| 明光市| 谷城县| 吴川市| 沙坪坝区| 和田县| 桑日县| 潞西市| 南华县| 龙门县| 罗田县| 凌海市| 旅游| 皋兰县| 上虞市| 侯马市| 马龙县| 泰宁县| 巴林右旗| 大荔县| 炎陵县| 丹东市| 渝中区| 杭州市| 太白县| 星子县| 永仁县| 新巴尔虎左旗| 弥勒县|