lit-litelements 2.3.6 → 2.3.8
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,13 +1 @@
|
|
|
1
1
|
export declare function isDoji(d: any): boolean;
|
|
2
|
-
export declare function isHammer(d: any): boolean;
|
|
3
|
-
export declare function isHangingMan(d: any): boolean;
|
|
4
|
-
export declare function isBullishEngulfing(prev: any, now: any): boolean;
|
|
5
|
-
export declare function isBearishEngulfing(prev: any, now: any): boolean;
|
|
6
|
-
export declare function isDarkCloud(prev: any, now: any): boolean;
|
|
7
|
-
export declare function isBullishPiercing(prev: any, now: any): boolean;
|
|
8
|
-
export declare function isHarami(prev: any, now: any): boolean;
|
|
9
|
-
export declare function isHaramiCross(prev: any, now: any): boolean;
|
|
10
|
-
export declare function isMorningStar(a: any, b: any, c: any): boolean;
|
|
11
|
-
export declare function isEveningStar(a: any, b: any, c: any): boolean;
|
|
12
|
-
export declare function isMorningDojiStar(a: any, b: any, c: any): boolean;
|
|
13
|
-
export declare function isEveningDojiStar(a: any, b: any, c: any): boolean;
|
|
@@ -3,87 +3,5 @@ export function isDoji(d) {
|
|
|
3
3
|
// const body = Math.abs(d.close - d.open);
|
|
4
4
|
// const range = d.high - d.low;
|
|
5
5
|
// return body / range < 0.1; // very small body relative to range
|
|
6
|
-
return d.close === d.open;
|
|
7
|
-
}
|
|
8
|
-
export function isHammer(d) {
|
|
9
|
-
const body = Math.abs(d.close - d.open);
|
|
10
|
-
const upperShadow = d.high - Math.max(d.close, d.open);
|
|
11
|
-
const lowerShadow = Math.min(d.close, d.open) - d.low;
|
|
12
|
-
return (lowerShadow > 2 * body) && (upperShadow < body);
|
|
13
|
-
}
|
|
14
|
-
export function isHangingMan(d) {
|
|
15
|
-
const body = Math.abs(d.close - d.open);
|
|
16
|
-
const upperShadow = d.high - Math.max(d.close, d.open);
|
|
17
|
-
const lowerShadow = Math.min(d.close, d.open) - d.low;
|
|
18
|
-
return (lowerShadow > 2 * body) && (upperShadow <= body) && (d.close < d.open);
|
|
19
|
-
}
|
|
20
|
-
export function isBullishEngulfing(prev, now) {
|
|
21
|
-
return (prev.close < prev.open && // previous candle red
|
|
22
|
-
now.close > now.open && // current candle green
|
|
23
|
-
now.open < prev.close &&
|
|
24
|
-
now.close > prev.open);
|
|
25
|
-
}
|
|
26
|
-
// Bearish Engulfing
|
|
27
|
-
export function isBearishEngulfing(prev, now) {
|
|
28
|
-
return (prev.close > prev.open && // prev green
|
|
29
|
-
now.close < now.open && // now red
|
|
30
|
-
now.open > prev.close &&
|
|
31
|
-
now.close < prev.open);
|
|
32
|
-
}
|
|
33
|
-
// Dark Cloud Cover
|
|
34
|
-
export function isDarkCloud(prev, now) {
|
|
35
|
-
const midpoint = (prev.open + prev.close) / 2;
|
|
36
|
-
return (prev.close > prev.open && // prev green
|
|
37
|
-
now.open > prev.high && // gap up
|
|
38
|
-
now.close < midpoint && // closes below midpoint
|
|
39
|
-
now.close > prev.open // but above prev open
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
// Bullish Piercing
|
|
43
|
-
export function isBullishPiercing(prev, now) {
|
|
44
|
-
const midpoint = (prev.open + prev.close) / 2;
|
|
45
|
-
return (prev.close < prev.open && // prev red
|
|
46
|
-
now.open < prev.low && // gap down
|
|
47
|
-
now.close > midpoint && // closes above midpoint
|
|
48
|
-
now.close < prev.open // but below prev open
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
// Harami (bearish or bullish depending on colors)
|
|
52
|
-
export function isHarami(prev, now) {
|
|
53
|
-
return ((prev.close > prev.open && now.close < now.open &&
|
|
54
|
-
now.open < prev.close && now.close > prev.open) || // bearish
|
|
55
|
-
(prev.close < prev.open && now.close > now.open &&
|
|
56
|
-
now.open > prev.close && now.close < prev.open) // bullish
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
// Harami Cross (small doji inside prior candle)
|
|
60
|
-
export function isHaramiCross(prev, now) {
|
|
61
|
-
const body = Math.abs(now.close - now.open);
|
|
62
|
-
return (body / (now.high - now.low) < 0.1 &&
|
|
63
|
-
now.high < Math.max(prev.open, prev.close) &&
|
|
64
|
-
now.low > Math.min(prev.open, prev.close));
|
|
65
|
-
}
|
|
66
|
-
// Morning Star (3-candle bullish reversal)
|
|
67
|
-
export function isMorningStar(a, b, c) {
|
|
68
|
-
return (a.close < a.open && // red
|
|
69
|
-
Math.abs(b.close - b.open) < (a.open - a.close) * 0.3 && // small candle
|
|
70
|
-
c.close > c.open && // green
|
|
71
|
-
c.close > (a.open + a.close) / 2 // closes well into body of first
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
// Evening Star (3-candle bearish reversal)
|
|
75
|
-
export function isEveningStar(a, b, c) {
|
|
76
|
-
return (a.close > a.open && // green
|
|
77
|
-
Math.abs(b.close - b.open) < (a.close - a.open) * 0.3 && // small candle
|
|
78
|
-
c.close < c.open && // red
|
|
79
|
-
c.close < (a.open + a.close) / 2 // closes well into body of first
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
// Morning Doji Star (doji middle candle)
|
|
83
|
-
export function isMorningDojiStar(a, b, c) {
|
|
84
|
-
return isMorningStar(a, b, c) && isDoji(b);
|
|
85
|
-
}
|
|
86
|
-
// Evening Doji Star (doji middle candle)
|
|
87
|
-
export function isEveningDojiStar(a, b, c) {
|
|
88
|
-
return isEveningStar(a, b, c) && isDoji(b);
|
|
6
|
+
return (d === null || d === void 0 ? void 0 : d.close) === (d === null || d === void 0 ? void 0 : d.open);
|
|
89
7
|
}
|
|
@@ -135,10 +135,10 @@ let ChartElement = class ChartElement extends LitElement {
|
|
|
135
135
|
const candle = this.stockData[i];
|
|
136
136
|
const divergence = candle === null || candle === void 0 ? void 0 : candle.divergence;
|
|
137
137
|
const isDoji = Patterns.isDoji(candle);
|
|
138
|
-
const isBull = candle.close > candle.open;
|
|
139
|
-
const isBear = candle.close < candle.open;
|
|
138
|
+
const isBull = (candle === null || candle === void 0 ? void 0 : candle.close) > (candle === null || candle === void 0 ? void 0 : candle.open);
|
|
139
|
+
const isBear = (candle === null || candle === void 0 ? void 0 : candle.close) < (candle === null || candle === void 0 ? void 0 : candle.open);
|
|
140
140
|
const x = scales.x.getPixelForValue(i);
|
|
141
|
-
const y = scales.yPrice.getPixelForValue(candle.close);
|
|
141
|
+
const y = scales.yPrice.getPixelForValue(candle === null || candle === void 0 ? void 0 : candle.close);
|
|
142
142
|
if (!candle)
|
|
143
143
|
continue;
|
|
144
144
|
const currentVolume = volumeData[i];
|
|
@@ -222,8 +222,8 @@ let ChartElement = class ChartElement extends LitElement {
|
|
|
222
222
|
// --------------------------------------------------------------------
|
|
223
223
|
_getChartData() {
|
|
224
224
|
return {
|
|
225
|
-
dates: this.stockData.map((d) => d.date),
|
|
226
|
-
closePrices: this.stockData.map((d) => d.close),
|
|
225
|
+
dates: this.stockData.map((d) => { var _a; return (_a = d.date) !== null && _a !== void 0 ? _a : null; }),
|
|
226
|
+
closePrices: this.stockData.map((d) => { var _a; return (_a = d.close) !== null && _a !== void 0 ? _a : null; }),
|
|
227
227
|
rsi: this.stockData.map((d) => { var _a; return (_a = d.RSI) !== null && _a !== void 0 ? _a : null; }),
|
|
228
228
|
// ✅ StochRSI
|
|
229
229
|
stochRSI_K: this.stockData.map((d) => { var _a; return (_a = d.StochRSI_K) !== null && _a !== void 0 ? _a : null; }),
|
|
@@ -394,8 +394,8 @@ let ChartElement = class ChartElement extends LitElement {
|
|
|
394
394
|
const candle = this.stockData[index];
|
|
395
395
|
if (!candle)
|
|
396
396
|
return "rgba(128,128,128,0.5)";
|
|
397
|
-
const isBull = candle.close > candle.open;
|
|
398
|
-
const isBear = candle.close < candle.open;
|
|
397
|
+
const isBull = (candle === null || candle === void 0 ? void 0 : candle.close) > (candle === null || candle === void 0 ? void 0 : candle.open);
|
|
398
|
+
const isBear = (candle === null || candle === void 0 ? void 0 : candle.close) < (candle === null || candle === void 0 ? void 0 : candle.open);
|
|
399
399
|
if (isBull) {
|
|
400
400
|
return "rgba(0, 200, 0, 0.6)";
|
|
401
401
|
}
|
package/dist/main.js
CHANGED
|
@@ -538,7 +538,7 @@ const lt=t=>(e,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(t,e)
|
|
|
538
538
|
* (c) 2016-2024 chartjs-plugin-zoom Contributors
|
|
539
539
|
* Released under the MIT License
|
|
540
540
|
*/
|
|
541
|
-
const il=t=>t&&t.enabled&&t.modifierKey,nl=(t,e)=>t&&e[t+"Key"],sl=(t,e)=>t&&!e[t+"Key"];function ol(t,e,i){return void 0===t||("string"==typeof t?-1!==t.indexOf(e):"function"==typeof t&&-1!==t({chart:i}).indexOf(e))}function rl(t,e){return"function"==typeof t&&(t=t({chart:e})),"string"==typeof t?{x:-1!==t.indexOf("x"),y:-1!==t.indexOf("y")}:{x:!1,y:!1}}function al(t,e,i){const{mode:n="xy",scaleMode:s,overScaleMode:o}=t||{},r=function(t,e){let{x:i,y:n}=t;const s=e.scales,o=Object.keys(s);for(let t=0;t<o.length;t++){const e=s[o[t]];if(n>=e.top&&n<=e.bottom&&i>=e.left&&i<=e.right)return e}return null}(e,i),a=rl(n,i),l=rl(s,i);if(o){const t=rl(o,i);for(const e of["x","y"])t[e]&&(l[e]=a[e],a[e]=!1)}if(r&&l[r.axis])return[r];const h=[];return oe(i.scales,(function(t){a[t.axis]&&h.push(t)})),h}const ll=new WeakMap;function hl(t){let e=ll.get(t);return e||(e={originalScaleLimits:{},updatedScaleLimits:{},handlers:{},panDelta:{},dragging:!1,panning:!1},ll.set(t,e)),e}function cl(t,e,i,n){const s=Math.max(0,Math.min(1,(t-e)/i||0));return{min:n*s,max:n*(1-s)}}function dl(t,e){const i=t.isHorizontal()?e.x:e.y;return t.getValueForPixel(i)}function ul(t,e,i){const n=t.max-t.min,s=n*(e-1);return cl(dl(t,i),t.min,n,s)}function fl(t,e,i,n,s){let o=i[n];if("original"===o){const i=t.originalScaleLimits[e.id][n];o=ie(i.options,i.scale)}return ie(o,s)}function pl(t,e,i){let{min:n,max:s}=e,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=hl(t.chart),{options:a}=t,l=function(t,e){return e&&(e[t.id]||e[t.axis])||{}}(t,i),{minRange:h=0}=l,c=fl(r,t,l,"min",-1/0),d=fl(r,t,l,"max",1/0);if("pan"===o&&(n<c||s>d))return!0;const u=t.max-t.min,f=o?Math.max(s-n,h):u;if(o&&f===h&&u<=h)return!0;const p=function(t,e,i){let{min:n,max:s,minLimit:o,maxLimit:r}=e;const a=(t-s+n)/2;n-=a,s+=a;const l=i.min.options??i.min.scale,h=i.max.options??i.max.scale,c=t/1e6;return Ce(n,l,c)&&(n=l),Ce(s,h,c)&&(s=h),n<o?(n=o,s=Math.min(o+t,r)):s>r&&(s=r,n=Math.max(r-t,o)),{min:n,max:s}}(f,{min:n,max:s,minLimit:c,maxLimit:d},r.originalScaleLimits[t.id]);return a.min=p.min,a.max=p.max,r.updatedScaleLimits[t.id]=p,t.parse(p.min)!==t.min||t.parse(p.max)!==t.max}const gl=t=>0===t||isNaN(t)?0:t<0?Math.min(Math.round(t),-1):Math.max(Math.round(t),1);const ml={second:500,minute:3e4,hour:18e5,day:432e5,week:3024e5,month:1296e6,quarter:5184e6,year:157248e5};function bl(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{min:s,max:o,options:r}=t,a=r.time&&r.time.round,l=ml[a]||0,h=t.getValueForPixel(t.getPixelForValue(s+l)-e),c=t.getValueForPixel(t.getPixelForValue(o+l)-e);return!(!isNaN(h)&&!isNaN(c))||pl(t,{min:h,max:c},i,!!n&&"pan")}function xl(t,e,i){return bl(t,e,i,!0)}const yl={category:function(t,e,i,n){const s=ul(t,e,i);return t.min===t.max&&e<1&&function(t){const e=t.getLabels().length-1;t.min>0&&(t.min-=1),t.max<e&&(t.max+=1)}(t),pl(t,{min:t.min+gl(s.min),max:t.max-gl(s.max)},n,!0)},default:function(t,e,i,n){const s=ul(t,e,i);return pl(t,{min:t.min+s.min,max:t.max-s.max},n,!0)},logarithmic:function(t,e,i,n){const s=function(t,e,i){const n=dl(t,i);if(void 0===n)return{min:t.min,max:t.max};const s=Math.log10(t.min),o=Math.log10(t.max),r=o-s,a=cl(Math.log10(n),s,r,r*(e-1));return{min:Math.pow(10,s+a.min),max:Math.pow(10,o-a.max)}}(t,e,i);return pl(t,s,n,!0)}},vl={default:function(t,e,i,n){pl(t,function(t,e,i){const n=t.getValueForPixel(e),s=t.getValueForPixel(i);return{min:Math.min(n,s),max:Math.max(n,s)}}(t,e,i),n,!0)}},_l={category:function(t,e,i){const n=t.getLabels().length-1;let{min:s,max:o}=t;const r=Math.max(o-s,1),a=Math.round(function(t){return t.isHorizontal()?t.width:t.height}(t)/Math.max(r,10)),l=Math.round(Math.abs(e/a));let h;return e<-a?(o=Math.min(o+l,n),s=1===r?o:o-r,h=o===n):e>a&&(s=Math.max(0,s-l),o=1===r?s:s+r,h=0===s),pl(t,{min:s,max:o},i)||h},default:bl,logarithmic:xl,timeseries:xl};function wl(t,e){oe(t,((i,n)=>{e[n]||delete t[n]}))}function Ml(t,e){const{scales:i}=t,{originalScaleLimits:n,updatedScaleLimits:s}=e;return oe(i,(function(t){(function(t,e,i){const{id:n,options:{min:s,max:o}}=t;if(!e[n]||!i[n])return!0;const r=i[n];return r.min!==s||r.max!==o})(t,n,s)&&(n[t.id]={min:{scale:t.min,options:t.options.min},max:{scale:t.max,options:t.options.max}})})),wl(n,i),wl(s,i),n}function kl(t,e,i,n){se(yl[t.type]||yl.default,[t,e,i,n])}function Sl(t,e,i,n){se(vl[t.type]||vl.default,[t,e,i,n])}function Al(t){const e=t.chartArea;return{x:(e.left+e.right)/2,y:(e.top+e.bottom)/2}}function Pl(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"none",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"api";const{x:s=1,y:o=1,focalPoint:r=Al(t)}="number"==typeof e?{x:e,y:e}:e,a=hl(t),{options:{limits:l,zoom:h}}=a;Ml(t,a);const c=1!==s,d=1!==o;oe(al(h,r,t)||t.scales,(function(t){t.isHorizontal()&&c?kl(t,s,r,l):!t.isHorizontal()&&d&&kl(t,o,r,l)})),t.update(i),se(h.onZoom,[{chart:t,trigger:n}])}function Dl(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none",s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"api";const o=hl(t),{options:{limits:r,zoom:a}}=o,{mode:l="xy"}=a;Ml(t,o);const h=ol(l,"x",t),c=ol(l,"y",t);oe(t.scales,(function(t){t.isHorizontal()&&h?Sl(t,e.x,i.x,r):!t.isHorizontal()&&c&&Sl(t,e.y,i.y,r)})),t.update(n),se(a.onZoom,[{chart:t,trigger:s}])}function Cl(t){const e=hl(t);let i=1,n=1;return oe(t.scales,(function(t){const s=function(t,e){const i=t.originalScaleLimits[e];if(!i)return;const{min:n,max:s}=i;return ie(s.options,s.scale)-ie(n.options,n.scale)}(e,t.id);if(s){const e=Math.round(s/(t.max-t.min)*100)/100;i=Math.min(i,e),n=Math.max(n,e)}})),i<1?i:n}function Tl(t,e,i,n){const{panDelta:s}=n,o=s[t.id]||0;De(o)===De(e)&&(e+=o);se(_l[t.type]||_l.default,[t,e,i])?s[t.id]=0:s[t.id]=e}function El(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none";const{x:s=0,y:o=0}="number"==typeof e?{x:e,y:e}:e,r=hl(t),{options:{pan:a,limits:l}}=r,{onPan:h}=a||{};Ml(t,r);const c=0!==s,d=0!==o;oe(i||t.scales,(function(t){t.isHorizontal()&&c?Tl(t,s,l,r):!t.isHorizontal()&&d&&Tl(t,o,l,r)})),t.update(n),se(h,[{chart:t}])}function Ol(t){const e=hl(t);Ml(t,e);const i={};for(const n of Object.keys(t.scales)){const{min:t,max:s}=e.originalScaleLimits[n]||{min:{},max:{}};i[n]={min:t.scale,max:s.scale}}return i}function Rl(t){const e=hl(t);return e.panning||e.dragging}const Ll=(t,e,i)=>Math.min(i,Math.max(e,t));function zl(t,e){const{handlers:i}=hl(t),n=i[e];n&&n.target&&(n.target.removeEventListener(e,n),delete i[e])}function Il(t,e,i,n){const{handlers:s,options:o}=hl(t),r=s[i];if(r&&r.target===e)return;zl(t,i),s[i]=e=>n(t,e,o),s[i].target=e;const a="wheel"!==i&&void 0;e.addEventListener(i,s[i],{passive:a})}function $l(t,e){const i=hl(t);i.dragStart&&(i.dragging=!0,i.dragEnd=e,t.update("none"))}function Fl(t,e){const i=hl(t);i.dragStart&&"Escape"===e.key&&(zl(t,"keydown"),i.dragging=!1,i.dragStart=i.dragEnd=null,t.update("none"))}function Vl(t,e){if(t.target!==e.canvas){const i=e.canvas.getBoundingClientRect();return{x:t.clientX-i.left,y:t.clientY-i.top}}return _n(t,e)}function Nl(t,e,i){const{onZoomStart:n,onZoomRejected:s}=i;if(n){if(!1===se(n,[{chart:t,event:e,point:Vl(e,t)}]))return se(s,[{chart:t,event:e}]),!1}}function Wl(t,e){if(t.legend){if(Ai(_n(e,t),t.legend))return}const i=hl(t),{pan:n,zoom:s={}}=i.options;if(0!==e.button||nl(il(n),e)||sl(il(s.drag),e))return se(s.onZoomRejected,[{chart:t,event:e}]);!1!==Nl(t,e,s)&&(i.dragStart=e,Il(t,t.canvas.ownerDocument,"mousemove",$l),Il(t,window.document,"keydown",Fl))}function Hl(t,e,i,n){let{min:s,max:o,prop:r}=n;t[s]=Ll(Math.min(i.begin[r],i.end[r]),e[s],e[o]),t[o]=Ll(Math.max(i.begin[r],i.end[r]),e[s],e[o])}function Bl(t,e,i){const n={begin:Vl(e.dragStart,t),end:Vl(e.dragEnd,t)};if(i){!function(t,e){let{begin:i,end:n}=t,s=n.x-i.x,o=n.y-i.y;const r=Math.abs(s/o);r>e?s=Math.sign(s)*Math.abs(o*e):r<e&&(o=Math.sign(o)*Math.abs(s/e)),n.x=i.x+s,n.y=i.y+o}(n,t.chartArea.width/t.chartArea.height)}return n}function jl(t,e,i,n){const s=ol(e,"x",t),o=ol(e,"y",t),{top:r,left:a,right:l,bottom:h,width:c,height:d}=t.chartArea,u={top:r,left:a,right:l,bottom:h},f=Bl(t,i,n&&s&&o);s&&Hl(u,t.chartArea,f,{min:"left",max:"right",prop:"x"}),o&&Hl(u,t.chartArea,f,{min:"top",max:"bottom",prop:"y"});const p=u.right-u.left,g=u.bottom-u.top;return{...u,width:p,height:g,zoomX:s&&p?1+(c-p)/c:1,zoomY:o&&g?1+(d-g)/d:1}}function Ul(t,e){const i=hl(t);if(!i.dragStart)return;zl(t,"mousemove");const{mode:n,onZoomComplete:s,drag:{threshold:o=0,maintainAspectRatio:r}}=i.options.zoom,a=jl(t,n,{dragStart:i.dragStart,dragEnd:e},r),l=ol(n,"x",t)?a.width:0,h=ol(n,"y",t)?a.height:0,c=Math.sqrt(l*l+h*h);if(i.dragStart=i.dragEnd=null,c<=o)return i.dragging=!1,void t.update("none");Dl(t,{x:a.left,y:a.top},{x:a.right,y:a.bottom},"zoom","drag"),i.dragging=!1,i.filterNextClick=!0,se(s,[{chart:t}])}function Yl(t,e){const{handlers:{onZoomComplete:i},options:{zoom:n}}=hl(t);if(!function(t,e,i){if(sl(il(i.wheel),e))se(i.onZoomRejected,[{chart:t,event:e}]);else if(!1!==Nl(t,e,i)&&(e.cancelable&&e.preventDefault(),void 0!==e.deltaY))return!0}(t,e,n))return;const s=e.target.getBoundingClientRect(),o=n.wheel.speed,r=e.deltaY>=0?2-1/(1-o):1+o;Pl(t,{x:r,y:r,focalPoint:{x:e.clientX-s.left,y:e.clientY-s.top}},"zoom","wheel"),se(i,[{chart:t}])}function Xl(t,e,i,n){i&&(hl(t).handlers[e]=function(t,e){let i;return function(){return clearTimeout(i),i=setTimeout(t,e),e}}((()=>se(i,[{chart:t}])),n))}function Zl(t,e){return function(i,n){const{pan:s,zoom:o={}}=e.options;if(!s||!s.enabled)return!1;const r=n&&n.srcEvent;return!r||(!(!e.panning&&"mouse"===n.pointerType&&(sl(il(s),r)||nl(il(o.drag),r)))||(se(s.onPanRejected,[{chart:t,event:n}]),!1))}}function ql(t,e,i){if(e.scale){const{center:n,pointers:s}=i,o=1/e.scale*i.scale,r=i.target.getBoundingClientRect(),a=function(t,e){const i=Math.abs(t.clientX-e.clientX),n=Math.abs(t.clientY-e.clientY),s=i/n;let o,r;return s>.3&&s<1.7?o=r=!0:i>n?o=!0:r=!0,{x:o,y:r}}(s[0],s[1]),l=e.options.zoom.mode;Pl(t,{x:a.x&&ol(l,"x",t)?o:1,y:a.y&&ol(l,"y",t)?o:1,focalPoint:{x:n.x-r.left,y:n.y-r.top}},"zoom","pinch"),e.scale=i.scale}}function Kl(t,e,i){const n=e.delta;n&&(e.panning=!0,El(t,{x:i.deltaX-n.x,y:i.deltaY-n.y},e.panScales),e.delta={x:i.deltaX,y:i.deltaY})}const Gl=new WeakMap;function Jl(t,e){const i=hl(t),n=t.canvas,{pan:s,zoom:o}=e,r=new el.Manager(n);o&&o.pinch.enabled&&(r.add(new el.Pinch),r.on("pinchstart",(e=>function(t,e,i){if(e.options.zoom.pinch.enabled){const n=_n(i,t);!1===se(e.options.zoom.onZoomStart,[{chart:t,event:i,point:n}])?(e.scale=null,se(e.options.zoom.onZoomRejected,[{chart:t,event:i}])):e.scale=1}}(t,i,e))),r.on("pinch",(e=>ql(t,i,e))),r.on("pinchend",(e=>function(t,e,i){e.scale&&(ql(t,e,i),e.scale=null,se(e.options.zoom.onZoomComplete,[{chart:t}]))}(t,i,e)))),s&&s.enabled&&(r.add(new el.Pan({threshold:s.threshold,enable:Zl(t,i)})),r.on("panstart",(e=>function(t,e,i){const{enabled:n,onPanStart:s,onPanRejected:o}=e.options.pan;if(!n)return;const r=i.target.getBoundingClientRect(),a={x:i.center.x-r.left,y:i.center.y-r.top};if(!1===se(s,[{chart:t,event:i,point:a}]))return se(o,[{chart:t,event:i}]);e.panScales=al(e.options.pan,a,t),e.delta={x:0,y:0},Kl(t,e,i)}(t,i,e))),r.on("panmove",(e=>Kl(t,i,e))),r.on("panend",(()=>function(t,e){e.delta=null,e.panning&&(e.panning=!1,e.filterNextClick=!0,se(e.options.pan.onPanComplete,[{chart:t}]))}(t,i)))),Gl.set(t,r)}function Ql(t){const e=Gl.get(t);e&&(e.remove("pinchstart"),e.remove("pinch"),e.remove("pinchend"),e.remove("panstart"),e.remove("pan"),e.remove("panend"),e.destroy(),Gl.delete(t))}function th(t,e,i){const n=i.zoom.drag,{dragStart:s,dragEnd:o}=hl(t);if(n.drawTime!==e||!o)return;const{left:r,top:a,width:l,height:h}=jl(t,i.zoom.mode,{dragStart:s,dragEnd:o},n.maintainAspectRatio),c=t.ctx;c.save(),c.beginPath(),c.fillStyle=n.backgroundColor||"rgba(225,225,225,0.3)",c.fillRect(r,a,l,h),n.borderWidth>0&&(c.lineWidth=n.borderWidth,c.strokeStyle=n.borderColor||"rgba(225,225,225)",c.strokeRect(r,a,l,h)),c.restore()}var eh={id:"zoom",version:"2.2.0",defaults:{pan:{enabled:!1,mode:"xy",threshold:10,modifierKey:null},zoom:{wheel:{enabled:!1,speed:.1,modifierKey:null},drag:{enabled:!1,drawTime:"beforeDatasetsDraw",modifierKey:null},pinch:{enabled:!1},mode:"xy"}},start:function(t,e,i){hl(t).options=i,Object.prototype.hasOwnProperty.call(i.zoom,"enabled")&&console.warn("The option `zoom.enabled` is no longer supported. Please use `zoom.wheel.enabled`, `zoom.drag.enabled`, or `zoom.pinch.enabled`."),(Object.prototype.hasOwnProperty.call(i.zoom,"overScaleMode")||Object.prototype.hasOwnProperty.call(i.pan,"overScaleMode"))&&console.warn("The option `overScaleMode` is deprecated. Please use `scaleMode` instead (and update `mode` as desired)."),el&&Jl(t,i),t.pan=(e,i,n)=>El(t,e,i,n),t.zoom=(e,i)=>Pl(t,e,i),t.zoomRect=(e,i,n)=>Dl(t,e,i,n),t.zoomScale=(e,i,n)=>function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none",s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"api";const o=hl(t);Ml(t,o),pl(t.scales[e],i,void 0,!0),t.update(n),se(o.options.zoom?.onZoom,[{chart:t,trigger:s}])}(t,e,i,n),t.resetZoom=e=>function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";const i=hl(t),n=Ml(t,i);oe(t.scales,(function(t){const e=t.options;n[t.id]?(e.min=n[t.id].min.options,e.max=n[t.id].max.options):(delete e.min,delete e.max),delete i.updatedScaleLimits[t.id]})),t.update(e),se(i.options.zoom.onZoomComplete,[{chart:t}])}(t,e),t.getZoomLevel=()=>Cl(t),t.getInitialScaleBounds=()=>Ol(t),t.getZoomedScaleBounds=()=>function(t){const e=hl(t),i={};for(const n of Object.keys(t.scales))i[n]=e.updatedScaleLimits[n];return i}(t),t.isZoomedOrPanned=()=>function(t){const e=Ol(t);for(const i of Object.keys(t.scales)){const{min:n,max:s}=e[i];if(void 0!==n&&t.scales[i].min!==n)return!0;if(void 0!==s&&t.scales[i].max!==s)return!0}return!1}(t),t.isZoomingOrPanning=()=>Rl(t)},beforeEvent(t,e){let{event:i}=e;if(Rl(t))return!1;if("click"===i.type||"mouseup"===i.type){const e=hl(t);if(e.filterNextClick)return e.filterNextClick=!1,!1}},beforeUpdate:function(t,e,i){const n=hl(t),s=n.options;n.options=i,function(t,e){const{pan:i,zoom:n}=t,{pan:s,zoom:o}=e;return n?.zoom?.pinch?.enabled!==o?.zoom?.pinch?.enabled||i?.enabled!==s?.enabled||i?.threshold!==s?.threshold}(s,i)&&(Ql(t),Jl(t,i)),function(t,e){const i=t.canvas,{wheel:n,drag:s,onZoomComplete:o}=e.zoom;n.enabled?(Il(t,i,"wheel",Yl),Xl(t,"onZoomComplete",o,250)):zl(t,"wheel"),s.enabled?(Il(t,i,"mousedown",Wl),Il(t,i.ownerDocument,"mouseup",Ul)):(zl(t,"mousedown"),zl(t,"mousemove"),zl(t,"mouseup"),zl(t,"keydown"))}(t,i)},beforeDatasetsDraw(t,e,i){th(t,"beforeDatasetsDraw",i)},afterDatasetsDraw(t,e,i){th(t,"afterDatasetsDraw",i)},beforeDraw(t,e,i){th(t,"beforeDraw",i)},afterDraw(t,e,i){th(t,"afterDraw",i)},stop:function(t){!function(t){zl(t,"mousedown"),zl(t,"mousemove"),zl(t,"mouseup"),zl(t,"wheel"),zl(t,"click"),zl(t,"keydown")}(t),el&&Ql(t),function(t){ll.delete(t)}(t)},panFunctions:_l,zoomFunctions:yl,zoomRectFunctions:vl};function ih(t){return t.close===t.open}let nh=class extends rt{constructor(){super(...arguments),this.stockData=[],this.zoomEnabled=!1,this.chart=null,this.customLinePlugin={id:"customLinePlugin",afterDraw:t=>{const e=t.ctx,{chartArea:i,scales:n,data:s}=t,o=t.data.datasets.find((t=>"RSI"===t.label)),r=s.datasets.find((t=>"Close Price"===t.label)),a=s.datasets.find((t=>"MA200"===t.label));if(!o||!r||!a)return;const l=o.data,h=r.data,c=a.data;for(let t=1;t<h.length;t++){const i=l[t];if(null!==i&&i<30){const s=n.x.getPixelForValue(t),o=n.yRSI.getPixelForValue(i);e.beginPath(),e.arc(s,o,4,0,2*Math.PI),e.fillStyle="green",e.fill(),e.fillStyle="green",e.font="bold 12px sans-serif",e.fillText("Buy_rsi",s+6,o-6)}else if(null!==i&&i>70){const s=n.x.getPixelForValue(t),o=n.yRSI.getPixelForValue(i);e.beginPath(),e.arc(s,o,4,0,2*Math.PI),e.fillStyle="red",e.fill(),e.fillStyle="red",e.font="bold 12px sans-serif",e.fillText("Sell_rsi",s+6,o-6)}const s=h[t-1],o=c[t-1],r=h[t],a=c[t];if(null==s||null==o||null==r||null==a)continue;const d=n.x.getPixelForValue(t),u=n.yPrice.getPixelForValue(r);if(r>a&&s<o){e.beginPath(),e.arc(d,u,4,0,2*Math.PI),e.fillStyle="green",e.fill(),e.fillStyle="green",e.font="bold 12px sans-serif",e.fillText("Bull",d+6,u-6);const t=.99*r,i=r+2*(r-t),s=n.yPrice.getPixelForValue(t),o=n.yPrice.getPixelForValue(i);e.fillStyle="red",e.fillRect(d,s,100,1),e.font="bold 12px sans-serif",e.fillText("SL "+t.toFixed(2),d+12,s-4),e.fillStyle="green",e.fillRect(d,o,100,1),e.fillText("TP "+i.toFixed(2),d+12,o-4)}else r<a&&s>o&&(e.beginPath(),e.arc(d,u,4,0,2*Math.PI),e.fillStyle="purple",e.fill(),e.fillStyle="purple",e.font="bold 12px sans-serif",e.fillText("Bear",d+6,u-6));e.setLineDash([])}}},this.volume_Doji_915_Plugin={id:"volumeSignalPlugin",afterDraw:t=>{const e=t.ctx,{scales:i,data:n}=t,s=n.datasets.find((t=>"Close Price"===t.label)),o=n.datasets.find((t=>"Volume"===t.label));if(!s||!o)return;const r=s.data,a=o.data;for(let t=5;t<r.length;t++){const n=this.stockData[t],s=null==n?void 0:n.divergence,o=ih(n),r=n.close>n.open,l=n.close<n.open,h=i.x.getPixelForValue(t),c=i.yPrice.getPixelForValue(n.close);if(!n)continue;const d=a[t];if(null==d)continue;const u=(a[t-1]+a[t-2]+a[t-3]+a[t-4]+a[t-5])/5;o&&(e.beginPath(),e.arc(h,c,4,0,2*Math.PI),e.fillStyle="red",e.fill(),e.fillStyle="gray",e.font="10px sans-serif",e.fillText("DOJI-REVERS",h+6,c-6)),d<=1.5*u||(r&&null!=s&&s>0&&(e.beginPath(),e.arc(h,c,4,0,2*Math.PI),e.fillStyle="green",e.fill(),e.fillStyle="green",e.font="bold 12px sans-serif",e.fillText("BUY_Vol",h+6,c-6)),l&&null!=s&&s<0&&(e.beginPath(),e.arc(h,c,4,0,2*Math.PI),e.fillStyle="red",e.fill(),e.fillStyle="red",e.font="bold 12px sans-serif",e.fillText("SELL_Vol",h+6,c-6)))}}}}firstUpdated(){this._createChart()}_resetZoom(){var t;null===(t=this.chart)||void 0===t||t.resetZoom()}_Zoomenalbe(){var t,e,i,n;if(!(null===(e=null===(t=this.chart)||void 0===t?void 0:t.options.plugins)||void 0===e?void 0:e.zoom))return;const s=this.chart.options.plugins.zoom,o=!this.zoomEnabled;(null===(i=s.zoom)||void 0===i?void 0:i.wheel)&&(s.zoom.wheel.enabled=o),(null===(n=s.zoom)||void 0===n?void 0:n.pinch)&&(s.zoom.pinch.enabled=o),s.pan&&(s.pan.enabled=o),this.zoomEnabled=o,this.chart.update()}willUpdate(t){return i(this,void 0,void 0,(function*(){t.has("stockData")&&(this.chart?this._updateChart():this._createChart())}))}_getChartData(){return{dates:this.stockData.map((t=>t.date)),closePrices:this.stockData.map((t=>t.close)),rsi:this.stockData.map((t=>{var e;return null!==(e=t.RSI)&&void 0!==e?e:null})),stochRSI_K:this.stockData.map((t=>{var e;return null!==(e=t.StochRSI_K)&&void 0!==e?e:null})),stochRSI_D:this.stockData.map((t=>{var e;return null!==(e=t.StochRSI_D)&&void 0!==e?e:null})),angleMACDsignal:this.stockData.map((t=>{var e;return null!==(e=t.angleMACDsignal)&&void 0!==e?e:null})),ma5:this.stockData.map((t=>{var e;return null!==(e=t.MA5)&&void 0!==e?e:null})),ma10:this.stockData.map((t=>{var e;return null!==(e=t.MA10)&&void 0!==e?e:null})),ma20:this.stockData.map((t=>{var e;return null!==(e=t.MA20)&&void 0!==e?e:null})),ma50:this.stockData.map((t=>{var e;return null!==(e=t.MA50)&&void 0!==e?e:null})),ma100:this.stockData.map((t=>{var e;return null!==(e=t.MA100)&&void 0!==e?e:null})),ma200:this.stockData.map((t=>{var e;return null!==(e=t.MA200)&&void 0!==e?e:null})),MACDLine:this.stockData.map((t=>{var e;return null!==(e=t.MACDLine)&&void 0!==e?e:null})),SignalLine:this.stockData.map((t=>{var e;return null!==(e=t.SignalLine)&&void 0!==e?e:null})),divergence:this.stockData.map((t=>{var e;return null!==(e=t.divergence)&&void 0!==e?e:null})),volumes:this.stockData.map((t=>{var e;return null!==(e=t.volume)&&void 0!==e?e:0}))}}_updateChart(){if(!this.chart)return;const{dates:t,closePrices:e,rsi:i,ma5:n,ma10:s,ma20:o,ma50:r,ma100:a,ma200:l,MACDLine:h,SignalLine:c,divergence:d,volumes:u,stochRSI_K:f,stochRSI_D:p,angleMACDsignal:g}=this._getChartData();this.chart.data.labels=t;const m=this.chart.data.datasets;m[0].data=i,m[1].data=d,m[2].data=h,m[3].data=c,m[4].data=e,m[5].data=o,m[6].data=r,m[7].data=a,m[8].data=l,m[9].data=s,m[10].data=n,m[11].data=u,m[12].data=f,m[13].data=p,m[14].data=g,this.chart.update()}_createChart(){var t;const{dates:e,closePrices:i,rsi:n,ma5:s,ma10:o,ma20:r,ma50:a,ma100:l,ma200:h,MACDLine:c,SignalLine:d,divergence:u,volumes:f,stochRSI_K:p,stochRSI_D:g,angleMACDsignal:m}=this._getChartData(),b=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("stockChart");if(!b)return;const x=b.getContext("2d");this.chart&&this.chart.destroy(),Ga.register(eh),Ga.register(this.volume_Doji_915_Plugin),this.chart=new Ga(x,{type:"line",data:{labels:e,datasets:[{label:"RSI",data:n,yAxisID:"yRSI",borderColor:"rgba(61, 58, 215, 0.2)",borderWidth:1,pointRadius:0,hidden:!0},{label:"MACD Histogram",data:u,type:"bar",yAxisID:"yMACD",backgroundColor:t=>t.raw>=0?"rgba(9, 225, 9, 0.4)":"rgba(227, 5, 5, 0.4)"},{label:"MACD Line",data:c,borderColor:"blue",yAxisID:"yMACD",borderWidth:1.2,fill:!1,pointRadius:0},{label:"Signal Line",data:d,borderColor:"orange",yAxisID:"yMACD",borderWidth:1.2,fill:!1,pointRadius:0},{label:"Close Price",data:i,yAxisID:"yPrice",borderColor:"rgba(75,192,192,1)",backgroundColor:"rgba(75,192,192,0.2)",fill:!0,pointRadius:0},{label:"MA20",data:r,yAxisID:"yPrice",borderColor:"#ff6384",borderWidth:1.5,pointRadius:0},{label:"MA50",data:a,yAxisID:"yPrice",borderColor:"green",borderWidth:4,pointRadius:0},{label:"MA100",data:l,yAxisID:"yPrice",borderColor:"#996633",borderWidth:1.5,pointRadius:0},{label:"MA200",data:h,yAxisID:"yPrice",borderColor:"purple",borderWidth:3,pointRadius:0},{label:"MA10",data:o,yAxisID:"yPrice",borderColor:"#cc3333",borderWidth:1,fill:!1,hidden:!0},{label:"MA5",data:s,yAxisID:"yPrice",borderColor:"#111111",borderWidth:1,fill:!1,hidden:!0},{label:"Volume",data:f,type:"bar",yAxisID:"yVolume",backgroundColor:t=>{const e=t.dataIndex,i=this.stockData[e];if(!i)return"rgba(128,128,128,0.5)";const n=i.close>i.open,s=i.close<i.open;return n?"rgba(0, 200, 0, 0.6)":s?"rgb(220, 0, 0)":"black"}},{label:"StochRSI %K",data:p,yAxisID:"yStochRSI",borderColor:"#00c853",borderWidth:1.5,pointRadius:0,hidden:!0},{label:"StochRSI %D",data:g,yAxisID:"yStochRSI",borderColor:"#ff5252",borderWidth:1.5,pointRadius:0,hidden:!0},{label:"angleMACDsignal",data:g,yAxisID:"yMACD",borderColor:"#ff5250",borderWidth:1.5,pointRadius:0,hidden:!0}]},options:{responsive:!0,maintainAspectRatio:!0,interaction:{mode:"index",intersect:!1},plugins:{legend:{position:"top"},zoom:{pan:{enabled:this.zoomEnabled,mode:"x"},zoom:{wheel:{enabled:this.zoomEnabled},mode:"x"}},tooltip:{mode:"index",intersect:!1}},scales:{x:{type:"category",ticks:{color:t=>{const e=t.tick.label;if("string"==typeof e){const t=new Date(e.replace(" ","T"));if(isNaN(t.getTime()))return"black";const i=(new Date).toISOString().split("T")[0];return t.toISOString().split("T")[0]===i?"Salmon":"black"}return"black"}}},yMACD:{position:"right",title:{display:!0,text:"MACD"},beginAtZero:!1,weight:1},yPrice:{position:"left",title:{display:!0,text:"Price"},beginAtZero:!1,weight:3,grid:{drawOnChartArea:!0}},yVolume:{position:"left",title:{display:!0,text:"Volume"},beginAtZero:!0,weight:1,grid:{drawOnChartArea:!1}},yStochRSI:{position:"right",min:-.5,max:1.5,title:{display:!0,text:"StochRSI"},grid:{drawOnChartArea:!1}}}}})}render(){return B`
|
|
541
|
+
const il=t=>t&&t.enabled&&t.modifierKey,nl=(t,e)=>t&&e[t+"Key"],sl=(t,e)=>t&&!e[t+"Key"];function ol(t,e,i){return void 0===t||("string"==typeof t?-1!==t.indexOf(e):"function"==typeof t&&-1!==t({chart:i}).indexOf(e))}function rl(t,e){return"function"==typeof t&&(t=t({chart:e})),"string"==typeof t?{x:-1!==t.indexOf("x"),y:-1!==t.indexOf("y")}:{x:!1,y:!1}}function al(t,e,i){const{mode:n="xy",scaleMode:s,overScaleMode:o}=t||{},r=function(t,e){let{x:i,y:n}=t;const s=e.scales,o=Object.keys(s);for(let t=0;t<o.length;t++){const e=s[o[t]];if(n>=e.top&&n<=e.bottom&&i>=e.left&&i<=e.right)return e}return null}(e,i),a=rl(n,i),l=rl(s,i);if(o){const t=rl(o,i);for(const e of["x","y"])t[e]&&(l[e]=a[e],a[e]=!1)}if(r&&l[r.axis])return[r];const h=[];return oe(i.scales,(function(t){a[t.axis]&&h.push(t)})),h}const ll=new WeakMap;function hl(t){let e=ll.get(t);return e||(e={originalScaleLimits:{},updatedScaleLimits:{},handlers:{},panDelta:{},dragging:!1,panning:!1},ll.set(t,e)),e}function cl(t,e,i,n){const s=Math.max(0,Math.min(1,(t-e)/i||0));return{min:n*s,max:n*(1-s)}}function dl(t,e){const i=t.isHorizontal()?e.x:e.y;return t.getValueForPixel(i)}function ul(t,e,i){const n=t.max-t.min,s=n*(e-1);return cl(dl(t,i),t.min,n,s)}function fl(t,e,i,n,s){let o=i[n];if("original"===o){const i=t.originalScaleLimits[e.id][n];o=ie(i.options,i.scale)}return ie(o,s)}function pl(t,e,i){let{min:n,max:s}=e,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=hl(t.chart),{options:a}=t,l=function(t,e){return e&&(e[t.id]||e[t.axis])||{}}(t,i),{minRange:h=0}=l,c=fl(r,t,l,"min",-1/0),d=fl(r,t,l,"max",1/0);if("pan"===o&&(n<c||s>d))return!0;const u=t.max-t.min,f=o?Math.max(s-n,h):u;if(o&&f===h&&u<=h)return!0;const p=function(t,e,i){let{min:n,max:s,minLimit:o,maxLimit:r}=e;const a=(t-s+n)/2;n-=a,s+=a;const l=i.min.options??i.min.scale,h=i.max.options??i.max.scale,c=t/1e6;return Ce(n,l,c)&&(n=l),Ce(s,h,c)&&(s=h),n<o?(n=o,s=Math.min(o+t,r)):s>r&&(s=r,n=Math.max(r-t,o)),{min:n,max:s}}(f,{min:n,max:s,minLimit:c,maxLimit:d},r.originalScaleLimits[t.id]);return a.min=p.min,a.max=p.max,r.updatedScaleLimits[t.id]=p,t.parse(p.min)!==t.min||t.parse(p.max)!==t.max}const gl=t=>0===t||isNaN(t)?0:t<0?Math.min(Math.round(t),-1):Math.max(Math.round(t),1);const ml={second:500,minute:3e4,hour:18e5,day:432e5,week:3024e5,month:1296e6,quarter:5184e6,year:157248e5};function bl(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{min:s,max:o,options:r}=t,a=r.time&&r.time.round,l=ml[a]||0,h=t.getValueForPixel(t.getPixelForValue(s+l)-e),c=t.getValueForPixel(t.getPixelForValue(o+l)-e);return!(!isNaN(h)&&!isNaN(c))||pl(t,{min:h,max:c},i,!!n&&"pan")}function xl(t,e,i){return bl(t,e,i,!0)}const yl={category:function(t,e,i,n){const s=ul(t,e,i);return t.min===t.max&&e<1&&function(t){const e=t.getLabels().length-1;t.min>0&&(t.min-=1),t.max<e&&(t.max+=1)}(t),pl(t,{min:t.min+gl(s.min),max:t.max-gl(s.max)},n,!0)},default:function(t,e,i,n){const s=ul(t,e,i);return pl(t,{min:t.min+s.min,max:t.max-s.max},n,!0)},logarithmic:function(t,e,i,n){const s=function(t,e,i){const n=dl(t,i);if(void 0===n)return{min:t.min,max:t.max};const s=Math.log10(t.min),o=Math.log10(t.max),r=o-s,a=cl(Math.log10(n),s,r,r*(e-1));return{min:Math.pow(10,s+a.min),max:Math.pow(10,o-a.max)}}(t,e,i);return pl(t,s,n,!0)}},vl={default:function(t,e,i,n){pl(t,function(t,e,i){const n=t.getValueForPixel(e),s=t.getValueForPixel(i);return{min:Math.min(n,s),max:Math.max(n,s)}}(t,e,i),n,!0)}},_l={category:function(t,e,i){const n=t.getLabels().length-1;let{min:s,max:o}=t;const r=Math.max(o-s,1),a=Math.round(function(t){return t.isHorizontal()?t.width:t.height}(t)/Math.max(r,10)),l=Math.round(Math.abs(e/a));let h;return e<-a?(o=Math.min(o+l,n),s=1===r?o:o-r,h=o===n):e>a&&(s=Math.max(0,s-l),o=1===r?s:s+r,h=0===s),pl(t,{min:s,max:o},i)||h},default:bl,logarithmic:xl,timeseries:xl};function wl(t,e){oe(t,((i,n)=>{e[n]||delete t[n]}))}function Ml(t,e){const{scales:i}=t,{originalScaleLimits:n,updatedScaleLimits:s}=e;return oe(i,(function(t){(function(t,e,i){const{id:n,options:{min:s,max:o}}=t;if(!e[n]||!i[n])return!0;const r=i[n];return r.min!==s||r.max!==o})(t,n,s)&&(n[t.id]={min:{scale:t.min,options:t.options.min},max:{scale:t.max,options:t.options.max}})})),wl(n,i),wl(s,i),n}function kl(t,e,i,n){se(yl[t.type]||yl.default,[t,e,i,n])}function Sl(t,e,i,n){se(vl[t.type]||vl.default,[t,e,i,n])}function Al(t){const e=t.chartArea;return{x:(e.left+e.right)/2,y:(e.top+e.bottom)/2}}function Pl(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"none",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"api";const{x:s=1,y:o=1,focalPoint:r=Al(t)}="number"==typeof e?{x:e,y:e}:e,a=hl(t),{options:{limits:l,zoom:h}}=a;Ml(t,a);const c=1!==s,d=1!==o;oe(al(h,r,t)||t.scales,(function(t){t.isHorizontal()&&c?kl(t,s,r,l):!t.isHorizontal()&&d&&kl(t,o,r,l)})),t.update(i),se(h.onZoom,[{chart:t,trigger:n}])}function Dl(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none",s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"api";const o=hl(t),{options:{limits:r,zoom:a}}=o,{mode:l="xy"}=a;Ml(t,o);const h=ol(l,"x",t),c=ol(l,"y",t);oe(t.scales,(function(t){t.isHorizontal()&&h?Sl(t,e.x,i.x,r):!t.isHorizontal()&&c&&Sl(t,e.y,i.y,r)})),t.update(n),se(a.onZoom,[{chart:t,trigger:s}])}function Cl(t){const e=hl(t);let i=1,n=1;return oe(t.scales,(function(t){const s=function(t,e){const i=t.originalScaleLimits[e];if(!i)return;const{min:n,max:s}=i;return ie(s.options,s.scale)-ie(n.options,n.scale)}(e,t.id);if(s){const e=Math.round(s/(t.max-t.min)*100)/100;i=Math.min(i,e),n=Math.max(n,e)}})),i<1?i:n}function Tl(t,e,i,n){const{panDelta:s}=n,o=s[t.id]||0;De(o)===De(e)&&(e+=o);se(_l[t.type]||_l.default,[t,e,i])?s[t.id]=0:s[t.id]=e}function El(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none";const{x:s=0,y:o=0}="number"==typeof e?{x:e,y:e}:e,r=hl(t),{options:{pan:a,limits:l}}=r,{onPan:h}=a||{};Ml(t,r);const c=0!==s,d=0!==o;oe(i||t.scales,(function(t){t.isHorizontal()&&c?Tl(t,s,l,r):!t.isHorizontal()&&d&&Tl(t,o,l,r)})),t.update(n),se(h,[{chart:t}])}function Ol(t){const e=hl(t);Ml(t,e);const i={};for(const n of Object.keys(t.scales)){const{min:t,max:s}=e.originalScaleLimits[n]||{min:{},max:{}};i[n]={min:t.scale,max:s.scale}}return i}function Rl(t){const e=hl(t);return e.panning||e.dragging}const Ll=(t,e,i)=>Math.min(i,Math.max(e,t));function zl(t,e){const{handlers:i}=hl(t),n=i[e];n&&n.target&&(n.target.removeEventListener(e,n),delete i[e])}function Il(t,e,i,n){const{handlers:s,options:o}=hl(t),r=s[i];if(r&&r.target===e)return;zl(t,i),s[i]=e=>n(t,e,o),s[i].target=e;const a="wheel"!==i&&void 0;e.addEventListener(i,s[i],{passive:a})}function $l(t,e){const i=hl(t);i.dragStart&&(i.dragging=!0,i.dragEnd=e,t.update("none"))}function Fl(t,e){const i=hl(t);i.dragStart&&"Escape"===e.key&&(zl(t,"keydown"),i.dragging=!1,i.dragStart=i.dragEnd=null,t.update("none"))}function Vl(t,e){if(t.target!==e.canvas){const i=e.canvas.getBoundingClientRect();return{x:t.clientX-i.left,y:t.clientY-i.top}}return _n(t,e)}function Nl(t,e,i){const{onZoomStart:n,onZoomRejected:s}=i;if(n){if(!1===se(n,[{chart:t,event:e,point:Vl(e,t)}]))return se(s,[{chart:t,event:e}]),!1}}function Wl(t,e){if(t.legend){if(Ai(_n(e,t),t.legend))return}const i=hl(t),{pan:n,zoom:s={}}=i.options;if(0!==e.button||nl(il(n),e)||sl(il(s.drag),e))return se(s.onZoomRejected,[{chart:t,event:e}]);!1!==Nl(t,e,s)&&(i.dragStart=e,Il(t,t.canvas.ownerDocument,"mousemove",$l),Il(t,window.document,"keydown",Fl))}function Hl(t,e,i,n){let{min:s,max:o,prop:r}=n;t[s]=Ll(Math.min(i.begin[r],i.end[r]),e[s],e[o]),t[o]=Ll(Math.max(i.begin[r],i.end[r]),e[s],e[o])}function Bl(t,e,i){const n={begin:Vl(e.dragStart,t),end:Vl(e.dragEnd,t)};if(i){!function(t,e){let{begin:i,end:n}=t,s=n.x-i.x,o=n.y-i.y;const r=Math.abs(s/o);r>e?s=Math.sign(s)*Math.abs(o*e):r<e&&(o=Math.sign(o)*Math.abs(s/e)),n.x=i.x+s,n.y=i.y+o}(n,t.chartArea.width/t.chartArea.height)}return n}function jl(t,e,i,n){const s=ol(e,"x",t),o=ol(e,"y",t),{top:r,left:a,right:l,bottom:h,width:c,height:d}=t.chartArea,u={top:r,left:a,right:l,bottom:h},f=Bl(t,i,n&&s&&o);s&&Hl(u,t.chartArea,f,{min:"left",max:"right",prop:"x"}),o&&Hl(u,t.chartArea,f,{min:"top",max:"bottom",prop:"y"});const p=u.right-u.left,g=u.bottom-u.top;return{...u,width:p,height:g,zoomX:s&&p?1+(c-p)/c:1,zoomY:o&&g?1+(d-g)/d:1}}function Ul(t,e){const i=hl(t);if(!i.dragStart)return;zl(t,"mousemove");const{mode:n,onZoomComplete:s,drag:{threshold:o=0,maintainAspectRatio:r}}=i.options.zoom,a=jl(t,n,{dragStart:i.dragStart,dragEnd:e},r),l=ol(n,"x",t)?a.width:0,h=ol(n,"y",t)?a.height:0,c=Math.sqrt(l*l+h*h);if(i.dragStart=i.dragEnd=null,c<=o)return i.dragging=!1,void t.update("none");Dl(t,{x:a.left,y:a.top},{x:a.right,y:a.bottom},"zoom","drag"),i.dragging=!1,i.filterNextClick=!0,se(s,[{chart:t}])}function Yl(t,e){const{handlers:{onZoomComplete:i},options:{zoom:n}}=hl(t);if(!function(t,e,i){if(sl(il(i.wheel),e))se(i.onZoomRejected,[{chart:t,event:e}]);else if(!1!==Nl(t,e,i)&&(e.cancelable&&e.preventDefault(),void 0!==e.deltaY))return!0}(t,e,n))return;const s=e.target.getBoundingClientRect(),o=n.wheel.speed,r=e.deltaY>=0?2-1/(1-o):1+o;Pl(t,{x:r,y:r,focalPoint:{x:e.clientX-s.left,y:e.clientY-s.top}},"zoom","wheel"),se(i,[{chart:t}])}function Xl(t,e,i,n){i&&(hl(t).handlers[e]=function(t,e){let i;return function(){return clearTimeout(i),i=setTimeout(t,e),e}}((()=>se(i,[{chart:t}])),n))}function Zl(t,e){return function(i,n){const{pan:s,zoom:o={}}=e.options;if(!s||!s.enabled)return!1;const r=n&&n.srcEvent;return!r||(!(!e.panning&&"mouse"===n.pointerType&&(sl(il(s),r)||nl(il(o.drag),r)))||(se(s.onPanRejected,[{chart:t,event:n}]),!1))}}function ql(t,e,i){if(e.scale){const{center:n,pointers:s}=i,o=1/e.scale*i.scale,r=i.target.getBoundingClientRect(),a=function(t,e){const i=Math.abs(t.clientX-e.clientX),n=Math.abs(t.clientY-e.clientY),s=i/n;let o,r;return s>.3&&s<1.7?o=r=!0:i>n?o=!0:r=!0,{x:o,y:r}}(s[0],s[1]),l=e.options.zoom.mode;Pl(t,{x:a.x&&ol(l,"x",t)?o:1,y:a.y&&ol(l,"y",t)?o:1,focalPoint:{x:n.x-r.left,y:n.y-r.top}},"zoom","pinch"),e.scale=i.scale}}function Kl(t,e,i){const n=e.delta;n&&(e.panning=!0,El(t,{x:i.deltaX-n.x,y:i.deltaY-n.y},e.panScales),e.delta={x:i.deltaX,y:i.deltaY})}const Gl=new WeakMap;function Jl(t,e){const i=hl(t),n=t.canvas,{pan:s,zoom:o}=e,r=new el.Manager(n);o&&o.pinch.enabled&&(r.add(new el.Pinch),r.on("pinchstart",(e=>function(t,e,i){if(e.options.zoom.pinch.enabled){const n=_n(i,t);!1===se(e.options.zoom.onZoomStart,[{chart:t,event:i,point:n}])?(e.scale=null,se(e.options.zoom.onZoomRejected,[{chart:t,event:i}])):e.scale=1}}(t,i,e))),r.on("pinch",(e=>ql(t,i,e))),r.on("pinchend",(e=>function(t,e,i){e.scale&&(ql(t,e,i),e.scale=null,se(e.options.zoom.onZoomComplete,[{chart:t}]))}(t,i,e)))),s&&s.enabled&&(r.add(new el.Pan({threshold:s.threshold,enable:Zl(t,i)})),r.on("panstart",(e=>function(t,e,i){const{enabled:n,onPanStart:s,onPanRejected:o}=e.options.pan;if(!n)return;const r=i.target.getBoundingClientRect(),a={x:i.center.x-r.left,y:i.center.y-r.top};if(!1===se(s,[{chart:t,event:i,point:a}]))return se(o,[{chart:t,event:i}]);e.panScales=al(e.options.pan,a,t),e.delta={x:0,y:0},Kl(t,e,i)}(t,i,e))),r.on("panmove",(e=>Kl(t,i,e))),r.on("panend",(()=>function(t,e){e.delta=null,e.panning&&(e.panning=!1,e.filterNextClick=!0,se(e.options.pan.onPanComplete,[{chart:t}]))}(t,i)))),Gl.set(t,r)}function Ql(t){const e=Gl.get(t);e&&(e.remove("pinchstart"),e.remove("pinch"),e.remove("pinchend"),e.remove("panstart"),e.remove("pan"),e.remove("panend"),e.destroy(),Gl.delete(t))}function th(t,e,i){const n=i.zoom.drag,{dragStart:s,dragEnd:o}=hl(t);if(n.drawTime!==e||!o)return;const{left:r,top:a,width:l,height:h}=jl(t,i.zoom.mode,{dragStart:s,dragEnd:o},n.maintainAspectRatio),c=t.ctx;c.save(),c.beginPath(),c.fillStyle=n.backgroundColor||"rgba(225,225,225,0.3)",c.fillRect(r,a,l,h),n.borderWidth>0&&(c.lineWidth=n.borderWidth,c.strokeStyle=n.borderColor||"rgba(225,225,225)",c.strokeRect(r,a,l,h)),c.restore()}var eh={id:"zoom",version:"2.2.0",defaults:{pan:{enabled:!1,mode:"xy",threshold:10,modifierKey:null},zoom:{wheel:{enabled:!1,speed:.1,modifierKey:null},drag:{enabled:!1,drawTime:"beforeDatasetsDraw",modifierKey:null},pinch:{enabled:!1},mode:"xy"}},start:function(t,e,i){hl(t).options=i,Object.prototype.hasOwnProperty.call(i.zoom,"enabled")&&console.warn("The option `zoom.enabled` is no longer supported. Please use `zoom.wheel.enabled`, `zoom.drag.enabled`, or `zoom.pinch.enabled`."),(Object.prototype.hasOwnProperty.call(i.zoom,"overScaleMode")||Object.prototype.hasOwnProperty.call(i.pan,"overScaleMode"))&&console.warn("The option `overScaleMode` is deprecated. Please use `scaleMode` instead (and update `mode` as desired)."),el&&Jl(t,i),t.pan=(e,i,n)=>El(t,e,i,n),t.zoom=(e,i)=>Pl(t,e,i),t.zoomRect=(e,i,n)=>Dl(t,e,i,n),t.zoomScale=(e,i,n)=>function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none",s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"api";const o=hl(t);Ml(t,o),pl(t.scales[e],i,void 0,!0),t.update(n),se(o.options.zoom?.onZoom,[{chart:t,trigger:s}])}(t,e,i,n),t.resetZoom=e=>function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";const i=hl(t),n=Ml(t,i);oe(t.scales,(function(t){const e=t.options;n[t.id]?(e.min=n[t.id].min.options,e.max=n[t.id].max.options):(delete e.min,delete e.max),delete i.updatedScaleLimits[t.id]})),t.update(e),se(i.options.zoom.onZoomComplete,[{chart:t}])}(t,e),t.getZoomLevel=()=>Cl(t),t.getInitialScaleBounds=()=>Ol(t),t.getZoomedScaleBounds=()=>function(t){const e=hl(t),i={};for(const n of Object.keys(t.scales))i[n]=e.updatedScaleLimits[n];return i}(t),t.isZoomedOrPanned=()=>function(t){const e=Ol(t);for(const i of Object.keys(t.scales)){const{min:n,max:s}=e[i];if(void 0!==n&&t.scales[i].min!==n)return!0;if(void 0!==s&&t.scales[i].max!==s)return!0}return!1}(t),t.isZoomingOrPanning=()=>Rl(t)},beforeEvent(t,e){let{event:i}=e;if(Rl(t))return!1;if("click"===i.type||"mouseup"===i.type){const e=hl(t);if(e.filterNextClick)return e.filterNextClick=!1,!1}},beforeUpdate:function(t,e,i){const n=hl(t),s=n.options;n.options=i,function(t,e){const{pan:i,zoom:n}=t,{pan:s,zoom:o}=e;return n?.zoom?.pinch?.enabled!==o?.zoom?.pinch?.enabled||i?.enabled!==s?.enabled||i?.threshold!==s?.threshold}(s,i)&&(Ql(t),Jl(t,i)),function(t,e){const i=t.canvas,{wheel:n,drag:s,onZoomComplete:o}=e.zoom;n.enabled?(Il(t,i,"wheel",Yl),Xl(t,"onZoomComplete",o,250)):zl(t,"wheel"),s.enabled?(Il(t,i,"mousedown",Wl),Il(t,i.ownerDocument,"mouseup",Ul)):(zl(t,"mousedown"),zl(t,"mousemove"),zl(t,"mouseup"),zl(t,"keydown"))}(t,i)},beforeDatasetsDraw(t,e,i){th(t,"beforeDatasetsDraw",i)},afterDatasetsDraw(t,e,i){th(t,"afterDatasetsDraw",i)},beforeDraw(t,e,i){th(t,"beforeDraw",i)},afterDraw(t,e,i){th(t,"afterDraw",i)},stop:function(t){!function(t){zl(t,"mousedown"),zl(t,"mousemove"),zl(t,"mouseup"),zl(t,"wheel"),zl(t,"click"),zl(t,"keydown")}(t),el&&Ql(t),function(t){ll.delete(t)}(t)},panFunctions:_l,zoomFunctions:yl,zoomRectFunctions:vl};function ih(t){return(null==t?void 0:t.close)===(null==t?void 0:t.open)}let nh=class extends rt{constructor(){super(...arguments),this.stockData=[],this.zoomEnabled=!1,this.chart=null,this.customLinePlugin={id:"customLinePlugin",afterDraw:t=>{const e=t.ctx,{chartArea:i,scales:n,data:s}=t,o=t.data.datasets.find((t=>"RSI"===t.label)),r=s.datasets.find((t=>"Close Price"===t.label)),a=s.datasets.find((t=>"MA200"===t.label));if(!o||!r||!a)return;const l=o.data,h=r.data,c=a.data;for(let t=1;t<h.length;t++){const i=l[t];if(null!==i&&i<30){const s=n.x.getPixelForValue(t),o=n.yRSI.getPixelForValue(i);e.beginPath(),e.arc(s,o,4,0,2*Math.PI),e.fillStyle="green",e.fill(),e.fillStyle="green",e.font="bold 12px sans-serif",e.fillText("Buy_rsi",s+6,o-6)}else if(null!==i&&i>70){const s=n.x.getPixelForValue(t),o=n.yRSI.getPixelForValue(i);e.beginPath(),e.arc(s,o,4,0,2*Math.PI),e.fillStyle="red",e.fill(),e.fillStyle="red",e.font="bold 12px sans-serif",e.fillText("Sell_rsi",s+6,o-6)}const s=h[t-1],o=c[t-1],r=h[t],a=c[t];if(null==s||null==o||null==r||null==a)continue;const d=n.x.getPixelForValue(t),u=n.yPrice.getPixelForValue(r);if(r>a&&s<o){e.beginPath(),e.arc(d,u,4,0,2*Math.PI),e.fillStyle="green",e.fill(),e.fillStyle="green",e.font="bold 12px sans-serif",e.fillText("Bull",d+6,u-6);const t=.99*r,i=r+2*(r-t),s=n.yPrice.getPixelForValue(t),o=n.yPrice.getPixelForValue(i);e.fillStyle="red",e.fillRect(d,s,100,1),e.font="bold 12px sans-serif",e.fillText("SL "+t.toFixed(2),d+12,s-4),e.fillStyle="green",e.fillRect(d,o,100,1),e.fillText("TP "+i.toFixed(2),d+12,o-4)}else r<a&&s>o&&(e.beginPath(),e.arc(d,u,4,0,2*Math.PI),e.fillStyle="purple",e.fill(),e.fillStyle="purple",e.font="bold 12px sans-serif",e.fillText("Bear",d+6,u-6));e.setLineDash([])}}},this.volume_Doji_915_Plugin={id:"volumeSignalPlugin",afterDraw:t=>{const e=t.ctx,{scales:i,data:n}=t,s=n.datasets.find((t=>"Close Price"===t.label)),o=n.datasets.find((t=>"Volume"===t.label));if(!s||!o)return;const r=s.data,a=o.data;for(let t=5;t<r.length;t++){const n=this.stockData[t],s=null==n?void 0:n.divergence,o=ih(n),r=(null==n?void 0:n.close)>(null==n?void 0:n.open),l=(null==n?void 0:n.close)<(null==n?void 0:n.open),h=i.x.getPixelForValue(t),c=i.yPrice.getPixelForValue(null==n?void 0:n.close);if(!n)continue;const d=a[t];if(null==d)continue;const u=(a[t-1]+a[t-2]+a[t-3]+a[t-4]+a[t-5])/5;o&&(e.beginPath(),e.arc(h,c,4,0,2*Math.PI),e.fillStyle="red",e.fill(),e.fillStyle="gray",e.font="10px sans-serif",e.fillText("DOJI-REVERS",h+6,c-6)),d<=1.5*u||(r&&null!=s&&s>0&&(e.beginPath(),e.arc(h,c,4,0,2*Math.PI),e.fillStyle="green",e.fill(),e.fillStyle="green",e.font="bold 12px sans-serif",e.fillText("BUY_Vol",h+6,c-6)),l&&null!=s&&s<0&&(e.beginPath(),e.arc(h,c,4,0,2*Math.PI),e.fillStyle="red",e.fill(),e.fillStyle="red",e.font="bold 12px sans-serif",e.fillText("SELL_Vol",h+6,c-6)))}}}}firstUpdated(){this._createChart()}_resetZoom(){var t;null===(t=this.chart)||void 0===t||t.resetZoom()}_Zoomenalbe(){var t,e,i,n;if(!(null===(e=null===(t=this.chart)||void 0===t?void 0:t.options.plugins)||void 0===e?void 0:e.zoom))return;const s=this.chart.options.plugins.zoom,o=!this.zoomEnabled;(null===(i=s.zoom)||void 0===i?void 0:i.wheel)&&(s.zoom.wheel.enabled=o),(null===(n=s.zoom)||void 0===n?void 0:n.pinch)&&(s.zoom.pinch.enabled=o),s.pan&&(s.pan.enabled=o),this.zoomEnabled=o,this.chart.update()}willUpdate(t){return i(this,void 0,void 0,(function*(){t.has("stockData")&&(this.chart?this._updateChart():this._createChart())}))}_getChartData(){return{dates:this.stockData.map((t=>{var e;return null!==(e=t.date)&&void 0!==e?e:null})),closePrices:this.stockData.map((t=>{var e;return null!==(e=t.close)&&void 0!==e?e:null})),rsi:this.stockData.map((t=>{var e;return null!==(e=t.RSI)&&void 0!==e?e:null})),stochRSI_K:this.stockData.map((t=>{var e;return null!==(e=t.StochRSI_K)&&void 0!==e?e:null})),stochRSI_D:this.stockData.map((t=>{var e;return null!==(e=t.StochRSI_D)&&void 0!==e?e:null})),angleMACDsignal:this.stockData.map((t=>{var e;return null!==(e=t.angleMACDsignal)&&void 0!==e?e:null})),ma5:this.stockData.map((t=>{var e;return null!==(e=t.MA5)&&void 0!==e?e:null})),ma10:this.stockData.map((t=>{var e;return null!==(e=t.MA10)&&void 0!==e?e:null})),ma20:this.stockData.map((t=>{var e;return null!==(e=t.MA20)&&void 0!==e?e:null})),ma50:this.stockData.map((t=>{var e;return null!==(e=t.MA50)&&void 0!==e?e:null})),ma100:this.stockData.map((t=>{var e;return null!==(e=t.MA100)&&void 0!==e?e:null})),ma200:this.stockData.map((t=>{var e;return null!==(e=t.MA200)&&void 0!==e?e:null})),MACDLine:this.stockData.map((t=>{var e;return null!==(e=t.MACDLine)&&void 0!==e?e:null})),SignalLine:this.stockData.map((t=>{var e;return null!==(e=t.SignalLine)&&void 0!==e?e:null})),divergence:this.stockData.map((t=>{var e;return null!==(e=t.divergence)&&void 0!==e?e:null})),volumes:this.stockData.map((t=>{var e;return null!==(e=t.volume)&&void 0!==e?e:0}))}}_updateChart(){if(!this.chart)return;const{dates:t,closePrices:e,rsi:i,ma5:n,ma10:s,ma20:o,ma50:r,ma100:a,ma200:l,MACDLine:h,SignalLine:c,divergence:d,volumes:u,stochRSI_K:f,stochRSI_D:p,angleMACDsignal:g}=this._getChartData();this.chart.data.labels=t;const m=this.chart.data.datasets;m[0].data=i,m[1].data=d,m[2].data=h,m[3].data=c,m[4].data=e,m[5].data=o,m[6].data=r,m[7].data=a,m[8].data=l,m[9].data=s,m[10].data=n,m[11].data=u,m[12].data=f,m[13].data=p,m[14].data=g,this.chart.update()}_createChart(){var t;const{dates:e,closePrices:i,rsi:n,ma5:s,ma10:o,ma20:r,ma50:a,ma100:l,ma200:h,MACDLine:c,SignalLine:d,divergence:u,volumes:f,stochRSI_K:p,stochRSI_D:g,angleMACDsignal:m}=this._getChartData(),b=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("stockChart");if(!b)return;const x=b.getContext("2d");this.chart&&this.chart.destroy(),Ga.register(eh),Ga.register(this.volume_Doji_915_Plugin),this.chart=new Ga(x,{type:"line",data:{labels:e,datasets:[{label:"RSI",data:n,yAxisID:"yRSI",borderColor:"rgba(61, 58, 215, 0.2)",borderWidth:1,pointRadius:0,hidden:!0},{label:"MACD Histogram",data:u,type:"bar",yAxisID:"yMACD",backgroundColor:t=>t.raw>=0?"rgba(9, 225, 9, 0.4)":"rgba(227, 5, 5, 0.4)"},{label:"MACD Line",data:c,borderColor:"blue",yAxisID:"yMACD",borderWidth:1.2,fill:!1,pointRadius:0},{label:"Signal Line",data:d,borderColor:"orange",yAxisID:"yMACD",borderWidth:1.2,fill:!1,pointRadius:0},{label:"Close Price",data:i,yAxisID:"yPrice",borderColor:"rgba(75,192,192,1)",backgroundColor:"rgba(75,192,192,0.2)",fill:!0,pointRadius:0},{label:"MA20",data:r,yAxisID:"yPrice",borderColor:"#ff6384",borderWidth:1.5,pointRadius:0},{label:"MA50",data:a,yAxisID:"yPrice",borderColor:"green",borderWidth:4,pointRadius:0},{label:"MA100",data:l,yAxisID:"yPrice",borderColor:"#996633",borderWidth:1.5,pointRadius:0},{label:"MA200",data:h,yAxisID:"yPrice",borderColor:"purple",borderWidth:3,pointRadius:0},{label:"MA10",data:o,yAxisID:"yPrice",borderColor:"#cc3333",borderWidth:1,fill:!1,hidden:!0},{label:"MA5",data:s,yAxisID:"yPrice",borderColor:"#111111",borderWidth:1,fill:!1,hidden:!0},{label:"Volume",data:f,type:"bar",yAxisID:"yVolume",backgroundColor:t=>{const e=t.dataIndex,i=this.stockData[e];if(!i)return"rgba(128,128,128,0.5)";const n=(null==i?void 0:i.close)>(null==i?void 0:i.open),s=(null==i?void 0:i.close)<(null==i?void 0:i.open);return n?"rgba(0, 200, 0, 0.6)":s?"rgb(220, 0, 0)":"black"}},{label:"StochRSI %K",data:p,yAxisID:"yStochRSI",borderColor:"#00c853",borderWidth:1.5,pointRadius:0,hidden:!0},{label:"StochRSI %D",data:g,yAxisID:"yStochRSI",borderColor:"#ff5252",borderWidth:1.5,pointRadius:0,hidden:!0},{label:"angleMACDsignal",data:g,yAxisID:"yMACD",borderColor:"#ff5250",borderWidth:1.5,pointRadius:0,hidden:!0}]},options:{responsive:!0,maintainAspectRatio:!0,interaction:{mode:"index",intersect:!1},plugins:{legend:{position:"top"},zoom:{pan:{enabled:this.zoomEnabled,mode:"x"},zoom:{wheel:{enabled:this.zoomEnabled},mode:"x"}},tooltip:{mode:"index",intersect:!1}},scales:{x:{type:"category",ticks:{color:t=>{const e=t.tick.label;if("string"==typeof e){const t=new Date(e.replace(" ","T"));if(isNaN(t.getTime()))return"black";const i=(new Date).toISOString().split("T")[0];return t.toISOString().split("T")[0]===i?"Salmon":"black"}return"black"}}},yMACD:{position:"right",title:{display:!0,text:"MACD"},beginAtZero:!1,weight:1},yPrice:{position:"left",title:{display:!0,text:"Price"},beginAtZero:!1,weight:3,grid:{drawOnChartArea:!0}},yVolume:{position:"left",title:{display:!0,text:"Volume"},beginAtZero:!0,weight:1,grid:{drawOnChartArea:!1}},yStochRSI:{position:"right",min:-.5,max:1.5,title:{display:!0,text:"StochRSI"},grid:{drawOnChartArea:!1}}}}})}render(){return B`
|
|
542
542
|
<button @click="${this._Zoomenalbe}">
|
|
543
543
|
${this.zoomEnabled?"Disable Zoom":"Enable Zoom"}
|
|
544
544
|
</button>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lit-litelements",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.8",
|
|
4
4
|
"description": "My LitElement component build for loading spinner with 10 types, and chart-display fix error hover hidden: true for some line async update",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"module": "dist/main.js",
|