@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.
Files changed (34) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/db.sqlite +0 -0
  3. package/dist/charts/ox-scichart-multiple copy.d.ts +53 -0
  4. package/dist/charts/ox-scichart-multiple copy.js +411 -0
  5. package/dist/charts/ox-scichart-multiple copy.js.map +1 -0
  6. package/dist/charts/ox-scichart-multiple.d.ts +9 -8
  7. package/dist/charts/ox-scichart-multiple.js +209 -85
  8. package/dist/charts/ox-scichart-multiple.js.map +1 -1
  9. package/dist/charts/scichart-builder copy.d.ts +22 -0
  10. package/dist/charts/scichart-builder copy.js +420 -0
  11. package/dist/charts/scichart-builder copy.js.map +1 -0
  12. package/dist/charts/scichart-builder.d.ts +2 -0
  13. package/dist/charts/scichart-builder.js +44 -30
  14. package/dist/charts/scichart-builder.js.map +1 -1
  15. package/dist/charts/scichart-overview-builder.d.ts +13 -0
  16. package/dist/charts/scichart-overview-builder.js +219 -0
  17. package/dist/charts/scichart-overview-builder.js.map +1 -0
  18. package/dist/templates/scichart-multiple-timeseries.d.ts +1 -1
  19. package/dist/templates/scichart-multiple-timeseries.js +1 -1
  20. package/dist/templates/scichart-multiple-timeseries.js.map +1 -1
  21. package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +20 -10
  22. package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +15 -0
  23. package/logs/{application-2024-08-02-17.log → application-2024-08-04-01.log} +8 -8
  24. package/logs/application-2024-08-04-04.log +420 -0
  25. package/logs/application-2024-08-04-18.log +2 -0
  26. package/logs/{application-2024-08-02-18.log → application-2024-08-04-19.log} +8 -8
  27. package/logs/connections-2024-08-04-01.log +50 -0
  28. package/logs/connections-2024-08-04-04.log +200 -0
  29. package/logs/connections-2024-08-04-19.log +50 -0
  30. package/package.json +2 -2
  31. package/src/charts/ox-scichart-multiple.ts +256 -99
  32. package/src/charts/scichart-builder.ts +47 -30
  33. package/src/templates/scichart-multiple-timeseries.ts +1 -1
  34. 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 { calculatePrecision, buildSciChart, buildSciChartOverview } from './scichart-builder'
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 { NumberRange, scaleAxes, SciChartVerticalGroup } from 'scichart'
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
- // Overview 차트는 정확히 일치하는 시리즈 이름만 포함
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: overviewDatasets }
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
- var needDataUpdate = false
104
-
105
- if (changedProperties.has('config') && this.config) {
106
- this.isInitializing = true
107
- await this.initializeSciChart()
108
- this.isInitializing = false
109
- needDataUpdate = true
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
- if (changedProperties.has('visibleSeries')) {
113
- if (this.isInitializing) {
114
- await this.ensureInitialization()
115
- }
116
- await this.updateSeries(this.visibleSeries, changedProperties.get('visibleSeries') as string[])
117
- needDataUpdate = true
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
- if (changedProperties.has('data')) {
121
- needDataUpdate = true
122
- }
135
+ if (changedProperties.has('data')) {
136
+ needUpdateDataSeries = true
137
+ }
123
138
 
124
- if (needDataUpdate) {
125
- await this.updateDataSeries()
126
- }
127
- }
139
+ if (needBuildChartGroup) {
140
+ await this.buildChartGroup()
141
+ }
128
142
 
129
- private async ensureInitialization() {
130
- while (this.isInitializing) {
131
- await new Promise(resolve => setTimeout(resolve, 100)) // Check every 100ms
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
- // Zoom 및 리렌더링
191
- setTimeout(() => {
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 => ds.clear())
203
-
204
- newData.forEach((data, index) => {
205
- if (this.visibleSeries.includes(datasets[index].dataKey!)) {
206
- const filteredData = data.filter(d => typeof d.yValue === 'number')
207
- if (filteredData.length > 0) {
208
- this.overviewDataSeries[index].appendRange(
209
- filteredData.map(d => d.xValue),
210
- filteredData.map(d => d.yValue)
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
- /* 기존 시리즈와 새로운 시리즈의 차이를 비교해서, before에는 있는데, after에는 없으면 await removeChart(string)를 호출하고, after에는 있는데, before에는 없으면, addChart(string) 한다. */
289
- // before에는 있는데 after에는 없는 시리즈를 제거합니다.
290
- for (const series of before || []) {
291
- if (!after.includes(series)) {
292
- await this.removeChart(series)
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
- // after에는 있는데 before에는 없는 시리즈를 추가합니다.
297
- for (const series of after || []) {
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 groupedChart = {
306
- dataKey: '',
307
- sciChartSurface: undefined,
308
- dataSeries: [] as any[]
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
- var { chart, dataSeries } = (await buildSciChart(
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
- groupedChart.dataKey = primaryDataset.dataKey!
356
- groupedChart.sciChartSurface = chart.sciChartSurface
357
- groupedChart.dataSeries = dataSeries
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
- this.groupCharts = this.groupSorter([...this.groupCharts, groupedChart])
433
+ return { chart, dataSeries, dataKey }
360
434
  }
361
435
 
362
- removeChart(dataKey: string) {
363
- const index = this.groupCharts.findIndex((chart: any) => chart.dataKey == dataKey)
364
- const [groupedChart] = this.groupCharts.splice(index, 1)
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
- if (!groupedChart) {
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
- this.verticalGroup.removeSurface(groupedChart.sciChartSurface)
371
- this.synchronizer.removeAxis(groupedChart.sciChartSurface.xAxes.get(0))
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
- groupedChart.sciChartSurface.delete()
374
- groupedChart.sciChartSurface = undefined
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
- this.groupCharts = this.groupSorter(this.groupCharts)
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
- groupSorter(group: any[]) {
380
- return group.sort(
381
- (a, b) =>
382
- this.visibleSeries.findIndex((s: any) => s.dataKey == a.dataKey) -
383
- this.visibleSeries.findIndex((s: any) => s.dataKey == b.dataKey)
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 appendData(appendum: { [attr: string]: any }[]) {}
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
- declare global {
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, animation, scales: fromScales, stacked, multiAxis } = options || {}
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
- const dataSeriesArray = datasets.map((dataset, index) => {
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
- const yAxis = new NumericAxis(wasmContext, {
526
- id: yAxisId,
527
- autoRange: EAutoRange.Always,
528
- drawLabels: false,
529
- drawMajorTickLines: false,
530
- drawMinorTickLines: false,
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
- sciChartSurface.yAxes.add(yAxis)
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
- const series = new FastLineRenderableSeries(wasmContext, {
538
- dataSeries,
539
- strokeThickness: 1,
540
- stroke: convertColor(dataset.color, DEFAULT_COLOR),
541
- yAxisId: yAxisId
542
- })
537
+ // sciChartSurface.yAxes.add(yAxis)
543
538
 
544
- sciChartSurface.renderableSeries.add(series)
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
- return dataSeries
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 updatedSelectedRange = visibleRange.clip(sciChartSurface.xAxes.get(0).visibleRange)
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: dataSeriesArray }
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
  }
@@ -82,6 +82,6 @@ export default {
82
82
  }
83
83
  },
84
84
  showOverview: true,
85
- visibleSeries: ['count', 'average']
85
+ visibleSeries: []
86
86
  }
87
87
  }