Nvd3 Angular2 change chart parameters dynamically

I am using nvd3 for angular2, and I am trying to change the parameters of the chart (yDomain) dynamically after initialization.

this.options = {
  chart: {
    type: 'lineChart',
    x: function(d){return d.x;},
    y: function(d){return d.y;},
    yDomain: [1, 2],

I have already tried this:

this.options.chart.yDomain = [0.1,0.2];

Any help is appreciated.

+5
source share
1 answer

Honestly, this should be correct, I used:

$scope.graphOptions.chart.title = ...

and at first it didn't work, so I thought this was the wrong way to dynamically update the header. I googled, found this thread, later fixed a seemingly unrelated error, and it worked correctly. Look at your code for other problems this.options.chart.yDomain, how you should update it.

0
source

Source: https://habr.com/ru/post/1678334/


All Articles