Javascript nvd3.js我可以更改域行plusbarchart

Javascript nvd3.js我可以更改域行plusbarchart,javascript,charts,d3.js,nvd3.js,Javascript,Charts,D3.js,Nvd3.js,我正在尝试从0显示Y2轴上的值,但我不能。y2axis中的最小值是12000,最大值是245000,我想从0开始显示 这是相关代码 # get the max value maxValue = _.reduce(series_2nd.values, ((n, m) -> Math.max(m.y, n)), -1) # ... nv.addGraph -> chart = nv.models.linePlusBarChart() chart.color(d3.

我正在尝试从0显示Y2轴上的值,但我不能。y2axis中的最小值是12000,最大值是245000,我想从0开始显示

这是相关代码

# get the max value
maxValue = _.reduce(series_2nd.values, ((n, m) -> Math.max(m.y, n)), -1)

# ...   
nv.addGraph ->
    chart = nv.models.linePlusBarChart()
    chart.color(d3.scale.category10().range())
    chart.xAxis.tickFormat (d) ->
        d3.time.format('%d/%m/%Y')(new Date(d))
    chart.y1Axis.tickFormat(d3.format(',.1'))
    chart.y2Axis.tickFormat(d3.format(',f'))
    chart.y2Axis.scale().range([0, scope.maxValue + 10]);
    chart.margin({top:50,right:50,bottom:50,left:120})
    nv.utils.windowResize chart.update
    d3.select('#' + name + ' svg').datum(data).transition().duration(500).call(chart)
    chart

不确定你想在代码中做什么。特别是最后一行似乎适得其反。我想显示0的值,而不是最小值的值。那么
chart.y2Axis.scale(scaleY1)
应该做什么呢?我认为这行
scale=…
改变了缩放域,后来即使我尝试了其他方法也没有成功,你也可以做
chart.lines.forceY([0])