dc.js linechart - 使行crOss而不是堆叠在彼此之上

时间:2016-11-11 23:00:37

标签: d3.js dc.js

我有一个带有日期维度的直线图表,并链接到我的数据中的其他几列。 链接到日期的图表值是百分比,但目前它们是叠加的,当Y轴最大为100时,Y轴最终超过1000,并且线应该交叉并表示百分比。 因为我按日期分组,所以它增加了该日期的总百分比,理论上对于3行数据可以是300,是否有办法使这个最大值为100,可能是平均值而没有行堆栈但是互相交叉?

    var dateDim = ndx.dimension(function(d) {return d.Date;});
    var a=dateDim.group().reduceSum(function(d) {return d.a;});
    hitslineChart
    .width(1000).height(300)
    .dimension(dateDim)
    .group(a,"a")
    .stack(b,"b")
    .stack(c,"c")
    .stack(d,"d") 
    .stack(e,"e")    
    .stack(f,"f")    
    .renderArea(false)//fills in the areas
    .x(d3.time.scale().domain([minDate,maxDate]))
    .brushOn(true)

    .legend(dc.legend().x(50).y(10).itemHeight(13).gap(5))
    .yAxisLabel("Score");

0 个答案:

没有答案