1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107 | 1×
1×
1×
1×
105×
1×
105×
105×
105×
105×
93×
93×
12×
12×
72×
12×
12×
105×
114×
114×
114×
114×
114×
112×
114×
9×
9×
9×
105×
105×
1×
105×
105×
105×
105×
105×
105×
1×
105×
105×
110×
110×
110×
105×
1×
105×
105×
1×
1×
1×
1×
| define(["require", "exports", "../../range-navigator/range-navigator", "@syncfusion/ej2-base", "../../common/utils/helper", "@syncfusion/ej2-svg-base"], function (require, exports, range_navigator_1, ej2_base_1, helper_1, ej2_svg_base_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var RangeSelector = (function () {
function RangeSelector(stockChart) {
this.stockChart = stockChart;
}
RangeSelector.prototype.initializeRangeNavigator = function () {
var _this = this;
var stockChart = this.stockChart;
var padding = stockChart.chart.axisCollections[1].labelPadding +
stockChart.chart.axisCollections[1].lineStyle.width * 0.5;
if (!stockChart.selectorObject) {
stockChart.selectorObject = stockChart.renderer.createGroup({
id: stockChart.element.id + '_stockChart_rangeSelector',
transform: 'translate(' + 0 + ',' + stockChart.cartesianChart.cartesianChartSize.height + ')'
});
stockChart.mainObject.appendChild(stockChart.selectorObject);
}
else {
var chartElement = document.getElementById(stockChart.selectorObject.id);
while (chartElement.firstChild) {
chartElement.removeChild(chartElement.firstChild);
}
Iif (helper_1.getElement(stockChart.selectorObject.id + '_leftTooltip')) {
ej2_base_1.remove(helper_1.getElement(stockChart.selectorObject.id + '_leftTooltip'));
}
Iif (helper_1.getElement(stockChart.selectorObject.id + '_rightTooltip')) {
ej2_base_1.remove(helper_1.getElement(stockChart.selectorObject.id + '_rightTooltip'));
}
}
stockChart.rangeNavigator = new range_navigator_1.RangeNavigator({
locale: 'en',
valueType: stockChart.primaryXAxis.valueType,
theme: this.stockChart.theme,
series: this.findSeriesCollection(stockChart.series),
height: this.calculateChartSize().height.toString(),
tickPosition: 'Inside',
majorTickLines: { width: 0 },
value: [stockChart.isDateTimeCategory ? new Date(stockChart.sortedData[Math.floor(stockChart.startValue)]) :
new Date(stockChart.startValue),
stockChart.isDateTimeCategory ? new Date(stockChart.sortedData[Math.floor(stockChart.endValue)]) :
new Date(stockChart.endValue)],
margin: this.findMargin(),
tooltip: { enable: stockChart.tooltip.enable, displayMode: 'OnDemand' },
labelPlacement: 'OnTicks',
labelPosition: 'Inside',
dataSource: stockChart.dataSource,
intervalType: stockChart.primaryXAxis.intervalType,
enableRtl: stockChart.enableRtl,
changed: function (args) {
var arg = {
name: 'rangeChange',
end: args.end,
selectedData: args.selectedData,
start: args.start,
zoomFactor: args.zoomFactor,
zoomPosition: args.zoomPosition,
data: undefined
};
_this.stockChart.trigger('rangeChange', arg);
_this.stockChart.startValue = args.start;
_this.stockChart.endValue = args.end;
if (!_this.stockChart.zoomChange) {
_this.stockChart.cartesianChart.cartesianChartRefresh(_this.stockChart, arg.data);
}
if (stockChart.periodSelector && stockChart.periodSelector.datePicker) {
stockChart.periodSelector.datePicker.startDate = _this.stockChart.isDateTimeCategory ?
new Date(_this.stockChart.sortedData[Math.floor(args.start)]) : new Date(args.start);
stockChart.periodSelector.datePicker.endDate = _this.stockChart.isDateTimeCategory ?
new Date(_this.stockChart.sortedData[Math.floor(args.end)]) : new Date(args.end);
stockChart.periodSelector.datePicker.dataBind();
}
}
});
stockChart.rangeNavigator.stockChart = stockChart;
stockChart.rangeNavigator.appendTo(stockChart.selectorObject);
};
RangeSelector.prototype.findMargin = function () {
var margin = {};
margin.top = 5;
margin.left = 0;
margin.right = 0;
margin.bottom = 0;
return margin;
};
RangeSelector.prototype.findSeriesCollection = function (series) {
var chartSeries = [];
for (var i = 0, len = series.length; i < len; i++) {
chartSeries.push(series[i]);
chartSeries[i].xName = series[i].xName;
chartSeries[i].yName = series[i].yName;
}
return chartSeries;
};
RangeSelector.prototype.calculateChartSize = function () {
var stockChart = this.stockChart;
return (new ej2_svg_base_1.Size(stockChart.availableSize.width, (stockChart.enableSelector) ? 51 : 0));
};
RangeSelector.prototype.sliderChange = function (start, end) {
this.stockChart.rangeNavigator.rangeSlider.performAnimation(start, end, this.stockChart.rangeNavigator);
};
return RangeSelector;
}());
exports.RangeSelector = RangeSelector;
});
|