0

I'm new using nvd3 and I try to do something but I can't find the right way to do it, I'll try to be clear. I need to make a little change to a nv.models.lineChart.

I need to add a button and when I click it, remove a last element from the data and update the chart. I try to do that but creating the button inside the library Example:

nv.models.lineChart = function () {    
    d3.select("body")
        .append("button")
        .attr('type','button')
        .text("test").on("click",function(){
            //Code here ...
            // I need to access data what are binding to svg here
            Is there any way to do it with nvd3? 

        });

    //============================================================
    // Public Variables with Default Settings
    //------------------------------------------------------------

    //...
}
YuryDG
  • 425
  • 3
  • 7
  • Why do you want to keep the button in the NVD3 library? Try to keep the button outside the library. Have a look at this [question & answer](http://stackoverflow.com/questions/24689157/nvd3-how-to-refresh-the-data-function-to-product-new-data-on-click/24695324#24695324) to get an idea on how to update the chart. – shabeer90 Apr 24 '15 at 10:01
  • thanks by your answer, but I really need to create a new nvd3 model and I need the button inside this model. Thanks anyway. – YuryDG Apr 27 '15 at 17:29

0 Answers0