2017-03-17 71 views

回答

0

您可以添加以下文件的组成部分。

map.component.ts

import { Component } from '@angular/core'; 

@Component({ 
    selector: 'app-root', 
    templateUrl: './map.component.html', 
    styleUrls: ['./map.component.css'] 
}) 
export class MapComponent { 
    private id = "mapdiv"; 

    private options; 

    makeChartConfig() { 

     return { 
      "type": "map", 
      "theme": "light", 

      "colorSteps": 10, 

      "dataProvider": { 
       "map": "indiaLow", 
       "areas": [{ 
        "id": "IN-AN", 
        "value": 4447100 
       }, { 
        "id": "IN-AP", 
        "value": 626932 
       }, { 
        "id": "IN-KA", 
        "value": 5130632 
       }] 
      }, 

      "areasSettings": { 
       "autoZoom": true 
      }, 

      "valueLegend": { 
       "right": 10, 
       "minValue": "little", 
       "maxValue": "a lot!" 
      } 

     }; 
    } 

    ngOnInit() { 
     this.options = this.makeChartConfig(); 
    } 
} 

map.component.html

<amCharts [id]="id" [options]="options" [style.width.%]="100" [style.height.px]="500"></amCharts>