/** * Created by michaelbessey on 10/30/16. * Modifiled by mm17060 on 6/14/2017 */ import { getLinearAxisConfigX, getLinearAxisConfigY } from "../mmviz-common/index"; import { ScaleContainerTypeEnum, ScaleTypeEnum, scatterLayoutCreator } from "../mmviz-layout/index"; import {ScatterComponentSvg} from "../mmviz-component-svg/index"; import { DetailsBehavior, DetailsFocusTypeEnum } from "../mmviz-behavior/index"; import {ChartBuilderSvg} from "./builder"; export class ScatterChartBuilderSvg extends ChartBuilderSvg { component; xScaleType; yScaleType; constructor(selector: string) { super(selector); this.xScaleType = ScaleTypeEnum.LINEAR; this.yScaleType = ScaleTypeEnum.LINEAR; this.component = new ScatterComponentSvg(selector); this.detailsBehavior = new DetailsBehavior(selector, this.component.selector); this.detailsBehavior.focusTypeEnum = DetailsFocusTypeEnum.DATA; this.xAxisConfigFactory = getLinearAxisConfigX; this.yAxisConfigFactory = getLinearAxisConfigY; } createView(){ super.createView(); this.chartView.addContentTypeClass("scatter-content"); return this; } updateView(): ScatterChartBuilderSvg { const areaScaleKey = "area", shapeScaleKey = "shape", layoutExtender = scatterLayoutCreator(this.colorScaleKey, areaScaleKey, shapeScaleKey); let viewModel: any, layouter: Function; super.updateView(); this.layoutScale .xScaleSetup(this.xScaleType) .yScaleSetup(this.yScaleType) .createScaleContainer(shapeScaleKey, ScaleContainerTypeEnum.SHAPE) .createScaleContainer(areaScaleKey, ScaleContainerTypeEnum.AREA) ; // setup color scale super.mapColorScale(); layouter = layoutExtender(this.dataModel, this.layoutScale); this.displayAxies(); viewModel = layouter(); this.component.updateView(this.chartView.stage, viewModel); super.updateComponents(); return this; } resizeView(){ return this.updateView(); } }