igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
1,579 lines (1,578 loc) • 120 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { Brush } from "igniteui-angular-core";
import { XYChart } from "./XYChart";
import { IndicatorPane } from "./IndicatorPane";
import { Base, BaseError, EventArgs, runOn, delegateRemove, delegateCombine, fromEnum, typeCast, EnumUtil, Number_$type, String_$type, enumGetBox, markType, TypeRegistrar, fromEn } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { DataSeriesType_$type } from "igniteui-angular-core";
import { IDataSeriesAdapterRule_$type } from "igniteui-angular-core";
import { SimpleFinancialPriceSeriesRule } from "igniteui-angular-core";
import { SubCollectionsRule } from "igniteui-angular-core";
import { XamDataChart } from "./XamDataChart";
import { FinancialChartVolumeType_$type } from "./FinancialChartVolumeType";
import { FinancialChartXAxisMode_$type } from "./FinancialChartXAxisMode";
import { FinancialChartYAxisMode_$type } from "./FinancialChartYAxisMode";
import { FinancialChartType_$type } from "./FinancialChartType";
import { NumericYAxis } from "./NumericYAxis";
import { CategoryAxisBase } from "./CategoryAxisBase";
import { FinancialChartZoomSliderType_$type } from "./FinancialChartZoomSliderType";
import { BrushCollection } from "igniteui-angular-core";
import { FinancialChartRangeSelectorOptionCollection } from "./FinancialChartRangeSelectorOptionCollection";
import { ObservableCollection$1 } from "igniteui-angular-core";
import { TemplatedHtmlControl } from "./TemplatedHtmlControl";
import { FinancialChartContext } from "./FinancialChartContext";
import { FinancialChartToolbarContext } from "./FinancialChartToolbarContext";
import { FinancialChartViewModel } from "./FinancialChartViewModel";
import { FinancialChartToolbarViewModel } from "./FinancialChartToolbarViewModel";
import { AxisDefaults } from "./AxisDefaults";
import { Defaults } from "./Defaults";
import { BrushUtil } from "igniteui-angular-core";
import { Series } from "./Series";
import { Rect } from "igniteui-angular-core";
import { Axis } from "./Axis";
import { AxisLabelSettings } from "./AxisLabelSettings";
import { MarkerSeries } from "./MarkerSeries";
import { IZoomableCategoryAxis_$type } from "./IZoomableCategoryAxis";
import { SyncSettings } from "./SyncSettings";
import { SyncManager } from "./SyncManager";
import { FinancialOverlayType_$type } from "./FinancialOverlayType";
import { ArrayExtension } from "igniteui-angular-core";
import { FinancialIndicatorType_$type } from "./FinancialIndicatorType";
import { IndicatorDisplayType_$type } from "./IndicatorDisplayType";
import { ITimeRangeSelectorAxis_$type } from "./ITimeRangeSelectorAxis";
import { FinancialChartVisualData } from "./FinancialChartVisualData";
import { FinancialChartCustomIndicatorArgs } from "./FinancialChartCustomIndicatorArgs";
import { ScalerParams } from "./ScalerParams";
import { stringReplace, stringJoin, stringIsNullOrEmpty } from "igniteui-angular-core";
import { timeSpanFromDays } from "igniteui-angular-core";
import { dateMaxValue, dateMinValue } from "igniteui-angular-core";
import { isNaN_, isInfinity } from "igniteui-angular-core";
import { FinancialChartTypePicker } from "./FinancialChartTypePicker";
import { FinancialChartIndicatorMenu } from "./FinancialChartIndicatorMenu";
import { TrendLineType_$type } from "igniteui-angular-core";
import { FinancialChartIndicatorMenuContext } from "./FinancialChartIndicatorMenuContext";
import { FinancialChartTypePickerContext } from "./FinancialChartTypePickerContext";
import { FinancialChartRangeSelectorContext } from "./FinancialChartRangeSelectorContext";
import { FinancialChartToolbarVisualData } from "./FinancialChartToolbarVisualData";
import { FinancialChartRangeSelectorViewModel } from "./FinancialChartRangeSelectorViewModel";
import { FinancialChartRangeSelectorView } from "./FinancialChartRangeSelectorView";
/**
* @hidden
*/
export class FinancialChart extends XYChart {
static { this.$t = markType(FinancialChart, 'FinancialChart', XYChart.$); }
w6(a, b, c) {
super.w6(a, b, c);
switch (a) {
case "ToolbarTemplate":
case "RangeSelectorTemplate":
this.akf = new FinancialChartToolbar(this, this.aow);
break;
case "Toolbar":
let d = b;
if (d != null) {
d.chartTypeChanged = delegateRemove(d.chartTypeChanged, runOn(this, this.arq));
d.trendLineTypeChanged = delegateRemove(d.trendLineTypeChanged, runOn(this, this.art));
d.volumeTypeChanged = delegateRemove(d.volumeTypeChanged, runOn(this, this.aru));
d.l(null);
}
if (this.akf != null) {
this.akf.ac = this.akm;
this.akf.ai = this.ee;
this.akf.y = this.akh;
this.akf.al = this.amf;
if (this.an3 != null) {
this.akf.l(this.an3);
}
let e = this.akf;
e.chartTypeChanged = delegateCombine(e.chartTypeChanged, runOn(this, this.arq));
;
let f = this.akf;
f.trendLineTypeChanged = delegateCombine(f.trendLineTypeChanged, runOn(this, this.art));
let g = this.akf;
g.volumeTypeChanged = delegateCombine(g.volumeTypeChanged, runOn(this, this.aru));
}
break;
case "ChartType":
if (this.akf != null) {
this.akf.y = this.akh;
}
break;
case "VolumeType":
if (this.akf != null) {
this.akf.ac = this.akm;
}
break;
case "TrendLineType":
if (this.akf != null) {
this.akf.ai = this.ee;
}
break;
case "IsToolbarVisible":
if (this.akf == null) {
break;
}
this.akf.al = this.amf;
this.setGridRows();
break;
}
}
aru(a, b) {
this.akm = this.akf.ac;
}
art(a, b) {
this.ee = this.akf.ai;
}
arq(a, b) {
this.akh = this.akf.y;
}
ar3() {
this.ak8 = new IndicatorPane();
this.akz = TypeRegistrar.create("FinancialLegend");
}
provideGrid(a) {
this.an6 = a;
this.aso();
this.setGridRows();
if (this.akf != null) {
this.akf.bg(a);
}
}
onDocumentClick(a) {
if (this.akf != null) {
this.akf.bl(a);
}
}
getContext() {
let a = this.akf.v();
let b = new FinancialChartContext();
b.vm = new FinancialChartViewModel();
b.vm.toolbar = a;
b.container = this.mi;
b.toolbarContainer = this.an3;
b.legendContainer = this.an2;
b.indicatorsContainer = this.an1;
b.volumeContainer = this.an4;
b.zoomContainer = this.an5;
return b;
}
provideContainer(a) {
let b = a;
if (b != null) {
let c = "financialChartMainGrid";
let d = b.createElement("div");
d.setStyleProperty("width", "100%");
d.setStyleProperty("height", "100%");
if (this.akf == null) {
this.akf = new FinancialChartToolbar(this, this.aow);
}
this.akf.w.isIndicatorMenuVisible = this.al6 && this.al7;
this.an3 = b.getSubRenderer(d);
this.akf.l(this.an3);
let e = b.createElement("div");
e.setStyleProperty("width", "100%");
e.setStyleProperty("height", "100%");
let f = b.createElement("div");
f.setStyleProperty("width", "100%");
f.setStyleProperty("height", "100%");
this.an2 = b.getSubRenderer(f);
let g = b.createElement("div");
g.setStyleProperty("width", "100%");
g.setStyleProperty("height", "100%");
this.an1 = b.getSubRenderer(g);
let h = b.createElement("div");
h.setStyleProperty("width", "100%");
h.setStyleProperty("height", "100%");
this.an4 = b.getSubRenderer(h);
let i = b.createElement("div");
i.setStyleProperty("width", "100%");
i.setStyleProperty("height", "100%");
this.an5 = b.getSubRenderer(i);
a = b.getSubRenderer(e);
}
else {
this.an3 = null;
if (this.akf != null) {
this.akf.l(null);
}
if (this.alx != null) {
this.alx.provideContainer(null);
this.alx = null;
}
if (this.akz != null) {
this.akz.provideContainer(null);
}
}
super.provideContainer(a);
if (b != null) {
if (this.volumeChart != null) {
this.volumeChart.dw.b7(this.an4);
}
if (this.ak8 != null) {
this.ak8.h(this.an1);
}
if (this.zoomSliderChart != null) {
this.zoomSliderChart.dw.b7(this.an5);
if (a != null) {
this.ara();
}
else {
this.alx = null;
}
}
if (this.akz != null) {
this.akz.provideContainer(this.an2);
}
this.setGridRows();
}
}
ase(a, b, c) {
if (a != null) {
a.provideContainer(null);
}
if (b != null) {
b.dw.b7(c);
}
this.setGridRows();
}
ass(a, b) {
this.ase(a, b, this.an5);
if (b == null) {
return;
}
this.ara();
}
ara() {
if (this.an5 == null) {
return;
}
if (this.alx != null) {
this.alx.provideContainer(null);
}
this.alx = TypeRegistrar.create("ZoomSlider");
this.alx.provideContainer(this.an5);
let a = this.alx;
a.windowRectChanged = delegateCombine(a.windowRectChanged, (a, b) => {
if (this.dataChart != null) {
this.dataChart.ze = new Rect(0, this.alx.windowRect.left, this.dataChart.yv.top, this.alx.windowRect.width, this.dataChart.yv.height);
}
});
this.arb();
}
asq(a, b) {
this.ase(a, b, this.an4);
}
setGridRows() {
if (this.an6 == null) {
return;
}
let a = new Array(6);
a[0] = (this.amf ? this.ann : 0) + "px";
a[1] = this.amb ? "min-content" : "0px";
a[2] = "auto";
a[3] = this.indicatorCharts == null || this.indicatorCharts.count == 0 ? "0px" : this.indicatorCharts.count * 150 + "px";
a[4] = this.volumeChart == null ? "0px" : "100px";
a[5] = this.zoomSliderChart == null ? "0px" : "100px";
if (this.alx != null) {
if (a[5] == "0px") {
this.alx.hide();
}
else {
this.alx.show();
}
}
this.an6.setStyleProperty("-ms-grid-rows", stringReplace(stringJoin(" ", ...a), "auto", "1fr"));
this.an6.setStyleProperty("grid-template-rows", stringJoin(" ", ...a));
if (this.mi == null) {
return;
}
if (this.dataChart != null) {
this.dataChart.notifyContainerResized();
}
if (this.ak8 != null) {
this.ak8.f();
}
if (this.volumeChart != null) {
this.volumeChart.notifyContainerResized();
}
if (this.zoomSliderChart != null) {
this.zoomSliderChart.notifyContainerResized();
}
if (this.alx != null) {
this.alx.notifySizeChanged();
}
}
v9() {
super.v9();
this.abu = 1;
this.ah9 = 0;
this.aef = 0;
this.ai3 = null;
this.aiw = AxisDefaults.axis_LineBrush;
this.adx = AxisDefaults.axis_TickStroke;
this.adw = AxisDefaults.categoryAxis_TickLength;
this.aix = AxisDefaults.axis_TickBrush;
this.ait = null;
this.asu = AxisDefaults.axis_MajorBrush;
this.an0 = AxisDefaults.axis_MajorStroke;
this.finalValueAnnotationsVisible = true;
this.crosshairsAnnotationEnabled = true;
this.g0 = false;
this.crosshairsDisplayMode = 0;
this.j3 = Defaults.crosshairLineThickness;
this.zt = Defaults.crosshairLineBrush;
this.zo = Defaults.crosshairXAxisAnnotationBackground;
this.zp = Defaults.crosshairXAxisAnnotationTextColor;
this.ko = NaN;
this.kg = 40;
this.hg = true;
this.hp = false;
if (this.dataChart != null) {
let a = this.dataChart.dw.j.e();
this.ajq = a.d;
this.ajr = a.e;
this.ajp = a.d;
this.asu = this.dataChart.adx;
}
let b = new BrushCollection();
b.add(((() => {
let $ret = new Brush();
$ret.fill = "#8BDC5C";
return $ret;
})()));
b.add(((() => {
let $ret = new Brush();
$ret.fill = "#8961A9";
return $ret;
})()));
b.add(((() => {
let $ret = new Brush();
$ret.fill = "#6DB1FF";
return $ret;
})()));
b.add(((() => {
let $ret = new Brush();
$ret.fill = "#82E9D9";
return $ret;
})()));
b.add(((() => {
let $ret = new Brush();
$ret.fill = "#EA3C63";
return $ret;
})()));
b.add(((() => {
let $ret = new Brush();
$ret.fill = "#735656";
return $ret;
})()));
b.add(((() => {
let $ret = new Brush();
$ret.fill = "#F8CE4F";
return $ret;
})()));
b.add(((() => {
let $ret = new Brush();
$ret.fill = "#A8A8B7";
return $ret;
})()));
b.add(((() => {
let $ret = new Brush();
$ret.fill = "#E051A9";
return $ret;
})()));
b.add(((() => {
let $ret = new Brush();
$ret.fill = "#FF903B";
return $ret;
})()));
let c = new BrushCollection();
for (let d of fromEnum(b)) {
c.add(BrushUtil.r(d, 0.3));
}
this.ajs = c;
this.ajt = b;
}
asa() {
if (this.ak8 != null) {
this.ak8.b = null;
this.ak8.b = this.indicatorCharts;
}
this.setGridRows();
}
asb() {
this.setGridRows();
}
ask() {
this.asa();
}
aq9() {
if (this.alx == null || this.zoomSliderChart == null || this.dataChart == null || this.dataChart.series.count == 0) {
return;
}
let a = this.mi.rootWrapper.width();
let b = this.dataChart.zd.left + this.dataChart.zd.width;
let c = this.dataChart.zd.left;
let d = a - b;
this.alx.startInset = c - this.alx.trackStartInset;
this.alx.endInset = d - this.alx.trackEndInset;
if (this.alx.endInset < 0) {
let e = this.alx.endInset;
this.alx.endInset = 0;
this.dataChart.jd += (e * -1);
}
if (this.alx.startInset < 0) {
let f = this.alx.startInset;
this.alx.startInset = 0;
this.dataChart.i8 += (f * -1);
}
this.zoomSliderChart.i8 = c;
this.zoomSliderChart.jd = d;
this.zoomSliderChart.is = this.alx.barExtent;
}
ar0() {
this.aq9();
}
v6(a) {
super.v6(a);
if (a != null) {
a.ir = 0;
}
}
asv(a) {
return a.yo();
}
asy() {
return this.an2 == null ? null : this.asx(this.an2.rootWrapper);
}
asw(a) {
if (a == null || a.d == null) {
return null;
}
return this.asx(a.d.rootWrapper);
}
asx(a) {
if (a == null) {
return null;
}
let b = a.getOffset();
return new Rect(0, b.left, b.top, a.width(), a.height());
}
ani() {
if (this.an6 == null) {
return NaN;
}
let a = this.an6.getOffset();
return this.an6.width() + (a == null ? 0 : a.left);
}
wj(source_, a, b) {
super.wj(source_, a, b);
if (this.zoomSliderChart != null) {
this.zoomSliderChart.p5(source_, a, b);
}
}
wk(source_, a, b) {
super.wk(source_, a, b);
if (this.zoomSliderChart != null) {
this.zoomSliderChart.p6(source_, a, b);
}
}
wi(source_) {
super.wi(source_);
if (this.zoomSliderChart != null) {
this.zoomSliderChart.py(source_);
}
}
wm(source_, a, b, c) {
super.wm(source_, a, b, c);
if (this.zoomSliderChart != null) {
this.zoomSliderChart.p7(source_, a, b, c);
}
}
wc(a, b) {
super.wc(a, b);
if (this.amc(a)) {
a.toolTip = null;
}
}
get akf() {
return this.ake;
}
set akf(a) {
let b = this.akf;
if (a != b) {
this.ake = a;
this.w1("Toolbar", b, this.akf);
}
}
get aov() {
return this.aoo;
}
set aov(a) {
let b = this.aov;
if (a != b) {
this.aoo = a;
this.w1("RangeSelectorTemplate", b, this.aov);
}
}
get aow() {
return this.aop;
}
set aow(a) {
let b = this.aow;
if (a != b) {
this.aop = a;
this.w1("ToolbarTemplate", b, this.aow);
}
}
get aos() {
return this.aol;
}
set aos(a) {
let b = this.aos;
if (a != b) {
this.aol = a;
this.w1("ChartTypePickerTemplate", b, this.aos);
}
}
get aox() {
return this.aoq;
}
set aox(a) {
let b = this.aox;
if (a != b) {
this.aoq = a;
this.w1("TrendLineTypePickerTemplate", b, this.aox);
}
}
get aoy() {
return this.aor;
}
set aoy(a) {
let b = this.aoy;
if (a != b) {
this.aor = a;
this.w1("VolumeTypePickerTemplate", b, this.aoy);
}
}
get aot() {
return this.aom;
}
set aot(a) {
let b = this.aot;
if (a != b) {
this.aom = a;
this.w1("IndicatorMenuTemplate", b, this.aot);
}
}
get aou() {
return this.aon;
}
set aou(a) {
let b = this.aou;
if (a != b) {
this.aon = a;
this.w1("OverlayPickerTemplate", b, this.aou);
}
}
get alx() {
return this.alw;
}
set alx(a) {
let b = this.alx;
if (a != b) {
this.alw = a;
this.w1("ZoomSlider", b, this.alx);
}
}
get_kg() {
return super.get_kg();
}
set_kg(a) {
super.set_kg(a);
}
get_hg() {
return super.get_hg();
}
set_hg(a) {
super.set_hg(a);
}
get ann() {
return this.am6;
}
set ann(a) {
let b = this.ann;
if (a != b) {
this.am6 = a;
this.w1("ToolbarHeight", b, this.ann);
}
}
constructor() {
super();
this.ak8 = null;
this.an6 = null;
this.an4 = null;
this.an1 = null;
this.an3 = null;
this.an5 = null;
this.an2 = null;
this.ake = null;
this.aoo = null;
this.aop = null;
this.aol = null;
this.aoq = null;
this.aor = null;
this.aom = null;
this.aon = null;
this.alw = null;
this.am6 = 40;
this.ak2 = null;
this.ak0 = null;
this.ak4 = null;
this.ak9 = null;
this.aoz = null;
this.als = null;
this.ami = false;
this.amh = false;
this.amp = false;
this.al4 = false;
this.aoc = 10;
this.and = NaN;
this.anf = NaN;
this.ane = NaN;
this.ang = 0;
this.akk = 0;
this.akn = 0;
this.am8 = 3;
this.anb = NaN;
this.am9 = NaN;
this.ana = NaN;
this.anc = NaN;
this.akp = 0;
this.alz = true;
this.akg = 0;
this.al0 = false;
this.aku = null;
this.akw = null;
this.amr = null;
this.al2 = true;
this.al1 = false;
this.al3 = false;
this.alt = null;
this.akr = 1;
this.aji = null;
this.ajj = null;
this.ajk = null;
this.ajl = null;
this.ajn = null;
this.ajm = null;
this.ajh = null;
this.ajg = null;
this.am7 = 1;
this.am5 = 1;
this.am4 = 2;
this.am3 = 1;
this.ak6 = null;
this.an8 = -2147483648;
this.am2 = 2;
this.aob = 3;
this.an9 = 10;
this.an7 = 30;
this.aoa = 9;
this.akb = null;
this.akc = null;
this.aj7 = null;
this.applyCustomIndicators = null;
this.ast = null;
this.anh = 1;
this.aly = false;
this.aky = null;
this.amz = dateMinValue();
this.amy = dateMaxValue();
this.amw = null;
this.vn();
this.amw = new ObservableCollection$1(Base.$, 0);
if (this.xAxisBreaks != null) {
let a = this.xAxisBreaks;
a.collectionChanged = delegateCombine(a.collectionChanged, (a, b) => this.asi());
}
this.ar3();
}
abj() {
return this.xAxis;
}
abk() {
return this.yAxis;
}
onAttachedToUI() {
super.onAttachedToUI();
if (this.alx != null) {
this.alx.onAttachedToUI();
}
}
onDetachedFromUI() {
super.onDetachedFromUI();
if (this.alx != null) {
this.alx.onDetachedFromUI();
}
}
bf(a) {
return 20;
}
get_ie() {
return ((() => {
let $ret = new List$1(DataSeriesType_$type, 0);
$ret.add(20);
return $ret;
})());
}
get ie() {
return this.get_ie();
}
get_id() {
return ((() => {
let $ret = new List$1(IDataSeriesAdapterRule_$type, 0);
$ret.add(new SimpleFinancialPriceSeriesRule());
$ret.add(new SubCollectionsRule());
return $ret;
})());
}
get id() {
return this.get_id();
}
aj1(a) {
return this.aj2(a);
}
alf(a) {
return this.alg(a);
}
aj0(a) {
let b = this.aj1(0);
b.name = a;
return b;
}
vi() {
this.xAxis = this.aj0("xAxis");
this.yAxis = this.alf(0);
this.yAxis.name = "yAxis";
this.volumeAxis = this.alf(0);
this.volumeAxis.name = "volumeAxis";
this.volumeXAxis = this.aj0("volumeXAxis");
this.amt = new List$1(NumericYAxis.$, 0);
this.amv = new List$1(CategoryAxisBase.$, 0);
this.indicatorAxis = this.alf(0);
this.indicatorAxis.name = "indicatorAxis";
this.indicatorXAxis = this.aj0("indicatorXAxis_0");
this.amt.add(this.indicatorAxis);
this.amv.add(this.indicatorXAxis);
if (this.xAxis.a4 == null) {
this.xAxis.a4 = new AxisLabelSettings();
}
if (this.yAxis.a4 == null) {
this.yAxis.a4 = new AxisLabelSettings();
}
if (this.volumeAxis.a4 == null) {
this.volumeAxis.a4 = new AxisLabelSettings();
}
if (this.volumeXAxis.a4 == null) {
this.volumeAxis.a4 = new AxisLabelSettings();
}
if (this.indicatorAxis.a4 == null) {
this.indicatorAxis.a4 = new AxisLabelSettings();
}
if (this.indicatorXAxis.a4 == null) {
this.indicatorXAxis.a4 = new AxisLabelSettings();
}
this.zoomSliderAxis = this.alf(0);
this.zoomSliderAxis.name = "zoomSliderAxis";
this.zoomSliderXAxis = this.aj0("zoomSliderXAxis");
if (this.zoomSliderAxis.a4 == null) {
this.zoomSliderAxis.a4 = new AxisLabelSettings();
}
if (this.zoomSliderXAxis.a4 == null) {
this.zoomSliderXAxis.a4 = new AxisLabelSettings();
}
}
vb(a, b) {
let c = typeCast(MarkerSeries.$, a);
if (c != null) {
c.xy = this.c4(a, b);
}
}
c3(a) {
if (a != null) {
return 1;
}
return super.c3(a);
}
xz(a) {
if (a.suggestedSecondaryAxis == 2) {
this.yAxis.qu = true;
this.yAxis.rx = 10;
}
}
x2() {
this.yAxis.qu = this.amm;
this.yAxis.rx = this.aok;
}
akj(a) {
let b;
if (this.akh == 0) {
if (a == null || a.index > 0 || stringIsNullOrEmpty(a.getMemberPathFor(12))) {
b = 4;
}
else {
b = 2;
}
}
else {
b = this.akh;
}
b = this.aki(b);
return b;
}
aki(a) {
if ((a == 1 || a == 2)) {
if (TypeRegistrar.isRegistered("FinancialPriceSeries")) {
return a;
}
a = 4;
}
if (a == 4) {
if (TypeRegistrar.isRegistered("LineSeries")) {
return a;
}
a = 3;
}
if (a == 3) {
if (TypeRegistrar.isRegistered("ColumnSeries")) {
return a;
}
}
return a;
}
aks(a) {
if ((a == 2 || a == 3)) {
if (TypeRegistrar.isRegistered("FinancialPriceSeries")) {
return a;
}
a = 5;
}
if (a == 5) {
if (TypeRegistrar.isRegistered("LineSeries")) {
return a;
}
a = 6;
}
if (a == 6) {
if (TypeRegistrar.isRegistered("AreaSeries")) {
return a;
}
a = 4;
}
if (a == 4) {
if (TypeRegistrar.isRegistered("ColumnSeries")) {
return a;
}
}
return a;
}
akl(a) {
if (a == 2) {
if (TypeRegistrar.isRegistered("LineSeries")) {
return a;
}
a = 3;
}
if (a == 3) {
if (TypeRegistrar.isRegistered("AreaSeries")) {
return a;
}
a = 1;
}
if (a == 1) {
if (TypeRegistrar.isRegistered("ColumnSeries")) {
return a;
}
}
return a;
}
ao7(a) {
let b = a.getMemberPathFor(14);
if (stringIsNullOrEmpty(b)) {
b = a.getMemberPathFor(11);
}
return b;
}
aj2(axisType_) {
if ((this.externalObject)) {
return (this.externalObject.createXAxis(axisType_).i);
}
else {
let a;
switch (axisType_) {
case 0:
if (TypeRegistrar.isRegistered("OrdinalTimeXAxis")) {
a = TypeRegistrar.create("OrdinalTimeXAxis");
}
else if (TypeRegistrar.isRegistered("TimeXAxis")) {
a = TypeRegistrar.create("TimeXAxis");
}
else {
throw new BaseError(1, "no valid axes loaded");
}
return a;
case 1:
if (TypeRegistrar.isRegistered("TimeXAxis")) {
a = TypeRegistrar.create("TimeXAxis");
}
else if (TypeRegistrar.isRegistered("OrdinalTimeXAxis")) {
a = TypeRegistrar.create("OrdinalTimeXAxis");
}
else {
throw new BaseError(1, "no valid axes loaded");
}
return a;
}
return null;
}
}
alg(axisType_) {
if ((this.externalObject)) {
return (this.externalObject.createYAxis(axisType_).i);
}
else {
let a;
switch (axisType_) {
case 0:
if (TypeRegistrar.isRegistered("NumericYAxis")) {
a = TypeRegistrar.create("NumericYAxis");
}
else if (TypeRegistrar.isRegistered("PercentChangeYAxis")) {
a = TypeRegistrar.create("PercentChangeYAxis");
}
else {
throw new BaseError(1, "no valid axes loaded");
}
return a;
case 1:
if (TypeRegistrar.isRegistered("PercentChangeYAxis")) {
a = TypeRegistrar.create("PercentChangeYAxis");
}
else if (TypeRegistrar.isRegistered("NumericYAxis")) {
a = TypeRegistrar.create("NumericYAxis");
}
else {
throw new BaseError(1, "no valid axes loaded");
}
return a;
}
return null;
}
}
alm() {
return this.dh(1);
}
aln() {
return this.dh(0);
}
all() {
return this.dh(2);
}
alo() {
return this.dh(20);
}
get al5() {
return (TypeRegistrar.isRegistered("HorizontalAnchoredCategorySeriesProxy"));
}
get ak3() {
if (TypeRegistrar.isRegistered("HorizontalAnchoredCategorySeriesProxy")) {
return TypeRegistrar.create("HorizontalAnchoredCategorySeriesProxy");
}
else {
throw new BaseError(1, "horizontal series module is not loaded, but is required.");
}
}
get al8() {
return (TypeRegistrar.isRegistered("FinancialPriceSeriesProxy"));
}
get ak1() {
if (TypeRegistrar.isRegistered("FinancialPriceSeriesProxy")) {
return TypeRegistrar.create("FinancialPriceSeriesProxy");
}
else {
throw new BaseError(1, "financial series module is not loaded, but is required.");
}
}
get al6() {
return (TypeRegistrar.isRegistered("IndicatorProxy"));
}
get ak5() {
if (TypeRegistrar.isRegistered("IndicatorProxy")) {
return TypeRegistrar.create("IndicatorProxy");
}
else {
throw new BaseError(1, "financial series module is not loaded, but is required.");
}
}
get al7() {
return (TypeRegistrar.isRegistered("OverlayProxy"));
}
get ala() {
if (TypeRegistrar.isRegistered("OverlayProxy")) {
return TypeRegistrar.create("OverlayProxy");
}
else {
throw new BaseError(1, "overlay series module is not loaded, but is required.");
}
}
de(a, b) {
let c = this.ao7(a);
switch (this.akj(a)) {
case 3:
let d = this.alm();
this.ak3.setValueMemberPath(d, c);
this.ak3.setXAxis(d, this.xAxis);
this.ak3.setYAxis(d, this.yAxis);
this.ak3.setCategoryMode(d, 1);
return d;
case 4:
let e = this.aln();
this.ak3.setValueMemberPath(e, c);
this.ak3.setXAxis(e, this.xAxis);
this.ak3.setYAxis(e, this.yAxis);
this.ak3.setCategoryMode(e, 1);
return e;
default:
case 1:
case 2:
let f = this.alo();
this.ak1.setOpenMemberPath(f, a.getMemberPathFor(11));
this.ak1.setHighMemberPath(f, a.getMemberPathFor(12));
this.ak1.setLowMemberPath(f, a.getMemberPathFor(13));
this.ak1.setCloseMemberPath(f, a.getMemberPathFor(14));
this.ak1.setVolumeMemberPath(f, a.getMemberPathFor(15));
this.ak1.setXAxis(f, this.xAxis);
this.ak1.setYAxis(f, this.yAxis);
this.ak1.setDisplayType(f, this.akh == 1 ? 1 : 0);
this.ak1.setCategoryMode(f, 1);
return f;
}
}
x1() {
super.x1();
this.ary(this.xAxis);
this.asm(false);
if (this.akm != 0 && this.volumeChart != null) {
this.ar5();
}
this.ary(this.volumeXAxis);
this.ary(this.indicatorXAxis);
this.asj();
this.asl();
if (this.akt != 0) {
this.ar6();
this.ary(this.zoomSliderXAxis);
}
}
ahu(a, b) {
super.ahu(a, b);
a(this.volumeXAxis);
if (this.amv != null) {
for (let c of fromEnum(this.amv)) {
a(c);
}
}
let d = true;
switch (b) {
case "XAxisMajorStroke":
case "XAxisMajorStrokeThickness":
d = false;
break;
}
if (d) {
a(this.zoomSliderXAxis);
}
}
ahz(a, b) {
super.ahz(a, b);
if (b) {
a(this.volumeAxis);
if (this.amt != null) {
for (let c of fromEnum(this.amt)) {
a(c);
}
}
a(this.zoomSliderAxis);
}
}
ar2(a) {
let b = typeCast(IZoomableCategoryAxis_$type, this.xAxis);
if (b != null) {
a(b);
}
}
ahy(a) {
super.ahy(a);
this.ahp(this.volumeXAxis, a);
this.ahp(this.indicatorXAxis, a);
this.ahp(this.zoomSliderXAxis, a);
}
ah3(a) {
super.ah3(a);
this.ahp(this.volumeAxis, a);
this.ahp(this.indicatorAxis, a);
this.ahp(this.zoomSliderAxis, a);
}
ah1(a) {
super.ah1(a);
this.aho(this.volumeAxis, a);
this.aho(this.indicatorAxis, a);
this.aho(this.zoomSliderAxis, a);
}
ahw(a) {
super.ahw(a);
this.aho(this.volumeXAxis, a);
this.aho(this.indicatorXAxis, a);
this.aho(this.zoomSliderXAxis, a);
}
v5(a) {
super.v5(a);
if (a == null) {
return;
}
if (a == this.zoomSliderChart) {
a.aai = a.aam = false;
a.legend = null;
if (this.dataChart != null) {
a.ag = this.dataChart.ag;
a.aj = this.dataChart.aj;
}
}
else {
SyncManager.d(a, ((() => {
let $ret = new SyncSettings();
$ret.syncChannel = this.ap2();
$ret.synchronizeHorizontally = true;
$ret.synchronizeVertically = false;
return $ret;
})()));
SyncManager.c(a);
}
a.di = 2;
}
static { this.aoj = 0; }
ap2() {
if (this.aoz == null) {
FinancialChart.aoj++;
this.aoz = FinancialChart.aoj.toString();
}
return this.aoz;
}
ark(a, b) {
this.aq6();
this.ar0();
}
aq6() {
if (this.yAxis.de()) {
return;
}
let a = this.yAxis.a1.bk;
if (this.akm != 0) {
a = Math.max(a, this.volumeAxis.a1.bk);
}
for (let b of fromEnum(this.amt)) {
a = Math.max(a, b.a1.bk);
}
this.aq7(a);
}
aq7(a) {
if (this.yAxis.de()) {
return;
}
this.yAxis.gk = this.volumeAxis.gk = a;
for (let b of fromEnum(this.amt)) {
b.gk = a;
}
this.zoomSliderAxis.gk = this.yAxis.gk;
}
arc(a) {
if (this.indicatorCharts == null) {
return;
}
for (let b = 0; b < this.indicatorCharts.count; b++) {
let c = this.indicatorCharts._inner[b];
for (let d = 0; d < c.b9.count; d++) {
let e = c.b9._inner[d];
if (!(this.ama(e))) {
continue;
}
a(c.b9._inner[d], b);
}
}
}
arf(a) {
if (this.volumeChart == null) {
return;
}
for (let b = 0; b < this.volumeChart.b9.count; b++) {
let c = this.volumeChart.b9._inner[b];
if (c.ev) {
continue;
}
a(this.volumeChart.b9._inner[b], b);
}
}
ard(a) {
if (this.dataChart == null) {
return;
}
for (let b = 0; b < this.dataChart.b9.count; b++) {
let c = this.dataChart.b9._inner[b];
if (!this.amc(c)) {
continue;
}
a(c, b);
}
}
are(a, b) {
if (this.dataChart == null) {
return;
}
for (let c = 0; c < this.dataChart.b9.count; c++) {
let d = this.dataChart.b9._inner[c];
if (this.amc(d)) {
continue;
}
let e = this.aod(d, c);
a(d, e);
}
if (b) {
this.arg(a);
}
}
arg(a) {
if (this.zoomSliderChart == null) {
return;
}
for (let b = 0; b < this.zoomSliderChart.b9.count; b++) {
let c = this.zoomSliderChart.b9._inner[b];
if (c.ev) {
continue;
}
a(this.zoomSliderChart.b9._inner[b], b);
}
}
aod(a, b) {
if (a.da != this.dataChart) {
return b;
}
let c = this.bg == null || this.bg.dataSeries == null ? 0 : this.bg.dataSeries.count;
let d = this.akx == null ? 0 : this.akx.count;
return b - (c * d);
}
vu(a) {
super.vu(a);
this.arf(a);
this.arc(a);
this.arg(a);
}
get volumeChart() {
return this.als;
}
set volumeChart(a) {
let b = this.volumeChart;
if (a != b) {
this.als = a;
this.w1("VolumeChart", b, this.volumeChart);
}
}
ar5() {
if (this.dataChart == null) {
return;
}
this.volumeChart.series.clear();
let a = new List$1(Series.$, 0);
let b = -1;
for (let c = 0; c < this.dataChart.b9.count; c++) {
let d = this.dataChart.b9._inner[c];
if (this.amc(d) || d.ev) {
continue;
}
b++;
let e;
let f = this.akm;
f = this.akl(f);
switch (f) {
case 2:
e = this.aln();
break;
case 3:
e = this.all();
break;
default:
case 1:
e = this.alm();
break;
}
this.ak3.setCategoryMode(e, 1);
e.name = "volumeSeries_" + b;
e.itemsSource = d.itemsSource;
this.ak3.setXAxis(e, this.volumeXAxis);
this.ak3.setYAxis(e, this.volumeAxis);
this.ak3.setValueMemberPath(e, this.bg != null && this.bg.dataSeries != null && this.bg.dataSeries.count > b ? this.bg.dataSeries._inner[b].getMemberPathFor(15) : null);
e.title = d.title + " Volume";
e.v1 = ArrayExtension.getModulus$1(Brush.$, this.aju, b);
e.wh = ArrayExtension.getModulus$1(Brush.$, this.ajv, b);
e.j0 = this.ano;
a.add(e);
}
let g = this.ia("volume", false);
if (g != null) {
a.o(g);
}
for (let h = 0; h < a.count; h++) {
let i = a._inner[h];
this.volumeChart.series.add(i);
this.wa(i, h);
}
}
al9(a) {
if (!this.al5) {
return false;
}
return this.ak3.matchesType(a);
}
amd(a) {
if (!this.al8) {
return false;
}
return this.ak1.matchesType(a);
}
ama(a) {
if (!this.al6) {
return false;
}
return this.ak5.matchesType(a);
}
amc(a) {
if (!this.al7) {
return false;
}
return this.ala.matchesType(a);
}
ar4() {
if (this.dataChart == null) {
return;
}
let a = 0;
let b = this.akv == null ? 0 : this.akv.count;
let c = this.customIndicatorNames == null ? 0 : this.customIndicatorNames.count;
let d = b + c;
for (let e = 0; e < d; e++) {
let f = new List$1(Series.$, 0);
let g = this.indicatorCharts._inner[e];
let h = e >= b;
let i = h ? this.customIndicatorNames._inner[e - b] : EnumUtil.getName(FinancialIndicatorType_$type, this.akv._inner[e]);
let j = -1;
for (let k = 0; k < this.dataChart.b9.count; k++) {
let l = this.dataChart.b9._inner[k];
if (this.amc(l) || l.ev) {
continue;
}
j++;
let m;
if (h) {
let n = this.alp("Custom");
this.ak5.handleCustomIndicatorEvent(n, runOn(this, this.ari));
m = n;
}
else {
m = this.alr(this.akv._inner[e]);
}
if (m == null) {
continue;
}
m.name = "indicator_" + a++;
this.ak5.setXAxis(m, this.amv._inner[e]);
this.ak5.setYAxis(m, this.amt._inner[e]);
m.itemsSource = l.itemsSource;
this.ak5.setOpenMemberPath(m, this.bg.dataSeries._inner[j].getMemberPathFor(11));
this.ak5.setHighMemberPath(m, this.bg.dataSeries._inner[j].getMemberPathFor(12));
this.ak5.setLowMemberPath(m, this.bg.dataSeries._inner[j].getMemberPathFor(13));
this.ak5.setCloseMemberPath(m, this.bg.dataSeries._inner[j].getMemberPathFor(14));
this.ak5.setVolumeMemberPath(m, this.bg.dataSeries._inner[j].getMemberPathFor(15));
m.title = l.title + " " + i;
m.v1 = ArrayExtension.getModulus$1(Brush.$, this.ajo, e);
m.j0 = this.ank;
if (this.ama(m)) {
this.ak5.setNegativeBrush(m, ArrayExtension.getModulus$1(Brush.$, this.ajp, e));
this.ak5.setDisplayType(m, ArrayExtension.getModulus$1(IndicatorDisplayType_$type, this.ak7, e));
}
if (this.aof != -2147483648 && this.ama(m)) {
this.ak5.setPeriodOverride(m, this.aof);
}
if (this.ama(m)) {
this.ak5.setSmoothingPeriod(m, this.aoi);
}
if (this.ama(m)) {
this.ak5.setSignalPeriod(m, this.aoh);
}
if (this.ama(m)) {
this.ak5.setShortPeriod(m, this.aog);
this.ak5.setLongPeriod(m, this.aoe);
}
this.wa(m, e);
f.add(m);
}
let o = this.ia(i, false);
for (let p = 0; p < f.count; p++) {
let q = f._inner[p];
g.series.add(q);
}
if (o != null) {
for (let r = 0; r < o.count; r++) {
let s = o._inner[r];
g.series.add(s);
this.wa(s, r);
}
}
}
}
alp(indicatorName_) {
return (this.externalObject.createIndicator(indicatorName_ + 'Indicator').i);
}
alr(a) {
return this.alp(EnumUtil.getName(FinancialIndicatorType_$type, a));
}
asm(a) {
if (this.akf == null) {
return;
}
let b = this.xAxis;
if (b.actualMinimumValue > b.actualMaximumValue) {
return;
}
this.akf.as = b.actualMinimumValue;
this.akf.ar = b.actualMaximumValue;
if (a) {
this.akf.au = b.visibleMinimum;
this.akf.at = b.visibleMaximum;
}
this.akf.bn();
}
mj() {
let a = ((() => {
let $ret = new FinancialChartVisualData();
$ret.mainChart = super.mj();
$ret.volumeChart = this.volumeChart == null ? null : this.volumeChart.abw();
$ret.toolbar = this.akf == null ? null : this.akf.aj();
$ret.zoomChart = this.zoomSliderChart == null ? null : this.zoomSliderChart.abw();
return $ret;
})());
if (this.indicatorCharts != null) {
a.indicatorCharts = new List$1(Base.$, 0);
for (let b of fromEnum(this.indicatorCharts)) {
a.indicatorCharts.add1(b.abw());
}
}
if (this.dataChart != null) {
a.mainChartLeft = this.asv(this.dataChart).x;
a.mainChartTop = this.asv(this.dataChart).y;
}
if (this.volumeChart != null) {
a.volumeChartLeft = this.asv(this.volumeChart).x;
a.volumeChartTop = this.asv(this.volumeChart).y;
}
if (this.zoomSliderChart != null) {
a.zoomChartLeft = this.asv(this.zoomSliderChart).x;
a.zoomChartTop = this.asv(this.zoomSliderChart).y;
}
if (this.akf != null) {
let c = this.asw(this.akf);
a.toolbarLeft = c.left;
a.toolbarTop = c.top;
a.toolbarWidth = c.width;
a.toolbarHeight = c.height;
}
if (this.indicatorCharts != null) {
a.indicatorChartLefts = new List$1(Number_$type, 0);
a.indicatorChartTops = new List$1(Number_$type, 0);
for (let d of fromEnum(this.indicatorCharts)) {
a.indicatorChartLefts.add(this.asv(d).x);
a.indicatorChartTops.add(this.asv(d).y);
}
}
let e = this.asy();
a.legendLeft = e.left;
a.legendTop = e.top;
a.legendWidth = e.width;
a.legendHeight = e.height;
a.legend = this.akz == null ? null : this.akz.exportVisualData();
return a;
}
ao4() {
let a = this.mj();
a.scaleByViewport();
return a.serialize();
}
alq(overlayName_) {
return (this.externalObject.createOverlay(overlayName_ + 'Overlay').i);
}
asl() {
if (this.dataChart == null) {
return;
}
let a = new List$1(Series.$, 0);
for (let b of fromEnum(this.dataChart.series)) {
if (this.amc(b)) {
a.add(b);
}
}
for (let c of fromEnum(a)) {
this.dataChart.series.remove(c);
}
if (this.akx == null) {
return;
}
let d = new List$1(Series.$, 0);
let e = -1;
for (let f = 0; f < this.dataChart.b9.count; f++) {
let g = this.dataChart.b9._inner[f];
if (this.amc(g) || g.ev) {
continue;
}
e++;
for (let h = 0; h < this.akx.count; h++) {
let i = this.akx._inner[h];
let j;
switch (i) {
case 1:
j = this.alq(EnumUtil.getName(FinancialOverlayType_$type, i));
break;
default:
case 0:
j = this.alq(EnumUtil.getName(FinancialOverlayType_$type, i));
break;
}
j.name = g.name + "_" + EnumUtil.getName(FinancialOverlayType_$type, i);
this.ala.setXAxis(j, this.xAxis);
this.ala.setYAxis(j, this.yAxis);
j.itemsSource = g.itemsSource;
let k = e * this.akx.count + h;
j.v1 = ArrayExtension.getModulus$1(Brush.$, this.ajs, k);
j.wh = ArrayExtension.getModulus$1(Brush.$, this.ajt, k);
j.j0 = this.anm;
j.title = g.title + " " + EnumUtil.getName(FinancialOverlayType_$type, i);
let l = g;
if (l == null) {
continue;
}
let m = this.bg.dataSeries._inner[e];
this.ala.setOpenMemberPath(j, m.getMemberPathFor(11));
this.ala.setHighMemberPath(j, m.getMemberPathFor(12));
this.ala.setLowMemberPath(j, m.getMemberPathFor(13));