@millistream/millistream-widgets 1.0.19 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/millistream-widgets.js +369 -369
- package/package.json +1 -1
package/millistream-widgets.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
9
|
(function(prototype) {
|
|
10
10
|
|
|
11
11
|
var pixelRatio = (function() {
|
|
12
12
|
var canvas = document.createElement('canvas'),
|
|
13
13
|
context = canvas.getContext('2d');
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
22
|
})(),
|
|
23
23
|
forEach = function(obj, func) {
|
|
24
24
|
for (var p in obj) {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
|
|
31
31
|
ratioArgs = {
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
|
|
33
|
+
|
|
34
34
|
'strokeRect': 'all',
|
|
35
35
|
'moveTo': 'all',
|
|
36
36
|
'lineTo': 'all',
|
|
@@ -43,18 +43,18 @@
|
|
|
43
43
|
'rect': 'all',
|
|
44
44
|
'translate': 'all',
|
|
45
45
|
'createRadialGradient': 'all',
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
if (pixelRatio === 1) return;
|
|
50
50
|
|
|
51
51
|
function getPixelRatio(_this) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
58
|
var backingStore = _this.backingStorePixelRatio ||
|
|
59
59
|
_this.webkitBackingStorePixelRatio ||
|
|
60
60
|
_this.mozBackingStorePixelRatio ||
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
return function() {
|
|
71
71
|
var i, len,
|
|
72
72
|
args = Array.prototype.slice.call(arguments);
|
|
73
|
-
if (key == 'lineTo' || key == 'moveTo') {
|
|
73
|
+
if (key == 'lineTo' || key == 'moveTo') {
|
|
74
74
|
args = args.map(function(a) {
|
|
75
75
|
return a;
|
|
76
76
|
});
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
})(prototype[key]);
|
|
91
91
|
});
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
prototype.stroke = (function(_super) {
|
|
95
95
|
return function() {
|
|
96
96
|
this.lineWidth *= getPixelRatio(this);
|
|
@@ -114,12 +114,12 @@
|
|
|
114
114
|
var i = _super.apply(this, args);
|
|
115
115
|
|
|
116
116
|
this.font = tmp;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
123
|
return i;
|
|
124
124
|
};
|
|
125
125
|
})(prototype.measureText);
|
|
@@ -145,8 +145,8 @@
|
|
|
145
145
|
return function() {
|
|
146
146
|
var args = Array.prototype.slice.call(arguments);
|
|
147
147
|
|
|
148
|
-
args[1] *= getPixelRatio(this);
|
|
149
|
-
args[2] *= getPixelRatio(this);
|
|
148
|
+
args[1] *= getPixelRatio(this);
|
|
149
|
+
args[2] *= getPixelRatio(this);
|
|
150
150
|
var tmp = this.font;
|
|
151
151
|
var _this = this;
|
|
152
152
|
this.font = this.font.replace(
|
|
@@ -158,12 +158,12 @@
|
|
|
158
158
|
|
|
159
159
|
_super.apply(this, args);
|
|
160
160
|
this.font = tmp;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
167
|
};
|
|
168
168
|
})(prototype.strokeText);
|
|
169
169
|
|
|
@@ -185,17 +185,17 @@
|
|
|
185
185
|
}
|
|
186
186
|
prototype.getContext = (function(_super) {
|
|
187
187
|
return function(type) {
|
|
188
|
-
|
|
188
|
+
|
|
189
189
|
context = _super.call(this, type);
|
|
190
190
|
|
|
191
191
|
if (type === '2d') {
|
|
192
192
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
199
|
|
|
200
200
|
var ratio = getPixelRatio();
|
|
201
201
|
if (ratio > 1) {
|
|
@@ -220,7 +220,7 @@
|
|
|
220
220
|
|
|
221
221
|
})(HTMLCanvasElement.prototype);
|
|
222
222
|
|
|
223
|
-
|
|
223
|
+
|
|
224
224
|
function Milli_Chart(settings) {
|
|
225
225
|
"use strict";
|
|
226
226
|
var _this = this;
|
|
@@ -242,13 +242,13 @@ function Milli_Chart(settings) {
|
|
|
242
242
|
compress: 1,
|
|
243
243
|
curveOnTop: true,
|
|
244
244
|
dateformat: 'd/m',
|
|
245
|
-
drawxaxis: true,
|
|
245
|
+
drawxaxis: true,
|
|
246
246
|
drawyaxis: true,
|
|
247
247
|
drawy2axis: false,
|
|
248
248
|
enablezoom: true,
|
|
249
249
|
fields: ['name', 'tradecurrency', 'time', 'date', 'tradeprice', 'tradequantity', 'marketopen', 'marketclose'],
|
|
250
250
|
fillchart: false,
|
|
251
|
-
gridVerticalLines: true,
|
|
251
|
+
gridVerticalLines: true,
|
|
252
252
|
gridVerticalLinesStyle: 'line',
|
|
253
253
|
gridHorizontalLines: true,
|
|
254
254
|
gridHorizontalLinesStyle: 'dash',
|
|
@@ -257,7 +257,7 @@ function Milli_Chart(settings) {
|
|
|
257
257
|
instrument: null,
|
|
258
258
|
intradayDatePos: { x: 'center', y: 'bottom', orientation: 'horizontal', dateformat: 'd mmm' },
|
|
259
259
|
intradaylen: null,
|
|
260
|
-
messagetypes: 1030,
|
|
260
|
+
messagetypes: 1030,
|
|
261
261
|
nochartlabel: 'No data to draw on',
|
|
262
262
|
onreadyCallback: null,
|
|
263
263
|
previousDayClose: true,
|
|
@@ -272,8 +272,8 @@ function Milli_Chart(settings) {
|
|
|
272
272
|
display: 'block'
|
|
273
273
|
},
|
|
274
274
|
xAxisSpacing: 0,
|
|
275
|
-
yAxisSpacing: 4,
|
|
276
|
-
xAxisModulo: 1
|
|
275
|
+
yAxisSpacing: 4,
|
|
276
|
+
xAxisModulo: 1
|
|
277
277
|
};
|
|
278
278
|
var m_startdate = null;
|
|
279
279
|
var m_chartspaces = {
|
|
@@ -286,10 +286,10 @@ function Milli_Chart(settings) {
|
|
|
286
286
|
height: 0
|
|
287
287
|
}
|
|
288
288
|
};
|
|
289
|
-
var m_dummyDiv = null;
|
|
289
|
+
var m_dummyDiv = null;
|
|
290
290
|
var m_canvas = null;
|
|
291
291
|
var m_ctx = null;
|
|
292
|
-
var m_datapoints = [];
|
|
292
|
+
var m_datapoints = [];
|
|
293
293
|
var m_dataPoints = {
|
|
294
294
|
arr: [],
|
|
295
295
|
map: new Map()
|
|
@@ -378,7 +378,7 @@ function Milli_Chart(settings) {
|
|
|
378
378
|
}
|
|
379
379
|
var m_instrumentCss = [{
|
|
380
380
|
color: '#E2507A',
|
|
381
|
-
|
|
381
|
+
|
|
382
382
|
width: 1
|
|
383
383
|
}, {
|
|
384
384
|
color: '#ff0000',
|
|
@@ -427,10 +427,10 @@ function Milli_Chart(settings) {
|
|
|
427
427
|
}
|
|
428
428
|
|
|
429
429
|
function dateDiffInDays(a, b) {
|
|
430
|
-
|
|
430
|
+
|
|
431
431
|
const utc1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate());
|
|
432
432
|
const utc2 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate());
|
|
433
|
-
return Math.floor((utc2 - utc1) / 86400000);
|
|
433
|
+
return Math.floor((utc2 - utc1) / 86400000);
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
function findFirstWeekDay(date) {
|
|
@@ -444,7 +444,7 @@ function Milli_Chart(settings) {
|
|
|
444
444
|
}
|
|
445
445
|
|
|
446
446
|
function getFontSize(obj) {
|
|
447
|
-
|
|
447
|
+
|
|
448
448
|
return parseInt(obj.fontSize);
|
|
449
449
|
}
|
|
450
450
|
|
|
@@ -613,7 +613,7 @@ function Milli_Chart(settings) {
|
|
|
613
613
|
var quantity = 0;
|
|
614
614
|
|
|
615
615
|
for (i = 0; i < data.length; i++) {
|
|
616
|
-
|
|
616
|
+
|
|
617
617
|
var price = data[i].price * _this.instruments[s].factor;
|
|
618
618
|
quantity = 0;
|
|
619
619
|
if (data[i].quantity !== 'undefined') {
|
|
@@ -631,7 +631,7 @@ function Milli_Chart(settings) {
|
|
|
631
631
|
}
|
|
632
632
|
|
|
633
633
|
if (_this.scaleinfoY.type != 'history' && (data[i].timestamp % 86400000 < _this.instruments[0].opentimestamp || data[i].timestamp % 86400000 > _this.instruments[0].closetimestamp)) {
|
|
634
|
-
|
|
634
|
+
|
|
635
635
|
continue;
|
|
636
636
|
}
|
|
637
637
|
|
|
@@ -658,7 +658,7 @@ function Milli_Chart(settings) {
|
|
|
658
658
|
if (_this.scaleinfoY.lowLowerChart == null || _this.scaleinfoY.lowLowerChart > quantity) _this.scaleinfoY.lowLowerChart = quantity;
|
|
659
659
|
if (_this.scaleinfoY.highLowerChart == null || _this.scaleinfoY.highLowerChart < quantity) _this.scaleinfoY.highLowerChart = quantity;
|
|
660
660
|
}
|
|
661
|
-
if ((_this.settings.chartlen == '1d' || _this.settings.chartlen == '0d') && !m_zoom.mousedown.timestamp) {
|
|
661
|
+
if ((_this.settings.chartlen == '1d' || _this.settings.chartlen == '0d') && !m_zoom.mousedown.timestamp) {
|
|
662
662
|
var cp = parseFloat(_this.instruments[s].closeprice1d) * _this.instruments[s].factor;
|
|
663
663
|
if (_this.scaleinfoY.lowValue > cp) _this.scaleinfoY.lowValue = cp;
|
|
664
664
|
else
|
|
@@ -687,7 +687,7 @@ function Milli_Chart(settings) {
|
|
|
687
687
|
_this.scaleinfoY.lowValue -= 1;
|
|
688
688
|
_this.scaleinfoY.highValue += 1;
|
|
689
689
|
}
|
|
690
|
-
|
|
690
|
+
|
|
691
691
|
for (i = 0; i < _this.settings.indicators.length; i++) {
|
|
692
692
|
if (_this.scaleinfoY.type == 'history') data = _this.settings.indicators[i].history;
|
|
693
693
|
else data = _this.settings.indicators[i].trades;
|
|
@@ -760,7 +760,7 @@ function Milli_Chart(settings) {
|
|
|
760
760
|
var maxValue = _this.scaleinfoY.highLowerChart == 0 ? 100 : _this.scaleinfoY.highLowerChart + (tickSize * 0.2);
|
|
761
761
|
var valuePerPixel = lineLength / maxValue;
|
|
762
762
|
if (isNaN(valuePerPixel) || !isFinite(valuePerPixel)) {
|
|
763
|
-
|
|
763
|
+
() => {};
|
|
764
764
|
return false;
|
|
765
765
|
}
|
|
766
766
|
var value = 0;
|
|
@@ -781,7 +781,7 @@ function Milli_Chart(settings) {
|
|
|
781
781
|
m_ctx.closePath();
|
|
782
782
|
m_ctx.restore();
|
|
783
783
|
} else
|
|
784
|
-
if (_this.settings.drawyaxis == true && markers == true) {
|
|
784
|
+
if (_this.settings.drawyaxis == true && markers == true) {
|
|
785
785
|
m_ctx.beginPath();
|
|
786
786
|
m_ctx.moveTo(m_chartspaces.lowerChart.left, y + 0.5);
|
|
787
787
|
m_ctx.lineTo(m_chartspaces.lowerChart.left + 3, y + 0.5);
|
|
@@ -793,7 +793,7 @@ function Milli_Chart(settings) {
|
|
|
793
793
|
var label = formatLargeNumber(value, 0, _this);
|
|
794
794
|
var textpos = x - 5;
|
|
795
795
|
if (m_yLegendCss.verticalAlign == 'top') {
|
|
796
|
-
if (y - (getFontSize(m_yLegendCss)) > 0)
|
|
796
|
+
if (y - (getFontSize(m_yLegendCss)) > 0)
|
|
797
797
|
m_ctx.fillText(label, textpos, y - ((getFontSize(m_yLegendCss) + 2)));
|
|
798
798
|
} else
|
|
799
799
|
m_ctx.fillText(label, textpos, y - (getFontSize(m_yLegendCss) / 2));
|
|
@@ -811,7 +811,7 @@ function Milli_Chart(settings) {
|
|
|
811
811
|
m_ctx.fillStyle = m_yLegendCss.color;
|
|
812
812
|
var lineLen = m_chartspaces.lowerChart.bottom - m_chartspaces.lowerChart.top;
|
|
813
813
|
var numticks = lineLen / (getFontSize(m_yLegendCss) * 2);
|
|
814
|
-
if (numticks > 8) numticks = 8;
|
|
814
|
+
if (numticks > 8) numticks = 8;
|
|
815
815
|
|
|
816
816
|
m_ctx.beginPath();
|
|
817
817
|
m_ctx.strokeStyle = m_gridVerticalCss.color;
|
|
@@ -825,13 +825,13 @@ function Milli_Chart(settings) {
|
|
|
825
825
|
}
|
|
826
826
|
|
|
827
827
|
function checkYLegendSpace(y, text) {
|
|
828
|
-
|
|
828
|
+
|
|
829
829
|
if (y - (getFontSize(m_yLegendCss)) - m_chartspaces.chart.top < 0) return false;
|
|
830
830
|
if (y > m_chartspaces.chart.bottom) return false;
|
|
831
831
|
return true;
|
|
832
832
|
}
|
|
833
833
|
|
|
834
|
-
function drawY2Legend(x) {
|
|
834
|
+
function drawY2Legend(x) {
|
|
835
835
|
if (_this.settings.absoluteScaling == true) {
|
|
836
836
|
for (var s = 1; s < _this.instruments.length; s++) {
|
|
837
837
|
if (_this.instruments[s].insref != 0) return;
|
|
@@ -859,7 +859,7 @@ function Milli_Chart(settings) {
|
|
|
859
859
|
var count = 0;
|
|
860
860
|
for (;;) {
|
|
861
861
|
if (count++ > 10) {
|
|
862
|
-
|
|
862
|
+
() => {};
|
|
863
863
|
break;
|
|
864
864
|
}
|
|
865
865
|
var v;
|
|
@@ -870,9 +870,9 @@ function Milli_Chart(settings) {
|
|
|
870
870
|
var y = Math.round(m_chartspaces.chart.height - getScaledSetting(m_chartCss.marginBottom) - ((v - _this.scaleinfoY.minValue) * _this.scaleinfoY.valuePerPixel));
|
|
871
871
|
|
|
872
872
|
if (y <= m_chartspaces.chart.top) break;
|
|
873
|
-
|
|
873
|
+
|
|
874
874
|
if (y <= m_chartspaces.chart.bottom) {
|
|
875
|
-
if (_this.settings.drawy2axis == true) {
|
|
875
|
+
if (_this.settings.drawy2axis == true) {
|
|
876
876
|
m_ctx.beginPath();
|
|
877
877
|
m_ctx.moveTo(x, y + 0.5);
|
|
878
878
|
if ((m_y2LegendCss.float == 'left' && m_y2LegendCss.textAlign == 'left') || (m_y2LegendCss.float == 'right' && m_y2LegendCss.textAlign == 'left')) {
|
|
@@ -905,7 +905,7 @@ function Milli_Chart(settings) {
|
|
|
905
905
|
si.maxValue = si.highValue + (si.tickSize * 0.2);
|
|
906
906
|
si.minValue = si.lowValue - (si.tickSize * 0.2);
|
|
907
907
|
m_ctx.font = m_yLegendCss.fontWeight + ' ' + m_yLegendCss.fontSize + ' ' + m_yLegendCss.fontFamily;
|
|
908
|
-
if (si.highValue == si.lowValue) {
|
|
908
|
+
if (si.highValue == si.lowValue) {
|
|
909
909
|
si.maxValue = si.maxValue + si.tickSize;
|
|
910
910
|
si.minValue = si.minValue - si.tickSize;
|
|
911
911
|
value = Math.abs(si.lowValue);
|
|
@@ -917,14 +917,14 @@ function Milli_Chart(settings) {
|
|
|
917
917
|
}
|
|
918
918
|
si.valuePerPixel = si.lineLength / (si.maxValue - si.minValue);
|
|
919
919
|
if (isNaN(si.valuePerPixel) || !isFinite(si.valuePerPixel)) {
|
|
920
|
-
|
|
920
|
+
() => {};
|
|
921
921
|
return false;
|
|
922
922
|
}
|
|
923
923
|
var textpos;
|
|
924
924
|
var count = 0;
|
|
925
925
|
for (;;) {
|
|
926
926
|
if (count++ > 10) {
|
|
927
|
-
|
|
927
|
+
() => {};
|
|
928
928
|
break;
|
|
929
929
|
}
|
|
930
930
|
var y = Math.round(m_chartspaces.chart.height - getScaledSetting(m_chartCss.marginBottom) - ((value - si.minValue) * si.valuePerPixel));
|
|
@@ -948,7 +948,7 @@ function Milli_Chart(settings) {
|
|
|
948
948
|
}
|
|
949
949
|
|
|
950
950
|
} else
|
|
951
|
-
if (_this.settings.drawyaxis == true && number == 1 && draw) {
|
|
951
|
+
if (_this.settings.drawyaxis == true && number == 1 && draw) {
|
|
952
952
|
if (!draw) return;
|
|
953
953
|
m_ctx.beginPath();
|
|
954
954
|
m_ctx.moveTo(m_chartspaces.chart.left, y + 0.5);
|
|
@@ -986,35 +986,35 @@ function Milli_Chart(settings) {
|
|
|
986
986
|
m_ctx.fillStyle = m_yLegendCss.color;
|
|
987
987
|
if (0 == calcHighLow()) {
|
|
988
988
|
m_ctx.restore();
|
|
989
|
-
|
|
989
|
+
() => {};
|
|
990
990
|
return;
|
|
991
991
|
}
|
|
992
992
|
_this.scaleinfoY.lineLength = m_chartspaces.chart.bottom - m_chartspaces.chart.top;
|
|
993
993
|
_this.scaleinfoY2.lineLength = _this.scaleinfoY.lineLength;
|
|
994
|
-
|
|
994
|
+
|
|
995
995
|
var numticks = _this.scaleinfoY.lineLength / (getFontSize(m_yLegendCss) * _this.settings.yAxisSpacing);
|
|
996
|
-
if (numticks > 8) numticks = 8;
|
|
996
|
+
if (numticks > 8) numticks = 8;
|
|
997
997
|
_this.scaleinfoY.tickSize = getTickValue(_this.scaleinfoY.lowValue, _this.scaleinfoY.highValue, numticks);
|
|
998
|
-
_this.scaleinfoY.decimals = _this.scaleinfoY.tickSize.countDecimals();
|
|
998
|
+
_this.scaleinfoY.decimals = _this.scaleinfoY.tickSize.countDecimals();
|
|
999
999
|
_this.scaleinfoY.decimals = _this.scaleinfoY.decimals > 4 ? 4 : _this.scaleinfoY.decimals;
|
|
1000
1000
|
_this.scaleinfoY.decimals = _this.scaleinfoY.decimals < 2 ? 2 : _this.scaleinfoY.decimals;
|
|
1001
1001
|
var label = formatNiceNumber(_this.scaleinfoY.highValue, _this.settings.thousandseparator, _this.settings.decimalseparator, _this.scaleinfoY.decimals);
|
|
1002
1002
|
if (_this.settings.drawyaxis) {
|
|
1003
1003
|
if (m_yLegendCss.float != 'right') {
|
|
1004
|
-
m_chartspaces.chart.left = 10 + Math.round(m_ctx.measureText(label).width);
|
|
1004
|
+
m_chartspaces.chart.left = 10 + Math.round(m_ctx.measureText(label).width);
|
|
1005
1005
|
m_chartspaces.lowerChart.left = m_chartspaces.chart.left;
|
|
1006
1006
|
} else {
|
|
1007
1007
|
if (m_yLegendCss.textAlign == 'right') {
|
|
1008
|
-
m_chartspaces.chart.right = m_canvas.width - (10 + Math.round(m_ctx.measureText(label).width));
|
|
1008
|
+
m_chartspaces.chart.right = m_canvas.width - (10 + Math.round(m_ctx.measureText(label).width));
|
|
1009
1009
|
m_chartspaces.lowerChart.right = m_chartspaces.chart.right;
|
|
1010
1010
|
}
|
|
1011
1011
|
}
|
|
1012
1012
|
}
|
|
1013
|
-
if (_this.settings.drawy2axis) {
|
|
1014
|
-
|
|
1013
|
+
if (_this.settings.drawy2axis) {
|
|
1014
|
+
|
|
1015
1015
|
_this.scaleinfoY2.tickSize = getTickValue(_this.scaleinfoY2.lowValue, _this.scaleinfoY2.highValue, numticks);
|
|
1016
1016
|
|
|
1017
|
-
_this.scaleinfoY2.decimals = _this.scaleinfoY2.tickSize.countDecimals();
|
|
1017
|
+
_this.scaleinfoY2.decimals = _this.scaleinfoY2.tickSize.countDecimals();
|
|
1018
1018
|
_this.scaleinfoY2.decimals = _this.scaleinfoY2.decimals > 4 ? 4 : _this.scaleinfoY2.decimals;
|
|
1019
1019
|
_this.scaleinfoY2.decimals = _this.scaleinfoY2.decimals < 0 ? 0 : _this.scaleinfoY2.decimals;
|
|
1020
1020
|
|
|
@@ -1022,12 +1022,12 @@ function Milli_Chart(settings) {
|
|
|
1022
1022
|
label = formatNiceNumber(widestDiff, _this.settings.thousandseparator, _this.settings.decimalseparator, _this.scaleinfoY2.decimals) + ' %';
|
|
1023
1023
|
if (m_y2LegendCss.float != 'right') {
|
|
1024
1024
|
if (m_y2LegendCss.textAlign == 'left')
|
|
1025
|
-
m_chartspaces.chart.left = 10 + Math.round(m_ctx.measureText(label).width);
|
|
1025
|
+
m_chartspaces.chart.left = 10 + Math.round(m_ctx.measureText(label).width);
|
|
1026
1026
|
m_chartspaces.lowerChart.left = m_chartspaces.chart.left;
|
|
1027
1027
|
} else {
|
|
1028
|
-
|
|
1028
|
+
|
|
1029
1029
|
if (m_y2LegendCss.textAlign == 'right')
|
|
1030
|
-
m_chartspaces.chart.right = m_canvas.width - (10 + Math.round(m_ctx.measureText(label).width));
|
|
1030
|
+
m_chartspaces.chart.right = m_canvas.width - (10 + Math.round(m_ctx.measureText(label).width));
|
|
1031
1031
|
m_chartspaces.lowerChart.right = m_chartspaces.chart.right;
|
|
1032
1032
|
}
|
|
1033
1033
|
}
|
|
@@ -1075,7 +1075,7 @@ function Milli_Chart(settings) {
|
|
|
1075
1075
|
}
|
|
1076
1076
|
|
|
1077
1077
|
function drawXAxisGridlines(p, newday) {
|
|
1078
|
-
|
|
1078
|
+
|
|
1079
1079
|
m_ctx.save();
|
|
1080
1080
|
m_ctx.strokeStyle = m_gridVerticalCss.color;
|
|
1081
1081
|
if (_this.settings.gridVerticalLines) {
|
|
@@ -1098,7 +1098,7 @@ function Milli_Chart(settings) {
|
|
|
1098
1098
|
m_ctx.closePath();
|
|
1099
1099
|
}
|
|
1100
1100
|
} else
|
|
1101
|
-
if (_this.settings.drawxaxis != 0) {
|
|
1101
|
+
if (_this.settings.drawxaxis != 0) {
|
|
1102
1102
|
m_ctx.beginPath();
|
|
1103
1103
|
m_ctx.moveTo(p.x + 0.5, p.y);
|
|
1104
1104
|
m_ctx.lineTo(p.x + 0.5, p.y + 3);
|
|
@@ -1109,13 +1109,13 @@ function Milli_Chart(settings) {
|
|
|
1109
1109
|
}
|
|
1110
1110
|
|
|
1111
1111
|
function calcXScale(starttime, endtime) {
|
|
1112
|
-
|
|
1112
|
+
|
|
1113
1113
|
_this.scaleinfoX.startDate = new Date(starttime);
|
|
1114
1114
|
_this.scaleinfoX.endDate = new Date(endtime);
|
|
1115
1115
|
_this.scaleinfoX.days = getNumberOfDays(starttime, endtime);
|
|
1116
1116
|
_this.scaleinfoX.lineLength = m_chartspaces.chart.right - m_chartspaces.chart.left;
|
|
1117
|
-
var datesize = new Date('2888-12-28');
|
|
1118
|
-
_this.scaleinfoX.itemwidth = getStringWidth(m_ctx, formatDate(datesize, _this.settings.dateformat, _this)) * 2;
|
|
1117
|
+
var datesize = new Date('2888-12-28');
|
|
1118
|
+
_this.scaleinfoX.itemwidth = getStringWidth(m_ctx, formatDate(datesize, _this.settings.dateformat, _this)) * 2;
|
|
1119
1119
|
|
|
1120
1120
|
var maxLegendItems = _this.scaleinfoX.lineLength / (_this.scaleinfoX.itemwidth * 2);
|
|
1121
1121
|
|
|
@@ -1137,7 +1137,7 @@ function Milli_Chart(settings) {
|
|
|
1137
1137
|
var tmp = 60;
|
|
1138
1138
|
while (tmp < x) {
|
|
1139
1139
|
tmp += 60;
|
|
1140
|
-
if (x - tmp < 20) break;
|
|
1140
|
+
if (x - tmp < 20) break;
|
|
1141
1141
|
}
|
|
1142
1142
|
_this.scaleinfoX.ticksize = tmp * 60000;
|
|
1143
1143
|
}
|
|
@@ -1145,22 +1145,22 @@ function Milli_Chart(settings) {
|
|
|
1145
1145
|
}
|
|
1146
1146
|
|
|
1147
1147
|
function getXPosition(timestamp) {
|
|
1148
|
-
var offset = (timestamp.getTime() - _this.scaleinfoX.startDate.getTime()) / (86400000 * 7);
|
|
1148
|
+
var offset = (timestamp.getTime() - _this.scaleinfoX.startDate.getTime()) / (86400000 * 7);
|
|
1149
1149
|
offset = offset * 86400000 * 2 / _this.scaleinfoX.timePerPixel;
|
|
1150
1150
|
return Math.round(m_chartspaces.chart.left + ((timestamp.getTime() - _this.scaleinfoX.startDate.getTime()) / _this.scaleinfoX.timePerPixel) - offset);
|
|
1151
1151
|
}
|
|
1152
1152
|
|
|
1153
1153
|
function checkXLegendSides(x, text) {
|
|
1154
|
-
|
|
1154
|
+
|
|
1155
1155
|
if (_this.scaleinfoX.lineLength + m_chartspaces.chart.left < x + (m_ctx.measureText(text).width / 2)) return false;
|
|
1156
|
-
|
|
1156
|
+
|
|
1157
1157
|
if (m_chartspaces.chart.left > x - (m_ctx.measureText(text).width / 2)) return false;
|
|
1158
1158
|
return true;
|
|
1159
1159
|
|
|
1160
1160
|
}
|
|
1161
1161
|
|
|
1162
1162
|
function drawXAxisYears(starttime, endtime) {
|
|
1163
|
-
if (getNumberOfDays(starttime, endtime) < 250) return drawXAxisMonth(starttime, endtime);
|
|
1163
|
+
if (getNumberOfDays(starttime, endtime) < 250) return drawXAxisMonth(starttime, endtime);
|
|
1164
1164
|
m_ctx.save();
|
|
1165
1165
|
m_ctx.font = m_xLegendCss.fontWeight + ' ' + m_xLegendCss.fontSize + ' ' + m_xLegendCss.fontFamily;
|
|
1166
1166
|
m_ctx.strokeStyle = m_gridHorizontalCss.color;
|
|
@@ -1176,7 +1176,7 @@ function Milli_Chart(settings) {
|
|
|
1176
1176
|
}
|
|
1177
1177
|
m_ctx.strokeStyle = m_gridVerticalCss.color;
|
|
1178
1178
|
var legendItems = [];
|
|
1179
|
-
|
|
1179
|
+
|
|
1180
1180
|
var year = _this.scaleinfoX.startDate.getFullYear() + 1;
|
|
1181
1181
|
var numItems = 0,
|
|
1182
1182
|
x, draw, i, text;
|
|
@@ -1193,7 +1193,7 @@ function Milli_Chart(settings) {
|
|
|
1193
1193
|
text = year;
|
|
1194
1194
|
if (checkXLegendSides(x, text)) {
|
|
1195
1195
|
if (_this.settings.yearLabelsPos == 'top') {
|
|
1196
|
-
m_ctx.save();
|
|
1196
|
+
m_ctx.save();
|
|
1197
1197
|
var fontMetrix = m_ctx.measureText(text);
|
|
1198
1198
|
x = x + fontMetrix.actualBoundingBoxAscent + fontMetrix.actualBoundingBoxDescent + 2;
|
|
1199
1199
|
var y = m_chartspaces.chart.top;
|
|
@@ -1210,14 +1210,14 @@ function Milli_Chart(settings) {
|
|
|
1210
1210
|
}
|
|
1211
1211
|
year++;
|
|
1212
1212
|
}
|
|
1213
|
-
if (numItems * m_ctx.measureText('8888').width / _this.scaleinfoX.lineLength > 0.3) numItems = 11;
|
|
1214
|
-
|
|
1215
|
-
if (numItems < 10) {
|
|
1213
|
+
if (numItems * m_ctx.measureText('8888').width / _this.scaleinfoX.lineLength > 0.3) numItems = 11;
|
|
1214
|
+
|
|
1215
|
+
if (numItems < 10) {
|
|
1216
1216
|
year = new Date(_this.scaleinfoX.startDate.getFullYear() + '-07-01T00:00:00Z');
|
|
1217
1217
|
if (year.getTime() < _this.scaleinfoX.startDate.getTime())
|
|
1218
1218
|
year = new Date(_this.scaleinfoX.startDate.getFullYear() + 1 + '-07-01T00:00:00Z');
|
|
1219
1219
|
while (year < _this.scaleinfoX.endDate) {
|
|
1220
|
-
x = getXPosition(new Date(year.getFullYear() + '-07-01T00:00:00Z'));
|
|
1220
|
+
x = getXPosition(new Date(year.getFullYear() + '-07-01T00:00:00Z'));
|
|
1221
1221
|
draw = true;
|
|
1222
1222
|
for (i = 0; i < legendItems.length; i++) {
|
|
1223
1223
|
if (Math.abs(legendItems[i].x - x) < getMaxDateWidth()) {
|
|
@@ -1236,13 +1236,13 @@ function Milli_Chart(settings) {
|
|
|
1236
1236
|
year = new Date((year.getFullYear() + 1) + '-07-01T00:00:00Z');
|
|
1237
1237
|
}
|
|
1238
1238
|
}
|
|
1239
|
-
|
|
1240
|
-
if (numItems * m_ctx.measureText('8888').width / _this.scaleinfoX.lineLength > 0.3) numItems = 11;
|
|
1241
|
-
if (numItems < 10) {
|
|
1239
|
+
|
|
1240
|
+
if (numItems * m_ctx.measureText('8888').width / _this.scaleinfoX.lineLength > 0.3) numItems = 11;
|
|
1241
|
+
if (numItems < 10) {
|
|
1242
1242
|
year = new Date(_this.scaleinfoX.startDate.getFullYear() + '-04-01T00:00:00Z');
|
|
1243
1243
|
if (year.getTime() < _this.scaleinfoX.startDate.getTime())
|
|
1244
1244
|
year = new Date(_this.scaleinfoX.startDate.getFullYear() + 1 + '-04-01T00:00:00Z');
|
|
1245
|
-
var dontPrint = false;
|
|
1245
|
+
var dontPrint = false;
|
|
1246
1246
|
while (year < _this.scaleinfoX.endDate) {
|
|
1247
1247
|
x = getXPosition(new Date(year.getFullYear() + '-04-01T00:00:00Z'));
|
|
1248
1248
|
draw = true;
|
|
@@ -1263,7 +1263,7 @@ function Milli_Chart(settings) {
|
|
|
1263
1263
|
legendItems.push({ 'text': text, timestamp: new Date(year + '-04-01T00:00:00Z'), 'x': x });
|
|
1264
1264
|
year = new Date((year.getFullYear() + 1) + '-04-01T00:00:00Z');
|
|
1265
1265
|
}
|
|
1266
|
-
|
|
1266
|
+
|
|
1267
1267
|
if (dontPrint == false) {
|
|
1268
1268
|
year = new Date(_this.scaleinfoX.startDate.getFullYear() + '-10-01T00:00:00Z');
|
|
1269
1269
|
if (year.getTime() < _this.scaleinfoX.startDate.getTime())
|
|
@@ -1300,7 +1300,7 @@ function Milli_Chart(settings) {
|
|
|
1300
1300
|
m_ctx.strokeStyle = m_gridHorizontalCss.color;
|
|
1301
1301
|
m_ctx.fillStyle = m_xLegendCss.color;
|
|
1302
1302
|
calcXScale(starttime, endtime);
|
|
1303
|
-
if (_this.settings.drawxaxis != 0) {
|
|
1303
|
+
if (_this.settings.drawxaxis != 0) {
|
|
1304
1304
|
m_ctx.beginPath();
|
|
1305
1305
|
m_ctx.moveTo(m_chartspaces.chart.left, m_chartspaces.chart.height - getScaledSetting(m_chartCss.marginBottom) + 0.5);
|
|
1306
1306
|
m_ctx.lineTo(m_chartspaces.chart.right, m_chartspaces.chart.height - getScaledSetting(m_chartCss.marginBottom) + 0.5);
|
|
@@ -1315,14 +1315,14 @@ function Milli_Chart(settings) {
|
|
|
1315
1315
|
var draw = true;
|
|
1316
1316
|
var offset = 0;
|
|
1317
1317
|
var count = 0;
|
|
1318
|
-
while (currentDate.getTime() < _this.scaleinfoX.endTimeStamp) {
|
|
1318
|
+
while (currentDate.getTime() < _this.scaleinfoX.endTimeStamp) {
|
|
1319
1319
|
draw = true;
|
|
1320
|
-
while (currentDate.getDay() == 0 || currentDate.getDay() == 6) {
|
|
1320
|
+
while (currentDate.getDay() == 0 || currentDate.getDay() == 6) {
|
|
1321
1321
|
currentDate = new Date(currentDate.getTime() + 86400000);
|
|
1322
1322
|
offset += 86400000 / _this.scaleinfoX.timePerPixel;
|
|
1323
1323
|
}
|
|
1324
1324
|
x = Math.round(m_chartspaces.chart.left + ((currentDate.getTime() - _this.scaleinfoX.startDate.getTime()) / _this.scaleinfoX.timePerPixel) - offset);
|
|
1325
|
-
if (lastx == 0 && m_chartspaces.chart.left > (x - (getMaxDateWidth() / 2))) {
|
|
1325
|
+
if (lastx == 0 && m_chartspaces.chart.left > (x - (getMaxDateWidth() / 2))) {
|
|
1326
1326
|
currentDate = new Date(currentDate.getTime() + 86400000);
|
|
1327
1327
|
continue;
|
|
1328
1328
|
}
|
|
@@ -1340,7 +1340,7 @@ function Milli_Chart(settings) {
|
|
|
1340
1340
|
}
|
|
1341
1341
|
currentDate = new Date(currentDate.getTime() + 86400000);
|
|
1342
1342
|
}
|
|
1343
|
-
|
|
1343
|
+
|
|
1344
1344
|
if (typeof m_chartCss.boxShadow !== 'undefined' && typeof m_chartCss.boxShadow.rightWidth !== 'undefined') {
|
|
1345
1345
|
if (m_chartCss.boxShadow.rightWidth == 0) drawXAxisGridlines({ 'x': x, y: m_chartspaces.chart.bottom }, false);
|
|
1346
1346
|
} else {
|
|
@@ -1352,9 +1352,9 @@ function Milli_Chart(settings) {
|
|
|
1352
1352
|
function calcXScaleTick(starttime, endtime) {
|
|
1353
1353
|
_this.scaleinfoX.startDate = new Date(starttime);
|
|
1354
1354
|
_this.scaleinfoX.endDate = new Date(endtime);
|
|
1355
|
-
_this.scaleinfoX.days = getNumberOfDays(starttime, endtime);
|
|
1356
|
-
_this.scaleinfoX.lineLength = m_chartspaces.chart.right - m_chartspaces.chart.left;
|
|
1357
|
-
_this.scaleinfoX.itemwidth = getStringWidth(m_ctx, '88:88') * 2;
|
|
1355
|
+
_this.scaleinfoX.days = getNumberOfDays(starttime, endtime);
|
|
1356
|
+
_this.scaleinfoX.lineLength = m_chartspaces.chart.right - m_chartspaces.chart.left;
|
|
1357
|
+
_this.scaleinfoX.itemwidth = getStringWidth(m_ctx, '88:88') * 2;
|
|
1358
1358
|
var maxLegendItems = Math.floor(_this.scaleinfoX.lineLength / (_this.scaleinfoX.itemwidth * 2));
|
|
1359
1359
|
|
|
1360
1360
|
if (_this.scaleinfoY.type != 'history') {
|
|
@@ -1391,28 +1391,28 @@ function Milli_Chart(settings) {
|
|
|
1391
1391
|
|
|
1392
1392
|
var factor = 60;
|
|
1393
1393
|
if (numticks < 1)
|
|
1394
|
-
_this.scaleinfoX.ticksize = 86400000;
|
|
1394
|
+
_this.scaleinfoX.ticksize = 86400000;
|
|
1395
1395
|
else {
|
|
1396
1396
|
if (numticks < 2) numticks = 2;
|
|
1397
1397
|
x = _this.scaleinfoX.milliPerDay / numticks / 60000;
|
|
1398
|
-
if (totalmilli > 4 * 3600000) factor = 60;
|
|
1398
|
+
if (totalmilli > 4 * 3600000) factor = 60;
|
|
1399
1399
|
else
|
|
1400
|
-
if (totalmilli > 2 * 3600000) factor = 30;
|
|
1400
|
+
if (totalmilli > 2 * 3600000) factor = 30;
|
|
1401
1401
|
else
|
|
1402
|
-
if (totalmilli > 3600000) factor = 20;
|
|
1402
|
+
if (totalmilli > 3600000) factor = 20;
|
|
1403
1403
|
else
|
|
1404
|
-
if (totalmilli > 3600000 / 2) factor = 10;
|
|
1404
|
+
if (totalmilli > 3600000 / 2) factor = 10;
|
|
1405
1405
|
else
|
|
1406
|
-
if (totalmilli > 3600000 / 4) factor = 5;
|
|
1406
|
+
if (totalmilli > 3600000 / 4) factor = 5;
|
|
1407
1407
|
else factor = 1;
|
|
1408
|
-
_this.scaleinfoX.ticksize = factor * 60000;
|
|
1408
|
+
_this.scaleinfoX.ticksize = factor * 60000;
|
|
1409
1409
|
}
|
|
1410
1410
|
return;
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
1413
|
|
|
1414
1414
|
function formatChartTime(value, format) {
|
|
1415
|
-
|
|
1415
|
+
|
|
1416
1416
|
if (typeof value !== 'string') return "";
|
|
1417
1417
|
var datetime = new Date();
|
|
1418
1418
|
datetime.setHours(parseInt(value));
|
|
@@ -1471,7 +1471,7 @@ function Milli_Chart(settings) {
|
|
|
1471
1471
|
m_ctx.fillStyle = m_xLegendCss.color;
|
|
1472
1472
|
m_ctx.textAlign = "left";
|
|
1473
1473
|
calcXScaleTick(starttime, endtime);
|
|
1474
|
-
if (_this.settings.drawxaxis != 0) {
|
|
1474
|
+
if (_this.settings.drawxaxis != 0) {
|
|
1475
1475
|
m_ctx.beginPath();
|
|
1476
1476
|
m_ctx.moveTo(m_chartspaces.chart.left, m_chartspaces.chart.bottom + 0.5);
|
|
1477
1477
|
m_ctx.lineTo(m_chartspaces.chart.right, m_chartspaces.chart.bottom + 0.5);
|
|
@@ -1488,20 +1488,20 @@ function Milli_Chart(settings) {
|
|
|
1488
1488
|
var legendItems = [];
|
|
1489
1489
|
var openhour = new Date(new Date(currentDate.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketopen + 'Z')).getTime() % 86400000;
|
|
1490
1490
|
var closehour = new Date(new Date(currentDate.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketclose + 'Z')).getTime() % 86400000;
|
|
1491
|
-
|
|
1491
|
+
|
|
1492
1492
|
var middleOfDay = new Date(currentDate.getTime() - (currentDate.getTime() % 86400000) + ((openhour + closehour) / 2));
|
|
1493
1493
|
if (_this.settings.intradayDatePos.x == 'left' && (_this.settings.intradayDatePos.y == 'scale' || _this.settings.intradayDatePos.y == 'top')) {
|
|
1494
1494
|
middleOfDay = new Date(currentDate.getTime());
|
|
1495
1495
|
}
|
|
1496
|
-
if (currentDate.getTime() % 3600000 != 0)
|
|
1497
|
-
currentDate = new Date(currentDate.getTime() - currentDate.getTime() % 3600000 + 3600000);
|
|
1496
|
+
if (currentDate.getTime() % 3600000 != 0)
|
|
1497
|
+
currentDate = new Date(currentDate.getTime() - currentDate.getTime() % 3600000 + 3600000);
|
|
1498
1498
|
|
|
1499
1499
|
var firstDate = new Date(currentDate);
|
|
1500
1500
|
var days = calcTimeSpanInDays(starttime, endtime);
|
|
1501
1501
|
if (m_zoom.mouseup.timestamp == null || (m_zoom.mouseup.timestamp != null && days > 1)) {
|
|
1502
1502
|
while (currentDate.getTime() < _this.scaleinfoX.endTimeStamp) {
|
|
1503
1503
|
draw = true;
|
|
1504
|
-
while (currentDate.getDay() == 0 || currentDate.getDay() == 6) {
|
|
1504
|
+
while (currentDate.getDay() == 0 || currentDate.getDay() == 6) {
|
|
1505
1505
|
currentDate = new Date(currentDate.getTime() + 86400000);
|
|
1506
1506
|
if (_this.settings.intradayDatePos.x == 'left' && (_this.settings.intradayDatePos.y == 'scale' || _this.settings.intradayDatePos.y == 'top')) {
|
|
1507
1507
|
middleOfDay = new Date(currentDate.getTime());
|
|
@@ -1520,14 +1520,14 @@ function Milli_Chart(settings) {
|
|
|
1520
1520
|
lastx = x + 0.5;
|
|
1521
1521
|
var text = formatChartTime(currentDate.toTimeString().substring(0, 8), _this.settings.timeformat);
|
|
1522
1522
|
var date = formatDate(currentDate, _this.settings.intradayDatePos.dateformat, _this);
|
|
1523
|
-
if (_this.scaleinfoX.lineLength + m_chartspaces.chart.left > x - getMaxTimeWidth()) {
|
|
1523
|
+
if (_this.scaleinfoX.lineLength + m_chartspaces.chart.left > x - getMaxTimeWidth()) {
|
|
1524
1524
|
if (_this.settings.intradayDatePos.y == 'scale' && _this.settings.chartlen != '0d' && _this.settings.chartlen != '1d') {
|
|
1525
|
-
|
|
1525
|
+
|
|
1526
1526
|
m_ctx.fillText(date, middleX - (m_ctx.measureText(date).width / 2), m_chartspaces.chart.bottom + getScaledSetting(m_xLegendCss.paddingTop));
|
|
1527
1527
|
legendItems.push({ x: middleX, type: 0, text: date, width: m_ctx.measureText(date) });
|
|
1528
1528
|
} else if (_this.settings.intradayDatePos.y == 'bottom' && _this.settings.chartlen != '0d' && _this.settings.chartlen != '1d') {
|
|
1529
1529
|
m_ctx.fillText(date, middleX - (m_ctx.measureText(date).width / 2), m_chartspaces.chart.bottom + getScaledSetting(m_xLegendCss.paddingTop) + parseInt(m_xLegendCss.fontSize) * window.devicePixelRatio);
|
|
1530
|
-
|
|
1530
|
+
|
|
1531
1531
|
m_ctx.fillText(text, x - (m_ctx.measureText(text).width / 2), m_chartspaces.chart.bottom + getScaledSetting(m_xLegendCss.paddingTop));
|
|
1532
1532
|
legendItems.push({ x: x, type: 0, text: text });
|
|
1533
1533
|
} else {
|
|
@@ -1547,7 +1547,7 @@ function Milli_Chart(settings) {
|
|
|
1547
1547
|
if (_this.settings.intradayDatePos.x == 'center') {
|
|
1548
1548
|
m_ctx.fillText(date, middleX - (m_ctx.measureText(date).width / 2), getScaledSetting(m_chartCss.marginTop));
|
|
1549
1549
|
} else {
|
|
1550
|
-
|
|
1550
|
+
|
|
1551
1551
|
m_ctx.fillText(date, middleX + 1, getScaledSetting(m_chartCss.marginTop));
|
|
1552
1552
|
}
|
|
1553
1553
|
}
|
|
@@ -1555,17 +1555,17 @@ function Milli_Chart(settings) {
|
|
|
1555
1555
|
}
|
|
1556
1556
|
}
|
|
1557
1557
|
}
|
|
1558
|
-
if (x != m_chartspaces.chart.left + 0.5) {
|
|
1558
|
+
if (x != m_chartspaces.chart.left + 0.5) {
|
|
1559
1559
|
if (_this.settings.intradayDatePos.y != 'bottom') {
|
|
1560
1560
|
if (openhour == currentDate.getTime() % 86400000) {
|
|
1561
|
-
drawXAxisGridlines({ 'x': x, y: m_chartspaces.chart.bottom }, true);
|
|
1561
|
+
drawXAxisGridlines({ 'x': x, y: m_chartspaces.chart.bottom }, true);
|
|
1562
1562
|
} else {
|
|
1563
|
-
drawXAxisGridlines({ 'x': x, y: m_chartspaces.chart.bottom }, false);
|
|
1563
|
+
drawXAxisGridlines({ 'x': x, y: m_chartspaces.chart.bottom }, false);
|
|
1564
1564
|
}
|
|
1565
1565
|
}
|
|
1566
1566
|
}
|
|
1567
1567
|
}
|
|
1568
|
-
|
|
1568
|
+
|
|
1569
1569
|
currentDate = new Date(currentDate.getTime() + 86400000);
|
|
1570
1570
|
currentDate = new Date(currentDate.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketopen + 'Z');
|
|
1571
1571
|
middleOfDay = new Date(currentDate.getTime() - (currentDate.getTime() % 86400000) + ((openhour + closehour) / 2));
|
|
@@ -1573,23 +1573,23 @@ function Milli_Chart(settings) {
|
|
|
1573
1573
|
middleOfDay = new Date(currentDate);
|
|
1574
1574
|
}
|
|
1575
1575
|
|
|
1576
|
-
if (currentDate.getTime() % 3600000 != 0)
|
|
1577
|
-
currentDate = new Date(currentDate.getTime() - currentDate.getTime() % 3600000 + 3600000);
|
|
1578
|
-
|
|
1576
|
+
if (currentDate.getTime() % 3600000 != 0)
|
|
1577
|
+
currentDate = new Date(currentDate.getTime() - currentDate.getTime() % 3600000 + 3600000);
|
|
1578
|
+
|
|
1579
1579
|
offset += (86400000 - _this.scaleinfoX.milliPerDay) / _this.scaleinfoX.timePerPixel;
|
|
1580
1580
|
}
|
|
1581
1581
|
}
|
|
1582
|
-
|
|
1582
|
+
|
|
1583
1583
|
currentDate = new Date(starttime);
|
|
1584
|
-
if (currentDate.getTime() % 3600000 != 0)
|
|
1585
|
-
currentDate = new Date(currentDate.getTime() - currentDate.getTime() % 3600000 + 3600000);
|
|
1584
|
+
if (currentDate.getTime() % 3600000 != 0)
|
|
1585
|
+
currentDate = new Date(currentDate.getTime() - currentDate.getTime() % 3600000 + 3600000);
|
|
1586
1586
|
|
|
1587
1587
|
var maxHourLegends;
|
|
1588
1588
|
if (legendItems.length == 0)
|
|
1589
|
-
maxHourLegends = Math.floor((_this.scaleinfoX.lineLength - m_chartspaces.chart.left - getMaxTimeWidth()) / (getMaxTimeWidth() * 3));
|
|
1589
|
+
maxHourLegends = Math.floor((_this.scaleinfoX.lineLength - m_chartspaces.chart.left - getMaxTimeWidth()) / (getMaxTimeWidth() * 3));
|
|
1590
1590
|
else if (legendItems.length == 1) {
|
|
1591
1591
|
if (m_zoom.mouseup.timestamp && days == 2) {
|
|
1592
|
-
|
|
1592
|
+
|
|
1593
1593
|
if (_this.scaleinfoX.lineLength / 2 < legendItems[0].x + m_chartspaces.chart.left)
|
|
1594
1594
|
maxHourLegends = Math.floor((_this.scaleinfoX.lineLength - (_this.scaleinfoX.lineLength - legendItems[0].x) - getMaxTimeWidth()) / (getMaxTimeWidth() * 3));
|
|
1595
1595
|
else
|
|
@@ -1597,15 +1597,15 @@ function Milli_Chart(settings) {
|
|
|
1597
1597
|
} else
|
|
1598
1598
|
maxHourLegends = Math.floor((_this.scaleinfoX.lineLength - legendItems[0].x - getMaxTimeWidth()) / (getMaxTimeWidth() * 3));
|
|
1599
1599
|
} else {
|
|
1600
|
-
maxHourLegends = Math.floor((legendItems[legendItems.length - 1].x - legendItems[legendItems.length - 2].x - getMaxTimeWidth()) / (getMaxTimeWidth() * 3));
|
|
1600
|
+
maxHourLegends = Math.floor((legendItems[legendItems.length - 1].x - legendItems[legendItems.length - 2].x - getMaxTimeWidth()) / (getMaxTimeWidth() * 3));
|
|
1601
1601
|
}
|
|
1602
1602
|
|
|
1603
|
-
var tickSize;
|
|
1603
|
+
var tickSize;
|
|
1604
1604
|
if (days == 1) {
|
|
1605
|
-
|
|
1605
|
+
|
|
1606
1606
|
tickSize = new Date(endtime - starttime);
|
|
1607
|
-
} else if (m_zoom.mouseup.timestamp && days == 2) {
|
|
1608
|
-
|
|
1607
|
+
} else if (m_zoom.mouseup.timestamp && days == 2) {
|
|
1608
|
+
|
|
1609
1609
|
var tmpDate = new Date(starttime);
|
|
1610
1610
|
tickSize = new Date(new Date(tmpDate.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketclose + 'Z') - new Date(starttime)).getTime();
|
|
1611
1611
|
var firstDay = tickSize;
|
|
@@ -1614,13 +1614,13 @@ function Milli_Chart(settings) {
|
|
|
1614
1614
|
tickSize += new Date(endtime - new Date(tmpDate.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketopen + 'Z').getTime()).getTime();
|
|
1615
1615
|
tickSize = new Date(Math.max(firstDay, secondDay));
|
|
1616
1616
|
} else {
|
|
1617
|
-
|
|
1617
|
+
|
|
1618
1618
|
tickSize = new Date(new Date(currentDate.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketclose + 'Z') - new Date(currentDate.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketopen + 'Z'));
|
|
1619
1619
|
}
|
|
1620
1620
|
var interval;
|
|
1621
1621
|
var modularvalue = 3600000;
|
|
1622
1622
|
|
|
1623
|
-
|
|
1623
|
+
|
|
1624
1624
|
if (tickSize.getTime() < 1800000) {
|
|
1625
1625
|
tickSize = tickSize.getTime() / 60000;
|
|
1626
1626
|
interval = Math.floor(tickSize / (maxHourLegends + 1)) * 60000;
|
|
@@ -1639,14 +1639,14 @@ function Milli_Chart(settings) {
|
|
|
1639
1639
|
interval = Math.floor(tickSize / (maxHourLegends + 1)) * 3600000;
|
|
1640
1640
|
}
|
|
1641
1641
|
if (interval == 0) {
|
|
1642
|
-
|
|
1642
|
+
|
|
1643
1643
|
interval = 3600000;
|
|
1644
1644
|
modularvalue = 3600000;
|
|
1645
1645
|
}
|
|
1646
1646
|
if (interval % 60000 != 0) {
|
|
1647
|
-
interval = (interval - interval % 60000) + 60000;
|
|
1647
|
+
interval = (interval - interval % 60000) + 60000;
|
|
1648
1648
|
}
|
|
1649
|
-
|
|
1649
|
+
|
|
1650
1650
|
offset = 0;
|
|
1651
1651
|
lastx = 0;
|
|
1652
1652
|
var closeTime = new Date(currentDate.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketclose + 'Z');
|
|
@@ -1655,38 +1655,38 @@ function Milli_Chart(settings) {
|
|
|
1655
1655
|
|
|
1656
1656
|
var workDate = new Date(currentDate);
|
|
1657
1657
|
currentDate = new Date(starttime);
|
|
1658
|
-
if (currentDate.getTime() % modularvalue != 0)
|
|
1659
|
-
currentDate = new Date(currentDate.getTime() - currentDate.getTime() % modularvalue + modularvalue);
|
|
1658
|
+
if (currentDate.getTime() % modularvalue != 0)
|
|
1659
|
+
currentDate = new Date(currentDate.getTime() - currentDate.getTime() % modularvalue + modularvalue);
|
|
1660
1660
|
|
|
1661
1661
|
var count = 0;
|
|
1662
1662
|
while (currentDate.getTime() <= _this.scaleinfoX.endTimeStamp) {
|
|
1663
1663
|
dayLightChange = (closeTime.getTimezoneOffset() - new Date().getTimezoneOffset()) * 60000;
|
|
1664
1664
|
if (count++ > 100) {
|
|
1665
|
-
break;
|
|
1665
|
+
break;
|
|
1666
1666
|
|
|
1667
1667
|
}
|
|
1668
1668
|
draw = true;
|
|
1669
|
-
while (currentDate.getDay() == 0 || currentDate.getDay() == 6) {
|
|
1670
|
-
|
|
1669
|
+
while (currentDate.getDay() == 0 || currentDate.getDay() == 6) {
|
|
1670
|
+
|
|
1671
1671
|
currentDate = new Date(currentDate.getTime() + 86400000);
|
|
1672
1672
|
closeTime = new Date(currentDate.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketclose + 'Z');
|
|
1673
|
-
if (currentDate.getTime() % modularvalue != 0)
|
|
1674
|
-
currentDate = new Date(currentDate.getTime() - currentDate.getTime() % modularvalue + modularvalue);
|
|
1673
|
+
if (currentDate.getTime() % modularvalue != 0)
|
|
1674
|
+
currentDate = new Date(currentDate.getTime() - currentDate.getTime() % modularvalue + modularvalue);
|
|
1675
1675
|
workDate = new Date(workDate.getTime() + 86400000);
|
|
1676
1676
|
offset += 86400000 / _this.scaleinfoX.timePerPixel;
|
|
1677
1677
|
}
|
|
1678
1678
|
if (currentDate.getTime() > closeTime.getTime()) {
|
|
1679
|
-
|
|
1679
|
+
|
|
1680
1680
|
var dayStart = new Date(workDate.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketclose + 'Z');
|
|
1681
1681
|
x = Math.round(m_chartspaces.chart.left + ((dayStart.getTime() - _this.scaleinfoX.startDate.getTime()) / _this.scaleinfoX.timePerPixel) - offset);
|
|
1682
|
-
drawXAxisGridlines({ 'x': x, y: m_chartspaces.chart.bottom }, true);
|
|
1682
|
+
drawXAxisGridlines({ 'x': x, y: m_chartspaces.chart.bottom }, true);
|
|
1683
1683
|
|
|
1684
1684
|
closeTime = new Date(closeTime.getTime() + 86400000);
|
|
1685
1685
|
workDate = new Date(workDate.getTime() + 86400000);
|
|
1686
1686
|
currentDate = new Date(workDate.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketopen + 'Z');
|
|
1687
1687
|
|
|
1688
|
-
if (currentDate.getTime() % modularvalue != 0)
|
|
1689
|
-
currentDate = new Date(currentDate.getTime() - currentDate.getTime() % modularvalue + modularvalue);
|
|
1688
|
+
if (currentDate.getTime() % modularvalue != 0)
|
|
1689
|
+
currentDate = new Date(currentDate.getTime() - currentDate.getTime() % modularvalue + modularvalue);
|
|
1690
1690
|
offset += (86400000 - _this.scaleinfoX.milliPerDay) / _this.scaleinfoX.timePerPixel;
|
|
1691
1691
|
continue;
|
|
1692
1692
|
}
|
|
@@ -1706,12 +1706,12 @@ function Milli_Chart(settings) {
|
|
|
1706
1706
|
}
|
|
1707
1707
|
}
|
|
1708
1708
|
if (lastx + (getMaxTimeWidth() / 2) > (x - getMaxTimeWidth())) {
|
|
1709
|
-
|
|
1709
|
+
|
|
1710
1710
|
}
|
|
1711
1711
|
if (draw) {
|
|
1712
1712
|
lastx = x;
|
|
1713
|
-
|
|
1714
|
-
if (_this.scaleinfoX.lineLength + m_chartspaces.chart.left > x - getMaxTimeWidth()) {
|
|
1713
|
+
|
|
1714
|
+
if (_this.scaleinfoX.lineLength + m_chartspaces.chart.left > x - getMaxTimeWidth()) {
|
|
1715
1715
|
var label = formatChartTime(currentDate.toTimeString().substring(0, 8), _this.settings.timeformat);
|
|
1716
1716
|
x = Math.round(x);
|
|
1717
1717
|
m_ctx.fillText(label, x - (m_ctx.measureText(label).width / 2), m_chartspaces.chart.bottom + getScaledSetting(m_xLegendCss.paddingTop));
|
|
@@ -1722,7 +1722,7 @@ function Milli_Chart(settings) {
|
|
|
1722
1722
|
currentDate = new Date(currentDate.getTime() + interval);
|
|
1723
1723
|
}
|
|
1724
1724
|
|
|
1725
|
-
|
|
1725
|
+
|
|
1726
1726
|
if (typeof m_chartCss.boxShadow !== 'undefined' && typeof m_chartCss.boxShadow.rightWidth !== 'undefined') {
|
|
1727
1727
|
if (m_chartCss.boxShadow.rightWidth == 0) drawXAxisGridlines({ 'x': x, y: m_chartspaces.chart.bottom }, false);
|
|
1728
1728
|
|
|
@@ -1771,7 +1771,7 @@ function Milli_Chart(settings) {
|
|
|
1771
1771
|
m_priceIndicator.setAttribute('class', 'millistream-chart-price-indicator');
|
|
1772
1772
|
}
|
|
1773
1773
|
m_priceIndicator.innerHTML = newValue;
|
|
1774
|
-
m_priceIndicator.style.left = (m_chartspaces.chart.right / window.devicePixelRatio) - (offsetWidth == 0 ? -1 : m_priceIndicator.offsetWidth) + 'px';
|
|
1774
|
+
m_priceIndicator.style.left = (m_chartspaces.chart.right / window.devicePixelRatio) - (offsetWidth == 0 ? -1 : m_priceIndicator.offsetWidth) + 'px';
|
|
1775
1775
|
m_priceIndicator.style.top = obj.instruments[0].y - (m_priceIndicator.offsetHeight / 2) + 'px';
|
|
1776
1776
|
newValue = MillistreamWidgetApi_getElementNumber(_this, m_priceIndicator);
|
|
1777
1777
|
MillistreamWidgetApi_flashElement(_this, m_priceIndicator, newValue, oldValue);
|
|
@@ -1858,13 +1858,13 @@ function Milli_Chart(settings) {
|
|
|
1858
1858
|
instr.data.price = formatNiceNumber(instr.data.price, _this.settings.thousandseparator, _this.settings.decimalseparator, _this.settings.num_decimals, false);
|
|
1859
1859
|
|
|
1860
1860
|
if (typeof _this.instruments[x].toolTip === 'undefined') {
|
|
1861
|
-
|
|
1861
|
+
|
|
1862
1862
|
_this.instruments[x].toolTip = document.createElement('div');
|
|
1863
1863
|
_this.instruments[x].toolTip.style.display = _this.settings.tooltip.display;
|
|
1864
|
-
_this.instruments[x].toolTip.setAttribute('class', 'millistream-chart-tooltip');
|
|
1864
|
+
_this.instruments[x].toolTip.setAttribute('class', 'millistream-chart-tooltip');
|
|
1865
1865
|
_this.instruments[x].toolTip.position = 'absolute';
|
|
1866
1866
|
m_canvas.parentNode.appendChild(_this.instruments[x].toolTip);
|
|
1867
|
-
|
|
1867
|
+
|
|
1868
1868
|
_this.instruments[x].toolTipPointer = document.createElement('div');
|
|
1869
1869
|
m_canvas.parentNode.appendChild(_this.instruments[x].toolTipPointer);
|
|
1870
1870
|
_this.instruments[x].toolTipPointer.setAttribute('class', 'millistream-chart-pointer');
|
|
@@ -1879,16 +1879,16 @@ function Milli_Chart(settings) {
|
|
|
1879
1879
|
var pointerWidth = _this.instruments[x].toolTipPointer.offsetWidth + parseInt(pointerStyle.marginLeft) + parseInt(pointerStyle.marginRight);
|
|
1880
1880
|
var pointerHeight = _this.instruments[x].toolTipPointer.offsetHeight + parseInt(pointerStyle.marginTop) + parseInt(pointerStyle.marginBottom);
|
|
1881
1881
|
var posy = obj.instruments[x].y - (_this.instruments[x].toolTip.offsetHeight / 2);
|
|
1882
|
-
if (m_dataPoints.arr[i] + (_this.instruments[x].toolTip.offsetWidth * 1.5) > m_canvas.width) {
|
|
1883
|
-
|
|
1882
|
+
if (m_dataPoints.arr[i] + (_this.instruments[x].toolTip.offsetWidth * 1.5) > m_canvas.width) {
|
|
1883
|
+
|
|
1884
1884
|
_this.instruments[x].toolTip.style.left = (obj.instruments[x].x - _this.instruments[x].toolTip.offsetWidth - (pointerWidth / 2)) + 1 + 'px';
|
|
1885
1885
|
} else {
|
|
1886
|
-
|
|
1886
|
+
|
|
1887
1887
|
_this.instruments[x].toolTip.style.left = (obj.instruments[x].x + (pointerWidth / 2)) + 'px';
|
|
1888
1888
|
}
|
|
1889
1889
|
_this.instruments[x].toolTip.style.top = posy + 'px';
|
|
1890
1890
|
toolArray.push({ top: (obj.instruments[x].y - (pointerHeight / 2)), instrument: x });
|
|
1891
|
-
_this.instruments[x].toolTipPointer.style.left = (obj.instruments[x].x - (pointerWidth / 2)) + 1 + 'px';
|
|
1891
|
+
_this.instruments[x].toolTipPointer.style.left = (obj.instruments[x].x - (pointerWidth / 2)) + 1 + 'px';
|
|
1892
1892
|
_this.instruments[x].toolTipPointer.style.top = (obj.instruments[x].y - (pointerHeight / 2)) + 'px';
|
|
1893
1893
|
if (posy > highy) highy = posy;
|
|
1894
1894
|
if (posy < lowy) lowy = posy;
|
|
@@ -1938,7 +1938,7 @@ function Milli_Chart(settings) {
|
|
|
1938
1938
|
startdate = startdate.replaceAll('\/', '-');
|
|
1939
1939
|
enddate = enddate.replaceAll('\/', '-');
|
|
1940
1940
|
m_zoom.mousedown.timestamp = findFirstWeekDay(new Date(startdate + 'T00:00:00Z'));
|
|
1941
|
-
|
|
1941
|
+
() => {};
|
|
1942
1942
|
|
|
1943
1943
|
m_zoom.mouseup.timestamp = new Date(enddate + 'T00:00:00Z');
|
|
1944
1944
|
|
|
@@ -1982,7 +1982,7 @@ function Milli_Chart(settings) {
|
|
|
1982
1982
|
}
|
|
1983
1983
|
}
|
|
1984
1984
|
}
|
|
1985
|
-
if (_this.scaleinfoY.type == 'trades' && count > 0 && _this.instruments[0].closeprice1d) return true;
|
|
1985
|
+
if (_this.scaleinfoY.type == 'trades' && count > 0 && _this.instruments[0].closeprice1d) return true;
|
|
1986
1986
|
var y = (m_chartspaces.chart.bottom - m_chartspaces.chart.top) / 2 + m_chartspaces.chart.top;
|
|
1987
1987
|
var x = (m_chartspaces.chart.right - m_chartspaces.chart.left) / 2 + m_chartspaces.chart.left;
|
|
1988
1988
|
m_ctx.save();
|
|
@@ -2014,7 +2014,7 @@ function Milli_Chart(settings) {
|
|
|
2014
2014
|
|
|
2015
2015
|
_this.drawChart = function() {
|
|
2016
2016
|
if (m_zoom.isZooming) {
|
|
2017
|
-
return;
|
|
2017
|
+
return;
|
|
2018
2018
|
}
|
|
2019
2019
|
|
|
2020
2020
|
for (var i = 0; i < _this.settings.indicators.length; i++) {
|
|
@@ -2057,7 +2057,7 @@ function Milli_Chart(settings) {
|
|
|
2057
2057
|
m_dataPoints.map = new Map();
|
|
2058
2058
|
m_dataPoints.arr = [];
|
|
2059
2059
|
if (_this.instruments.length < 0) {
|
|
2060
|
-
|
|
2060
|
+
() => {};
|
|
2061
2061
|
return;
|
|
2062
2062
|
}
|
|
2063
2063
|
calcChartSpaces();
|
|
@@ -2066,42 +2066,42 @@ function Milli_Chart(settings) {
|
|
|
2066
2066
|
var len = parseInt(_this.settings.chartlen.substring(0, _this.settings.chartlen.length - 1));
|
|
2067
2067
|
m_ctx.clearRect(0, 0, m_canvas.width, m_canvas.height);
|
|
2068
2068
|
m_ctx.lineWidth = 1 / window.devicePixelRatio;
|
|
2069
|
-
m_ctx.textBaseline = 'top';
|
|
2069
|
+
m_ctx.textBaseline = 'top';
|
|
2070
2070
|
var i;
|
|
2071
2071
|
if (period == 'd' && _this.settings.chartlen != 'ytd') {
|
|
2072
2072
|
if (m_zoom.mousedown.timestamp) {
|
|
2073
2073
|
_this.scaleinfoX.endTimeStamp = m_zoom.mouseup.timestamp > m_zoom.mousedown.timestamp ? m_zoom.mouseup.timestamp : m_zoom.mousedown.timestamp;
|
|
2074
2074
|
_this.scaleinfoX.startTimeStamp = m_zoom.mouseup.timestamp < m_zoom.mousedown.timestamp ? m_zoom.mouseup.timestamp : m_zoom.mousedown.timestamp;
|
|
2075
2075
|
} else {
|
|
2076
|
-
_this.scaleinfoX.startTimeStamp = getTickStartDate(len);
|
|
2077
|
-
|
|
2078
|
-
|
|
2076
|
+
_this.scaleinfoX.startTimeStamp = getTickStartDate(len);
|
|
2077
|
+
|
|
2078
|
+
|
|
2079
2079
|
var quoteDate = businessDaysSubtraction(_this.instruments[0].quotedate, len);
|
|
2080
|
-
if (_this.scaleinfoX.startTimeStamp - _this.scaleinfoX.startTimeStamp % 86400000 > quoteDate) {
|
|
2080
|
+
if (_this.scaleinfoX.startTimeStamp - _this.scaleinfoX.startTimeStamp % 86400000 > quoteDate) {
|
|
2081
2081
|
_this.scaleinfoX.startTimeStamp -= _this.scaleinfoX.startTimeStamp - _this.scaleinfoX.startTimeStamp % 86400000;
|
|
2082
2082
|
_this.scaleinfoX.startTimeStamp += quoteDate;
|
|
2083
2083
|
}
|
|
2084
|
-
_this.scaleinfoX.endTimeStamp = new Date();
|
|
2084
|
+
_this.scaleinfoX.endTimeStamp = new Date();
|
|
2085
2085
|
if (len > 1)
|
|
2086
2086
|
_this.scaleinfoX.endTimeStamp = new Date(_this.scaleinfoX.endTimeStamp.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketclose + 'Z').getTime();
|
|
2087
2087
|
else if (len == 1) {
|
|
2088
|
-
|
|
2088
|
+
|
|
2089
2089
|
if (_this.scaleinfoX.startTimeStamp % 86400000 != new Date().getTime() % 86400) {
|
|
2090
2090
|
_this.scaleinfoX.endTimeStamp = new Date(new Date(_this.scaleinfoX.startTimeStamp).toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketclose + 'Z').getTime();
|
|
2091
2091
|
} else
|
|
2092
2092
|
_this.scaleinfoX.endTimeStamp = new Date(_this.scaleinfoX.endTimeStamp.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketclose + 'Z').getTime();
|
|
2093
2093
|
} else {
|
|
2094
|
-
|
|
2094
|
+
|
|
2095
2095
|
var tradetimestamp = new Date(_this.instruments[0].trades[_this.instruments[0].trades.length - 1].timestamp).getTime();
|
|
2096
2096
|
var closetimestamp = new Date(new Date(_this.instruments[0].trades[_this.instruments[0].trades.length - 1].timestamp).toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketclose + 'Z').getTime();
|
|
2097
2097
|
if (closetimestamp < tradetimestamp)
|
|
2098
|
-
_this.scaleinfoX.endTimeStamp = new Date(closetimestamp);
|
|
2098
|
+
_this.scaleinfoX.endTimeStamp = new Date(closetimestamp);
|
|
2099
2099
|
else
|
|
2100
2100
|
_this.scaleinfoX.endTimeStamp = new Date(tradetimestamp);
|
|
2101
2101
|
}
|
|
2102
2102
|
if (_this.scaleinfoX.endTimeStamp - (_this.scaleinfoX.endTimeStamp % 86400000) > _this.instruments[0].quotedate) {
|
|
2103
2103
|
_this.scaleinfoX.endTimeStamp -= _this.scaleinfoX.endTimeStamp - _this.scaleinfoX.endTimeStamp % 86400000;
|
|
2104
|
-
_this.scaleinfoX.endTimeStamp += _this.instruments[0].quotedate;
|
|
2104
|
+
_this.scaleinfoX.endTimeStamp += _this.instruments[0].quotedate;
|
|
2105
2105
|
}
|
|
2106
2106
|
}
|
|
2107
2107
|
setTimeSpanData();
|
|
@@ -2110,7 +2110,7 @@ function Milli_Chart(settings) {
|
|
|
2110
2110
|
for (var s = 1; s < _this.instruments.length; s++) _this.instruments[s].factor = 1;
|
|
2111
2111
|
} else
|
|
2112
2112
|
if (_this.instruments.length > 1) {
|
|
2113
|
-
|
|
2113
|
+
|
|
2114
2114
|
var instrumentprice;
|
|
2115
2115
|
for (i = 0; i < _this.instruments[0].trades.length; i++) {
|
|
2116
2116
|
if (_this.instruments[0].trades[i].timestamp >= _this.scaleinfoX.startTimeStamp) {
|
|
@@ -2147,7 +2147,7 @@ function Milli_Chart(settings) {
|
|
|
2147
2147
|
|
|
2148
2148
|
} else
|
|
2149
2149
|
if (period == 'm') {
|
|
2150
|
-
|
|
2150
|
+
() => {};
|
|
2151
2151
|
|
|
2152
2152
|
if (m_zoom.mousedown.timestamp) {
|
|
2153
2153
|
_this.scaleinfoX.startTimeStamp = m_zoom.mousedown.timestamp > m_zoom.mouseup.timestamp ? m_zoom.mouseup.timestamp : m_zoom.mousedown.timestamp;
|
|
@@ -2162,7 +2162,7 @@ function Milli_Chart(settings) {
|
|
|
2162
2162
|
if (_this.instruments[0].history.length > 1 && _this.scaleinfoX.startTimeStamp < _this.instruments[0].history[0].timestamp) _this.scaleinfoX.startTimeStamp = _this.instruments[0].history[0].timestamp;
|
|
2163
2163
|
|
|
2164
2164
|
_this.scaleinfoX.endTimeStamp = new Date().getTime();
|
|
2165
|
-
_this.scaleinfoX.endTimeStamp = _this.scaleinfoX.endTimeStamp - (_this.scaleinfoX.endTimeStamp % 86400000);
|
|
2165
|
+
_this.scaleinfoX.endTimeStamp = _this.scaleinfoX.endTimeStamp - (_this.scaleinfoX.endTimeStamp % 86400000);
|
|
2166
2166
|
}
|
|
2167
2167
|
setTimeSpanData();
|
|
2168
2168
|
_this.scaleinfoY.type = 'history';
|
|
@@ -2197,7 +2197,7 @@ function Milli_Chart(settings) {
|
|
|
2197
2197
|
_this.scaleinfoX.startTimeStamp = _this.instruments[0].history[0].timestamp;
|
|
2198
2198
|
} else
|
|
2199
2199
|
if (_this.settings.chartlen == 'ytd') {
|
|
2200
|
-
_this.scaleinfoX.startTimeStamp = new Date(new Date().getFullYear() + '-01-01').getTime();
|
|
2200
|
+
_this.scaleinfoX.startTimeStamp = new Date(new Date().getFullYear() + '-01-01').getTime();
|
|
2201
2201
|
} else {
|
|
2202
2202
|
_this.scaleinfoX.startTimeStamp = new Date().getTime() - (86400000 * 365 * (isNaN(len) ? 1 : len));
|
|
2203
2203
|
}
|
|
@@ -2205,7 +2205,7 @@ function Milli_Chart(settings) {
|
|
|
2205
2205
|
_this.scaleinfoX.startTimeStamp = findFirstWeekDay(_this.scaleinfoX.startTimeStamp).getTime();
|
|
2206
2206
|
|
|
2207
2207
|
_this.scaleinfoX.endTimeStamp = new Date().getTime();
|
|
2208
|
-
_this.scaleinfoX.endTimeStamp = _this.scaleinfoX.endTimeStamp - (_this.scaleinfoX.endTimeStamp % 86400000);
|
|
2208
|
+
_this.scaleinfoX.endTimeStamp = _this.scaleinfoX.endTimeStamp - (_this.scaleinfoX.endTimeStamp % 86400000);
|
|
2209
2209
|
}
|
|
2210
2210
|
setTimeSpanData();
|
|
2211
2211
|
_this.scaleinfoY.type = 'history';
|
|
@@ -2227,10 +2227,10 @@ function Milli_Chart(settings) {
|
|
|
2227
2227
|
|
|
2228
2228
|
}
|
|
2229
2229
|
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2230
|
+
|
|
2231
|
+
|
|
2232
|
+
|
|
2233
|
+
|
|
2234
2234
|
}
|
|
2235
2235
|
drawBoxShadow(m_chartspaces.chart);
|
|
2236
2236
|
|
|
@@ -2244,11 +2244,11 @@ function Milli_Chart(settings) {
|
|
|
2244
2244
|
if (_this.settings.curveOnTop == false)
|
|
2245
2245
|
m_ctx.globalCompositeOperation = 'destination-over'
|
|
2246
2246
|
m_ctx.fillStyle = m_chartCss.backgroundColor;
|
|
2247
|
-
|
|
2247
|
+
|
|
2248
2248
|
m_ctx.fillRect(0, 0, m_canvas.width, m_canvas.height);
|
|
2249
2249
|
m_ctx.restore();
|
|
2250
2250
|
}
|
|
2251
|
-
|
|
2251
|
+
|
|
2252
2252
|
};
|
|
2253
2253
|
|
|
2254
2254
|
function drawBoxShadow(space) {
|
|
@@ -2286,7 +2286,7 @@ function Milli_Chart(settings) {
|
|
|
2286
2286
|
|
|
2287
2287
|
if (typeof data.tradecurrency !== 'undefined') instr.tradecurrency = data.tradecurrency;
|
|
2288
2288
|
if (data.marketopen && data.marketclose) {
|
|
2289
|
-
if (new Date('2020-01-01T' + data.marketopen + 'Z') > new Date('2020-01-01T' + data.marketclose + 'Z')) {
|
|
2289
|
+
if (new Date('2020-01-01T' + data.marketopen + 'Z') > new Date('2020-01-01T' + data.marketclose + 'Z')) {
|
|
2290
2290
|
data.marketopen = '00:00:00';
|
|
2291
2291
|
data.marketclose = '22:00:00';
|
|
2292
2292
|
}
|
|
@@ -2318,7 +2318,7 @@ function Milli_Chart(settings) {
|
|
|
2318
2318
|
instr.trades = [];
|
|
2319
2319
|
instr.hashmap.clear();
|
|
2320
2320
|
for (i = 0; i < data.trades.length; i++) {
|
|
2321
|
-
if (data.trades[i].tradecode & 16) {
|
|
2321
|
+
if (data.trades[i].tradecode & 16) {
|
|
2322
2322
|
continue;
|
|
2323
2323
|
}
|
|
2324
2324
|
item = [];
|
|
@@ -2335,7 +2335,7 @@ function Milli_Chart(settings) {
|
|
|
2335
2335
|
}
|
|
2336
2336
|
instr.trades.push(item);
|
|
2337
2337
|
instr.hashmap.set(item.timestamp, item);
|
|
2338
|
-
|
|
2338
|
+
|
|
2339
2339
|
instr.trades.sort(function(a, b) {
|
|
2340
2340
|
return a.timestamp - b.timestamp;
|
|
2341
2341
|
});
|
|
@@ -2348,7 +2348,7 @@ function Milli_Chart(settings) {
|
|
|
2348
2348
|
instr.history = [];
|
|
2349
2349
|
for (i = 0; i < data.history.length; i++) {
|
|
2350
2350
|
item = [];
|
|
2351
|
-
if (typeof data.history[i].date !== 'undefined' && data.history[i].closeprice != null) {
|
|
2351
|
+
if (typeof data.history[i].date !== 'undefined' && data.history[i].closeprice != null) {
|
|
2352
2352
|
var timestamp = new Date(data.history[i].date + 'T00:00:00Z').getTime();
|
|
2353
2353
|
item.timestamp = timestamp;
|
|
2354
2354
|
} else continue;
|
|
@@ -2358,7 +2358,7 @@ function Milli_Chart(settings) {
|
|
|
2358
2358
|
if (typeof data.history[i].dividend !== 'undefined') item.dividend = data.history[i].dividend;
|
|
2359
2359
|
instr.history.push(item);
|
|
2360
2360
|
}
|
|
2361
|
-
if (_this.settings.hcurve && instr.history.length > 0) {
|
|
2361
|
+
if (_this.settings.hcurve && instr.history.length > 0) {
|
|
2362
2362
|
if (!isToday(new Date(instr.history[instr.history.length - 1].timestamp))) {
|
|
2363
2363
|
var addItem = {};
|
|
2364
2364
|
MillistreamWidgetApi_AssignObject(instr.history[instr.history.length - 1], addItem);
|
|
@@ -2383,7 +2383,7 @@ function Milli_Chart(settings) {
|
|
|
2383
2383
|
};
|
|
2384
2384
|
|
|
2385
2385
|
function plotExternalHistoricalData(data) {
|
|
2386
|
-
|
|
2386
|
+
|
|
2387
2387
|
m_ctx.save();
|
|
2388
2388
|
var startpoint = { x: 0, y: 0 };
|
|
2389
2389
|
var endpoint = { x: 0, y: 0 };
|
|
@@ -2407,25 +2407,25 @@ function Milli_Chart(settings) {
|
|
|
2407
2407
|
currentDate.setMinutes(lastdate.getMinutes());
|
|
2408
2408
|
currentDate.setSeconds(lastdate.getSeconds());
|
|
2409
2409
|
|
|
2410
|
-
if (lastdate.toISOString().substring(0, 10) != currentDate.toISOString().substring(0, 10)) {
|
|
2410
|
+
if (lastdate.toISOString().substring(0, 10) != currentDate.toISOString().substring(0, 10)) {
|
|
2411
2411
|
var tmp = new Date(lastdate.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketclose + 'Z');
|
|
2412
2412
|
var nextDate = new Date(data[i].timestamp);
|
|
2413
|
-
tmp = tmp.getTime() + 86400000 - _this.scaleinfoX.milliPerDay;
|
|
2413
|
+
tmp = tmp.getTime() + 86400000 - _this.scaleinfoX.milliPerDay;
|
|
2414
2414
|
currentDate = new Date(tmp);
|
|
2415
2415
|
while (dateDiffInDays(currentDate, nextDate) > 0) {
|
|
2416
2416
|
if (currentDate.getDay() == 0 || currentDate.getDay() == 6)
|
|
2417
2417
|
offset += 86400000 / _this.scaleinfoX.timePerPixel;
|
|
2418
2418
|
else
|
|
2419
|
-
offset += ((86400000 - _this.scaleinfoX.milliPerDay) / _this.scaleinfoX.timePerPixel);
|
|
2419
|
+
offset += ((86400000 - _this.scaleinfoX.milliPerDay) / _this.scaleinfoX.timePerPixel);
|
|
2420
2420
|
currentDate = new Date(currentDate.getTime() + 86400000);
|
|
2421
2421
|
}
|
|
2422
|
-
offset += ((86400000 - _this.scaleinfoX.milliPerDay) / _this.scaleinfoX.timePerPixel);
|
|
2422
|
+
offset += ((86400000 - _this.scaleinfoX.milliPerDay) / _this.scaleinfoX.timePerPixel);
|
|
2423
2423
|
lastdate = currentDate;
|
|
2424
2424
|
startpoint.x = Math.round(m_chartspaces.chart.left + ((data[i].timestamp - startDate) / _this.scaleinfoX.timePerPixel)) + 0.5 - offset;
|
|
2425
|
-
|
|
2425
|
+
|
|
2426
2426
|
|
|
2427
2427
|
}
|
|
2428
|
-
|
|
2428
|
+
|
|
2429
2429
|
startpoint.y = Math.round(m_chartspaces.chart.height - getScaledSetting(m_chartCss.marginBottom) - (((data[i].price * factor) - _this.scaleinfoY.minValue) * _this.scaleinfoY.valuePerPixel)) + 0.5;
|
|
2430
2430
|
maxy = maxy > startpoint.y ? maxy : startpoint.y;
|
|
2431
2431
|
|
|
@@ -2467,19 +2467,19 @@ function Milli_Chart(settings) {
|
|
|
2467
2467
|
var endtimeToday = new Date(data[i].timestamp);
|
|
2468
2468
|
if (endtimeToday.getDay() == 0 || endtimeToday.getDay() == 6) continue;
|
|
2469
2469
|
if (_this.scaleinfoY.type != 'history') {
|
|
2470
|
-
endtimeToday = new Date(endtimeToday.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketclose + 'Z');
|
|
2470
|
+
endtimeToday = new Date(endtimeToday.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketclose + 'Z');
|
|
2471
2471
|
}
|
|
2472
2472
|
if (data[i].timestamp > endtimeToday.getTime()) {
|
|
2473
|
-
continue;
|
|
2473
|
+
continue;
|
|
2474
2474
|
}
|
|
2475
2475
|
currentDate = new Date(data[i].timestamp);
|
|
2476
2476
|
currentDate.setHours(lastdate.getHours());
|
|
2477
2477
|
currentDate.setMinutes(lastdate.getMinutes());
|
|
2478
2478
|
currentDate.setSeconds(lastdate.getSeconds());
|
|
2479
|
-
if (lastdate.toISOString().substring(0, 10) != currentDate.toISOString().substring(0, 10)) {
|
|
2479
|
+
if (lastdate.toISOString().substring(0, 10) != currentDate.toISOString().substring(0, 10)) {
|
|
2480
2480
|
tmp = new Date(lastdate.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketclose + 'Z');
|
|
2481
2481
|
var nextDate = new Date(data[i].timestamp);
|
|
2482
|
-
tmp = tmp.getTime() + 86400000 - _this.scaleinfoX.milliPerDay;
|
|
2482
|
+
tmp = tmp.getTime() + 86400000 - _this.scaleinfoX.milliPerDay;
|
|
2483
2483
|
|
|
2484
2484
|
currentDate = new Date(tmp);
|
|
2485
2485
|
while (dateDiffInDays(currentDate, nextDate) > 0) {
|
|
@@ -2489,11 +2489,11 @@ function Milli_Chart(settings) {
|
|
|
2489
2489
|
offset += ((86400000 - _this.scaleinfoX.milliPerDay) / _this.scaleinfoX.timePerPixel);
|
|
2490
2490
|
currentDate = new Date(currentDate.getTime() + 86400000);
|
|
2491
2491
|
}
|
|
2492
|
-
offset += ((86400000 - _this.scaleinfoX.milliPerDay) / _this.scaleinfoX.timePerPixel);
|
|
2492
|
+
offset += ((86400000 - _this.scaleinfoX.milliPerDay) / _this.scaleinfoX.timePerPixel);
|
|
2493
2493
|
lastdate = currentDate;
|
|
2494
2494
|
startpoint.x = Math.round(m_chartspaces.chart.left + ((data[i].timestamp - startDate) / _this.scaleinfoX.timePerPixel)) + 0.5 - offset;
|
|
2495
2495
|
|
|
2496
|
-
|
|
2496
|
+
|
|
2497
2497
|
if (_this.scaleinfoY.type == 'trades' && tmpx < startpoint.x) {
|
|
2498
2498
|
ret.push(startpoint.x, startpoint.y);
|
|
2499
2499
|
}
|
|
@@ -2529,7 +2529,7 @@ function Milli_Chart(settings) {
|
|
|
2529
2529
|
if (line.length == 0) return;
|
|
2530
2530
|
m_ctx.save();
|
|
2531
2531
|
m_ctx.beginPath();
|
|
2532
|
-
m_ctx.closePath();
|
|
2532
|
+
m_ctx.closePath();
|
|
2533
2533
|
m_ctx.moveTo(line[0].x, line[0].y);
|
|
2534
2534
|
for (var i = 1; i < line.length; i++) {
|
|
2535
2535
|
m_ctx.lineTo(line[i].x, line[i].y);
|
|
@@ -2560,7 +2560,7 @@ function Milli_Chart(settings) {
|
|
|
2560
2560
|
}
|
|
2561
2561
|
var sma = calcAnalyzisLine(data, 2);
|
|
2562
2562
|
m_ctx.beginPath();
|
|
2563
|
-
m_ctx.closePath();
|
|
2563
|
+
m_ctx.closePath();
|
|
2564
2564
|
m_ctx.moveTo(sma[0].x, sma[0].y);
|
|
2565
2565
|
for (i = 0; i < sma.length; i++) m_ctx.lineTo(sma[i].x, sma[i].y);
|
|
2566
2566
|
m_ctx.stroke();
|
|
@@ -2571,7 +2571,7 @@ function Milli_Chart(settings) {
|
|
|
2571
2571
|
function plotData(data, instrument) {
|
|
2572
2572
|
m_ctx.save();
|
|
2573
2573
|
if (_this.settings.curveOnTop == false)
|
|
2574
|
-
m_ctx.globalCompositeOperation = 'destination-over';
|
|
2574
|
+
m_ctx.globalCompositeOperation = 'destination-over';
|
|
2575
2575
|
m_ctx.strokeStyle = m_instrumentCss[instrument].color;
|
|
2576
2576
|
var factor = _this.instruments[instrument].factor;
|
|
2577
2577
|
var startpoint = { x: 0, y: 0 };
|
|
@@ -2592,7 +2592,7 @@ function Milli_Chart(settings) {
|
|
|
2592
2592
|
|
|
2593
2593
|
for (var i = 0; i < len; i++) {
|
|
2594
2594
|
var currentDate;
|
|
2595
|
-
|
|
2595
|
+
|
|
2596
2596
|
var tmpx = startpoint.x;
|
|
2597
2597
|
var tmp;
|
|
2598
2598
|
if (data[i].timestamp < _this.scaleinfoX.startTimeStamp) {
|
|
@@ -2600,42 +2600,42 @@ function Milli_Chart(settings) {
|
|
|
2600
2600
|
continue;
|
|
2601
2601
|
}
|
|
2602
2602
|
if (data[i].timestamp > _this.scaleinfoX.endTimeStamp) {
|
|
2603
|
-
break;
|
|
2603
|
+
break;
|
|
2604
2604
|
}
|
|
2605
2605
|
if (data[i].timestamp > new Date().getTime())
|
|
2606
2606
|
break;
|
|
2607
2607
|
|
|
2608
2608
|
if (_this.scaleinfoY.type != 'history' && (data[i].timestamp % 86400000 < _this.instruments[0].opentimestamp || data[i].timestamp % 86400000 > _this.instruments[0].closetimestamp)) {
|
|
2609
|
-
|
|
2609
|
+
|
|
2610
2610
|
continue;
|
|
2611
2611
|
}
|
|
2612
2612
|
var endtimeToday = new Date(data[i].timestamp);
|
|
2613
|
-
if (endtimeToday.getDay() == 0 || endtimeToday.getDay() == 6) continue;
|
|
2613
|
+
if (endtimeToday.getDay() == 0 || endtimeToday.getDay() == 6) continue;
|
|
2614
2614
|
if (_this.scaleinfoY.type != 'history') {
|
|
2615
|
-
endtimeToday = new Date(endtimeToday.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketclose + 'Z');
|
|
2615
|
+
endtimeToday = new Date(endtimeToday.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketclose + 'Z');
|
|
2616
2616
|
}
|
|
2617
2617
|
if (data[i].timestamp > endtimeToday.getTime()) {
|
|
2618
|
-
continue;
|
|
2618
|
+
continue;
|
|
2619
2619
|
}
|
|
2620
2620
|
|
|
2621
2621
|
if (_this.scaleinfoY.type == 'history') {
|
|
2622
|
-
|
|
2623
|
-
|
|
2622
|
+
|
|
2623
|
+
|
|
2624
2624
|
} else
|
|
2625
|
-
if (_this.settings.previousDayClose && addedcloseprice1d == false && m_zoom.mouseup.timestamp == null) {
|
|
2625
|
+
if (_this.settings.previousDayClose && addedcloseprice1d == false && m_zoom.mouseup.timestamp == null) {
|
|
2626
2626
|
currentDate = new Date(data[i].timestamp);
|
|
2627
2627
|
offset = ((86400000 - _this.scaleinfoX.milliPerDay) / _this.scaleinfoX.timePerPixel) * dateDiffInDays(new Date(startDate), currentDate);
|
|
2628
2628
|
tmp = new Date(currentDate.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketopen + 'Z');
|
|
2629
2629
|
endpoint.x = Math.round(m_chartspaces.chart.left + ((tmp.getTime() - startDate) / _this.scaleinfoX.timePerPixel)) + 0.5 - offset;
|
|
2630
2630
|
|
|
2631
|
-
|
|
2631
|
+
|
|
2632
2632
|
endpoint.y = Math.round(m_chartspaces.chart.height - getScaledSetting(m_chartCss.marginBottom) - (((parseFloat(_this.instruments[instrument].startValue)) - _this.scaleinfoY.minValue) * _this.scaleinfoY.valuePerPixel)) + 0.5;
|
|
2633
2633
|
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2634
|
+
|
|
2635
|
+
|
|
2636
|
+
|
|
2637
|
+
|
|
2638
|
+
|
|
2639
2639
|
m_ctx.moveTo(endpoint.x, endpoint.y);
|
|
2640
2640
|
lastdate = new Date(data[i].timestamp);
|
|
2641
2641
|
addedcloseprice1d = true;
|
|
@@ -2646,25 +2646,25 @@ function Milli_Chart(settings) {
|
|
|
2646
2646
|
currentDate.setHours(lastdate.getHours());
|
|
2647
2647
|
currentDate.setMinutes(lastdate.getMinutes());
|
|
2648
2648
|
currentDate.setSeconds(lastdate.getSeconds());
|
|
2649
|
-
if (lastdate.toISOString().substring(0, 10) != currentDate.toISOString().substring(0, 10)) {
|
|
2649
|
+
if (lastdate.toISOString().substring(0, 10) != currentDate.toISOString().substring(0, 10)) {
|
|
2650
2650
|
tmp = new Date(lastdate.toISOString().substring(0, 10) + 'T' + _this.instruments[0].marketclose + 'Z');
|
|
2651
|
-
|
|
2651
|
+
|
|
2652
2652
|
var nextDate = new Date(data[i].timestamp);
|
|
2653
|
-
tmp = tmp.getTime() + 86400000 - _this.scaleinfoX.milliPerDay;
|
|
2653
|
+
tmp = tmp.getTime() + 86400000 - _this.scaleinfoX.milliPerDay;
|
|
2654
2654
|
|
|
2655
2655
|
currentDate = new Date(tmp);
|
|
2656
2656
|
while (dateDiffInDays(currentDate, nextDate) > 0) {
|
|
2657
2657
|
if (currentDate.getDay() == 0 || currentDate.getDay() == 6)
|
|
2658
2658
|
offset += 86400000 / _this.scaleinfoX.timePerPixel;
|
|
2659
2659
|
else
|
|
2660
|
-
offset += ((86400000 - _this.scaleinfoX.milliPerDay) / _this.scaleinfoX.timePerPixel);
|
|
2660
|
+
offset += ((86400000 - _this.scaleinfoX.milliPerDay) / _this.scaleinfoX.timePerPixel);
|
|
2661
2661
|
currentDate = new Date(currentDate.getTime() + 86400000);
|
|
2662
2662
|
}
|
|
2663
|
-
offset += ((86400000 - _this.scaleinfoX.milliPerDay) / _this.scaleinfoX.timePerPixel);
|
|
2663
|
+
offset += ((86400000 - _this.scaleinfoX.milliPerDay) / _this.scaleinfoX.timePerPixel);
|
|
2664
2664
|
lastdate = currentDate;
|
|
2665
2665
|
startpoint.x = Math.round(m_chartspaces.chart.left + ((data[i].timestamp - startDate) / _this.scaleinfoX.timePerPixel)) + 0.5 - offset;
|
|
2666
2666
|
|
|
2667
|
-
|
|
2667
|
+
|
|
2668
2668
|
if (_this.scaleinfoY.type == 'trades' && tmpx < startpoint.x) {
|
|
2669
2669
|
m_ctx.lineTo(startpoint.x, startpoint.y);
|
|
2670
2670
|
}
|
|
@@ -2693,7 +2693,7 @@ function Milli_Chart(settings) {
|
|
|
2693
2693
|
if (tmpx < startpoint.x) {
|
|
2694
2694
|
if (_this.settings.hcurve) m_ctx.lineTo(startpoint.x, endpoint.y);
|
|
2695
2695
|
m_ctx.lineTo(startpoint.x, startpoint.y);
|
|
2696
|
-
|
|
2696
|
+
|
|
2697
2697
|
|
|
2698
2698
|
if (instrument == 0) {
|
|
2699
2699
|
point = { price: data[i].price, open: data[i].openprice, x: startpoint.x / window.devicePixelRatio - 0.5, y: startpoint.y / window.devicePixelRatio - 0.5, timestamp: data[i].timestamp, date: new Date(data[i].timestamp), quantity: quantity };
|
|
@@ -2710,7 +2710,7 @@ function Milli_Chart(settings) {
|
|
|
2710
2710
|
m_datapoints.push(point);
|
|
2711
2711
|
if (_this.settings.hcurve && _this.scaleinfoY.type == 'history') {
|
|
2712
2712
|
if (isToday(currentDate)) {
|
|
2713
|
-
|
|
2713
|
+
|
|
2714
2714
|
m_ctx.moveTo(m_chartspaces.chart.left, startpoint.y);
|
|
2715
2715
|
point = { price: data[i].price, open: data[i].openprice, x: m_chartspaces.chart.left / window.devicePixelRatio - 0.5, y: startpoint.y / window.devicePixelRatio - 0.5, timestamp: data[i].timestamp, date: new Date(data[i].timestamp), insref: _this.instruments[instrument].insref, diff: data[i].diff, quantity: quantity };
|
|
2716
2716
|
m_datapoints.push(point);
|
|
@@ -2718,12 +2718,12 @@ function Milli_Chart(settings) {
|
|
|
2718
2718
|
m_datapoints.push(point);
|
|
2719
2719
|
startx = m_chartspaces.chart.left;
|
|
2720
2720
|
starty = startpoint.y;
|
|
2721
|
-
|
|
2721
|
+
|
|
2722
2722
|
break;
|
|
2723
2723
|
} else if (hCurveLastPoint) {
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2724
|
+
|
|
2725
|
+
|
|
2726
|
+
|
|
2727
2727
|
}
|
|
2728
2728
|
}
|
|
2729
2729
|
quantity = 0;
|
|
@@ -2736,7 +2736,7 @@ function Milli_Chart(settings) {
|
|
|
2736
2736
|
endpoint.y = startpoint.y;
|
|
2737
2737
|
}
|
|
2738
2738
|
if (data[i].dividend) {
|
|
2739
|
-
|
|
2739
|
+
|
|
2740
2740
|
}
|
|
2741
2741
|
}
|
|
2742
2742
|
m_dataPoints.arr.sort(function(a, b) {
|
|
@@ -2760,7 +2760,7 @@ function Milli_Chart(settings) {
|
|
|
2760
2760
|
m_ctx.fill();
|
|
2761
2761
|
} else
|
|
2762
2762
|
m_ctx.closePath();
|
|
2763
|
-
|
|
2763
|
+
|
|
2764
2764
|
if (instrument == 0) {
|
|
2765
2765
|
drawPriceIndicator();
|
|
2766
2766
|
drawClosePriceIndicator();
|
|
@@ -2769,13 +2769,13 @@ function Milli_Chart(settings) {
|
|
|
2769
2769
|
m_ctx.restore();
|
|
2770
2770
|
}
|
|
2771
2771
|
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2772
|
+
|
|
2773
|
+
|
|
2774
|
+
|
|
2775
|
+
|
|
2776
|
+
|
|
2777
|
+
|
|
2778
|
+
|
|
2779
2779
|
|
|
2780
2780
|
_this.setChartLength = function(len) {
|
|
2781
2781
|
_this.settings.chartlen = len;
|
|
@@ -2907,7 +2907,7 @@ function Milli_Chart(settings) {
|
|
|
2907
2907
|
};
|
|
2908
2908
|
req.open("GET", url, true);
|
|
2909
2909
|
req.onerror = function(error) {
|
|
2910
|
-
|
|
2910
|
+
() => {};
|
|
2911
2911
|
};
|
|
2912
2912
|
req.send();
|
|
2913
2913
|
}
|
|
@@ -2919,9 +2919,9 @@ function Milli_Chart(settings) {
|
|
|
2919
2919
|
fetchHistory(c.insref);
|
|
2920
2920
|
}
|
|
2921
2921
|
});
|
|
2922
|
-
|
|
2922
|
+
|
|
2923
2923
|
};
|
|
2924
|
-
|
|
2924
|
+
|
|
2925
2925
|
_this.removeAllCompares = function() {
|
|
2926
2926
|
if (_this.instruments.length == 1) return;
|
|
2927
2927
|
for (var i = 0; i < 3; i++)
|
|
@@ -2972,7 +2972,7 @@ function Milli_Chart(settings) {
|
|
|
2972
2972
|
fetchHistory(insref);
|
|
2973
2973
|
return 1;
|
|
2974
2974
|
};
|
|
2975
|
-
|
|
2975
|
+
|
|
2976
2976
|
|
|
2977
2977
|
function setChartSize() {
|
|
2978
2978
|
var offset = 0;
|
|
@@ -2981,8 +2981,8 @@ function Milli_Chart(settings) {
|
|
|
2981
2981
|
}
|
|
2982
2982
|
_this.settings.target.style.height = (_this.settings.target.parentNode.offsetHeight - offset) + 'px';
|
|
2983
2983
|
_this.settings.target.style.width = _this.settings.target.parentNode.offsetWidth + 'px';
|
|
2984
|
-
|
|
2985
|
-
|
|
2984
|
+
|
|
2985
|
+
|
|
2986
2986
|
m_canvas.setRect(_this.settings.target.offsetHeight, _this.settings.target.offsetWidth);
|
|
2987
2987
|
}
|
|
2988
2988
|
|
|
@@ -3002,8 +3002,8 @@ function Milli_Chart(settings) {
|
|
|
3002
3002
|
diff = (m_resizing.width - m_canvas.width) / m_canvas.width * 100;
|
|
3003
3003
|
if (Math.abs(diff) > 1) {
|
|
3004
3004
|
setChartSize();
|
|
3005
|
-
|
|
3006
|
-
|
|
3005
|
+
|
|
3006
|
+
|
|
3007
3007
|
m_resizing.width = m_canvas.width;
|
|
3008
3008
|
m_resizing.height = m_canvas.height;
|
|
3009
3009
|
_this.drawChart();
|
|
@@ -3035,11 +3035,11 @@ function Milli_Chart(settings) {
|
|
|
3035
3035
|
m_canvas = MillistreamWidgetApi_addElement(_this, 'canvas', 'millistream-chart-canvas', _this.settings.target);
|
|
3036
3036
|
m_ctx = m_canvas.getContext("2d");
|
|
3037
3037
|
setChartSize();
|
|
3038
|
-
m_canvas.addEventListener('mousemove', onMouseMove, false);
|
|
3038
|
+
m_canvas.addEventListener('mousemove', onMouseMove, false);
|
|
3039
3039
|
m_canvas.addEventListener('mouseout', onMouseOut, false);
|
|
3040
3040
|
m_canvas.style.cursor = "crosshair";
|
|
3041
3041
|
m_canvas.onmousedown = (function(evt) {
|
|
3042
|
-
if (!evt.which == 1) return;
|
|
3042
|
+
if (!evt.which == 1) return;
|
|
3043
3043
|
if (_this.settings.enablezoom == false) return;
|
|
3044
3044
|
if (m_datapoints.length == 0) return;
|
|
3045
3045
|
var rect = m_canvas.getBoundingClientRect();
|
|
@@ -3065,7 +3065,7 @@ function Milli_Chart(settings) {
|
|
|
3065
3065
|
clearZoom();
|
|
3066
3066
|
return;
|
|
3067
3067
|
}
|
|
3068
|
-
if (Math.abs(x - m_zoom.mousedown.pos) > 5) {
|
|
3068
|
+
if (Math.abs(x - m_zoom.mousedown.pos) > 5) {
|
|
3069
3069
|
var i;
|
|
3070
3070
|
for (i = m_datapoints.length - 1; i > 0; i--) {
|
|
3071
3071
|
if (x >= m_datapoints[i].x) {
|
|
@@ -3082,7 +3082,7 @@ function Milli_Chart(settings) {
|
|
|
3082
3082
|
m_zoom.mousedown.pos = 0;
|
|
3083
3083
|
m_zoom.mousedown.i = 0;
|
|
3084
3084
|
if (m_zoom.mousedown.oldtimestamp != null) {
|
|
3085
|
-
m_zoom.mousedown.timestamp = m_zoom.mousedown.oldtimestamp;
|
|
3085
|
+
m_zoom.mousedown.timestamp = m_zoom.mousedown.oldtimestamp;
|
|
3086
3086
|
m_zoom.mousedown.oldtimestamp = null;
|
|
3087
3087
|
} else
|
|
3088
3088
|
m_zoom.mousedown.timestamp = null;
|
|
@@ -3170,27 +3170,27 @@ function Milli_Chart(settings) {
|
|
|
3170
3170
|
var data = instr.hashmap.get(timestamp);
|
|
3171
3171
|
if (typeof data === 'undefined') {
|
|
3172
3172
|
data = {};
|
|
3173
|
-
|
|
3173
|
+
|
|
3174
3174
|
data.timestamp = timestamp;
|
|
3175
3175
|
calcAnalyizis = true;
|
|
3176
3176
|
if (instr.pricetype == 'price') {
|
|
3177
3177
|
update = true;
|
|
3178
|
-
data.price = parseFloat(json['12']);
|
|
3179
|
-
data.open = parseFloat(json['12']);
|
|
3180
|
-
data.high = parseFloat(json['12']);
|
|
3181
|
-
data.low = parseFloat(json['12']);
|
|
3178
|
+
data.price = parseFloat(json['12']);
|
|
3179
|
+
data.open = parseFloat(json['12']);
|
|
3180
|
+
data.high = parseFloat(json['12']);
|
|
3181
|
+
data.low = parseFloat(json['12']);
|
|
3182
3182
|
data.quantity = typeof json['13'] === 'undefined' ? 0 : parseInt(json['13']);
|
|
3183
3183
|
} else if (instr.pricetype == 'price') {
|
|
3184
|
-
data.price = parseFloat(json['201']);
|
|
3185
|
-
data.open = parseFloat(json['201']);
|
|
3186
|
-
data.high = parseFloat(json['201']);
|
|
3187
|
-
data.low = parseFloat(json['201']);
|
|
3184
|
+
data.price = parseFloat(json['201']);
|
|
3185
|
+
data.open = parseFloat(json['201']);
|
|
3186
|
+
data.high = parseFloat(json['201']);
|
|
3187
|
+
data.low = parseFloat(json['201']);
|
|
3188
3188
|
data.quantity = typeof json['13'] === 'undefined' ? 0 : parseInt(json['13']);
|
|
3189
3189
|
update = true;
|
|
3190
3190
|
}
|
|
3191
3191
|
if (update) {
|
|
3192
3192
|
if (instr.trades.length != 0 && data.timestamp < instr.trades[instr.trades.length - 1].timestamp) {
|
|
3193
|
-
|
|
3193
|
+
|
|
3194
3194
|
} else
|
|
3195
3195
|
instr.hashmap.set(data.timestamp, data);
|
|
3196
3196
|
instr.trades.push(data);
|
|
@@ -3199,24 +3199,24 @@ function Milli_Chart(settings) {
|
|
|
3199
3199
|
if (instr.pricetype == 'price') {
|
|
3200
3200
|
if (data.price != parseFloat(json['12']))
|
|
3201
3201
|
calcAnalyizis = true;
|
|
3202
|
-
data.price = parseFloat(json['12']);
|
|
3202
|
+
data.price = parseFloat(json['12']);
|
|
3203
3203
|
data.quantity += typeof json['13'] === 'undefined' ? 0 : parseInt(json['13']);
|
|
3204
3204
|
if (_this.scaleinfoY.type == 'trades') update = true;
|
|
3205
3205
|
} else {
|
|
3206
3206
|
if (instr.pricetype == 'price') {
|
|
3207
3207
|
if (data.price != parseFloat(json['201']))
|
|
3208
3208
|
calcAnalyizis = true;
|
|
3209
|
-
data.price = parseFloat(json['201']);
|
|
3209
|
+
data.price = parseFloat(json['201']);
|
|
3210
3210
|
data.quantity += typeof json['13'] === 'undefined' ? 0 : parseInt(json['13']);
|
|
3211
3211
|
if (_this.scaleinfoY.type == 'trades') update = true;
|
|
3212
3212
|
}
|
|
3213
|
-
|
|
3213
|
+
|
|
3214
3214
|
}
|
|
3215
3215
|
}
|
|
3216
3216
|
}
|
|
3217
3217
|
if (calcAnalyizis && insref == _this.instruments[0].insref) {
|
|
3218
3218
|
for (var i = 0; i < _this.settings.indicators.length; i++) {
|
|
3219
|
-
|
|
3219
|
+
|
|
3220
3220
|
switch (_this.settings.indicators[i].method) {
|
|
3221
3221
|
case 'sma':
|
|
3222
3222
|
_this.settings.indicators[i].trades = [];
|
|
@@ -3231,7 +3231,7 @@ function Milli_Chart(settings) {
|
|
|
3231
3231
|
_this.settings.indicators[i].trades = bollingerBands(_this.instruments[0].trades, _this.settings.indicators[i].method_length, _this.settings.indicators[i].stddev | 2);
|
|
3232
3232
|
break;
|
|
3233
3233
|
default:
|
|
3234
|
-
|
|
3234
|
+
|
|
3235
3235
|
break;
|
|
3236
3236
|
}
|
|
3237
3237
|
}
|
|
@@ -3243,14 +3243,14 @@ function Milli_Chart(settings) {
|
|
|
3243
3243
|
};
|
|
3244
3244
|
}
|
|
3245
3245
|
|
|
3246
|
-
|
|
3246
|
+
|
|
3247
3247
|
_this.exportData = function() {
|
|
3248
3248
|
let ret = [];
|
|
3249
3249
|
|
|
3250
3250
|
if (_this.scaleinfoY.type == 'trades') {
|
|
3251
3251
|
if (_this.instruments.length > 0) {
|
|
3252
3252
|
for (var i = 0; i < _this.instruments[0].trades.length; i++) {
|
|
3253
|
-
var date = new Date(_this.instruments[0].trades[i].timestamp - new Date().getTimezoneOffset() * 60000);
|
|
3253
|
+
var date = new Date(_this.instruments[0].trades[i].timestamp - new Date().getTimezoneOffset() * 60000);
|
|
3254
3254
|
var datestr = date.toISOString();
|
|
3255
3255
|
|
|
3256
3256
|
ret.push([datestr.substring(0, 10), datestr.substring(11, 23), _this.instruments[0].trades[i].price, _this.instruments[0].trades[i].quantity]);
|
|
@@ -3279,7 +3279,7 @@ function Milli_Chart(settings) {
|
|
|
3279
3279
|
}
|
|
3280
3280
|
|
|
3281
3281
|
_this.destroyWidget = function() {
|
|
3282
|
-
|
|
3282
|
+
|
|
3283
3283
|
if (MillistreamWidgetApi_isObjectEmpty(_this.unsubscriptions) == false)
|
|
3284
3284
|
_this.requestid = _this.settings.streaming.MillistreamWidgetStreamingApi_subscribeInstruments(_this, _this.requestid, []);
|
|
3285
3285
|
return 0;
|
|
@@ -3319,7 +3319,7 @@ function Milli_Chart(settings) {
|
|
|
3319
3319
|
}
|
|
3320
3320
|
|
|
3321
3321
|
_this.drawWidget = function() {
|
|
3322
|
-
|
|
3322
|
+
|
|
3323
3323
|
_this.settings.fields = _this.settings.fields.filter(function(obj) {
|
|
3324
3324
|
return ['name', 'tradecurrency', 'time', 'date', 'tradeprice', 'tradequantity', 'marketopen', 'marketclose', 'closeprice1d', 'closeprice', 'closequantity'].indexOf(obj) == -1;
|
|
3325
3325
|
});
|
|
@@ -3345,7 +3345,7 @@ function Milli_Chart(settings) {
|
|
|
3345
3345
|
var e = new Date();
|
|
3346
3346
|
var days = 0;
|
|
3347
3347
|
var newlen = 0;
|
|
3348
|
-
while (days < _this.settings.intradaylen - 1) {
|
|
3348
|
+
while (days < _this.settings.intradaylen - 1) {
|
|
3349
3349
|
d -= 86400000;
|
|
3350
3350
|
e.setTime(d);
|
|
3351
3351
|
if (e.getDay() != 0 && e.getDay() != 6)
|
|
@@ -3386,7 +3386,7 @@ function Milli_Chart(settings) {
|
|
|
3386
3386
|
|
|
3387
3387
|
(function updatePixelRatio() {
|
|
3388
3388
|
matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`).addEventListener('change', updatePixelRatio, { once: true });
|
|
3389
|
-
|
|
3389
|
+
() => {};
|
|
3390
3390
|
_this.drawChart();
|
|
3391
3391
|
})();
|
|
3392
3392
|
|
|
@@ -3445,14 +3445,14 @@ function MillistreamWidgetApi_buildQuery(widget, type) {
|
|
|
3445
3445
|
if (typeof widget.settings.instrumenttype !== 'object') {
|
|
3446
3446
|
throw new Error(widget.constructor.name + ': instrumenttype is not valid');
|
|
3447
3447
|
}
|
|
3448
|
-
|
|
3448
|
+
|
|
3449
3449
|
url += '&instrumenttypes=' + widget.settings.instrumenttype.join();
|
|
3450
3450
|
}
|
|
3451
3451
|
if (widget.settings.instrumentsubtype != null) {
|
|
3452
3452
|
if (typeof widget.settings.instrumentsubtype !== 'object') {
|
|
3453
3453
|
throw new Error(widget.constructor.name + ': instrumentsubtype is not valid');
|
|
3454
3454
|
}
|
|
3455
|
-
|
|
3455
|
+
|
|
3456
3456
|
url += '&instrumentsubtypes=' + widget.settings.instrumentsubtype.join();
|
|
3457
3457
|
}
|
|
3458
3458
|
if (widget.settings.derivativeindicator != null) {
|
|
@@ -3801,12 +3801,12 @@ function MillistreamWidgetApi_addPagination(widget) {
|
|
|
3801
3801
|
li.onclick = function() {
|
|
3802
3802
|
MillistreamWidgetApi_getPaginationPage(widget, 'next');
|
|
3803
3803
|
};
|
|
3804
|
-
if (widget.pagination.numPages < max + 1) li.style.display = 'none';
|
|
3804
|
+
if (widget.pagination.numPages < max + 1) li.style.display = 'none';
|
|
3805
3805
|
li = MillistreamWidgetApi_addElement(widget, 'li', 'millistream-list-pagination-li', widget.pagination.ul, null, '>>');
|
|
3806
3806
|
li.onclick = function() {
|
|
3807
3807
|
MillistreamWidgetApi_getPaginationPage(widget, 'last');
|
|
3808
3808
|
};
|
|
3809
|
-
if (widget.pagination.numPages < max + 1) li.style.display = 'none';
|
|
3809
|
+
if (widget.pagination.numPages < max + 1) li.style.display = 'none';
|
|
3810
3810
|
}
|
|
3811
3811
|
} else
|
|
3812
3812
|
if (widget.settings.pagination > 0 && widget.pagination.numPages < 2) {
|
|
@@ -3874,11 +3874,11 @@ function MillistreamWidgetApi_getPaginationPage(widget, page) {
|
|
|
3874
3874
|
startno = 1;
|
|
3875
3875
|
} else
|
|
3876
3876
|
if (widget.pagination.selectedPage > widget.pagination.numPages - 2) {
|
|
3877
|
-
startno = widget.pagination.numPages - (max - 1);
|
|
3877
|
+
startno = widget.pagination.numPages - (max - 1);
|
|
3878
3878
|
|
|
3879
3879
|
} else {
|
|
3880
3880
|
startno = widget.pagination.selectedPage - 2 < 1 ? 1 : widget.pagination.selectedPage - (max - Math.ceil(max / 2));
|
|
3881
|
-
|
|
3881
|
+
|
|
3882
3882
|
}
|
|
3883
3883
|
for (i = 2; i < items.length - 2; i++) {
|
|
3884
3884
|
items[i].innerHTML = (startno);
|
|
@@ -3917,15 +3917,15 @@ function MillistreamWidgetApi_getElementHeight(el) {
|
|
|
3917
3917
|
return rect.height + s;
|
|
3918
3918
|
}
|
|
3919
3919
|
|
|
3920
|
-
|
|
3920
|
+
|
|
3921
3921
|
function MillistreamWidgetApi_clearFlash(el) {
|
|
3922
|
-
|
|
3922
|
+
|
|
3923
3923
|
el.classList.remove('millistream-flash-up');
|
|
3924
3924
|
el.classList.remove('millistream-flash-down');
|
|
3925
3925
|
}
|
|
3926
3926
|
|
|
3927
3927
|
function milli_clearValuedFlash(widget, el, oldValue) {
|
|
3928
|
-
|
|
3928
|
+
|
|
3929
3929
|
var currentValue = MillistreamWidgetApi_getElementNumber(widget, el);
|
|
3930
3930
|
if (currentValue == oldValue || currentValue == 0) {
|
|
3931
3931
|
MillistreamWidgetApi_clearFlash(el);
|
|
@@ -3933,7 +3933,7 @@ function milli_clearValuedFlash(widget, el, oldValue) {
|
|
|
3933
3933
|
}
|
|
3934
3934
|
|
|
3935
3935
|
function MillistreamWidgetApi_flashElement(widget, el, newValue, oldValue) {
|
|
3936
|
-
|
|
3936
|
+
|
|
3937
3937
|
if (newValue == oldValue) return;
|
|
3938
3938
|
MillistreamWidgetApi_clearFlash(el);
|
|
3939
3939
|
if (newValue == '' || !newValue) return;
|
|
@@ -3952,7 +3952,7 @@ function MillistreamWidgetApi_flashElement(widget, el, newValue, oldValue) {
|
|
|
3952
3952
|
}
|
|
3953
3953
|
|
|
3954
3954
|
|
|
3955
|
-
|
|
3955
|
+
|
|
3956
3956
|
function MillistreamWidgetApi_isNumber(widget, testsubject) {
|
|
3957
3957
|
if (!testsubject) return;
|
|
3958
3958
|
var n = testsubject.replace(widget.settings.decimalseparator, '.').split(widget.settings.thousandseparator).join('');
|
|
@@ -3965,7 +3965,7 @@ function MillistreamWidgetApi_getNumDecimals(widget, value, current, validfields
|
|
|
3965
3965
|
if (value == null || MillistreamWidgetApi_isNumber(widget, value) == false) return current;
|
|
3966
3966
|
var parts = value.toString().split('.');
|
|
3967
3967
|
if (parts.length == 2) {
|
|
3968
|
-
while (parts[1].charAt(parts[1].length - 1) == "0") {
|
|
3968
|
+
while (parts[1].charAt(parts[1].length - 1) == "0") {
|
|
3969
3969
|
parts[1] = parts[1].slice(0, -1);
|
|
3970
3970
|
}
|
|
3971
3971
|
return current > parts[1].length ? current : parts[1].length;
|
|
@@ -3974,7 +3974,7 @@ function MillistreamWidgetApi_getNumDecimals(widget, value, current, validfields
|
|
|
3974
3974
|
}
|
|
3975
3975
|
|
|
3976
3976
|
function MillistreamWidgetApi_getElementNumber(widget, el) {
|
|
3977
|
-
|
|
3977
|
+
|
|
3978
3978
|
var res = parseFloat(el.innerHTML.replace(widget.settings.decimalseparator, '.').split(widget.settings.thousandseparator).join(''));
|
|
3979
3979
|
if (!isNaN(parseFloat(res)) && isFinite(res)) return res;
|
|
3980
3980
|
return 0;
|
|
@@ -4005,7 +4005,7 @@ function MillistreamWidgetApi_colorCell(widget, element, info) {
|
|
|
4005
4005
|
MillistreamWidgetApi_setCellColor(widget, element, v);
|
|
4006
4006
|
}
|
|
4007
4007
|
} else
|
|
4008
|
-
if (widget.settings.controlcolumn || widget.settings.controlcolumn == 0) {
|
|
4008
|
+
if (widget.settings.controlcolumn || widget.settings.controlcolumn == 0) {
|
|
4009
4009
|
if (widget.settings.stylecolumn === null) return;
|
|
4010
4010
|
var tr = element.parentNode;
|
|
4011
4011
|
while (tr.tagName.toLowerCase() != 'tr') {
|
|
@@ -4014,13 +4014,13 @@ function MillistreamWidgetApi_colorCell(widget, element, info) {
|
|
|
4014
4014
|
if (tr.cells.length > widget.settings.controlcolumn) {
|
|
4015
4015
|
v = MillistreamWidgetApi_getElementNumber(widget, tr.cells[widget.settings.controlcolumn]);
|
|
4016
4016
|
var el;
|
|
4017
|
-
if (widget.settings.stylecolumn && widget.settings.stylecolumn[0] == -1) {
|
|
4018
|
-
el = tr;
|
|
4017
|
+
if (widget.settings.stylecolumn && widget.settings.stylecolumn[0] == -1) {
|
|
4018
|
+
el = tr;
|
|
4019
4019
|
MillistreamWidgetApi_setCellColor(widget, tr, v);
|
|
4020
4020
|
|
|
4021
4021
|
} else {
|
|
4022
4022
|
for (var s = 0; s < widget.settings.stylecolumn.length; s++) {
|
|
4023
|
-
el = tr.cells[widget.settings.stylecolumn[s]];
|
|
4023
|
+
el = tr.cells[widget.settings.stylecolumn[s]];
|
|
4024
4024
|
if (el) {
|
|
4025
4025
|
MillistreamWidgetApi_setCellColor(widget, el, v);
|
|
4026
4026
|
}
|
|
@@ -4028,17 +4028,17 @@ function MillistreamWidgetApi_colorCell(widget, element, info) {
|
|
|
4028
4028
|
}
|
|
4029
4029
|
}
|
|
4030
4030
|
} else
|
|
4031
|
-
if (widget.settings.positiveclass && widget.settings.negativeclass) {
|
|
4031
|
+
if (widget.settings.positiveclass && widget.settings.negativeclass) {
|
|
4032
4032
|
v = MillistreamWidgetApi_getElementNumber(widget, element);
|
|
4033
4033
|
MillistreamWidgetApi_setCellColor(widget, element, v);
|
|
4034
4034
|
}
|
|
4035
4035
|
}
|
|
4036
4036
|
|
|
4037
4037
|
function print_field(widget, element, field, value, overridedecimals) {
|
|
4038
|
-
|
|
4038
|
+
|
|
4039
4039
|
var f = parseInt(field);
|
|
4040
4040
|
var info = MillistreamWidgetApi_getColumnInfo(widget, f.toString());
|
|
4041
|
-
if (typeof value === 'undefined' || value == null || (!value && isNaN(value) == true)) {
|
|
4041
|
+
if (typeof value === 'undefined' || value == null || (!value && isNaN(value) == true)) {
|
|
4042
4042
|
if (info[4] & 16) {
|
|
4043
4043
|
value = '0.0';
|
|
4044
4044
|
} else {
|
|
@@ -4084,7 +4084,7 @@ function print_field(widget, element, field, value, overridedecimals) {
|
|
|
4084
4084
|
else
|
|
4085
4085
|
element.innerHTML = formatFactorNumber(value, widget.settings.factor, widget.settings.num_decimals, widget.settings.thousandseparator, widget.settings.decimalseparator);
|
|
4086
4086
|
} else if (info[4] & 4)
|
|
4087
|
-
element.innerHTML = formatNiceNumber(value, widget.settings.thousandseparator, widget.settings.decimalseparator, 0);
|
|
4087
|
+
element.innerHTML = formatNiceNumber(value, widget.settings.thousandseparator, widget.settings.decimalseparator, 0);
|
|
4088
4088
|
else if (info[4] & 1 && overridedecimals)
|
|
4089
4089
|
element.innerHTML = formatNiceNumber(value, widget.settings.thousandseparator, widget.settings.decimalseparator, overridedecimals || widget.settings.num_decimals);
|
|
4090
4090
|
else {
|
|
@@ -4102,8 +4102,8 @@ function print_field(widget, element, field, value, overridedecimals) {
|
|
|
4102
4102
|
}
|
|
4103
4103
|
|
|
4104
4104
|
function MillistreamWidgetApi_getColumnInfo(widget, name) {
|
|
4105
|
-
|
|
4106
|
-
|
|
4105
|
+
|
|
4106
|
+
|
|
4107
4107
|
switch (name) {
|
|
4108
4108
|
case '222':
|
|
4109
4109
|
case 'accountsreceivable':
|
|
@@ -4194,7 +4194,7 @@ function MillistreamWidgetApi_getColumnInfo(widget, name) {
|
|
|
4194
4194
|
return [232, 'numeric', 'right', widget.get_lang_text(name) || name, 8];
|
|
4195
4195
|
case '404':
|
|
4196
4196
|
case 'd1':
|
|
4197
|
-
return [404, 'date', 'right', widget.get_lang_text(name) || name, 0];
|
|
4197
|
+
return [404, 'date', 'right', widget.get_lang_text(name) || name, 0];
|
|
4198
4198
|
case '3':
|
|
4199
4199
|
case 'date':
|
|
4200
4200
|
return [3, 'date', 'right', widget.get_lang_text(name) || name, 0];
|
|
@@ -4448,10 +4448,10 @@ function MillistreamWidgetApi_getColumnInfo(widget, name) {
|
|
|
4448
4448
|
return [229, 'numeric', 'right', widget.get_lang_text(name) || name, 8];
|
|
4449
4449
|
case '395':
|
|
4450
4450
|
case 'n2':
|
|
4451
|
-
return [395, 'numeric', 'left', widget.get_lang_text(name) || name, 0];
|
|
4451
|
+
return [395, 'numeric', 'left', widget.get_lang_text(name) || name, 0];
|
|
4452
4452
|
case '396':
|
|
4453
4453
|
case 'n3':
|
|
4454
|
-
return [396, 'numeric', 'left', widget.get_lang_text(name) || name, 0];
|
|
4454
|
+
return [396, 'numeric', 'left', widget.get_lang_text(name) || name, 0];
|
|
4455
4455
|
case '22':
|
|
4456
4456
|
case 'name':
|
|
4457
4457
|
return [22, 'string', 'left', widget.get_lang_text(name) || name, 0];
|
|
@@ -4463,10 +4463,10 @@ function MillistreamWidgetApi_getColumnInfo(widget, name) {
|
|
|
4463
4463
|
return [138, 'numeric', 'right', widget.get_lang_text(name) || name, 8];
|
|
4464
4464
|
case '48':
|
|
4465
4465
|
case 'newsid':
|
|
4466
|
-
return [48, 'string', 'left', 'newsid', 0];
|
|
4466
|
+
return [48, 'string', 'left', 'newsid', 0];
|
|
4467
4467
|
case 'newstype':
|
|
4468
4468
|
case '86':
|
|
4469
|
-
return [86, 'string', 'left', 'newstype', 0];
|
|
4469
|
+
return [86, 'string', 'left', 'newstype', 0];
|
|
4470
4470
|
case '219':
|
|
4471
4471
|
case 'noncurrentasset':
|
|
4472
4472
|
return [219, 'numeric', 'right', widget.get_lang_text(name) || name, 8];
|
|
@@ -4526,13 +4526,13 @@ function MillistreamWidgetApi_getColumnInfo(widget, name) {
|
|
|
4526
4526
|
return [98, 'string', 'left', widget.get_lang_text(name) || name, 0];
|
|
4527
4527
|
case '180':
|
|
4528
4528
|
case 's3':
|
|
4529
|
-
return [180, 'string', 'left', widget.get_lang_text(name) || name, 0];
|
|
4529
|
+
return [180, 'string', 'left', widget.get_lang_text(name) || name, 0];
|
|
4530
4530
|
case '181':
|
|
4531
4531
|
case 's4':
|
|
4532
|
-
return [181, 'string', 'left', widget.get_lang_text(name) || name, 0];
|
|
4532
|
+
return [181, 'string', 'left', widget.get_lang_text(name) || name, 0];
|
|
4533
4533
|
case '393':
|
|
4534
4534
|
case 's10':
|
|
4535
|
-
return [393, 'string', 'left', widget.get_lang_text(name) || name, 0];
|
|
4535
|
+
return [393, 'string', 'left', widget.get_lang_text(name) || name, 0];
|
|
4536
4536
|
case '127':
|
|
4537
4537
|
case 'sales':
|
|
4538
4538
|
return [127, 'numeric', 'right', widget.get_lang_text(name) || name, 8];
|
|
@@ -4569,7 +4569,7 @@ function MillistreamWidgetApi_getColumnInfo(widget, name) {
|
|
|
4569
4569
|
case '227':
|
|
4570
4570
|
case 'totalassets':
|
|
4571
4571
|
return [227, 'numeric', 'right', widget.get_lang_text(name) || name, 8];
|
|
4572
|
-
case '1023':
|
|
4572
|
+
case '1023':
|
|
4573
4573
|
case 'totalnumberofshares':
|
|
4574
4574
|
return [1023, 'numeric', 'right', widget.get_lang_text(name) || name, 8];
|
|
4575
4575
|
case '233':
|
|
@@ -4618,7 +4618,7 @@ function MillistreamWidgetApi_getColumnInfo(widget, name) {
|
|
|
4618
4618
|
case 'vega':
|
|
4619
4619
|
return [703, 'numeric', 'right', widget.get_lang_text(name) || name, 0];
|
|
4620
4620
|
|
|
4621
|
-
|
|
4621
|
+
|
|
4622
4622
|
case '3000':
|
|
4623
4623
|
case 'boughtquantity':
|
|
4624
4624
|
return [3000, 'numeric', 'right', widget.get_lang_text(name) || name, 4];
|
|
@@ -4806,7 +4806,7 @@ function MillistreamWidgetApi_getColumnInfo(widget, name) {
|
|
|
4806
4806
|
case '3060':
|
|
4807
4807
|
case 'soldturnoverytd':
|
|
4808
4808
|
return [3060, 'numeric', 'left', widget.get_lang_text(name) || name, 4];
|
|
4809
|
-
|
|
4809
|
+
|
|
4810
4810
|
case 'per_last':
|
|
4811
4811
|
case '3100':
|
|
4812
4812
|
return [3100, 'numeric', 'right', widget.get_lang_text(name) || name, 0];
|
|
@@ -4927,7 +4927,7 @@ function MillistreamWidgetApi_getColumnInfo(widget, name) {
|
|
|
4927
4927
|
case 'latestreport':
|
|
4928
4928
|
case '3140':
|
|
4929
4929
|
return [3140, 'date', 'right', widget.get_lang_text(name) || name, 0];
|
|
4930
|
-
|
|
4930
|
+
|
|
4931
4931
|
case 'fundcompanyname':
|
|
4932
4932
|
case '3200':
|
|
4933
4933
|
return [3200, 'string', 'left', widget.get_lang_text(name) || name, 0];
|
|
@@ -4946,17 +4946,17 @@ function MillistreamWidgetApi_getColumnInfo(widget, name) {
|
|
|
4946
4946
|
case '3205':
|
|
4947
4947
|
case 'underlyingsymbol':
|
|
4948
4948
|
return [3204, 'string', 'left', widget.get_lang_text(name) || name, 0];
|
|
4949
|
-
case '3206':
|
|
4949
|
+
case '3206':
|
|
4950
4950
|
case 'multiplier':
|
|
4951
4951
|
return [3206, 'string', 'left', widget.get_lang_text(name) || name, 0];
|
|
4952
|
-
case '3207':
|
|
4952
|
+
case '3207':
|
|
4953
4953
|
case 'type':
|
|
4954
4954
|
return [3207, 'string', 'left', widget.get_lang_text(name) || name, 0];
|
|
4955
|
-
case '3208':
|
|
4955
|
+
case '3208':
|
|
4956
4956
|
case 'direction':
|
|
4957
4957
|
return [3208, 'string', 'left', widget.get_lang_text(name) || name, 0];
|
|
4958
4958
|
|
|
4959
|
-
|
|
4959
|
+
|
|
4960
4960
|
case '3300':
|
|
4961
4961
|
case 'iv30d':
|
|
4962
4962
|
case 'ivXXd':
|
|
@@ -4999,8 +4999,8 @@ function MillistreamWidgetApi_getColumnInfo(widget, name) {
|
|
|
4999
4999
|
}
|
|
5000
5000
|
}
|
|
5001
5001
|
|
|
5002
|
-
function set_hashed_element(widget, insref, info, json, num_dec) {
|
|
5003
|
-
|
|
5002
|
+
function set_hashed_element(widget, insref, info, json, num_dec) {
|
|
5003
|
+
|
|
5004
5004
|
var key = insref + '_' + info[0];
|
|
5005
5005
|
var arr = widget.cell_map.get(key);
|
|
5006
5006
|
if (arr !== undefined) {
|
|
@@ -5010,9 +5010,9 @@ function set_hashed_element(widget, insref, info, json, num_dec) { // called fro
|
|
|
5010
5010
|
}
|
|
5011
5011
|
}
|
|
5012
5012
|
|
|
5013
|
-
|
|
5013
|
+
|
|
5014
5014
|
function MillistreamWidgetApi_addElementToMap(insref, field, element, widget) {
|
|
5015
|
-
|
|
5015
|
+
|
|
5016
5016
|
if (insref && field && widget && widget.cell_map) {
|
|
5017
5017
|
var key = insref + '_' + field;
|
|
5018
5018
|
var arr = widget.cell_map.get(key);
|
|
@@ -5028,7 +5028,7 @@ function MillistreamWidgetApi_addElementToMap(insref, field, element, widget) {
|
|
|
5028
5028
|
}
|
|
5029
5029
|
|
|
5030
5030
|
function MillistreamWidgetApi_addElement(widget, el, cl, parent, field, value, overridedecimals) {
|
|
5031
|
-
|
|
5031
|
+
|
|
5032
5032
|
var element = document.createElement(el);
|
|
5033
5033
|
if (cl)
|
|
5034
5034
|
element.setAttribute('class', cl);
|
|
@@ -5111,7 +5111,7 @@ function MillistreamWidgetApi_addTableCell(widget, key, cl, parent, json, decima
|
|
|
5111
5111
|
widget.settings.link_field.forEach(function(element) {
|
|
5112
5112
|
hrefparam[element] = json[element];
|
|
5113
5113
|
});
|
|
5114
|
-
if (info[0] == 1) {
|
|
5114
|
+
if (info[0] == 1) {
|
|
5115
5115
|
td.onclick = function(e) {
|
|
5116
5116
|
hrefparam.event = e;
|
|
5117
5117
|
hrefparam.source = widget;
|
|
@@ -5227,7 +5227,7 @@ function fabs(value) {
|
|
|
5227
5227
|
}
|
|
5228
5228
|
|
|
5229
5229
|
function zeroPad(number, width) {
|
|
5230
|
-
|
|
5230
|
+
|
|
5231
5231
|
if (number <= 9.9999999 * Math.pow(10, width)) return ("0000000" + number).slice(-width);
|
|
5232
5232
|
return number;
|
|
5233
5233
|
}
|
|
@@ -5272,7 +5272,7 @@ function formatNiceNumber(y, thousandSeparator, decimalSeparator, precision, add
|
|
|
5272
5272
|
}
|
|
5273
5273
|
|
|
5274
5274
|
function formatDate(date, format, widget) {
|
|
5275
|
-
|
|
5275
|
+
|
|
5276
5276
|
var timeStamp, mon, day;
|
|
5277
5277
|
if (format == 'yyyy-mm-dd') {
|
|
5278
5278
|
timeStamp = new Date(date);
|
|
@@ -5286,66 +5286,66 @@ function formatDate(date, format, widget) {
|
|
|
5286
5286
|
day = timeStamp.getDate();
|
|
5287
5287
|
return timeStamp.getFullYear() % 100 + '-' + (mon <= 9 ? '0' + mon : mon) + '-' + (day <= 9 ? '0' + day : day);
|
|
5288
5288
|
}
|
|
5289
|
-
if (format == 'b dd') {
|
|
5289
|
+
if (format == 'b dd') {
|
|
5290
5290
|
timeStamp = new Date(date);
|
|
5291
5291
|
mon = timeStamp.toDateString().split(' ');
|
|
5292
5292
|
day = timeStamp.getDate();
|
|
5293
5293
|
return mon[1] + ' ' + (day <= 9 ? '0' + day : day);
|
|
5294
5294
|
}
|
|
5295
|
-
if (format == 'b dd yyyy') {
|
|
5295
|
+
if (format == 'b dd yyyy') {
|
|
5296
5296
|
timeStamp = new Date(date);
|
|
5297
5297
|
mon = timeStamp.toDateString().split(' ');
|
|
5298
5298
|
day = timeStamp.getDate();
|
|
5299
5299
|
return mon[1] + ' ' + (day <= 9 ? '0' + day : day) + ' ' + timeStamp.getFullYear();
|
|
5300
5300
|
}
|
|
5301
|
-
if (format == 'dd/mm') {
|
|
5301
|
+
if (format == 'dd/mm') {
|
|
5302
5302
|
timeStamp = new Date(date);
|
|
5303
5303
|
mon = timeStamp.getMonth() + 1;
|
|
5304
5304
|
day = timeStamp.getDate();
|
|
5305
5305
|
return (day <= 9 ? '0' + day : day) + '/' + (mon <= 9 ? '0' + mon : mon);
|
|
5306
5306
|
}
|
|
5307
|
-
if (format == 'd/m') {
|
|
5307
|
+
if (format == 'd/m') {
|
|
5308
5308
|
timeStamp = new Date(date);
|
|
5309
5309
|
return (timeStamp.getDate() + '/' + (timeStamp.getMonth() + 1));
|
|
5310
5310
|
}
|
|
5311
5311
|
if (format == 'd mmm yyyy') {
|
|
5312
5312
|
timeStamp = new Date(date);
|
|
5313
|
-
mon = timeStamp.toLocaleString(widget.settings.locale, { month: 'short' }).substring(0, 3);
|
|
5313
|
+
mon = timeStamp.toLocaleString(widget.settings.locale, { month: 'short' }).substring(0, 3);
|
|
5314
5314
|
day = timeStamp.getDate();
|
|
5315
5315
|
return day + ' ' + mon + ' ' + timeStamp.getFullYear();
|
|
5316
5316
|
}
|
|
5317
5317
|
if (format == 'dd mmm yyyy') {
|
|
5318
5318
|
timeStamp = new Date(date);
|
|
5319
|
-
mon = timeStamp.toLocaleString(widget.settings.locale, { month: 'short' }).substring(0, 3);
|
|
5319
|
+
mon = timeStamp.toLocaleString(widget.settings.locale, { month: 'short' }).substring(0, 3);
|
|
5320
5320
|
day = timeStamp.getDate();
|
|
5321
5321
|
return (day <= 9 ? '0' + day : day) + ' ' + mon + ' ' + timeStamp.getFullYear();
|
|
5322
5322
|
}
|
|
5323
5323
|
if (format == 'dd mmm') {
|
|
5324
5324
|
timeStamp = new Date(date);
|
|
5325
|
-
mon = timeStamp.toLocaleString(widget.settings.locale, { month: 'short' }).substring(0, 3);
|
|
5325
|
+
mon = timeStamp.toLocaleString(widget.settings.locale, { month: 'short' }).substring(0, 3);
|
|
5326
5326
|
day = timeStamp.getDate();
|
|
5327
5327
|
return (day <= 9 ? '0' + day : day) + ' ' + mon;
|
|
5328
5328
|
}
|
|
5329
5329
|
if (format == 'd mmm') {
|
|
5330
5330
|
timeStamp = new Date(date);
|
|
5331
|
-
mon = timeStamp.toLocaleString(widget.settings.locale, { month: 'short' }).substring(0, 3);
|
|
5331
|
+
mon = timeStamp.toLocaleString(widget.settings.locale, { month: 'short' }).substring(0, 3);
|
|
5332
5332
|
day = timeStamp.getDate();
|
|
5333
5333
|
return day + ' ' + mon;
|
|
5334
5334
|
}
|
|
5335
5335
|
if (format == 'mmm yyyy') {
|
|
5336
5336
|
timeStamp = new Date(date);
|
|
5337
|
-
mon = timeStamp.toLocaleString(widget.settings.locale, { month: 'short' }).substring(0, 3);
|
|
5337
|
+
mon = timeStamp.toLocaleString(widget.settings.locale, { month: 'short' }).substring(0, 3);
|
|
5338
5338
|
timeStamp = mon + ' ' + timeStamp.getFullYear();
|
|
5339
5339
|
return timeStamp;
|
|
5340
5340
|
}
|
|
5341
5341
|
if (format == 'mmm yy') {
|
|
5342
5342
|
timeStamp = new Date(date);
|
|
5343
|
-
mon = timeStamp.toLocaleString(widget.settings.locale, { month: 'short' }).substring(0, 3);
|
|
5343
|
+
mon = timeStamp.toLocaleString(widget.settings.locale, { month: 'short' }).substring(0, 3);
|
|
5344
5344
|
timeStamp = mon + ' ' + (timeStamp.getFullYear() % 100 < 9 ? '0' + timeStamp.getFullYear() % 100 : timeStamp.getFullYear() % 100);
|
|
5345
5345
|
return timeStamp;
|
|
5346
5346
|
}
|
|
5347
5347
|
|
|
5348
|
-
|
|
5348
|
+
|
|
5349
5349
|
timeStamp = new Date(date);
|
|
5350
5350
|
mon = timeStamp.getMonth() + 1;
|
|
5351
5351
|
day = timeStamp.getDate();
|
|
@@ -5353,7 +5353,7 @@ function formatDate(date, format, widget) {
|
|
|
5353
5353
|
}
|
|
5354
5354
|
|
|
5355
5355
|
function formatTime(value, format) {
|
|
5356
|
-
|
|
5356
|
+
|
|
5357
5357
|
if (typeof value !== 'string') return "";
|
|
5358
5358
|
var datetime = new Date();
|
|
5359
5359
|
var tz_offset = datetime.getTimezoneOffset();
|
|
@@ -5582,7 +5582,7 @@ function MillistreamWidgetApi_scrollIntoView(scrollarea, elem, xalign, yalign) {
|
|
|
5582
5582
|
scrollarea.scrollLeft = elem.offsetLeft - scrollarea.getBoundingClientRect().width / 2;
|
|
5583
5583
|
}
|
|
5584
5584
|
|
|
5585
|
-
|
|
5585
|
+
|
|
5586
5586
|
}
|
|
5587
5587
|
|
|
5588
5588
|
var MillistreamWidgetSettings = {
|
|
@@ -5602,9 +5602,9 @@ function MillistreamWidgetStreamingApi(settings) {
|
|
|
5602
5602
|
server: 'wss://stage.millistream.com:8900',
|
|
5603
5603
|
alarmClient: null
|
|
5604
5604
|
};
|
|
5605
|
-
var m_requestid = 1;
|
|
5605
|
+
var m_requestid = 1;
|
|
5606
5606
|
var m_socket = null;
|
|
5607
|
-
var m_requests = [];
|
|
5607
|
+
var m_requests = [];
|
|
5608
5608
|
var m_requestcallbacks = new Map();
|
|
5609
5609
|
|
|
5610
5610
|
|
|
@@ -5637,7 +5637,7 @@ function MillistreamWidgetStreamingApi(settings) {
|
|
|
5637
5637
|
req = new Object({
|
|
5638
5638
|
"widget": widget,
|
|
5639
5639
|
});
|
|
5640
|
-
m_requestcallbacks.set(requestid.toString(), req);
|
|
5640
|
+
m_requestcallbacks.set(requestid.toString(), req);
|
|
5641
5641
|
}
|
|
5642
5642
|
var request = '';
|
|
5643
5643
|
if (MillistreamWidgetApi_isObjectEmpty(widget.unsubscriptions) == false) {
|
|
@@ -5699,7 +5699,7 @@ function MillistreamWidgetStreamingApi(settings) {
|
|
|
5699
5699
|
|
|
5700
5700
|
|
|
5701
5701
|
widget.unsubscriptions.type = 'insrefs';
|
|
5702
|
-
widget.unsubscriptions.insrefs = insrefs.slice(0);
|
|
5702
|
+
widget.unsubscriptions.insrefs = insrefs.slice(0);
|
|
5703
5703
|
widget.unsubscriptions.messagetypes = widget.settings.messagetypes;
|
|
5704
5704
|
widget.unsubscriptions.requestid = requestid;
|
|
5705
5705
|
|
|
@@ -5712,7 +5712,7 @@ function MillistreamWidgetStreamingApi(settings) {
|
|
|
5712
5712
|
|
|
5713
5713
|
function reconnect() {
|
|
5714
5714
|
if (!m_socket.CLOSED) {
|
|
5715
|
-
|
|
5715
|
+
|
|
5716
5716
|
return;
|
|
5717
5717
|
}
|
|
5718
5718
|
m_requests.forEach(function(request) {
|
|
@@ -5731,21 +5731,21 @@ function MillistreamWidgetStreamingApi(settings) {
|
|
|
5731
5731
|
try {
|
|
5732
5732
|
m_socket = new WebSocket(_this.settings.server);
|
|
5733
5733
|
m_socket.onopen = function() {
|
|
5734
|
-
|
|
5734
|
+
() => {};
|
|
5735
5735
|
if (m_requests.length > 0) {
|
|
5736
5736
|
m_requests.forEach(function(request) {
|
|
5737
5737
|
if (request.send == 0) {
|
|
5738
|
-
|
|
5738
|
+
|
|
5739
5739
|
m_socket.send('{ "token":"' + _this.settings.token + '",' + request.request);
|
|
5740
5740
|
}
|
|
5741
5741
|
});
|
|
5742
5742
|
}
|
|
5743
5743
|
};
|
|
5744
5744
|
m_socket.onerror = function() {
|
|
5745
|
-
|
|
5745
|
+
() => {};
|
|
5746
5746
|
};
|
|
5747
5747
|
m_socket.onclose = function() {
|
|
5748
|
-
|
|
5748
|
+
() => {};
|
|
5749
5749
|
reconnect();
|
|
5750
5750
|
};
|
|
5751
5751
|
|
|
@@ -5754,9 +5754,9 @@ function MillistreamWidgetStreamingApi(settings) {
|
|
|
5754
5754
|
try {
|
|
5755
5755
|
jsondata = JSON.parse(msg.data);
|
|
5756
5756
|
} catch (e) {
|
|
5757
|
-
|
|
5757
|
+
() => {};
|
|
5758
5758
|
}
|
|
5759
|
-
|
|
5759
|
+
|
|
5760
5760
|
if (typeof jsondata.instruments !== 'undefined') {
|
|
5761
5761
|
for (var s = 0; s < jsondata.instruments.length; s++) {
|
|
5762
5762
|
var insref = jsondata.instruments[s].insref;
|
|
@@ -5782,16 +5782,16 @@ function MillistreamWidgetStreamingApi(settings) {
|
|
|
5782
5782
|
if (_this.settings.statusCallback !== null) _this.settings.statusCallback(jsondata);
|
|
5783
5783
|
} else
|
|
5784
5784
|
if (typeof jsondata.alarm !== 'undefined') {
|
|
5785
|
-
|
|
5785
|
+
() => {};
|
|
5786
5786
|
if (null != _this.settings.alarmClient) {
|
|
5787
5787
|
_this.settings.alarmClient(jsondata);
|
|
5788
5788
|
}
|
|
5789
5789
|
|
|
5790
5790
|
} else
|
|
5791
|
-
|
|
5791
|
+
() => {};
|
|
5792
5792
|
};
|
|
5793
5793
|
} catch (exception) {
|
|
5794
|
-
|
|
5794
|
+
() => {};
|
|
5795
5795
|
reconnect();
|
|
5796
5796
|
}
|
|
5797
5797
|
}
|