novus / nvd3

A reusable charting library written in d3.js
http://nvd3.org/
Other
7.22k stars 2.14k forks source link

SparklinePlus hover value not updating with new data #1558

Open jeremywestwood opened 8 years ago

jeremywestwood commented 8 years ago

I have an NVD3 SparklinePlus that I am updating with new data when it comes through. The line itself updates as expected but the hover values are as if the original data is still there. Example code is below and here is a link to a jsfiddle with a working example of the problem:

 var chart
  nv.addGraph(function() {
    chart = nv.models.sparklinePlus()
    chart.showLastValue(true)
    d3.select("#spark svg").datum(sine(10, 20)).call(chart)
    return chart
  })

  setTimeout(function() {
    d3.select("#spark svg").datum(sine(5, 30)).call(chart)
  }, 1000)

Am I doing something incorrect in the update function, in terms of how I replace the data, or is this a bug in the SparklinePlus?

jeremywestwood commented 8 years ago

Have created a potential fix for the issue in this pull request: https://github.com/novus/nvd3/pull/1561