How to set options?

2019-09-15 09:29发布

问题:

After angular2 updated, they don't import Highcharts from angular2-highcharts anymore. How can I set options? Plunker

I want to add

Highcharts.setOptions({ lang: { thousandsSep: ',' } });

Thanks

回答1:

import { Component } from '@angular/core';
declare var require: any;
const Highcharts = require('highcharts');
Highcharts.setOptions({ lang: { thousandsSep: ',' } });

export class AppComponent {
...


回答2:

Just add it to the literal inside the constructor: (inside app/main.ts) in the plunker.

class AppComponent {
  constructor() { 
    this.options = {
      title : { text : 'simple chart' },
      series: [{
        data: [29.9, 71.5, 106.4, 129]
      }],
      lang: { thousandsSep: ',' }
    };
  }
  options: Object;
}