Highcharts Map Map-Pies
HTML
<app-country></app-country>
JavaScript
import { Component, OnInit } from '@angular/core';
import { customEuropa } from '../../../testdata/europe'; /* europe map from "http://code.highcharts.com/mapdata/custom/europe.js */
import * as $ from 'jquery';
import * as proj4 from './../../../../../node_modules/proj4/dist/proj4.js';
@Component({
selector: 'app-country',
templateUrl: './country.component.html',
styleUrls: ['./country.component.scss']
})
export class CountryComponent implements OnInit {
options: any;
chart: any; // Highcharts.ChartObject;
series: Highcharts.SeriesObject;
maxVotes: number = 0;
demColor = 'rgba(74,131,240,0.80)';
repColor = 'rgba(220,71,71,0.80)';
libColor = 'rgba(240,190,50,0.80)';
grnColor = 'rgba(90,200,90,0.80)';
presidentElectionTestData:any = [
{
'hc-key': 'at',
"lat": 47.635783590864854,
"lon": 15.00732421875,
'x': 0,
'y': 100,
'repVotes': 41,
'demVotes': 25,
'sumVotes': 66,
},
{
'hc-key': 'de',
"lat": 55.07836723201514,
"lon": 9.7119140625,
'repVotes': 22,
'demVotes': 30,
'sumVotes': 52,
},
];
constructor() {
// proj4.defs(
// [
// 'EPSG:4326',
// '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees'],
// [
// 'EPSG:102014',
// '+proj=lcc +lat_1=43 +lat_2=62 +lat_0=30 +lon_0=10 +x_0=0 +y_0=0 +ellps=intl +units=m +no_defs'
// ]
// );
// get max votes for size of pie
presidentElectionTestData.forEach(row => {
this.maxVotes = Math.max(this.maxVotes, row.sumVotes);
// console.log(proj4('EPSG:4326', 'EPSG:102014', [row.lat, row.lon]));
});
// console.log(this.maxVotes);
// console.log(presidentElectionTestData);
// console.log(customEuropa);
}
...