如何在NVD3折线图上扩展数据比例

时间:2014-06-17 05:13:53

标签: d3.js nvd3.js

现在我有这样的额外目的。

enter image description here

有没有办法摆脱这些目的?目前我正在使用此设置:

  nv.addGraph ->
    chart = nv.models.lineChart()
      .showLegend(false)
      .width(elem.width())
      .margin(top: 10, left: 50, bottom: 20, right: 50)

    chart.xAxis
      .tickValues(_.map(data[0].values, (d) -> d.x))
      .tickFormat((d) -> d3.time.format('%d/%m')(new Date(d)))
      .tickPadding(10)

    chart.yAxis
      .tickFormat(d3.format('+.2f'))
      .tickPadding(10)
      .showMaxMin(false)

    d3.select(elem[0])
      .datum(data)
      .transition().duration(0)
      .call(chart)

谢谢!

1 个答案:

答案 0 :(得分:1)

尝试使用yDomain图表选项扩展y轴的域名:

chart.yDomain([-0.70, 0.50]);