@millistream/millistream-widgets 1.0.38 → 1.0.39
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 +49 -17
- package/package.json +1 -1
package/millistream-widgets.js
CHANGED
|
@@ -1145,7 +1145,6 @@ function Milli_Chart(settings) {
|
|
|
1145
1145
|
var count = 0;
|
|
1146
1146
|
for (;;) {
|
|
1147
1147
|
if (count++ > 10) {
|
|
1148
|
-
console.log('break out');
|
|
1149
1148
|
break;
|
|
1150
1149
|
}
|
|
1151
1150
|
var v;
|
|
@@ -1206,7 +1205,7 @@ function Milli_Chart(settings) {
|
|
|
1206
1205
|
si.valuePerPixel = (si.maxValue - si.minValue) / si.lineLength;
|
|
1207
1206
|
|
|
1208
1207
|
if (isNaN(si.valuePerPixel) || !isFinite(si.valuePerPixel)) {
|
|
1209
|
-
console.log('cant draw valuePerPixel', si.valuePerPixel, si.lineLength, si.maxValue, si.minValue);
|
|
1208
|
+
console.log('cant draw valuePerPixel', si.valuePerPixel, si.lineLength, si.maxValue, si.minValue,si.highValue,si.lowValue,m_yLegendCss,v);
|
|
1210
1209
|
return false;
|
|
1211
1210
|
}
|
|
1212
1211
|
var textpos;
|
|
@@ -3193,7 +3192,6 @@ function Milli_Chart(settings) {
|
|
|
3193
3192
|
continue;
|
|
3194
3193
|
}
|
|
3195
3194
|
if (timestamp > _this.scaleinfoX.endTimeStamp) {
|
|
3196
|
-
console.log('to big', data[i].timestamp, _this.scaleinfoX.endTimeStamp);
|
|
3197
3195
|
break;
|
|
3198
3196
|
}
|
|
3199
3197
|
|
|
@@ -3389,29 +3387,56 @@ function Milli_Chart(settings) {
|
|
|
3389
3387
|
m_ctx.strokeStyle = method.color;
|
|
3390
3388
|
m_ctx.lineWidth = method.lineWidth | 1;
|
|
3391
3389
|
m_ctx.save();
|
|
3390
|
+
|
|
3391
|
+
// draw upper
|
|
3392
3392
|
m_ctx.beginPath();
|
|
3393
|
+
m_ctx.closePath();
|
|
3393
3394
|
let num = calcAnalyzisLine(data, 0, undefined, m_chartspaces.chart, scaleinfoY);
|
|
3395
|
+
m_ctx.moveTo(data[data.length - 1].pos.x, data[data.length - 1].pos.y);
|
|
3394
3396
|
for (let i = data.length - 1; i >= data.length - num; i--) {
|
|
3395
3397
|
m_ctx.lineTo(data[i].pos.x, data[i].pos.y);
|
|
3396
3398
|
}
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
m_ctx.lineTo(data[i].pos.x, data[i].pos.y);
|
|
3401
|
-
}
|
|
3402
|
-
m_ctx.closePath();
|
|
3399
|
+
m_ctx.stroke();
|
|
3400
|
+
|
|
3401
|
+
// draw the fill area
|
|
3403
3402
|
if (method.fill) {
|
|
3403
|
+
m_ctx.beginPath();
|
|
3404
|
+
m_ctx.moveTo(data[data.length - 1].pos.x, data[data.length - 1].pos.y);
|
|
3405
|
+
for (let i = data.length - 1; i >= data.length - num; i--) {
|
|
3406
|
+
m_ctx.lineTo(data[i].pos.x, data[i].pos.y);
|
|
3407
|
+
}
|
|
3408
|
+
|
|
3409
|
+
num = calcAnalyzisLine(data, 1, undefined, m_chartspaces.chart, scaleinfoY);
|
|
3410
|
+
|
|
3411
|
+
m_ctx.lineTo(data[data.length - num].pos.x, data[data.length - num].pos.y); // behöver döljas...
|
|
3412
|
+
for (let i = data.length - num +1; i < data.length; i++) {
|
|
3413
|
+
m_ctx.lineTo(data[i].pos.x, data[i].pos.y);
|
|
3414
|
+
}
|
|
3415
|
+
|
|
3416
|
+
m_ctx.closePath();
|
|
3417
|
+
|
|
3404
3418
|
m_ctx.fillStyle = method.fill;
|
|
3405
3419
|
m_ctx.fill();
|
|
3406
3420
|
}
|
|
3407
|
-
|
|
3421
|
+
// draw Lower
|
|
3408
3422
|
m_ctx.beginPath();
|
|
3409
|
-
m_ctx.closePath();
|
|
3423
|
+
m_ctx.closePath();
|
|
3424
|
+
m_ctx.moveTo(data[data.length - num].pos.x, data[data.length - num].pos.y); // behöver döljas...
|
|
3425
|
+
for (let i = data.length - num; i < data.length; i++) {
|
|
3426
|
+
m_ctx.lineTo(data[i].pos.x, data[i].pos.y);
|
|
3427
|
+
}
|
|
3428
|
+
m_ctx.stroke();
|
|
3429
|
+
|
|
3430
|
+
// draw middle
|
|
3431
|
+
m_ctx.beginPath();
|
|
3432
|
+
m_ctx.closePath();
|
|
3433
|
+
num = calcAnalyzisLine(data, 2, undefined, m_chartspaces.chart, scaleinfoY);
|
|
3410
3434
|
m_ctx.moveTo(data[data.length - num].x, data[data.length - num].y);
|
|
3411
3435
|
for (let i = data.length - num; i < data.length; i++) {
|
|
3412
3436
|
m_ctx.lineTo(data[i].pos.x, data[i].pos.y);
|
|
3413
3437
|
}
|
|
3414
3438
|
m_ctx.stroke();
|
|
3439
|
+
|
|
3415
3440
|
m_ctx.restore();
|
|
3416
3441
|
return;
|
|
3417
3442
|
}
|
|
@@ -3958,7 +3983,6 @@ function Milli_Chart(settings) {
|
|
|
3958
3983
|
rsi.push({ timestamp: p[i].timestamp, datapoints: [100 - 100 / (1 + rs)] });
|
|
3959
3984
|
}
|
|
3960
3985
|
}
|
|
3961
|
-
console.log('RSI',rsi[rsi.length-1]);
|
|
3962
3986
|
return rsi;
|
|
3963
3987
|
}
|
|
3964
3988
|
_this.removeAllIndicators = function(j) {
|
|
@@ -4215,8 +4239,6 @@ function Milli_Chart(settings) {
|
|
|
4215
4239
|
}
|
|
4216
4240
|
_this.settings.target.style.height = (_this.settings.target.parentNode.offsetHeight - offset) + 'px';
|
|
4217
4241
|
_this.settings.target.style.width = _this.settings.target.parentNode.offsetWidth + 'px';
|
|
4218
|
-
//_this.settings.target.style.height = (_this.settings.target.parentNode.offsetHeight - offset) * 1 + 'px';
|
|
4219
|
-
//_this.settings.target.style.width = _this.settings.target.parentNode.offsetWidth * 1 + 'px';
|
|
4220
4242
|
m_canvas.setRect(_this.settings.target.offsetHeight, _this.settings.target.offsetWidth);
|
|
4221
4243
|
}
|
|
4222
4244
|
|
|
@@ -4877,19 +4899,29 @@ function Milli_Chart(settings) {
|
|
|
4877
4899
|
_this.drawChart();
|
|
4878
4900
|
})();
|
|
4879
4901
|
|
|
4880
|
-
window.addEventListener('resize', function() {
|
|
4902
|
+
window.addEventListener('resize', function(a) {
|
|
4881
4903
|
if (m_canvas != null) {
|
|
4882
4904
|
setChartSize();
|
|
4905
|
+
//console.log("windowresize",m_chartspaces);
|
|
4883
4906
|
_this.drawChart();
|
|
4884
4907
|
}
|
|
4885
4908
|
});
|
|
4909
|
+
|
|
4910
|
+
/* function parentResize(a) {
|
|
4911
|
+
console.log('a',a);
|
|
4912
|
+
if(m_canvas != null) {
|
|
4913
|
+
setChartSize();
|
|
4914
|
+
console.log(m_chartspaces);
|
|
4915
|
+
_this.drawChart();
|
|
4916
|
+
}
|
|
4917
|
+
};
|
|
4886
4918
|
|
|
4887
4919
|
if(_this.settings.target.parentNode) {
|
|
4888
|
-
const observer = new MutationObserver(
|
|
4920
|
+
const observer = new MutationObserver(parentResize);
|
|
4889
4921
|
const observerConfig = { attributes: true };
|
|
4890
4922
|
observer.observe(_this.settings.target.parentNode, observerConfig);
|
|
4891
4923
|
}
|
|
4892
|
-
|
|
4924
|
+
*/
|
|
4893
4925
|
};
|
|
4894
4926
|
|
|
4895
4927
|
function Milli_OptionsList(settings) {
|