/** * Created by michaelbessey on 10/15/16. */ // declare let d3; // import {select as d3_select} from 'd3-select'; // import {select as d3_select} from "d3"; import * as d3 from "d3"; export class Dashboard { public static getInstance(): Dashboard { return Dashboard._instance; } private static _instance: Dashboard = new Dashboard(); chartMap; constructor(){ this.chartMap = {}; } addChart(selector, chart){ this.chartMap[selector] = chart; } resize(){ let chart; for (let c in this.chartMap) { if (this.chartMap.hasOwnProperty(c)) { chart = this.chartMap[c]; if(chart){ chart.resizeView(); } } } } addResizeListener(){ d3.select(window).on("resize", () => { this.resize(); }); } }