Pat Wangrungarun
Pat Wangrungarun

Reputation: 526

How to expand a data scale on NVD3 line chart

Now I've got extra ends like this.

enter image description here

Is there any way to get rid of those ends? Currently I'm using this setup:

  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)

Thanks!

Upvotes: 0

Views: 522

Answers (1)

krispo
krispo

Reputation: 526

Try to expand domain for y axis using yDomain chart option:

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

Upvotes: 1

Related Questions