@operato/scene-scichart 7.2.6 → 7.2.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.
- package/CHANGELOG.md +11 -0
- package/db.sqlite +0 -0
- package/dist/charts/ox-scichart-multiple copy.d.ts +53 -0
- package/dist/charts/ox-scichart-multiple copy.js +411 -0
- package/dist/charts/ox-scichart-multiple copy.js.map +1 -0
- package/dist/charts/ox-scichart-multiple.d.ts +9 -8
- package/dist/charts/ox-scichart-multiple.js +209 -85
- package/dist/charts/ox-scichart-multiple.js.map +1 -1
- package/dist/charts/scichart-builder copy.d.ts +22 -0
- package/dist/charts/scichart-builder copy.js +420 -0
- package/dist/charts/scichart-builder copy.js.map +1 -0
- package/dist/charts/scichart-builder.d.ts +2 -0
- package/dist/charts/scichart-builder.js +44 -30
- package/dist/charts/scichart-builder.js.map +1 -1
- package/dist/charts/scichart-overview-builder.d.ts +13 -0
- package/dist/charts/scichart-overview-builder.js +219 -0
- package/dist/charts/scichart-overview-builder.js.map +1 -0
- package/dist/templates/scichart-multiple-timeseries.d.ts +1 -1
- package/dist/templates/scichart-multiple-timeseries.js +1 -1
- package/dist/templates/scichart-multiple-timeseries.js.map +1 -1
- package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +20 -10
- package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +15 -0
- package/logs/{application-2024-08-02-17.log → application-2024-08-04-01.log} +8 -8
- package/logs/application-2024-08-04-04.log +420 -0
- package/logs/application-2024-08-04-18.log +2 -0
- package/logs/{application-2024-08-02-18.log → application-2024-08-04-19.log} +8 -8
- package/logs/connections-2024-08-04-01.log +50 -0
- package/logs/connections-2024-08-04-04.log +200 -0
- package/logs/connections-2024-08-04-19.log +50 -0
- package/package.json +2 -2
- package/src/charts/ox-scichart-multiple.ts +256 -99
- package/src/charts/scichart-builder.ts +47 -30
- package/src/templates/scichart-multiple-timeseries.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -2,9 +2,23 @@ import { LitElement, html, css } from 'lit'
|
|
|
2
2
|
import { property, query, customElement } from 'lit/decorators.js'
|
|
3
3
|
import { keyed } from 'lit/directives/keyed.js'
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
calculatePrecision,
|
|
7
|
+
buildSciChart,
|
|
8
|
+
buildSciChartOverview,
|
|
9
|
+
convertColor,
|
|
10
|
+
DEFAULT_COLOR
|
|
11
|
+
} from './scichart-builder'
|
|
6
12
|
import { AxisSynchroniser } from './axis-synchronizer'
|
|
7
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
EAutoRange,
|
|
15
|
+
FastLineRenderableSeries,
|
|
16
|
+
NumberRange,
|
|
17
|
+
NumericAxis,
|
|
18
|
+
scaleAxes,
|
|
19
|
+
SciChartVerticalGroup,
|
|
20
|
+
XyDataSeries
|
|
21
|
+
} from 'scichart'
|
|
8
22
|
|
|
9
23
|
import { ScrollbarStyles } from '@operato/styles'
|
|
10
24
|
|
|
@@ -18,7 +32,6 @@ export class OxSciChartMultiple extends LitElement {
|
|
|
18
32
|
private synchronizer: AxisSynchroniser = new AxisSynchroniser(new NumberRange(200, 500))
|
|
19
33
|
private verticalGroup: SciChartVerticalGroup = new SciChartVerticalGroup()
|
|
20
34
|
|
|
21
|
-
private isInitializing: boolean = false
|
|
22
35
|
private overviewChart: any = null
|
|
23
36
|
private overviewDataSeries: any[] = []
|
|
24
37
|
private groupCharts: {
|
|
@@ -27,6 +40,8 @@ export class OxSciChartMultiple extends LitElement {
|
|
|
27
40
|
dataSeries: any[]
|
|
28
41
|
}[] = []
|
|
29
42
|
|
|
43
|
+
private initializationQueue: Promise<void> = Promise.resolve()
|
|
44
|
+
|
|
30
45
|
/*
|
|
31
46
|
[주의]
|
|
32
47
|
ox-scichart container의 id를 글로벌 유니크하게 해야한다.
|
|
@@ -77,16 +92,15 @@ export class OxSciChartMultiple extends LitElement {
|
|
|
77
92
|
|
|
78
93
|
async initializeSciChart() {
|
|
79
94
|
this.cleanup()
|
|
95
|
+
await this.createOverviewChart()
|
|
96
|
+
}
|
|
80
97
|
|
|
81
|
-
|
|
82
|
-
const overviewDatasets =
|
|
83
|
-
this.config?.data.datasets.filter(dataset => this.visibleSeries.includes(dataset.dataKey!)) || []
|
|
84
|
-
|
|
98
|
+
async createOverviewChart() {
|
|
85
99
|
const { chart, dataSeries } =
|
|
86
100
|
(await buildSciChartOverview(
|
|
87
101
|
{
|
|
88
102
|
...this.config,
|
|
89
|
-
data: { datasets:
|
|
103
|
+
data: { datasets: [] }
|
|
90
104
|
},
|
|
91
105
|
this.overviewContainer,
|
|
92
106
|
{},
|
|
@@ -100,45 +114,44 @@ export class OxSciChartMultiple extends LitElement {
|
|
|
100
114
|
}
|
|
101
115
|
|
|
102
116
|
async updated(changedProperties: Map<string | number | symbol, unknown>) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
117
|
+
this.initializationQueue = this.initializationQueue
|
|
118
|
+
.then(async () => {
|
|
119
|
+
let needUpdateDataSeries = false
|
|
120
|
+
let needBuildChartGroup = false
|
|
121
|
+
|
|
122
|
+
if (changedProperties.has('config') && this.config) {
|
|
123
|
+
await this.initializeSciChart()
|
|
124
|
+
needBuildChartGroup = true
|
|
125
|
+
needUpdateDataSeries = true
|
|
126
|
+
}
|
|
111
127
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
128
|
+
if (changedProperties.has('visibleSeries')) {
|
|
129
|
+
await this.updateSeries(this.visibleSeries, changedProperties.get('visibleSeries') as string[])
|
|
130
|
+
/* [중요] buildChartGroup 을 visibleSeries 수정때마다 하는 이유는, render() 의 캐시 컨트롤이 안되기 때문이다. 가급적 시도하지 말라. */
|
|
131
|
+
needBuildChartGroup = true
|
|
132
|
+
needUpdateDataSeries = true
|
|
133
|
+
}
|
|
119
134
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
135
|
+
if (changedProperties.has('data')) {
|
|
136
|
+
needUpdateDataSeries = true
|
|
137
|
+
}
|
|
123
138
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
139
|
+
if (needBuildChartGroup) {
|
|
140
|
+
await this.buildChartGroup()
|
|
141
|
+
}
|
|
128
142
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
143
|
+
if (needUpdateDataSeries) {
|
|
144
|
+
await this.updateDataSeries()
|
|
145
|
+
}
|
|
146
|
+
})
|
|
147
|
+
.catch((error: any) => {
|
|
148
|
+
console.error('Error in updated queue:', error)
|
|
149
|
+
})
|
|
133
150
|
}
|
|
134
151
|
|
|
135
152
|
cleanup() {
|
|
136
153
|
this.cleanupGroup()
|
|
137
|
-
|
|
138
|
-
if (this.overviewChart) {
|
|
139
|
-
this.overviewChart.sciChartSurface?.delete()
|
|
140
|
-
this.overviewChart = null
|
|
141
|
-
}
|
|
154
|
+
this.cleanupOverview()
|
|
142
155
|
}
|
|
143
156
|
|
|
144
157
|
cleanupGroup() {
|
|
@@ -153,6 +166,16 @@ export class OxSciChartMultiple extends LitElement {
|
|
|
153
166
|
this.groupCharts.length = 0
|
|
154
167
|
}
|
|
155
168
|
|
|
169
|
+
cleanupOverview() {
|
|
170
|
+
if (this.overviewChart) {
|
|
171
|
+
this.overviewChart.sciChartSurface.renderableSeries.clear()
|
|
172
|
+
this.overviewDataSeries.forEach(ds => ds.delete())
|
|
173
|
+
this.overviewDataSeries.length = 0
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
this.overviewChart = null
|
|
177
|
+
}
|
|
178
|
+
|
|
156
179
|
async updateDataSeries() {
|
|
157
180
|
const { config, data } = this
|
|
158
181
|
const { datasets = [], labelDataKey: attrX } = config?.data || {}
|
|
@@ -187,11 +210,8 @@ export class OxSciChartMultiple extends LitElement {
|
|
|
187
210
|
}
|
|
188
211
|
})
|
|
189
212
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
sciChartSurface.zoomExtents()
|
|
193
|
-
sciChartSurface.invalidateElement()
|
|
194
|
-
}, 200)
|
|
213
|
+
sciChartSurface.zoomExtents()
|
|
214
|
+
sciChartSurface.invalidateElement()
|
|
195
215
|
} catch (error) {
|
|
196
216
|
console.error('Error updating data series:', error)
|
|
197
217
|
}
|
|
@@ -199,19 +219,38 @@ export class OxSciChartMultiple extends LitElement {
|
|
|
199
219
|
|
|
200
220
|
try {
|
|
201
221
|
// Overview 차트 데이터 업데이트
|
|
202
|
-
this.overviewDataSeries.forEach(ds =>
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
if (
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
222
|
+
this.overviewDataSeries.forEach((ds, index) => {
|
|
223
|
+
const visibleKey = this.visibleSeries[index]
|
|
224
|
+
const dataset = datasets.find(dataset => dataset.dataKey === visibleKey)
|
|
225
|
+
if (!dataset) {
|
|
226
|
+
return
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const dataIndex = datasets.findIndex(ds => ds.dataKey === dataset.dataKey)
|
|
230
|
+
const filteredData = newData[dataIndex]?.filter(d => typeof d.yValue === 'number') || []
|
|
231
|
+
|
|
232
|
+
ds.clear()
|
|
233
|
+
if (filteredData.length > 0) {
|
|
234
|
+
ds.appendRange(
|
|
235
|
+
filteredData.map(d => d.xValue),
|
|
236
|
+
filteredData.map(d => d.yValue)
|
|
237
|
+
)
|
|
213
238
|
}
|
|
214
239
|
})
|
|
240
|
+
|
|
241
|
+
// this.overviewDataSeries.forEach(ds => ds.clear())
|
|
242
|
+
|
|
243
|
+
// newData.forEach((data, index) => {
|
|
244
|
+
// if (this.visibleSeries.includes(datasets[index].dataKey!)) {
|
|
245
|
+
// const filteredData = data.filter(d => typeof d.yValue === 'number')
|
|
246
|
+
// if (filteredData.length > 0) {
|
|
247
|
+
// this.overviewDataSeries[index].appendRange(
|
|
248
|
+
// filteredData.map(d => d.xValue),
|
|
249
|
+
// filteredData.map(d => d.yValue)
|
|
250
|
+
// )
|
|
251
|
+
// }
|
|
252
|
+
// }
|
|
253
|
+
// })
|
|
215
254
|
} catch (error) {
|
|
216
255
|
console.error('Error updating overview data series:', error)
|
|
217
256
|
}
|
|
@@ -285,38 +324,65 @@ export class OxSciChartMultiple extends LitElement {
|
|
|
285
324
|
}
|
|
286
325
|
|
|
287
326
|
async updateSeries(after: string[], before: string[]) {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}
|
|
327
|
+
const addSeries = after?.filter(series => !before.includes(series)) || []
|
|
328
|
+
const removeSeries = before?.filter(series => !after.includes(series)) || []
|
|
329
|
+
|
|
330
|
+
for (const series of removeSeries) {
|
|
331
|
+
await this.removeChart(series)
|
|
294
332
|
}
|
|
295
333
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
if (!before || !before.includes(series)) {
|
|
299
|
-
await this.addChart(series)
|
|
300
|
-
}
|
|
334
|
+
for (const series of addSeries) {
|
|
335
|
+
await this.addChart(series)
|
|
301
336
|
}
|
|
302
337
|
}
|
|
303
338
|
|
|
304
339
|
async addChart(dataKey: string) {
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
dataSeries
|
|
340
|
+
const chartData = await this.createChart(dataKey)
|
|
341
|
+
|
|
342
|
+
if (chartData) {
|
|
343
|
+
const { chart, dataSeries, dataKey } = chartData
|
|
344
|
+
this.verticalGroup.addSurfaceToGroup(chart.sciChartSurface)
|
|
345
|
+
|
|
346
|
+
this.groupCharts = this.groupSorter([
|
|
347
|
+
...this.groupCharts,
|
|
348
|
+
{ dataKey, sciChartSurface: chart.sciChartSurface, dataSeries }
|
|
349
|
+
])
|
|
350
|
+
|
|
351
|
+
await this.addSeriesToOverviewChart(dataKey)
|
|
309
352
|
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
async removeChart(dataKey: string) {
|
|
356
|
+
const index = this.groupCharts.findIndex(chart => chart.dataKey == dataKey)
|
|
357
|
+
if (index === -1) return
|
|
310
358
|
|
|
359
|
+
const [groupedChart] = this.groupCharts.splice(index, 1)
|
|
360
|
+
this.destroyChart(groupedChart)
|
|
361
|
+
|
|
362
|
+
this.groupCharts = this.groupSorter(this.groupCharts)
|
|
363
|
+
|
|
364
|
+
await this.removeSeriesFromOverviewChart(dataKey)
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
groupSorter(group: any[]) {
|
|
368
|
+
return group.sort(
|
|
369
|
+
(a, b) =>
|
|
370
|
+
this.visibleSeries.findIndex((s: any) => s.dataKey == a.dataKey) -
|
|
371
|
+
this.visibleSeries.findIndex((s: any) => s.dataKey == b.dataKey)
|
|
372
|
+
)
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
async appendData(appendum: { [attr: string]: any }[]) {}
|
|
376
|
+
|
|
377
|
+
private async createChart(dataKey: string) {
|
|
311
378
|
const { data = {}, options = {} } = this.config || {}
|
|
312
379
|
const { datasets = [] } = data as OperatoChart.ChartData
|
|
313
380
|
const primaryDataset = datasets.find(dataset => dataset.dataKey == dataKey)
|
|
314
381
|
|
|
315
382
|
if (!primaryDataset) {
|
|
316
|
-
return
|
|
383
|
+
return null
|
|
317
384
|
}
|
|
318
385
|
|
|
319
|
-
// 해당 dataKey로 시작하는 모든 시리즈를 함께 그룹화하여 차트를 구성
|
|
320
386
|
const relatedDatasets = datasets.filter(dataset => dataset.dataKey?.startsWith(dataKey))
|
|
321
387
|
|
|
322
388
|
const yAxis = {
|
|
@@ -327,7 +393,7 @@ export class OxSciChartMultiple extends LitElement {
|
|
|
327
393
|
const config = {
|
|
328
394
|
...this.config,
|
|
329
395
|
data: {
|
|
330
|
-
datasets: relatedDatasets
|
|
396
|
+
datasets: relatedDatasets
|
|
331
397
|
},
|
|
332
398
|
options: {
|
|
333
399
|
...options,
|
|
@@ -339,7 +405,7 @@ export class OxSciChartMultiple extends LitElement {
|
|
|
339
405
|
}
|
|
340
406
|
|
|
341
407
|
const container = this.renderRoot.querySelector(`#${this.containerId + '-' + dataKey}`)
|
|
342
|
-
|
|
408
|
+
const { chart, dataSeries } = (await buildSciChart(
|
|
343
409
|
config,
|
|
344
410
|
container,
|
|
345
411
|
{ fontSize: 14, fontFamily: 'Roboto', fontColor: undefined },
|
|
@@ -349,46 +415,137 @@ export class OxSciChartMultiple extends LitElement {
|
|
|
349
415
|
}
|
|
350
416
|
))!
|
|
351
417
|
|
|
352
|
-
this.verticalGroup.addSurfaceToGroup(chart.sciChartSurface)
|
|
353
418
|
this.synchronizer.addAxis(chart.sciChartSurface.xAxes.get(0))
|
|
354
419
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
420
|
+
// 각 시리즈에 대해 올바른 데이터를 추가
|
|
421
|
+
const newData = this.dataSet
|
|
422
|
+
dataSeries.forEach((ds, seriesIndex) => {
|
|
423
|
+
const dataset = relatedDatasets[seriesIndex]
|
|
424
|
+
const filteredData = newData[seriesIndex]?.filter(d => typeof d.yValue === 'number') || []
|
|
425
|
+
if (filteredData.length > 0) {
|
|
426
|
+
ds.appendRange(
|
|
427
|
+
filteredData.map(d => d.xValue),
|
|
428
|
+
filteredData.map(d => d.yValue)
|
|
429
|
+
)
|
|
430
|
+
}
|
|
431
|
+
})
|
|
358
432
|
|
|
359
|
-
|
|
433
|
+
return { chart, dataSeries, dataKey }
|
|
360
434
|
}
|
|
361
435
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
436
|
+
private destroyChart(groupedChart: { dataKey: string; sciChartSurface: any; dataSeries: any[] }) {
|
|
437
|
+
this.verticalGroup.removeSurface(groupedChart.sciChartSurface)
|
|
438
|
+
this.synchronizer.removeAxis(groupedChart.sciChartSurface.xAxes.get(0))
|
|
439
|
+
groupedChart.sciChartSurface.delete()
|
|
440
|
+
}
|
|
365
441
|
|
|
366
|
-
|
|
442
|
+
private async addSeriesToOverviewChart(dataKey: string) {
|
|
443
|
+
if (!this.overviewChart || !this.overviewDataSeries) {
|
|
444
|
+
console.error('Overview chart is not initialized.')
|
|
367
445
|
return
|
|
368
446
|
}
|
|
369
447
|
|
|
370
|
-
|
|
371
|
-
this.
|
|
448
|
+
// Check if the series already exists in the overview chart
|
|
449
|
+
const existingSeries = this.overviewChart.sciChartSurface.renderableSeries.asArray().find((series: any) => {
|
|
450
|
+
return series.dataSeries.dataSeriesName === dataKey
|
|
451
|
+
})
|
|
372
452
|
|
|
373
|
-
|
|
374
|
-
|
|
453
|
+
if (existingSeries) {
|
|
454
|
+
console.warn(`Series for dataKey ${dataKey} already exists in the overview chart.`)
|
|
455
|
+
return // Exit the function without adding the series again
|
|
456
|
+
}
|
|
375
457
|
|
|
376
|
-
|
|
458
|
+
const dataset = this.config?.data.datasets.find(dataset => dataset.dataKey === dataKey)
|
|
459
|
+
if (!dataset) {
|
|
460
|
+
console.error('Dataset not found for dataKey:', dataKey)
|
|
461
|
+
return
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
const newSeries = await this.createSeriesForOverview(dataset)
|
|
465
|
+
|
|
466
|
+
if (newSeries) {
|
|
467
|
+
this.overviewChart.sciChartSurface.renderableSeries.add(newSeries.series)
|
|
468
|
+
this.overviewDataSeries.push(newSeries.dataSeries)
|
|
469
|
+
}
|
|
377
470
|
}
|
|
378
471
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
(
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
472
|
+
private async removeSeriesFromOverviewChart(dataKey: string) {
|
|
473
|
+
if (!this.overviewChart || !this.overviewDataSeries) {
|
|
474
|
+
console.error('Overview chart is not initialized.')
|
|
475
|
+
return
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
const { sciChartSurface } = this.overviewChart
|
|
479
|
+
|
|
480
|
+
// 오버뷰 차트의 renderableSeries에서 해당 시리즈 제거
|
|
481
|
+
const seriesIndex = sciChartSurface.renderableSeries.asArray().findIndex((series: any) => {
|
|
482
|
+
return series.dataSeries.dataSeriesName === dataKey
|
|
483
|
+
})
|
|
484
|
+
|
|
485
|
+
if (seriesIndex !== -1) {
|
|
486
|
+
const series = sciChartSurface.renderableSeries.get(seriesIndex)
|
|
487
|
+
const yAxisId = series.yAxisId
|
|
488
|
+
|
|
489
|
+
// 시리즈 제거
|
|
490
|
+
sciChartSurface.renderableSeries.removeAt(seriesIndex)
|
|
491
|
+
this.overviewDataSeries.splice(seriesIndex, 1) // 데이터 시리즈도 제거
|
|
492
|
+
|
|
493
|
+
// 고유 Y축 제거
|
|
494
|
+
if (yAxisId) {
|
|
495
|
+
const yAxisIndex = sciChartSurface.yAxes.asArray().findIndex((axis: any) => axis.id === yAxisId)
|
|
496
|
+
if (yAxisIndex !== -1) {
|
|
497
|
+
sciChartSurface.yAxes.removeAt(yAxisIndex)
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
} else {
|
|
501
|
+
console.error('Series not found in overview chart for dataKey:', dataKey)
|
|
502
|
+
}
|
|
385
503
|
}
|
|
386
504
|
|
|
387
|
-
async
|
|
388
|
-
|
|
505
|
+
private async createSeriesForOverview(dataset: any) {
|
|
506
|
+
if (!this.overviewChart) return null
|
|
507
|
+
|
|
508
|
+
const { sciChartSurface, wasmContext } = this.overviewChart
|
|
509
|
+
const dataSeries = new XyDataSeries(wasmContext, {
|
|
510
|
+
dataSeriesName: dataset.dataKey,
|
|
511
|
+
containsNaN: false
|
|
512
|
+
})
|
|
513
|
+
|
|
514
|
+
// 새로운 Y축을 추가하여 노멀라이즈 효과를 제공
|
|
515
|
+
const yAxisId = `yAxis_${dataset.dataKey}`
|
|
516
|
+
const yAxis = new NumericAxis(wasmContext, {
|
|
517
|
+
id: yAxisId,
|
|
518
|
+
autoRange: EAutoRange.Always,
|
|
519
|
+
drawLabels: false,
|
|
520
|
+
drawMajorTickLines: false,
|
|
521
|
+
drawMinorTickLines: false,
|
|
522
|
+
drawMajorGridLines: false,
|
|
523
|
+
drawMinorGridLines: false
|
|
524
|
+
})
|
|
525
|
+
|
|
526
|
+
sciChartSurface.yAxes.add(yAxis)
|
|
527
|
+
|
|
528
|
+
const series = new FastLineRenderableSeries(wasmContext, {
|
|
529
|
+
dataSeries,
|
|
530
|
+
strokeThickness: 1,
|
|
531
|
+
stroke: convertColor(dataset.color, DEFAULT_COLOR),
|
|
532
|
+
yAxisId
|
|
533
|
+
})
|
|
534
|
+
|
|
535
|
+
// 초기 데이터 추가
|
|
536
|
+
const newData = this.dataSet.find((data, index) => this.config?.data.datasets[index].dataKey === dataset.dataKey)
|
|
537
|
+
if (newData && newData.length > 0) {
|
|
538
|
+
const xValues = newData.map(d => d.xValue)
|
|
539
|
+
const yValues = newData.map(d => d.yValue).filter(y => typeof y === 'number' && !isNaN(y)) // y 값 검증
|
|
540
|
+
|
|
541
|
+
if (yValues.length > 0) {
|
|
542
|
+
// 유효한 y 값이 있을 때만 추가
|
|
543
|
+
dataSeries.appendRange(xValues, yValues)
|
|
544
|
+
} else {
|
|
545
|
+
console.warn('No valid yValues found for dataset:', dataset.dataKey)
|
|
546
|
+
}
|
|
547
|
+
}
|
|
389
548
|
|
|
390
|
-
|
|
391
|
-
interface HTMLElementTagNameMap {
|
|
392
|
-
'ox-scichart-multiple': OxSciChartMultiple
|
|
549
|
+
return { series, dataSeries }
|
|
393
550
|
}
|
|
394
551
|
}
|
|
@@ -56,7 +56,7 @@ SciChartSurface.configure({
|
|
|
56
56
|
wasmUrl: `/node_modules/scichart/_wasm/scichart2d.wasm`
|
|
57
57
|
})
|
|
58
58
|
|
|
59
|
-
const DEFAULT_COLOR = '#FF6600'
|
|
59
|
+
export const DEFAULT_COLOR = '#FF6600'
|
|
60
60
|
const DEFAULT_STROKE = '#000000'
|
|
61
61
|
const POINT_MARKER_SIZE = 10
|
|
62
62
|
const STROKE_THICKNESS = 2
|
|
@@ -75,7 +75,7 @@ function getThemeFromBrowser() {
|
|
|
75
75
|
return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
function convertColor(color: string | string[] | undefined, defaultColor?: string) {
|
|
78
|
+
export function convertColor(color: string | string[] | undefined, defaultColor?: string) {
|
|
79
79
|
const tinyColor = new TinyColor(color as string)
|
|
80
80
|
return tinyColor.toHex8String() || defaultColor
|
|
81
81
|
}
|
|
@@ -488,7 +488,7 @@ export async function buildSciChartOverview(
|
|
|
488
488
|
|
|
489
489
|
const { type: chartType, options, data: fromData } = config
|
|
490
490
|
const { datasets = [] } = fromData || {}
|
|
491
|
-
var { theme,
|
|
491
|
+
var { theme, scales: fromScales } = options || {}
|
|
492
492
|
|
|
493
493
|
var baseColor = getBaseColorFromTheme(theme)
|
|
494
494
|
|
|
@@ -515,36 +515,38 @@ export async function buildSciChartOverview(
|
|
|
515
515
|
sciChartSurface.xAxes.add(xAxis)
|
|
516
516
|
})
|
|
517
517
|
|
|
518
|
-
|
|
519
|
-
const yAxisId = `yAxis${index}`
|
|
520
|
-
const dataSeries = new XyDataSeries(wasmContext, {
|
|
521
|
-
dataSeriesName: dataset.label,
|
|
522
|
-
containsNaN: false
|
|
523
|
-
})
|
|
518
|
+
getDefaultYAxis(wasmContext, sciChartSurface)
|
|
524
519
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
drawMajorGridLines: false,
|
|
532
|
-
drawMinorGridLines: false
|
|
533
|
-
})
|
|
520
|
+
// const dataSeriesArray = datasets.map((dataset, index) => {
|
|
521
|
+
// const yAxisId = `yAxis${index}`
|
|
522
|
+
// const dataSeries = new XyDataSeries(wasmContext, {
|
|
523
|
+
// dataSeriesName: dataset.label,
|
|
524
|
+
// containsNaN: false
|
|
525
|
+
// })
|
|
534
526
|
|
|
535
|
-
|
|
527
|
+
// const yAxis = new NumericAxis(wasmContext, {
|
|
528
|
+
// id: yAxisId,
|
|
529
|
+
// autoRange: EAutoRange.Always,
|
|
530
|
+
// drawLabels: false,
|
|
531
|
+
// drawMajorTickLines: false,
|
|
532
|
+
// drawMinorTickLines: false,
|
|
533
|
+
// drawMajorGridLines: false,
|
|
534
|
+
// drawMinorGridLines: false
|
|
535
|
+
// })
|
|
536
536
|
|
|
537
|
-
|
|
538
|
-
dataSeries,
|
|
539
|
-
strokeThickness: 1,
|
|
540
|
-
stroke: convertColor(dataset.color, DEFAULT_COLOR),
|
|
541
|
-
yAxisId: yAxisId
|
|
542
|
-
})
|
|
537
|
+
// sciChartSurface.yAxes.add(yAxis)
|
|
543
538
|
|
|
544
|
-
|
|
539
|
+
// const series = new FastLineRenderableSeries(wasmContext, {
|
|
540
|
+
// dataSeries,
|
|
541
|
+
// strokeThickness: 1,
|
|
542
|
+
// stroke: convertColor(dataset.color, DEFAULT_COLOR),
|
|
543
|
+
// yAxisId: yAxisId
|
|
544
|
+
// })
|
|
545
545
|
|
|
546
|
-
|
|
547
|
-
|
|
546
|
+
// sciChartSurface.renderableSeries.add(series)
|
|
547
|
+
|
|
548
|
+
// return dataSeries
|
|
549
|
+
// })
|
|
548
550
|
|
|
549
551
|
const rangeSelectionModifier = new OverviewRangeSelectionModifier()
|
|
550
552
|
rangeSelectionModifier.onSelectedAreaChanged = (selectedRange?: NumberRange) => {
|
|
@@ -557,12 +559,27 @@ export async function buildSciChartOverview(
|
|
|
557
559
|
sciChartSurface.chartModifiers.add(rangeSelectionModifier)
|
|
558
560
|
|
|
559
561
|
axisSynchroniser.visibleRangeChanged.subscribe(({ visibleRange }: any) => {
|
|
560
|
-
const
|
|
562
|
+
const xAxis = sciChartSurface.xAxes.get(0)
|
|
563
|
+
const updatedSelectedRange = visibleRange.clip(xAxis.visibleRange)
|
|
561
564
|
const shouldUpdateSelectedRange = !updatedSelectedRange.equals(rangeSelectionModifier.selectedArea)
|
|
562
565
|
if (shouldUpdateSelectedRange) {
|
|
563
566
|
rangeSelectionModifier.selectedArea = updatedSelectedRange
|
|
564
567
|
}
|
|
565
568
|
})
|
|
566
569
|
|
|
567
|
-
return { chart, dataSeries:
|
|
570
|
+
return { chart, dataSeries: [] }
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
function getDefaultYAxis(wasmContext: any, sciChartSurface: any): void {
|
|
574
|
+
const yAxis = new NumericAxis(wasmContext, {
|
|
575
|
+
id: 'DefaultAxisId',
|
|
576
|
+
autoRange: EAutoRange.Always,
|
|
577
|
+
drawLabels: false,
|
|
578
|
+
drawMajorTickLines: false,
|
|
579
|
+
drawMinorTickLines: false,
|
|
580
|
+
drawMajorGridLines: false,
|
|
581
|
+
drawMinorGridLines: false
|
|
582
|
+
})
|
|
583
|
+
|
|
584
|
+
sciChartSurface.yAxes.add(yAxis)
|
|
568
585
|
}
|