/** * Created by mm28969 on 11/7/16. */ import { getLinearAxisConfigX, getLinearAxisConfigY } from "../mmviz-common"; import {LineComponentSvg} from "../mmviz-component-svg/index"; import {lineLayoutCreator, ScaleContainerTypeEnum, ScaleTypeEnum} from "../mmviz-layout/index"; import {DetailsBehavior, DetailsFocusTypeEnum} from "../mmviz-behavior/index"; import {ChartBuilderSvg} from "./builder"; export class LineChartBuilderSvg extends ChartBuilderSvg { component; xScaleType; yScaleType; constructor(selector: string) { super(selector); this.xScaleType = ScaleTypeEnum.LINEAR; this.yScaleType = ScaleTypeEnum.LINEAR; this.xAxisConfigFactory = getLinearAxisConfigX; this.yAxisConfigFactory = getLinearAxisConfigY; this.component = new LineComponentSvg(selector); this.detailsBehavior = new DetailsBehavior(selector, this.component.selector); this.detailsBehavior.focusTypeEnum = DetailsFocusTypeEnum.DATA; } createView(){ super.createView(); this.chartView.addContentTypeClass("line-content"); return this; } updateView(): LineChartBuilderSvg { let viewModel: any, layouter: Function, layoutExtender = lineLayoutCreator(this.colorScaleKey); super.updateView(); this.layoutScale .xScaleSetup(this.xScaleType) .yScaleSetup(this.yScaleType); 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(); } }