2016-04-26 68 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