@operato/chart 7.0.37 → 7.0.40

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 (61) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/src/editors/configurer.d.ts +4 -2
  3. package/dist/src/editors/configurer.js +27 -14
  4. package/dist/src/editors/configurer.js.map +1 -1
  5. package/dist/src/editors/input-chart-abstract.d.ts +0 -26
  6. package/dist/src/editors/input-chart-abstract.js +1 -607
  7. package/dist/src/editors/input-chart-abstract.js.map +1 -1
  8. package/dist/src/editors/input-chart-styles.js +27 -0
  9. package/dist/src/editors/input-chart-styles.js.map +1 -1
  10. package/dist/src/editors/ox-input-chart-hbar.d.ts +1 -1
  11. package/dist/src/editors/ox-input-chart-hbar.js +2 -69
  12. package/dist/src/editors/ox-input-chart-hbar.js.map +1 -1
  13. package/dist/src/editors/ox-input-chart-mixed.d.ts +1 -0
  14. package/dist/src/editors/ox-input-chart-mixed.js +2 -2
  15. package/dist/src/editors/ox-input-chart-mixed.js.map +1 -1
  16. package/dist/src/editors/ox-input-chart-pie.d.ts +1 -0
  17. package/dist/src/editors/ox-input-chart-pie.js +3 -1
  18. package/dist/src/editors/ox-input-chart-pie.js.map +1 -1
  19. package/dist/src/editors/ox-input-chart-radar.d.ts +1 -0
  20. package/dist/src/editors/ox-input-chart-radar.js +2 -2
  21. package/dist/src/editors/ox-input-chart-radar.js.map +1 -1
  22. package/dist/src/editors/ox-input-chart-timeseries.d.ts +2 -0
  23. package/dist/src/editors/ox-input-chart-timeseries.js +9 -3
  24. package/dist/src/editors/ox-input-chart-timeseries.js.map +1 -1
  25. package/dist/src/editors/ox-property-editor-chart.js.map +1 -1
  26. package/dist/src/editors/templates/annotations.d.ts +23 -0
  27. package/dist/src/editors/templates/annotations.js +270 -0
  28. package/dist/src/editors/templates/annotations.js.map +1 -0
  29. package/dist/src/editors/templates/display-value.d.ts +12 -0
  30. package/dist/src/editors/templates/display-value.js +105 -0
  31. package/dist/src/editors/templates/display-value.js.map +1 -0
  32. package/dist/src/editors/templates/series.d.ts +31 -0
  33. package/dist/src/editors/templates/series.js +277 -0
  34. package/dist/src/editors/templates/series.js.map +1 -0
  35. package/dist/src/scichart/ox-scichart.js +4 -3
  36. package/dist/src/scichart/ox-scichart.js.map +1 -1
  37. package/dist/src/scichart/scichart-builder.js +25 -7
  38. package/dist/src/scichart/scichart-builder.js.map +1 -1
  39. package/dist/stories/common.d.ts +2 -2
  40. package/dist/stories/common.js +6 -3
  41. package/dist/stories/common.js.map +1 -1
  42. package/dist/stories/ox-input-chart-timeseries.stories.js +2 -2
  43. package/dist/stories/ox-input-chart-timeseries.stories.js.map +1 -1
  44. package/dist/tsconfig.tsbuildinfo +1 -1
  45. package/package.json +2 -2
  46. package/src/editors/configurer.ts +28 -15
  47. package/src/editors/input-chart-abstract.ts +1 -655
  48. package/src/editors/input-chart-styles.ts +27 -0
  49. package/src/editors/ox-input-chart-hbar.ts +3 -73
  50. package/src/editors/ox-input-chart-mixed.ts +2 -2
  51. package/src/editors/ox-input-chart-pie.ts +3 -2
  52. package/src/editors/ox-input-chart-radar.ts +3 -2
  53. package/src/editors/ox-input-chart-timeseries.ts +10 -3
  54. package/src/editors/ox-property-editor-chart.ts +1 -1
  55. package/src/editors/templates/annotations.ts +287 -0
  56. package/src/editors/templates/display-value.ts +110 -0
  57. package/src/editors/templates/series.ts +304 -0
  58. package/src/scichart/ox-scichart.ts +7 -3
  59. package/src/scichart/scichart-builder.ts +30 -6
  60. package/stories/common.ts +6 -3
  61. package/stories/ox-input-chart-timeseries.stories.ts +2 -2
@@ -1,11 +1,9 @@
1
1
  import '@operato/i18n/ox-i18n.js'
2
2
 
3
3
  import { html, PropertyValues } from 'lit'
4
- import { property, query } from 'lit/decorators.js'
5
- import { keyed } from 'lit/directives/keyed.js'
4
+ import { property } from 'lit/decorators.js'
6
5
 
7
6
  import { random as randomColor, TinyColor } from '@ctrl/tinycolor'
8
- import { MdIcon } from '@material/web/icon/icon.js'
9
7
 
10
8
  import { InputChartStyles } from './input-chart-styles'
11
9
  import { Configurer } from './configurer'
@@ -17,14 +15,6 @@ export class InputChartAbstract extends OxFormField {
17
15
  @property({ type: Object }) value: OperatoChart.ChartConfig | null = null
18
16
  @property({ type: String, attribute: 'chart-type' }) chartType: OperatoChart.ChartType
19
17
 
20
- @query('#annotations-tabs') annotationsTabs!: HTMLElement
21
- @query('#annotations-tab-nav-left-button') annotationsTabNavLeftButton!: MdIcon
22
- @query('#annotations-tab-nav-right-button') annotationsTabNavRightButton!: MdIcon
23
-
24
- @query('#series-tabs') seriesTabs!: HTMLElement
25
- @query('#series-tab-nav-left-button') seriesTabNavLeftButton!: MdIcon
26
- @query('#series-tab-nav-right-button') seriesTabNavRightButton!: MdIcon
27
-
28
18
  private _configurer?: Configurer
29
19
 
30
20
  get configurer() {
@@ -88,114 +78,6 @@ export class InputChartAbstract extends OxFormField {
88
78
  this.renderRoot.addEventListener('change', this.onValuesChanged.bind(this))
89
79
  }
90
80
 
91
- protected firstUpdated(_changedProperties: PropertyValues): void {
92
- this.seriesTabContainer?.addEventListener('scroll', e => {
93
- this._onTabScroll(e, 'series')
94
- })
95
-
96
- this.annotationsTabContainer?.addEventListener('scroll', e => {
97
- this._onTabScroll(e, 'annotations')
98
- })
99
- }
100
-
101
- get seriesTabContainer(): HTMLElement | null | undefined {
102
- return this.seriesTabs
103
- }
104
-
105
- get annotationsTabContainer(): HTMLElement | null | undefined {
106
- return this.annotationsTabs
107
- }
108
-
109
- displayValueTemplate() {
110
- const configurer = this.configurer
111
-
112
- return html`
113
- <label for="value-format"> <ox-i18n msgid="label.value-format">Value Format</ox-i18n> </label>
114
- <input
115
- id="value-format"
116
- type="text"
117
- value-key="series.valueFormat"
118
- .value=${configurer.series.valueFormat || ''}
119
- list="format-list"
120
- />
121
- <datalist id="format-list">
122
- <option value="#,###."></option>
123
- <option value="#,###.#"></option>
124
- <option value="#,###.0"></option>
125
- <option value="#,##0.#"></option>
126
- <option value="#,##0.0"></option>
127
- <option value="#,##0.0%"></option>
128
- </datalist>
129
-
130
- <label for="value-prefix"> <ox-i18n msgid="label.value-prefix">Value Prefix</ox-i18n> </label>
131
- <input
132
- id="value-prefix"
133
- type="text"
134
- value-key="series.valuePrefix"
135
- .value=${configurer.series.valuePrefix || ''}
136
- />
137
-
138
- <label for="value-suffix"> <ox-i18n msgid="label.value-suffix">Value Suffix</ox-i18n> </label>
139
- <input
140
- id="value-suffix"
141
- type="text"
142
- value-key="series.valueSuffix"
143
- .value=${configurer.series.valueSuffix || ''}
144
- />
145
-
146
- <input
147
- id="display-value"
148
- type="checkbox"
149
- value-key="series.displayValue"
150
- ?checked=${!!configurer.series.displayValue}
151
- />
152
- <label for="display-value"> <ox-i18n msgid="label.value-display">Value Display</ox-i18n> </label>
153
-
154
- ${configurer.series.displayValue
155
- ? html`
156
- <label for="font-color"> <ox-i18n msgid="label.font-color">Font Color</ox-i18n> </label>
157
- <ox-input-color
158
- id="font-color"
159
- value-key="series.defaultFontColor"
160
- .value=${configurer.series.defaultFontColor || '#000'}
161
- ></ox-input-color>
162
- <label for="font-size"> <ox-i18n msgid="label.font-size">Font Size</ox-i18n> </label>
163
- <input
164
- id="font-size"
165
- type="number"
166
- value-key="series.defaultFontSize"
167
- value=${configurer.series.defaultFontSize || 10}
168
- />
169
- <label for="data-label-anchor"> <ox-i18n msgid="label.data-label-anchor">Position</ox-i18n> </label>
170
- <select
171
- id="data-label-anchor"
172
- value-key="series.dataLabelAnchor"
173
- .value=${configurer.series.dataLabelAnchor || 'center'}
174
- >
175
- <option value=""></option>
176
- <option value="start">Start</option>
177
- <option value="center">Center</option>
178
- <option value="end">End</option>
179
- </select>
180
- <label for="data-label-offset"> <ox-i18n msgid="label.data-label-offset">Offset</ox-i18n> </label>
181
- <input
182
- id="data-label-offset"
183
- type="number"
184
- value-key="series.dataLabelOffset"
185
- value=${configurer.series.dataLabelOffset || 0}
186
- />
187
- <label for="data-label-rotation"> <ox-i18n msgid="label.data-label-rotation">Rotation</ox-i18n> </label>
188
- <input
189
- id="data-label-rotation"
190
- type="number"
191
- value-key="series.dataLabelRotation"
192
- value=${configurer.series.dataLabelRotation || 0}
193
- />
194
- `
195
- : html``}
196
- `
197
- }
198
-
199
81
  subTemplate() {
200
82
  return html``
201
83
  }
@@ -302,96 +184,6 @@ export class InputChartAbstract extends OxFormField {
302
184
  this.requestUpdate()
303
185
  }
304
186
 
305
- onTapAddSeriesTab(e: Event) {
306
- const configurer = this.configurer
307
-
308
- if (!configurer.config.data.datasets) return
309
-
310
- const lastSeriesIndex = configurer.config.data.datasets.length
311
- const chartType = configurer.series.type || configurer.config.type
312
- const color = configurer.datasets[lastSeriesIndex - 1]?.backgroundColor
313
- const lastSeriesColor = new TinyColor(Array.isArray(color) ? color[0] : color)
314
-
315
- const seriesModel = this._getSeriesModel({
316
- chartType: chartType!,
317
- datasetsLength: lastSeriesIndex,
318
- lastSeriesColor
319
- })
320
-
321
- configurer.config.data.datasets.push(seriesModel)
322
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
323
- configurer.setCurrentSeriesIndex(lastSeriesIndex)
324
-
325
- this.value = { ...this.configurer.value }
326
- }
327
-
328
- onTapRemoveCurrentSeriesTab(index: number) {
329
- const configurer = this.configurer
330
-
331
- if (!configurer.config.data.datasets) {
332
- return
333
- }
334
-
335
- this.configurer.data.datasets.splice(index, 1)
336
-
337
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
338
- configurer.setCurrentSeriesIndex(Math.max(0, configurer.currentSeriesIndex - 1))
339
-
340
- this.requestUpdate()
341
- }
342
-
343
- onTapAddAnnotation(e: Event) {
344
- const configurer = this.configurer
345
-
346
- const lastAnnotationIndex = configurer.annotations.length
347
- configurer.annotations.push({ type: 'line', x1: 0, y1: 0 })
348
-
349
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
350
- configurer.setCurrentAnnotationIndex(lastAnnotationIndex)
351
-
352
- this.value = { ...this.configurer.value }
353
- }
354
-
355
- onTapRemoveCurrentAnnotation(index: number) {
356
- const configurer = this.configurer
357
-
358
- if (!configurer.annotations) {
359
- return
360
- }
361
-
362
- configurer.annotations.splice(index, 1)
363
-
364
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
365
- configurer.setCurrentAnnotationIndex(Math.max(0, configurer.currentAnnotationIndex - 1))
366
-
367
- this.requestUpdate()
368
- }
369
-
370
- _getSeriesModel({
371
- chartType,
372
- datasetsLength,
373
- lastSeriesColor
374
- }: {
375
- chartType: string
376
- datasetsLength: number
377
- lastSeriesColor: TinyColor
378
- }) {
379
- const addSeriesOption: any = {
380
- label: `series ${datasetsLength + 1}`,
381
- data: [],
382
- borderWidth: 1,
383
- dataKey: '',
384
- yAxisID: 'left',
385
- color: randomColor({
386
- hue: lastSeriesColor.toHsv().h
387
- }).toRgbString(),
388
- stack: ''
389
- }
390
-
391
- addSeriesOption.type = addSeriesOption.chartType = chartType
392
- return addSeriesOption
393
- }
394
-
395
187
  _getElementValue(element: HTMLElement) {
396
188
  switch (element.tagName) {
397
189
  case 'INPUT':
@@ -407,450 +199,4 @@ export class InputChartAbstract extends OxFormField {
407
199
  return (element as any).value
408
200
  }
409
201
  }
410
-
411
- annotationsTabTemplate() {
412
- const configurer = this.configurer
413
- const currentAnnotation = configurer.annotations[configurer.currentAnnotationIndex] || {}
414
-
415
- return keyed(
416
- configurer.currentAnnotationIndex,
417
- html`
418
- <div id="annotations-properties-container" fullwidth>
419
- <div id="annotations-tab-header">
420
- <md-icon
421
- id="annotations-tab-nav-left-button"
422
- @tap=${(e: Event) => {
423
- this._onTabScrollNavLeft(e, 'annotations')
424
- }}
425
- disabled
426
- >chevron_left</md-icon
427
- >
428
- <div
429
- id="annotations-tabs"
430
- @change=${(e: Event) => {
431
- configurer.setCurrentAnnotationIndex((e.target as any).activeTabIndex)
432
- }}
433
- active-tab-index=${configurer.currentAnnotationIndex}
434
- fit-container
435
- >
436
- ${configurer.annotations!.map(
437
- (annotation: any, index: number) => html`
438
- <div
439
- data-annotation=${index + 1}
440
- data-tab-index=${index}
441
- tab
442
- ?selected=${index == configurer.currentAnnotationIndex}
443
- @click=${(e: Event) => {
444
- const target = e.target as HTMLDivElement
445
- this.configurer.setCurrentAnnotationIndex(Number(target.getAttribute('data-tab-index')))
446
- this.value = { ...this.configurer.value }
447
- }}
448
- >
449
- ${index + 1}
450
- ${!configurer.annotations ||
451
- (configurer.annotations.length != 1 && configurer.currentAnnotationIndex == index)
452
- ? html`
453
- <md-icon @tap=${(e: Event) => this.onTapRemoveCurrentAnnotation(index)}> close </md-icon>
454
- `
455
- : html``}
456
- </div>
457
- `
458
- )}
459
- </div>
460
- <md-icon
461
- id="annotations-tab-nav-right-button"
462
- @click=${(e: Event) => {
463
- this._onTabScrollNavRight(e, 'annotations')
464
- }}
465
- disabled
466
- >chevron_right</md-icon
467
- >
468
- </div>
469
- <div id="add-annotation-button-container">
470
- <md-icon id="add-annotation-button" @tap=${(e: Event) => this.onTapAddAnnotation(e)}>add</md-icon>
471
- </div>
472
-
473
- <div class="tab-content">
474
- <label for="annotation-type"> <ox-i18n msgid="label.chart-annotation-type">Type</ox-i18n> </label>
475
- <select
476
- id="annotation-type"
477
- class="select-content"
478
- value-key="annotation.type"
479
- .value=${currentAnnotation.type || ''}
480
- >
481
- <option value="">&nbsp;</option>
482
- <option value="line">Line</option>
483
- <option value="text">Text</option>
484
- <option value="box">Box</option>
485
- <option value="horizontalLine">Horizontal Line</option>
486
- <option value="verticalLine">Vertical Line</option>
487
- </select>
488
-
489
- <label for="annotation-x1">X1</label>
490
- <input
491
- id="annotation-x1"
492
- type="number"
493
- value-key="annotation.x1"
494
- .value=${String(currentAnnotation.x1 || 0)}
495
- />
496
-
497
- <label for="annotation-y1">Y1</label>
498
- <input
499
- id="annotation-y1"
500
- type="number"
501
- value-key="annotation.y1"
502
- .value=${String(currentAnnotation.y1 || 0)}
503
- />
504
-
505
- <label for="annotation-x2">X2</label>
506
- <input
507
- id="annotation-x2"
508
- type="number"
509
- value-key="annotation.x2"
510
- .value=${String(currentAnnotation.x2 || 0)}
511
- />
512
-
513
- <label for="annotation-y2">Y2</label>
514
- <input
515
- id="annotation-y2"
516
- type="number"
517
- value-key="annotation.y2"
518
- .value=${String(currentAnnotation.y2 || 0)}
519
- />
520
-
521
- <label for="annotation-stroke"> <ox-i18n msgid="label.stroke-style">Stroke Style</ox-i18n> </label>
522
- <ox-input-color
523
- id="annotation-stroke"
524
- value-key="annotation.stroke"
525
- .value=${currentAnnotation.stroke}
526
- ></ox-input-color>
527
-
528
- <label for="annotation-stroke-thickness">
529
- <ox-i18n msgid="label.stroke-thickness">Stroke Thickness</ox-i18n>
530
- </label>
531
- <input
532
- id="annotation-stroke-thickness"
533
- type="number"
534
- value-key="annotation.strokeThickness"
535
- .value=${String(currentAnnotation.strokeThickness || 1)}
536
- />
537
-
538
- <label for="annotation-fill"> <ox-i18n msgid="label.fill">Fill</ox-i18n> </label>
539
- <ox-input-color
540
- id="annotation-fill"
541
- value-key="annotation.fill"
542
- .value=${currentAnnotation.fill}
543
- ></ox-input-color>
544
-
545
- <label for="annotation-text"> <ox-i18n msgid="label.annotation-text">Text</ox-i18n> </label>
546
- <input
547
- id="annotation-text"
548
- type="text"
549
- value-key="annotation.text"
550
- .value=${currentAnnotation.text || ''}
551
- />
552
-
553
- <label for="annotation-horizontal-anchor">
554
- <ox-i18n msgid="label.horizontal-anchor">Horizontal Anchor</ox-i18n>
555
- </label>
556
- <select
557
- id="annotation-horizontal-anchor"
558
- class="select-content"
559
- value-key="annotation.horizontalAnchorPoint"
560
- .value=${currentAnnotation.horizontalAnchorPoint || ''}
561
- >
562
- <option value="">&nbsp;</option>
563
- <option value="Left">Left</option>
564
- <option value="Center">Center</option>
565
- <option value="Right">Right</option>
566
- </select>
567
-
568
- <label for="annotation-vertical-anchor">
569
- <ox-i18n msgid="label.vertical-anchor">Vertical Anchor</ox-i18n>
570
- </label>
571
- <select
572
- id="annotation-vertical-anchor"
573
- class="select-content"
574
- value-key="annotation.verticalAnchorPoint"
575
- .value=${currentAnnotation.verticalAnchorPoint || ''}
576
- >
577
- <option value="">&nbsp;</option>
578
- <option value="Top">Top</option>
579
- <option value="Center">Center</option>
580
- <option value="Bottom">Bottom</option>
581
- </select>
582
-
583
- <label for="annotation-x-coordinate-mode">X Coordinate Mode</label>
584
- <select
585
- id="annotation-x-coordinate-mode"
586
- class="select-content"
587
- value-key="annotation.xCoordinateMode"
588
- .value=${currentAnnotation.xCoordinateMode || 'DataValue'}
589
- >
590
- <option value="">&nbsp;</option>
591
- <option value="DataValue">DataValue</option>
592
- <option value="Pixel">Pixel</option>
593
- <option value="Relative">Relative</option>
594
- </select>
595
-
596
- <label for="annotation-y-coordinate-mode">Y Coordinate Mode</label>
597
- <select
598
- id="annotation-y-coordinate-mode"
599
- class="select-content"
600
- value-key="annotation.yCoordinateMode"
601
- .value=${currentAnnotation.yCoordinateMode || 'DataValue'}
602
- >
603
- <option value="">&nbsp;</option>
604
- <option value="DataValue">DataValue</option>
605
- <option value="Pixel">Pixel</option>
606
- <option value="Relative">Relative</option>
607
- </select>
608
- </div>
609
- </div>
610
- `
611
- )
612
- }
613
-
614
- multiSeriesTabTemplate() {
615
- const configurer = this.configurer
616
-
617
- return keyed(
618
- configurer.currentSeriesIndex,
619
- html`
620
- <div id="series-properties-container" fullwidth>
621
- <div id="series-tab-header">
622
- <md-icon
623
- id="series-tab-nav-left-button"
624
- @tap=${(e: Event) => {
625
- this._onTabScrollNavLeft(e, 'series')
626
- }}
627
- disabled
628
- >chevron_left</md-icon
629
- >
630
- <div
631
- id="series-tabs"
632
- @change=${(e: Event) => {
633
- // configurer.currentSeriesIndex = (e.target as any).activeTabIndex
634
- configurer.setCurrentSeriesIndex((e.target as any).activeTabIndex)
635
- }}
636
- active-tab-index=${configurer.currentSeriesIndex}
637
- fit-container
638
- >
639
- ${configurer.datasets.map(
640
- (dataset: any, index: number) => html`
641
- <div
642
- data-series=${index + 1}
643
- data-tab-index=${index}
644
- tab
645
- ?selected=${index == configurer.currentSeriesIndex}
646
- @click=${(e: Event) => {
647
- const target = e.target as HTMLDivElement
648
- this.configurer.setCurrentSeriesIndex(Number(target.getAttribute('data-tab-index')))
649
- this.value = { ...this.configurer.value }
650
- }}
651
- >
652
- ${index + 1}
653
- ${!configurer.datasets ||
654
- (configurer.datasets.length != 1 && configurer.currentSeriesIndex == index)
655
- ? html` <md-icon @tap=${(e: Event) => this.onTapRemoveCurrentSeriesTab(index)}> close </md-icon> `
656
- : html``}
657
- </div>
658
- `
659
- )}
660
- </div>
661
- <md-icon
662
- id="series-tab-nav-right-button"
663
- @click=${(e: Event) => {
664
- this._onTabScrollNavRight(e, 'series')
665
- }}
666
- disabled
667
- >chevron_right</md-icon
668
- >
669
- </div>
670
- <div id="add-series-button-container">
671
- <md-icon id="add-series-button" @tap=${(e: Event) => this.onTapAddSeriesTab(e)}>add</md-icon>
672
- </div>
673
-
674
- <div class="tab-content">
675
- <label for="data-key"> <ox-i18n msgid="label.data-key">Data Key</ox-i18n> </label>
676
- <input id="data-key" type="text" value-key="dataKey" .value=${configurer.dataKey || ''} />
677
-
678
- ${this.chartType == 'line' || this.chartType == 'bar'
679
- ? html`
680
- <label for="series-type"> <ox-i18n msgid="label.series-type">Type</ox-i18n> </label>
681
- <select
682
- id="series-type"
683
- class="select-content"
684
- value-key="series.type"
685
- .value=${configurer.series.type || ''}
686
- >
687
- <option value="bar" selected>Bar</option>
688
- <option value="line">Line</option>
689
- </select>
690
- `
691
- : html``}
692
-
693
- <label for="series-label"> <ox-i18n msgid="label.label">Label</ox-i18n> </label>
694
- <input id="series-label" type="text" value-key="series.label" .value=${configurer.series.label || ''} />
695
-
696
- ${configurer.series.type == 'line'
697
- ? html`
698
- <label for="series-line-tension"> <ox-i18n msgid="label.line-tension">Line Tension</ox-i18n> </label>
699
- <select
700
- id="series-line-tension"
701
- class="select-content"
702
- value-key="series.lineTension"
703
- .value=${String(configurer.series.lineTension || 0)}
704
- >
705
- <option value="0.4">Smooth</option>
706
- <option value="0">Angled</option>
707
- </select>
708
- `
709
- : html``}
710
- ${configurer.series.type == 'line'
711
- ? html`
712
- <label for="series-border-width"> <ox-i18n msgid="label.border-width">Border Width</ox-i18n> </label>
713
- <input
714
- id="series-border-width"
715
- type="number"
716
- value-key="series.borderWidth"
717
- .value=${String(configurer.series.borderWidth || 0)}
718
- />
719
- `
720
- : html``}
721
-
722
- <label for="series-color"> <ox-i18n msgid="label.color">Color</ox-i18n> </label>
723
- <ox-input-color id="series-color" value-key="color" .value=${configurer.color}></ox-input-color>
724
-
725
- ${configurer.series.type == 'line'
726
- ? html`
727
- <label for="series-point-style"> <ox-i18n msgid="label.point-shape">Point Shape</ox-i18n> </label>
728
- <select
729
- id="series-point-style"
730
- class="select-content"
731
- value-key="series.pointStyle"
732
- .value=${configurer.series.pointStyle || ''}
733
- >
734
- <option value="">&nbsp;</option>
735
- <option value="circle">⚬</option>
736
- <option value="triangle">▵</option>
737
- <option value="rect">□</option>
738
- <option value="rectRot">◇</option>
739
- <option value="cross">+</option>
740
- <option value="crossRot">⨉</option>
741
- <option value="star">✱</option>
742
- <option value="line">―</option>
743
- <option value="dash">┄</option>
744
- </select>
745
-
746
- <label for="series-point-radius"> <ox-i18n msgid="label.point-size">Point Size</ox-i18n> </label>
747
- <input
748
- id="series-point-radius"
749
- type="number"
750
- value-key="series.pointRadius"
751
- .value=${String(configurer.series.pointRadius || 0)}
752
- />
753
- `
754
- : html``} <label for="series-stack"> <ox-i18n msgid="label.stack-group">Stack group</ox-i18n> </label>
755
- <input id="series-stack" type="text" value-key="series.stack" .value=${configurer.series.stack || ''} />
756
- ${configurer.series.type == 'line'
757
- ? html`
758
- <input id="seires-fill" type="checkbox" value-key="series.fill" ?checked=${configurer.series.fill} />
759
- <label for="seires-fill"> <ox-i18n msgid="label.fill">Fill</ox-i18n> </label>
760
- `
761
- : html``}
762
- ${configurer.multiAxis
763
- ? html`
764
- <label for="series-y-axis-id"> <ox-i18n msgid="label.target-axis">Target Axis</ox-i18n> </label>
765
- <select
766
- id="series-y-axis-id"
767
- class="select-content"
768
- value-key="series.yAxisID"
769
- .value=${configurer.series.yAxisID || ''}
770
- >
771
- <option value="left">Left</option>
772
- <option value="right">Right</option>
773
- </select>
774
- `
775
- : html``}
776
- ${this.displayValueTemplate()}
777
- </div>
778
- </div>
779
- `
780
- )
781
- }
782
-
783
- _onTabScroll(e: Event, type: 'series' | 'annotations') {
784
- let tabContainer: HTMLElement | null | undefined
785
- let tabNavLeftButton: MdIcon
786
- let tabNavRightButton: MdIcon
787
-
788
- if (type === 'series') {
789
- tabContainer = this.seriesTabContainer
790
- tabNavLeftButton = this.seriesTabNavLeftButton
791
- tabNavRightButton = this.seriesTabNavRightButton
792
- } else {
793
- tabContainer = this.annotationsTabContainer
794
- tabNavLeftButton = this.annotationsTabNavLeftButton
795
- tabNavRightButton = this.annotationsTabNavRightButton
796
- }
797
-
798
- if (!tabContainer) {
799
- return
800
- }
801
-
802
- if (tabContainer.clientWidth == tabContainer.scrollWidth) {
803
- tabNavLeftButton.setAttribute('disabled', '')
804
- tabNavRightButton.setAttribute('disabled', '')
805
- }
806
- // left-end
807
- else if (tabContainer.scrollLeft == 0) {
808
- tabNavLeftButton.setAttribute('disabled', '')
809
- tabNavRightButton.removeAttribute('disabled')
810
- }
811
- // right-end
812
- else if (tabContainer.scrollLeft + tabContainer.clientWidth >= tabContainer.scrollWidth) {
813
- tabNavLeftButton.removeAttribute('disabled')
814
- tabNavRightButton.setAttribute('disabled', '')
815
- } else {
816
- tabNavLeftButton.removeAttribute('disabled')
817
- tabNavRightButton.removeAttribute('disabled')
818
- }
819
- }
820
-
821
- _onTabScrollNavLeft(e: Event, type: 'series' | 'annotations') {
822
- let tabContainer: HTMLElement | null | undefined
823
-
824
- if (type === 'series') {
825
- tabContainer = this.seriesTabContainer
826
- } else {
827
- tabContainer = this.annotationsTabContainer
828
- }
829
-
830
- if (!tabContainer) {
831
- return
832
- }
833
-
834
- tabContainer.style.scrollBehavior = 'smooth'
835
- tabContainer.scrollLeft -= tabContainer.clientWidth
836
- tabContainer.style.scrollBehavior = 'auto'
837
- }
838
-
839
- _onTabScrollNavRight(e: Event, type: 'series' | 'annotations') {
840
- let tabContainer: HTMLElement | null | undefined
841
-
842
- if (type === 'series') {
843
- tabContainer = this.seriesTabContainer
844
- } else {
845
- tabContainer = this.annotationsTabContainer
846
- }
847
-
848
- if (!tabContainer) {
849
- return
850
- }
851
-
852
- tabContainer.style.scrollBehavior = 'smooth'
853
- tabContainer.scrollLeft += tabContainer.clientWidth
854
- tabContainer.style.scrollBehavior = 'auto'
855
- }
856
202
  }