@millistream/millistream-widgets 1.0.5 → 1.0.7

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.
@@ -1,9 +1,25 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
1
9
  (function(prototype) {
2
10
 
3
11
  var pixelRatio = (function() {
4
12
  var canvas = document.createElement('canvas'),
5
13
  context = canvas.getContext('2d');
6
- })(),
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+ })(),
7
23
 
8
24
  forEach = function(obj, func) {
9
25
  for (var p in obj) {
@@ -93,7 +109,13 @@
93
109
  var i = _super.apply(this, args);
94
110
 
95
111
  this.font = tmp;
96
- return i;
112
+
113
+
114
+
115
+
116
+
117
+
118
+ return i;
97
119
  };
98
120
  })(prototype.measureText);
99
121
 
@@ -129,7 +151,13 @@
129
151
 
130
152
  _super.apply(this, args);
131
153
  this.font = tmp;
132
- };
154
+
155
+
156
+
157
+
158
+
159
+
160
+ };
133
161
  })(prototype.strokeText);
134
162
 
135
163
  })(CanvasRenderingContext2D.prototype);
@@ -156,6 +184,12 @@
156
184
  if (type === '2d') {
157
185
 
158
186
 
187
+
188
+
189
+
190
+
191
+
192
+
159
193
  var ratio = getPixelRatio();
160
194
  if (ratio > 1) {
161
195
  this.style.height = this.height + 'px';
@@ -719,7 +753,7 @@ function Milli_Chart(settings) {
719
753
  var maxValue = _this.scaleinfoY.highLowerChart == 0 ? 100 : _this.scaleinfoY.highLowerChart + (tickSize * 0.2);
720
754
  var valuePerPixel = lineLength / maxValue;
721
755
  if (isNaN(valuePerPixel) || !isFinite(valuePerPixel)) {
722
-
756
+ () => {};
723
757
  return false;
724
758
  }
725
759
  var value = 0;
@@ -818,7 +852,7 @@ function Milli_Chart(settings) {
818
852
  var count = 0;
819
853
  for (;;) {
820
854
  if (count++ > 10) {
821
-
855
+ () => {};
822
856
  break;
823
857
  }
824
858
  var v;
@@ -876,14 +910,14 @@ function Milli_Chart(settings) {
876
910
  }
877
911
  si.valuePerPixel = si.lineLength / (si.maxValue - si.minValue);
878
912
  if (isNaN(si.valuePerPixel) || !isFinite(si.valuePerPixel)) {
879
-
913
+ () => {};
880
914
  return false;
881
915
  }
882
916
  var textpos;
883
917
  var count = 0;
884
918
  for (;;) {
885
919
  if (count++ > 10) {
886
-
920
+ () => {};
887
921
  break;
888
922
  }
889
923
  var y = Math.round(m_chartspaces.chart.height - getScaledSetting(m_chartCss.marginBottom) - ((value - si.minValue) * si.valuePerPixel));
@@ -945,7 +979,7 @@ function Milli_Chart(settings) {
945
979
  m_ctx.fillStyle = m_yLegendCss.color;
946
980
  if (0 == calcHighLow()) {
947
981
  m_ctx.restore();
948
-
982
+ () => {};
949
983
  return;
950
984
  }
951
985
  _this.scaleinfoY.lineLength = m_chartspaces.chart.bottom - m_chartspaces.chart.top;
@@ -1897,7 +1931,7 @@ function Milli_Chart(settings) {
1897
1931
  startdate = startdate.replaceAll('\/', '-');
1898
1932
  enddate = enddate.replaceAll('\/', '-');
1899
1933
  m_zoom.mousedown.timestamp = findFirstWeekDay(new Date(startdate + 'T00:00:00Z'));
1900
-
1934
+ () => {};
1901
1935
 
1902
1936
  m_zoom.mouseup.timestamp = new Date(enddate + 'T00:00:00Z');
1903
1937
 
@@ -2016,7 +2050,7 @@ function Milli_Chart(settings) {
2016
2050
  m_dataPoints.map = new Map();
2017
2051
  m_dataPoints.arr = [];
2018
2052
  if (_this.instruments.length < 0) {
2019
-
2053
+ () => {};
2020
2054
  return;
2021
2055
  }
2022
2056
  calcChartSpaces();
@@ -2106,7 +2140,7 @@ function Milli_Chart(settings) {
2106
2140
 
2107
2141
  } else
2108
2142
  if (period == 'm') {
2109
-
2143
+ () => {};
2110
2144
 
2111
2145
  if (m_zoom.mousedown.timestamp) {
2112
2146
  _this.scaleinfoX.startTimeStamp = m_zoom.mousedown.timestamp > m_zoom.mouseup.timestamp ? m_zoom.mouseup.timestamp : m_zoom.mousedown.timestamp;
@@ -2186,7 +2220,11 @@ function Milli_Chart(settings) {
2186
2220
 
2187
2221
  }
2188
2222
 
2189
- }
2223
+
2224
+
2225
+
2226
+
2227
+ }
2190
2228
  drawBoxShadow(m_chartspaces.chart);
2191
2229
 
2192
2230
  if (m_chartspaces.chart.percent != 100) {
@@ -2586,7 +2624,12 @@ function Milli_Chart(settings) {
2586
2624
 
2587
2625
  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;
2588
2626
 
2589
- m_ctx.moveTo(endpoint.x, endpoint.y);
2627
+
2628
+
2629
+
2630
+
2631
+
2632
+ m_ctx.moveTo(endpoint.x, endpoint.y);
2590
2633
  lastdate = new Date(data[i].timestamp);
2591
2634
  addedcloseprice1d = true;
2592
2635
  startx = endpoint.x;
@@ -2671,7 +2714,10 @@ function Milli_Chart(settings) {
2671
2714
 
2672
2715
  break;
2673
2716
  } else if (hCurveLastPoint) {
2674
- }
2717
+
2718
+
2719
+
2720
+ }
2675
2721
  }
2676
2722
  quantity = 0;
2677
2723
  }
@@ -2717,6 +2763,13 @@ function Milli_Chart(settings) {
2717
2763
  }
2718
2764
 
2719
2765
 
2766
+
2767
+
2768
+
2769
+
2770
+
2771
+
2772
+
2720
2773
  _this.setChartLength = function(len) {
2721
2774
  _this.settings.chartlen = len;
2722
2775
  m_zoom.mousedown.timestamp = null;
@@ -2847,7 +2900,7 @@ function Milli_Chart(settings) {
2847
2900
  };
2848
2901
  req.open("GET", url, true);
2849
2902
  req.onerror = function(error) {
2850
-
2903
+ () => {};
2851
2904
  };
2852
2905
  req.send();
2853
2906
  }
@@ -3326,7 +3379,7 @@ function Milli_Chart(settings) {
3326
3379
 
3327
3380
  (function updatePixelRatio() {
3328
3381
  matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`).addEventListener('change', updatePixelRatio, { once: true });
3329
-
3382
+ () => {};
3330
3383
  _this.drawChart();
3331
3384
  })();
3332
3385
 
@@ -3337,7 +3390,6 @@ function Milli_Chart(settings) {
3337
3390
  }
3338
3391
  });
3339
3392
  }
3340
-
3341
3393
  var milli_data_api_url = 'https://stage.millistream.com/widgets/3.0.3/data/milli_widget_dataapi.php?';
3342
3394
 
3343
3395
  var millistream_data_api = {
@@ -5500,7 +5552,7 @@ function milli_widget_get_data(request, callback) {
5500
5552
  }
5501
5553
 
5502
5554
  function MillistreamWidgetApi_scrollIntoView(scrollarea, elem, xalign, yalign) {
5503
-
5555
+ //console.log("MillistreamWidgetApi_scrollIntoView", scrollarea, elem, elem.offsetLeft, elem.offsetTop, elem.offsetHeight);
5504
5556
 
5505
5557
  if (typeof xalign == "undefined")
5506
5558
  xalign = null;
@@ -5535,7 +5587,6 @@ var MillistreamWidgetSettings = {
5535
5587
  thousandseparator: ' ',
5536
5588
  streaming: false
5537
5589
  };
5538
-
5539
5590
  function MillistreamWidgetStreamingApi(settings) {
5540
5591
  var _this = this;
5541
5592
  _this.settings = {
@@ -5673,7 +5724,8 @@ function MillistreamWidgetStreamingApi(settings) {
5673
5724
  try {
5674
5725
  m_socket = new WebSocket(_this.settings.server);
5675
5726
  m_socket.onopen = function() {
5676
-
5727
+ () => {};
5728
+ if (m_requests.length > 0) {
5677
5729
  m_requests.forEach(function(request) {
5678
5730
  if (request.send == 0) {
5679
5731
 
@@ -5683,9 +5735,11 @@ function MillistreamWidgetStreamingApi(settings) {
5683
5735
  }
5684
5736
  };
5685
5737
  m_socket.onerror = function() {
5686
-
5738
+ () => {};
5739
+ };
5687
5740
  m_socket.onclose = function() {
5688
-
5741
+ () => {};
5742
+ reconnect();
5689
5743
  };
5690
5744
 
5691
5745
  m_socket.onmessage = function(msg) {
@@ -5693,7 +5747,8 @@ function MillistreamWidgetStreamingApi(settings) {
5693
5747
  try {
5694
5748
  jsondata = JSON.parse(msg.data);
5695
5749
  } catch (e) {
5696
-
5750
+ () => {};
5751
+ }
5697
5752
 
5698
5753
  if (typeof jsondata.instruments !== 'undefined') {
5699
5754
  for (var s = 0; s < jsondata.instruments.length; s++) {
@@ -5720,20 +5775,21 @@ function MillistreamWidgetStreamingApi(settings) {
5720
5775
  if (_this.settings.statusCallback !== null) _this.settings.statusCallback(jsondata);
5721
5776
  } else
5722
5777
  if (typeof jsondata.alarm !== 'undefined') {
5723
-
5778
+ () => {};
5724
5779
  if (null != _this.settings.alarmClient) {
5725
5780
  _this.settings.alarmClient(jsondata);
5726
5781
  }
5727
5782
 
5728
5783
  } else
5729
-
5784
+ () => {};
5785
+ };
5730
5786
  } catch (exception) {
5731
-
5787
+ () => {};
5788
+ reconnect();
5732
5789
  }
5733
5790
  }
5734
5791
  milli_stream_connect();
5735
5792
  }
5736
-
5737
5793
  exports.Milli_Chart = Milli_Chart;
5738
5794
  exports.MillistreamWidgetSettings = MillistreamWidgetSettings;
5739
5795
  exports.formatDate = formatDate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@millistream/millistream-widgets",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Millistream widgets node package",
5
5
  "main": "millistream-widgets.js",
6
6
  "scripts": {