2016-04-26 85 views
0

某些信息: 我有复合折线图。 而我的问题是: 即时通讯使用elasticY,但我的轴开始在0,但我的最小值可以是250. 是否有机会从250开始Y轴而不是从0开始?但动态Y轴应该工作(elasticY)如何更改y轴的范围 - dc.js复合折线图

var compositeAvg = dc.compositeChart("#avgline-chart"); 

    compositeAvg.width(1500).height(375) 
     .group(filtered_group) 
     .brushOn(true) 
     .yAxisLabel("Morbalwait AVG ") 
     .x(d3.scale.ordinal()) //x axis 
     .xUnits(dc.units.ordinal) 
     .margins({ top: 10, left: 50, right: 10, bottom: 50 }) 
     .elasticY(true) 
     .elasticX(true) 
     ._rangeBandPadding(1) 
     .compose(composeLines()) 
     .legend(dc.legend().x(1425).y(0).itemHeight(13).gap(1));  

回答

1

你试过.Y(d3.scale.linear()。域([250,yourmaxvalue))

+0

问题是我的最大值为总是不一样的:/我从数据库中获取我的数据 – Addy1992

+0

我认为你可以使用top函数自动获得最大值,请查看:https://github.com/square/crossfilter/wiki/API-Reference# dimension_top – Thanos

+0

感谢Thonas :) – Addy1992