nvd3 Angular2 change chart options dynamically

835 Views Asked by At

i'm using nvd3 for angular2 and i'm trying to change the chart options (yDomain) dynamically after beeing initialized.

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

I've already tried this:

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

Any help is appreciated.

1

There are 1 best solutions below

0
Murkantilism On

Honestly that should be correct, I used:

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

and at first it didn't work, so I thought that wasn't the correct way to dynamically update the title. I googled, found this thread, later fixed a seemingly unrelated error and it worked properly. Look around your code for other issues this.options.chart.yDomain is how you should update it.