@operato/scene-scichart 8.0.0-beta.1 → 8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +6 -6
- package/CHANGELOG.md +0 -278
- package/db.sqlite +0 -0
- package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +0 -15
- package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +0 -15
- package/logs/application-2024-09-10-23.log +0 -105
- package/logs/connections-2024-09-10-23.log +0 -50
- package/schema.graphql +0 -4455
- package/src/charts/axis-synchronizer.ts +0 -37
- package/src/charts/ox-scichart-multiple.ts +0 -579
- package/src/charts/ox-scichart.ts +0 -155
- package/src/charts/scichart-builder.ts +0 -630
- package/src/editors/index.ts +0 -8
- package/src/groups/index.ts +0 -0
- package/src/index.ts +0 -2
- package/src/scichart-multiple-timeseries.ts +0 -69
- package/src/scichart-timeseries.ts +0 -51
- package/src/templates/index.ts +0 -4
- package/src/templates/scichart-multiple-timeseries.ts +0 -87
- package/src/templates/scichart-timeseries.ts +0 -73
- package/tsconfig.json +0 -23
- package/tsconfig.tsbuildinfo +0 -1
@@ -1,155 +0,0 @@
|
|
1
|
-
import { LitElement, html, css } from 'lit'
|
2
|
-
import { property, query, customElement } from 'lit/decorators.js'
|
3
|
-
import { buildSciChart } from './scichart-builder'
|
4
|
-
|
5
|
-
@customElement('ox-scichart')
|
6
|
-
export class OxSciChart extends LitElement {
|
7
|
-
@property({ type: Object }) config: OperatoChart.ChartConfig | null = null
|
8
|
-
@property({ type: Array }) data: { [attr: string]: any }[] = []
|
9
|
-
|
10
|
-
public chart: any = null
|
11
|
-
private dataSeries: any[] = []
|
12
|
-
/*
|
13
|
-
[주의]
|
14
|
-
ox-scichart container의 id를 글로벌 유니크하게 해야한다.
|
15
|
-
SciChart가 특별히 container의 id를 기반으로 하위 컴포넌트를 구성하고 있기 때문이다.
|
16
|
-
shadowDom 안에 있는 container 이더라도, 글로벌 유니크한 id를 제공해야 한다.
|
17
|
-
그렇지 않으면, 단 하나의 차트만 제대로 렌더링된다.
|
18
|
-
*/
|
19
|
-
private containerId: string = 'ox-sci-chart' + ++OxSciChart.idx
|
20
|
-
|
21
|
-
@query('.chart-container') container!: HTMLDivElement
|
22
|
-
|
23
|
-
static idx: number = 0
|
24
|
-
|
25
|
-
static styles = css`
|
26
|
-
:host {
|
27
|
-
display: block;
|
28
|
-
width: 100%;
|
29
|
-
height: 100%;
|
30
|
-
}
|
31
|
-
|
32
|
-
.chart-container {
|
33
|
-
display: flex;
|
34
|
-
width: 100%;
|
35
|
-
height: 100%;
|
36
|
-
}
|
37
|
-
|
38
|
-
.chart-content {
|
39
|
-
flex: 1;
|
40
|
-
position: relative;
|
41
|
-
}
|
42
|
-
`
|
43
|
-
|
44
|
-
async initializeSciChart() {
|
45
|
-
if (this.chart) {
|
46
|
-
this.chart.sciChartSurface?.delete()
|
47
|
-
this.chart = null
|
48
|
-
}
|
49
|
-
|
50
|
-
const { chart, dataSeries } = (await buildSciChart(this.config, this.container, {}, {})) || {}
|
51
|
-
|
52
|
-
this.chart = chart
|
53
|
-
this.dataSeries = dataSeries!
|
54
|
-
}
|
55
|
-
|
56
|
-
dispose() {
|
57
|
-
// 데이터 시리즈 해제
|
58
|
-
this.dataSeries.forEach(ds => ds.delete())
|
59
|
-
this.dataSeries = []
|
60
|
-
|
61
|
-
// SciChartSurface 해제
|
62
|
-
if (this.chart?.sciChartSurface) {
|
63
|
-
this.chart.sciChartSurface.renderableSeries.clear() // 렌더러 시리즈 제거
|
64
|
-
this.chart.sciChartSurface.xAxes.clear() // X축 제거
|
65
|
-
this.chart.sciChartSurface.yAxes.clear() // Y축 제거
|
66
|
-
this.chart.sciChartSurface.delete() // SciChartSurface 삭제
|
67
|
-
}
|
68
|
-
|
69
|
-
this.chart = null // chart 객체 초기화
|
70
|
-
}
|
71
|
-
|
72
|
-
async updated(changedProperties: Map<string | number | symbol, unknown>) {
|
73
|
-
var needDataUpdate = false
|
74
|
-
|
75
|
-
if (changedProperties.has('config') && this.config) {
|
76
|
-
await this.initializeSciChart()
|
77
|
-
needDataUpdate = true
|
78
|
-
}
|
79
|
-
|
80
|
-
if (changedProperties.has('data')) {
|
81
|
-
needDataUpdate = true
|
82
|
-
}
|
83
|
-
|
84
|
-
if (needDataUpdate) {
|
85
|
-
await this.updateDataSeries()
|
86
|
-
}
|
87
|
-
}
|
88
|
-
|
89
|
-
updateDataSeries() {
|
90
|
-
if (!this.dataSeries?.length) {
|
91
|
-
return
|
92
|
-
}
|
93
|
-
|
94
|
-
this.dataSeries.forEach(ds => ds.clear())
|
95
|
-
const newData = this.dataSet
|
96
|
-
|
97
|
-
newData.forEach((data, index) => {
|
98
|
-
const filteredData = data.filter(d => typeof d.yValue === 'number')
|
99
|
-
|
100
|
-
if (filteredData.length > 0) {
|
101
|
-
this.dataSeries[index].appendRange(
|
102
|
-
filteredData.map(d => d.xValue),
|
103
|
-
filteredData.map(d => d.yValue)
|
104
|
-
)
|
105
|
-
}
|
106
|
-
})
|
107
|
-
|
108
|
-
setTimeout(() => {
|
109
|
-
this.chart?.sciChartSurface.zoomExtents()
|
110
|
-
this.chart?.sciChartSurface.invalidateElement()
|
111
|
-
}, 200)
|
112
|
-
}
|
113
|
-
|
114
|
-
get dataSet(): { xValue: number; yValue: number }[][] {
|
115
|
-
const { config, data } = this
|
116
|
-
const { datasets = [], labelDataKey: attrX } = config?.data || {}
|
117
|
-
|
118
|
-
if (!(data instanceof Array) || !attrX) {
|
119
|
-
return []
|
120
|
-
}
|
121
|
-
|
122
|
-
return datasets.map(dataset => {
|
123
|
-
return data
|
124
|
-
.map(item => {
|
125
|
-
if (!item || typeof item !== 'object') {
|
126
|
-
return
|
127
|
-
}
|
128
|
-
|
129
|
-
const xValue = new Date(item[attrX])
|
130
|
-
if (isNaN(xValue.getTime())) {
|
131
|
-
console.error('Invalid date:', item[attrX])
|
132
|
-
return
|
133
|
-
}
|
134
|
-
|
135
|
-
return {
|
136
|
-
xValue: xValue.getTime() / 1000,
|
137
|
-
yValue: item[dataset.dataKey!]
|
138
|
-
}
|
139
|
-
})
|
140
|
-
.filter(Boolean) as { xValue: number; yValue: number }[]
|
141
|
-
})
|
142
|
-
}
|
143
|
-
|
144
|
-
async appendData(appendum: { [attr: string]: any }[]) {}
|
145
|
-
|
146
|
-
render() {
|
147
|
-
return html` <div id=${this.containerId} class="chart-container"></div> `
|
148
|
-
}
|
149
|
-
}
|
150
|
-
|
151
|
-
declare global {
|
152
|
-
interface HTMLElementTagNameMap {
|
153
|
-
'ox-scichart': OxSciChart
|
154
|
-
}
|
155
|
-
}
|