/** * Created by michaelbessey on 10/30/16. */ import {ScaleContainerTypeEnum, ScaleTypeEnum, pieLayoutCreator} from "../mmviz-layout/index"; import {PieComponentSvg} from "../mmviz-component-svg/index"; import {DetailsBehavior} from "../mmviz-behavior/index"; import {ChartBuilderSvg} from "./builder"; export class PieChartBuilderSvg extends ChartBuilderSvg { component: PieComponentSvg; innerRadiusPercent: number; constructor(selector: string) { super(selector); this.component = new PieComponentSvg(selector); this.detailsBehavior = new DetailsBehavior(selector, this.component.selector); this.innerRadiusPercent = 0; } createView(){ super.createView(); this.chartView.addContentTypeClass("pie-content"); return this; } updateView(): PieChartBuilderSvg { let viewModel: any, layouter: Function, layoutExtender = pieLayoutCreator(this.colorScaleKey, this.innerRadiusPercent); super.updateView(); super.mapColorScale(); layouter = layoutExtender(this.dataModel, this.layoutScale); viewModel = layouter(); this.component.updateView(this.chartView.stage, viewModel); super.updateComponents(); return this; } resizeView(){ return this.updateView(); } }