lit-litelements
Advanced tools
Comparing version 2.0.1 to 2.0.2
import { LitElement } from "lit"; | ||
declare class ChartElement extends LitElement { | ||
stockData: any[]; | ||
constructor(); | ||
firstUpdated(): void; | ||
@@ -6,0 +5,0 @@ customLinePlugin: { |
@@ -11,13 +11,14 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
import { LitElement, html } from "lit"; | ||
import Chart from 'chart.js/auto'; | ||
import Chart from "chart.js/auto"; | ||
import { customElement, property } from "lit/decorators.js"; | ||
let ChartElement = class ChartElement extends LitElement { | ||
constructor() { | ||
super(); | ||
super(...arguments); | ||
this.stockData = []; | ||
// Define the custom plugin | ||
this.customLinePlugin = { | ||
id: 'customLinePlugin', // Ensure you give it an id | ||
id: 'customLinePlugin', | ||
afterDraw: function (chart) { | ||
if (chart.tooltip._active && chart.tooltip._active.length) { | ||
// Check if tooltip is defined and active | ||
if (chart.tooltip && chart.tooltip._active && chart.tooltip._active.length) { | ||
const ctx = chart.ctx; | ||
@@ -39,3 +40,2 @@ const activePoint = chart.tooltip._active[0]; | ||
}; | ||
this.stockData = []; | ||
} | ||
@@ -66,10 +66,74 @@ // First updated is called after the element has been rendered into the DOM | ||
datasets: [ | ||
{ label: "RSI", data: RSI, borderColor: "rgba(15, 92, 92, 1)", backgroundColor: "rgba(15, 92, 92, 0.2)", fill: false, borderWidth: 2, yAxisID: "yRSI" }, | ||
{ label: "MACDHistogram", data: MACDHistogram, borderColor: "rgba(175, 92, 92, 1)", backgroundColor: "rgba(175, 92, 92, 0.2)", fill: false, borderWidth: 2, yAxisID: "yMACD" }, | ||
{ label: "SignalLine", data: SignalLine, borderColor: "rgba(75, 92, 192, 1)", backgroundColor: "rgba(75, 92, 192, 0.2)", fill: false, borderWidth: 1, yAxisID: "yMACD" }, | ||
{ label: "MACDLine", data: MACDLine, borderColor: "rgba(175, 192, 192, 1)", backgroundColor: "rgba(175, 192, 192, 0.2)", fill: false, borderWidth: 1, yAxisID: "yMACD" }, | ||
{ label: "Close Price", data: closePrices, borderColor: "rgba(75, 192, 192, 1)", backgroundColor: "rgba(75, 192, 192, 0.2)", fill: true, borderWidth: 1, yAxisID: "yPrice" }, | ||
{ label: "MA20", data: ma20, borderColor: "rgba(255, 99, 132, 1)", backgroundColor: "rgba(255, 99, 132, 0.2)", fill: false, borderWidth: 2, yAxisID: "yPrice" }, | ||
{ label: "MA50", data: ma50, borderColor: "rgba(255, 206, 86, 1)", backgroundColor: "rgba(255, 206, 86, 0.2)", fill: false, borderWidth: 2, yAxisID: "yPrice" }, | ||
{ label: "MA200", data: ma200, borderColor: "rgba(153, 102, 255, 1)", backgroundColor: "rgba(153, 102, 255, 0.2)", fill: false, borderWidth: 2, yAxisID: "yPrice" }, | ||
{ | ||
label: "RSI", | ||
data: RSI, | ||
borderColor: "rgba(15, 92, 92, 1)", | ||
backgroundColor: "rgba(15, 92, 92, 0.2)", | ||
fill: false, | ||
borderWidth: 2, | ||
yAxisID: "yRSI", | ||
}, | ||
{ | ||
label: "MACDHistogram", | ||
data: MACDHistogram, | ||
borderColor: "rgba(175, 92, 92, 1)", | ||
backgroundColor: "rgba(175, 92, 92, 0.2)", | ||
fill: false, | ||
borderWidth: 2, | ||
yAxisID: "yMACD", | ||
}, | ||
{ | ||
label: "SignalLine", | ||
data: SignalLine, | ||
borderColor: "rgba(75, 92, 192, 1)", | ||
backgroundColor: "rgba(75, 92, 192, 0.2)", | ||
fill: false, | ||
borderWidth: 1, | ||
yAxisID: "yMACD", | ||
}, | ||
{ | ||
label: "MACDLine", | ||
data: MACDLine, | ||
borderColor: "rgba(175, 192, 192, 1)", | ||
backgroundColor: "rgba(175, 192, 192, 0.2)", | ||
fill: false, | ||
borderWidth: 1, | ||
yAxisID: "yMACD", | ||
}, | ||
{ | ||
label: "Close Price", | ||
data: closePrices, | ||
borderColor: "rgba(75, 192, 192, 1)", | ||
backgroundColor: "rgba(75, 192, 192, 0.2)", | ||
fill: true, | ||
borderWidth: 1, | ||
yAxisID: "yPrice", | ||
}, | ||
{ | ||
label: "MA20", | ||
data: ma20, | ||
borderColor: "rgba(255, 99, 132, 1)", | ||
backgroundColor: "rgba(255, 99, 132, 0.2)", | ||
fill: false, | ||
borderWidth: 2, | ||
yAxisID: "yPrice", | ||
}, | ||
{ | ||
label: "MA50", | ||
data: ma50, | ||
borderColor: "rgba(255, 206, 86, 1)", | ||
backgroundColor: "rgba(255, 206, 86, 0.2)", | ||
fill: false, | ||
borderWidth: 2, | ||
yAxisID: "yPrice", | ||
}, | ||
{ | ||
label: "MA200", | ||
data: ma200, | ||
borderColor: "rgba(153, 102, 255, 1)", | ||
backgroundColor: "rgba(153, 102, 255, 0.2)", | ||
fill: false, | ||
borderWidth: 2, | ||
yAxisID: "yPrice", | ||
}, | ||
], | ||
@@ -80,5 +144,22 @@ }, | ||
scales: { | ||
yPrice: { type: "linear", position: "left", beginAtZero: false, title: { display: true, text: "Price" } }, | ||
yRSI: { type: "linear", position: "right", beginAtZero: true, title: { display: true, text: "RSI" }, grid: { drawOnChartArea: false } }, | ||
yMACD: { type: "linear", position: "right", beginAtZero: true, title: { display: true, text: "MACD" }, grid: { drawOnChartArea: false } }, | ||
yPrice: { | ||
type: "linear", | ||
position: "left", | ||
beginAtZero: false, | ||
title: { display: true, text: "Price" }, | ||
}, | ||
yRSI: { | ||
type: "linear", | ||
position: "right", | ||
beginAtZero: true, | ||
title: { display: true, text: "RSI" }, | ||
grid: { drawOnChartArea: false }, | ||
}, | ||
yMACD: { | ||
type: "linear", | ||
position: "right", | ||
beginAtZero: true, | ||
title: { display: true, text: "MACD" }, | ||
grid: { drawOnChartArea: false }, | ||
}, | ||
}, | ||
@@ -101,4 +182,3 @@ interaction: { mode: "index", intersect: false }, | ||
ChartElement = __decorate([ | ||
customElement("stock-chart-display"), | ||
__metadata("design:paramtypes", []) | ||
customElement("stock-chart-display") | ||
], ChartElement); |
{ | ||
"name": "lit-litelements", | ||
"version": "2.0.1", | ||
"description": "My LitElement component build for loading spinner with 10 types, and chart-display", | ||
"version": "2.0.2", | ||
"description": "My LitElement component build for loading spinner with 10 types, and chart-display fix error hover", | ||
"main": "dist/main.js", | ||
@@ -6,0 +6,0 @@ "module": "dist/main.js", |
Sorry, the diff of this file is too big to display
263403
2142