5

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.

Banana Joe
  • 51
  • 2
  • 1
    It looks like ng2nvd3 is now https://github.com/swimlane/ngx-charts (maybe?). Might not be helpful. – Jeff Jun 09 '17 at 12:24
  • thx for the help. I've tried implementing ngx-charts but I keep getting a "is not a known property" error when I use their HTML-Tags. It seems to be a known issue but I can't get a fix for that either. I'm using Angular 2.4.3 and I literally tried every ngx version. It keeps frustrating me – Banana Joe Jun 12 '17 at 11:20
  • I've had that error before. You have to make a change in a json file, but I can't remember the change. Look up that error though. – Jeff Jun 12 '17 at 14:09
  • zone.js:405 Unhandled Promise rejection: Template parse errors: Can't bind to 'view' since it isn't a known property of 'ngx-charts-line-chart'. I keep getting this error. Haven't found the solution you mentioned – Banana Joe Jun 13 '17 at 12:14

1 Answers1

0

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.

Murkantilism
  • 1,060
  • 1
  • 16
  • 31