@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
@@ -176,4 +176,31 @@ export const InputChartStyles = css`
176
176
  background-color: var(--md-sys-color-surface);
177
177
  color: var(--md-sys-color-on-surface);
178
178
  }
179
+
180
+ #display-value-container {
181
+ display: grid;
182
+ grid-template-columns: repeat(10, 1fr);
183
+ grid-gap: 5px;
184
+
185
+ background-color: var(--ox-input-background-color, var(--md-sys-color-surface));
186
+ color: var(--ox-input-color, var(--md-sys-color-on-surface));
187
+ }
188
+
189
+ #display-value-container > * {
190
+ box-sizing: border-box;
191
+ grid-column: span 7;
192
+ }
193
+
194
+ #display-value-container > label {
195
+ box-sizing: border-box;
196
+ grid-column: span 3;
197
+ }
198
+
199
+ #display-value-container > legend {
200
+ box-sizing: border-box;
201
+ grid-column: 1 / -1;
202
+ color: var(--md-sys-color-on-secondary-container, #e46c2e);
203
+ font: var(--property-sidebar-fieldset-legend, bold 13px var(--theme-font));
204
+ text-transform: capitalize;
205
+ }
179
206
  `
@@ -8,6 +8,8 @@ import { ifDefined } from 'lit/directives/if-defined.js'
8
8
 
9
9
  import { InputChartAbstract } from './input-chart-abstract'
10
10
 
11
+ import './templates/display-value'
12
+
11
13
  @customElement('ox-input-chart-hbar')
12
14
  export class OxInputChartHBar extends InputChartAbstract {
13
15
  static styles = InputChartAbstract.styles
@@ -17,7 +19,7 @@ export class OxInputChartHBar extends InputChartAbstract {
17
19
 
18
20
  return html`
19
21
  <legend><ox-i18n msgid="label.series">Series</ox-i18n></legend>
20
- ${this.multiSeriesTabTemplate()}
22
+ <ox-chart-series .configurer=${configurer} .chartType=${this.chartType} fullwidth></ox-chart-series>
21
23
 
22
24
  <legend><ox-i18n msgid="label.y-axes">Y Axes</ox-i18n></legend>
23
25
 
@@ -144,78 +146,6 @@ export class OxInputChartHBar extends InputChartAbstract {
144
146
  `
145
147
  }
146
148
 
147
- multiSeriesTabTemplate() {
148
- const configurer = this.configurer
149
-
150
- return html`
151
- <div id="series-properties-container" fullwidth>
152
- <div id="series-tab-header">
153
- <md-icon
154
- id="series-tab-nav-left-button"
155
- @tap=${(e: Event) => {
156
- this._onTabScrollNavLeft(e, 'series')
157
- }}
158
- disabled
159
- >chevron_left</md-icon
160
- >
161
- <div
162
- id="series-tabs"
163
- @change=${(e: Event) => {
164
- configurer.currentSeriesIndex = (e.target as any).activeTabIndex
165
- }}
166
- active-tab-index=${configurer.currentSeriesIndex}
167
- fit-container
168
- >
169
- ${configurer.datasets.map(
170
- (dataset: any, index: number) => html`
171
- <div
172
- data-series=${index + 1}
173
- data-tab-index=${index}
174
- tab
175
- ?selected=${index == configurer.currentSeriesIndex}
176
- @click=${(e: Event) => {
177
- const target = e.target as HTMLDivElement
178
- this.configurer.setCurrentSeriesIndex(Number(target.getAttribute('data-tab-index')))
179
- this.value = { ...this.configurer.value }
180
- }}
181
- >
182
- ${index + 1}
183
- ${!configurer.datasets || (configurer.datasets.length != 1 && configurer.currentSeriesIndex == index)
184
- ? html` <md-icon @tap=${(e: Event) => this.onTapRemoveCurrentSeriesTab(index)}> close </md-icon> `
185
- : html``}
186
- </div>
187
- `
188
- )}
189
- </div>
190
- <md-icon
191
- id="series-tab-nav-right-button"
192
- @click=${(e: Event) => {
193
- this._onTabScrollNavRight(e, 'series')
194
- }}
195
- disabled
196
- >chevron_right</md-icon
197
- >
198
- </div>
199
- <div id="add-series-button-container">
200
- <md-icon id="add-series-button" @tap=${(e: Event) => this.onTapAddSeriesTab(e)}>add</md-icon>
201
- </div>
202
-
203
- <div class="tab-content">
204
- <label for="data-key"> <ox-i18n msgid="label.data-key">Data Key</ox-i18n> </label>
205
- <input id="data-key" type="text" value-key="dataKey" .value=${configurer.dataKey || ''} />
206
- <label for="series-label"> <ox-i18n msgid="label.label">Label</ox-i18n> </label>
207
- <input id="series-label" type="text" value-key="series.label" .value=${configurer.series.label || ''} />
208
- <label for="series-color"> <ox-i18n msgid="label.color">Color</ox-i18n> </label>
209
- <ox-input-color id="series-color" value-key="color" .value=${configurer.color || '#000'}></ox-input-color>
210
- <label for="series-stack"> <ox-i18n msgid="label.stack-group">Stack Group</ox-i18n> </label>
211
- <input id="series-stack" type="text" value-key="series.stack" .value=${configurer.series.stack || ''} />
212
-
213
- ${this.displayValueTemplate()}
214
- </div>
215
- </div>
216
- `
217
- }
218
-
219
149
  getDefaultDatasets(): OperatoChart.Dataset[] {
220
150
  return [this.getDefaultDataset('horizontalBar')]
221
151
  }
@@ -5,6 +5,7 @@ import { customElement } from 'lit/decorators.js'
5
5
  import { ifDefined } from 'lit/directives/if-defined.js'
6
6
 
7
7
  import { InputChartAbstract } from './input-chart-abstract'
8
+ import './templates/series'
8
9
 
9
10
  @customElement('ox-input-chart-mixed')
10
11
  export class OxInputChartMixed extends InputChartAbstract {
@@ -18,8 +19,7 @@ export class OxInputChartMixed extends InputChartAbstract {
18
19
  <label for="multi-axis"> <ox-i18n msgid="label.multi-axis">Multi Axis</ox-i18n> </label>
19
20
 
20
21
  <legend><ox-i18n msgid="label.series">Series</ox-i18n></legend>
21
-
22
- <div fullwidth>${this.multiSeriesTabTemplate()}</div>
22
+ <ox-chart-series .configurer=${configurer} .chartType=${this.chartType} fullwidth></ox-chart-series>
23
23
 
24
24
  <legend><ox-i18n msgid="label.x-axes">X Axes</ox-i18n></legend>
25
25
 
@@ -3,9 +3,9 @@ import '@operato/input/ox-input-multiple-colors.js'
3
3
 
4
4
  import { html } from 'lit'
5
5
  import { customElement } from 'lit/decorators.js'
6
- import { ifDefined } from 'lit/directives/if-defined.js'
7
6
 
8
7
  import { InputChartAbstract } from './input-chart-abstract'
8
+ import './templates/display-value'
9
9
 
10
10
  @customElement('ox-input-chart-pie')
11
11
  export default class OxInputChartPie extends InputChartAbstract {
@@ -27,7 +27,8 @@ export default class OxInputChartPie extends InputChartAbstract {
27
27
  .value=${configurer.color || []}
28
28
  ></ox-input-multiple-colors>
29
29
 
30
- ${this.displayValueTemplate()}
30
+ <label></label>
31
+ <ox-chart-display-value .configurer=${configurer} fullwidth></ox-chart-display-value>
31
32
 
32
33
  <legend><ox-i18n msgid="label.axes">Axes</ox-i18n></legend>
33
34
 
@@ -6,6 +6,8 @@ import { ifDefined } from 'lit/directives/if-defined.js'
6
6
 
7
7
  import { InputChartAbstract } from './input-chart-abstract'
8
8
 
9
+ import './templates/series'
10
+
9
11
  @customElement('ox-input-chart-radar')
10
12
  export default class OxInputChartRadar extends InputChartAbstract {
11
13
  static styles = InputChartAbstract.styles
@@ -15,8 +17,7 @@ export default class OxInputChartRadar extends InputChartAbstract {
15
17
 
16
18
  return html`
17
19
  <legend><ox-i18n msgid="label.series">Series</ox-i18n></legend>
18
-
19
- <div fullwidth>${this.multiSeriesTabTemplate()}</div>
20
+ <ox-chart-series .configurer=${configurer} .chartType=${this.chartType} fullwidth></ox-chart-series>
20
21
 
21
22
  <legend><ox-i18n msgid="label.axes">Axes</ox-i18n></legend>
22
23
 
@@ -6,6 +6,9 @@ import { ifDefined } from 'lit/directives/if-defined.js'
6
6
 
7
7
  import { InputChartAbstract } from './input-chart-abstract'
8
8
 
9
+ import './templates/annotations'
10
+ import './templates/series'
11
+
9
12
  @customElement('ox-input-chart-timeseries')
10
13
  export class OxInputChartTimeseries extends InputChartAbstract {
11
14
  static styles = [
@@ -22,7 +25,7 @@ export class OxInputChartTimeseries extends InputChartAbstract {
22
25
  margin: 0;
23
26
  }
24
27
 
25
- div[collapsed] {
28
+ [collapsed] {
26
29
  display: none;
27
30
  }
28
31
  `
@@ -38,7 +41,7 @@ export class OxInputChartTimeseries extends InputChartAbstract {
38
41
  <label for="multi-axis"> <ox-i18n msgid="label.multi-axis">Multi Axis</ox-i18n> </label>
39
42
 
40
43
  <legend><ox-i18n msgid="label.series">Series</ox-i18n></legend>
41
- <div fullwidth>${this.multiSeriesTabTemplate()}</div>
44
+ <ox-chart-series .configurer=${configurer} .chartType=${this.chartType} fullwidth></ox-chart-series>
42
45
 
43
46
  <legend><ox-i18n msgid="label.x-axes">X Axes</ox-i18n></legend>
44
47
 
@@ -253,7 +256,11 @@ export class OxInputChartTimeseries extends InputChartAbstract {
253
256
  >${this.annotationExpanded ? 'expand_less' : 'expand_more'}</md-icon
254
257
  >
255
258
  </legend>
256
- <div fullwidth ?collapsed=${!this.annotationExpanded}>${this.annotationsTabTemplate()}</div>
259
+ <ox-chart-annotations
260
+ .configurer=${configurer}
261
+ ?collapsed=${!this.annotationExpanded}
262
+ fullwidth
263
+ ></ox-chart-annotations>
257
264
  `
258
265
  }
259
266
 
@@ -6,7 +6,7 @@ import './ox-input-chart-pie'
6
6
  import './ox-input-chart-radar'
7
7
  import './ox-input-chart-timeseries'
8
8
 
9
- import { css, html, nothing } from 'lit'
9
+ import { css, html } from 'lit'
10
10
  import { customElement } from 'lit/decorators.js'
11
11
 
12
12
  import { OxPropertyEditor, PropertySpec } from '@operato/property-editor'
@@ -0,0 +1,287 @@
1
+ import '@material/web/icon/icon.js'
2
+
3
+ import { LitElement, html, PropertyValues } from 'lit'
4
+ import { customElement, property, query } from 'lit/decorators.js'
5
+ import { keyed } from 'lit/directives/keyed.js'
6
+ import { MdIcon } from '@material/web/icon/icon.js'
7
+
8
+ import { Configurer } from '../configurer'
9
+
10
+ @customElement('ox-chart-annotations')
11
+ export class AnnotationsTemplate extends LitElement {
12
+ createRenderRoot() {
13
+ return this
14
+ }
15
+
16
+ @property({ type: Object }) configurer!: Configurer
17
+
18
+ @query('#annotations-tabs') annotationsTabs!: HTMLElement
19
+ @query('#annotations-tab-nav-left-button') annotationsTabNavLeftButton!: MdIcon
20
+ @query('#annotations-tab-nav-right-button') annotationsTabNavRightButton!: MdIcon
21
+
22
+ protected updated(_changedProperties: PropertyValues): void {
23
+ if (_changedProperties.has('configurer')) {
24
+ this.requestUpdate()
25
+ }
26
+ }
27
+
28
+ render() {
29
+ return keyed(
30
+ this.configurer.currentAnnotationIndex,
31
+ html`
32
+ <div id="annotations-properties-container" fullwidth>
33
+ <div id="annotations-tab-header" @wheel=${this._onWheelScroll}>
34
+ <md-icon id="annotations-tab-nav-left-button" @click=${this._scrollLeft}>chevron_left</md-icon>
35
+ <div id="annotations-tabs" active-tab-index=${this.configurer.currentAnnotationIndex} fit-container>
36
+ ${this._renderTabs()}
37
+ </div>
38
+ <md-icon id="annotations-tab-nav-right-button" @click=${this._scrollRight}>chevron_right</md-icon>
39
+ </div>
40
+ <div id="add-annotation-button-container">
41
+ <md-icon id="add-annotation-button" @click=${this._addAnnotation}>add</md-icon>
42
+ </div>
43
+ ${this._renderAnnotationForm()}
44
+ </div>
45
+ `
46
+ )
47
+ }
48
+
49
+ private _renderTabs() {
50
+ return this.configurer.annotations.map(
51
+ (annotation: OperatoChart.Annotation, index: number) => html`
52
+ <div
53
+ data-annotation=${index + 1}
54
+ data-tab-index=${index}
55
+ tab
56
+ ?selected=${index === this.configurer.currentAnnotationIndex}
57
+ @click=${() => this._selectTab(index)}
58
+ >
59
+ ${index + 1}
60
+ ${this.configurer.annotations.length > 0 && this.configurer.currentAnnotationIndex === index
61
+ ? html`<md-icon @click=${() => this._removeAnnotation(index)}>close</md-icon>`
62
+ : html``}
63
+ </div>
64
+ `
65
+ )
66
+ }
67
+
68
+ private _renderAnnotationForm() {
69
+ const currentAnnotation =
70
+ this.configurer.currentAnnotationIndex >= 0
71
+ ? this.configurer.annotations[this.configurer.currentAnnotationIndex]
72
+ : undefined
73
+
74
+ if (!currentAnnotation) {
75
+ return html`<p>No annotations available. Add one using the button above.</p>`
76
+ }
77
+
78
+ return html`
79
+ <div class="tab-content">
80
+ <label for="annotation-type"> <ox-i18n msgid="label.chart-annotation-type">Type</ox-i18n> </label>
81
+ <select
82
+ id="annotation-type"
83
+ class="select-content"
84
+ value-key="annotation.type"
85
+ .value=${currentAnnotation!.type || ''}
86
+ >
87
+ <option value="">&nbsp;</option>
88
+ <option value="line">Line</option>
89
+ <option value="text">Text</option>
90
+ <option value="box">Box</option>
91
+ <option value="horizontalLine">Horizontal Line</option>
92
+ <option value="verticalLine">Vertical Line</option>
93
+ </select>
94
+
95
+ <label for="annotation-x1">X1</label>
96
+ <input
97
+ id="annotation-x1"
98
+ type="number"
99
+ value-key="annotation.x1"
100
+ .value=${String(currentAnnotation!.x1 || 0)}
101
+ />
102
+
103
+ <label for="annotation-y1">Y1</label>
104
+ <input
105
+ id="annotation-y1"
106
+ type="number"
107
+ value-key="annotation.y1"
108
+ .value=${String(currentAnnotation!.y1 || 0)}
109
+ />
110
+
111
+ <label for="annotation-x2">X2</label>
112
+ <input
113
+ id="annotation-x2"
114
+ type="number"
115
+ value-key="annotation.x2"
116
+ .value=${String(currentAnnotation!.x2 || 0)}
117
+ />
118
+
119
+ <label for="annotation-y2">Y2</label>
120
+ <input
121
+ id="annotation-y2"
122
+ type="number"
123
+ value-key="annotation.y2"
124
+ .value=${String(currentAnnotation!.y2 || 0)}
125
+ />
126
+
127
+ <label for="annotation-stroke"> <ox-i18n msgid="label.stroke-style">Stroke Style</ox-i18n> </label>
128
+ <ox-input-color
129
+ id="annotation-stroke"
130
+ value-key="annotation.stroke"
131
+ .value=${currentAnnotation!.stroke}
132
+ ></ox-input-color>
133
+
134
+ <label for="annotation-stroke-thickness">
135
+ <ox-i18n msgid="label.stroke-thickness">Stroke Thickness</ox-i18n>
136
+ </label>
137
+ <input
138
+ id="annotation-stroke-thickness"
139
+ type="number"
140
+ value-key="annotation.strokeThickness"
141
+ .value=${String(currentAnnotation!.strokeThickness || 1)}
142
+ />
143
+
144
+ <label for="annotation-fill"> <ox-i18n msgid="label.fill">Fill</ox-i18n> </label>
145
+ <ox-input-color
146
+ id="annotation-fill"
147
+ value-key="annotation.fill"
148
+ .value=${currentAnnotation!.fill}
149
+ ></ox-input-color>
150
+
151
+ <label for="annotation-text"> <ox-i18n msgid="label.annotation-text">Text</ox-i18n> </label>
152
+ <input id="annotation-text" type="text" value-key="annotation.text" .value=${currentAnnotation!.text || ''} />
153
+
154
+ <label for="annotation-horizontal-anchor">
155
+ <ox-i18n msgid="label.horizontal-anchor">Horizontal Anchor</ox-i18n>
156
+ </label>
157
+ <select
158
+ id="annotation-horizontal-anchor"
159
+ class="select-content"
160
+ value-key="annotation.horizontalAnchorPoint"
161
+ .value=${currentAnnotation!.horizontalAnchorPoint || ''}
162
+ >
163
+ <option value="">&nbsp;</option>
164
+ <option value="Left">Left</option>
165
+ <option value="Center">Center</option>
166
+ <option value="Right">Right</option>
167
+ </select>
168
+
169
+ <label for="annotation-vertical-anchor">
170
+ <ox-i18n msgid="label.vertical-anchor">Vertical Anchor</ox-i18n>
171
+ </label>
172
+ <select
173
+ id="annotation-vertical-anchor"
174
+ class="select-content"
175
+ value-key="annotation.verticalAnchorPoint"
176
+ .value=${currentAnnotation!.verticalAnchorPoint || ''}
177
+ >
178
+ <option value="">&nbsp;</option>
179
+ <option value="Top">Top</option>
180
+ <option value="Center">Center</option>
181
+ <option value="Bottom">Bottom</option>
182
+ </select>
183
+
184
+ <label for="annotation-x-coordinate-mode">X Coordinate Mode</label>
185
+ <select
186
+ id="annotation-x-coordinate-mode"
187
+ class="select-content"
188
+ value-key="annotation.xCoordinateMode"
189
+ .value=${currentAnnotation!.xCoordinateMode || 'DataValue'}
190
+ >
191
+ <option value="">&nbsp;</option>
192
+ <option value="DataValue">DataValue</option>
193
+ <option value="Pixel">Pixel</option>
194
+ <option value="Relative">Relative</option>
195
+ </select>
196
+
197
+ <label for="annotation-y-coordinate-mode">Y Coordinate Mode</label>
198
+ <select
199
+ id="annotation-y-coordinate-mode"
200
+ class="select-content"
201
+ value-key="annotation.yCoordinateMode"
202
+ .value=${currentAnnotation!.yCoordinateMode || 'DataValue'}
203
+ >
204
+ <option value="">&nbsp;</option>
205
+ <option value="DataValue">DataValue</option>
206
+ <option value="Pixel">Pixel</option>
207
+ <option value="Relative">Relative</option>
208
+ </select>
209
+ </div>
210
+ `
211
+ }
212
+
213
+ private _selectTab(index: number) {
214
+ this.configurer.setCurrentAnnotationIndex(index)
215
+ this.requestUpdate()
216
+ }
217
+
218
+ private _removeAnnotation(index: number) {
219
+ this.configurer.removeAnnotation(index)
220
+ this.requestUpdate()
221
+ }
222
+
223
+ private _addAnnotation() {
224
+ this.configurer.addAnnotation()
225
+ this.requestUpdate()
226
+ }
227
+
228
+ private _onWheelScroll(event: WheelEvent) {
229
+ const tabContainer = this.annotationsTabs
230
+ if (tabContainer) {
231
+ event.preventDefault()
232
+
233
+ tabContainer.scrollLeft += event.deltaY
234
+
235
+ this._onTabScroll()
236
+ }
237
+ }
238
+
239
+ private _scrollLeft() {
240
+ this._scrollTabContainer(-1)
241
+ }
242
+
243
+ private _scrollRight() {
244
+ this._scrollTabContainer(1)
245
+ }
246
+
247
+ private _scrollTabContainer(direction: number) {
248
+ const tabContainer = this.renderRoot!.querySelector<HTMLElement>('#annotations-tabs')
249
+ if (tabContainer) {
250
+ tabContainer.style.scrollBehavior = 'smooth'
251
+ tabContainer.scrollLeft += direction * tabContainer.clientWidth
252
+ }
253
+
254
+ setTimeout(() => {
255
+ tabContainer!.style.scrollBehavior = 'auto'
256
+ this._onTabScroll()
257
+ }, 300)
258
+ }
259
+
260
+ private _onTabScroll() {
261
+ let tabContainer: HTMLElement | null | undefined
262
+ let tabNavLeftButton: MdIcon
263
+ let tabNavRightButton: MdIcon
264
+
265
+ tabContainer = this.annotationsTabs
266
+ tabNavLeftButton = this.annotationsTabNavLeftButton
267
+ tabNavRightButton = this.annotationsTabNavRightButton
268
+
269
+ if (!tabContainer) {
270
+ return
271
+ }
272
+
273
+ if (tabContainer.clientWidth == tabContainer.scrollWidth) {
274
+ tabNavLeftButton.setAttribute('disabled', '')
275
+ tabNavRightButton.setAttribute('disabled', '')
276
+ } else if (tabContainer.scrollLeft <= 0) {
277
+ tabNavLeftButton.setAttribute('disabled', '')
278
+ tabNavRightButton.removeAttribute('disabled')
279
+ } else if (tabContainer.scrollLeft + tabContainer.clientWidth >= tabContainer.scrollWidth) {
280
+ tabNavLeftButton.removeAttribute('disabled')
281
+ tabNavRightButton.setAttribute('disabled', '')
282
+ } else {
283
+ tabNavLeftButton.removeAttribute('disabled')
284
+ tabNavRightButton.removeAttribute('disabled')
285
+ }
286
+ }
287
+ }
@@ -0,0 +1,110 @@
1
+ import { LitElement, html } from 'lit'
2
+ import { customElement, property } from 'lit/decorators.js'
3
+
4
+ import { Configurer } from '../configurer' // Configurer 경로에 맞게 수정하세요.
5
+
6
+ @customElement('ox-chart-display-value')
7
+ export class DisplayValue extends LitElement {
8
+ createRenderRoot() {
9
+ return this
10
+ }
11
+
12
+ @property({ type: Object }) configurer!: Configurer
13
+
14
+ render() {
15
+ const configurer = this.configurer
16
+
17
+ return html`
18
+ <div id="display-value-container">
19
+ <label for="value-format"> <ox-i18n msgid="label.value-format">Value Format</ox-i18n> </label>
20
+ <input
21
+ id="value-format"
22
+ type="text"
23
+ value-key="series.valueFormat"
24
+ .value=${configurer.series.valueFormat || ''}
25
+ list="format-list"
26
+ />
27
+ <datalist id="format-list">
28
+ <option value="#,###."></option>
29
+ <option value="#,###.#"></option>
30
+ <option value="#,###.0"></option>
31
+ <option value="#,##0.#"></option>
32
+ <option value="#,##0.0"></option>
33
+ <option value="#,##0.0%"></option>
34
+ </datalist>
35
+
36
+ <label for="value-prefix"> <ox-i18n msgid="label.value-prefix">Value Prefix</ox-i18n> </label>
37
+ <input
38
+ id="value-prefix"
39
+ type="text"
40
+ value-key="series.valuePrefix"
41
+ .value=${configurer.series.valuePrefix || ''}
42
+ />
43
+
44
+ <label for="value-suffix"> <ox-i18n msgid="label.value-suffix">Value Suffix</ox-i18n> </label>
45
+ <input
46
+ id="value-suffix"
47
+ type="text"
48
+ value-key="series.valueSuffix"
49
+ .value=${configurer.series.valueSuffix || ''}
50
+ />
51
+
52
+ <input
53
+ id="display-value"
54
+ type="checkbox"
55
+ value-key="series.displayValue"
56
+ ?checked=${!!configurer.series.displayValue}
57
+ />
58
+ <label for="display-value"> <ox-i18n msgid="label.value-display">Value Display</ox-i18n> </label>
59
+
60
+ ${configurer.series.displayValue
61
+ ? html`
62
+ <label for="font-color"> <ox-i18n msgid="label.font-color">Font Color</ox-i18n> </label>
63
+ <ox-input-color
64
+ id="font-color"
65
+ value-key="series.defaultFontColor"
66
+ .value=${configurer.series.defaultFontColor || '#000'}
67
+ ></ox-input-color>
68
+ <label for="font-size"> <ox-i18n msgid="label.font-size">Font Size</ox-i18n> </label>
69
+ <input
70
+ id="font-size"
71
+ type="number"
72
+ value-key="series.defaultFontSize"
73
+ .value=${configurer.series.defaultFontSize || 10}
74
+ />
75
+ <label for="data-label-anchor"> <ox-i18n msgid="label.data-label-anchor">Position</ox-i18n> </label>
76
+ <select
77
+ id="data-label-anchor"
78
+ value-key="series.dataLabelAnchor"
79
+ .value=${configurer.series.dataLabelAnchor || 'center'}
80
+ >
81
+ <option value="center">Center</option>
82
+ <option value="start">Start</option>
83
+ <option value="end">End</option>
84
+ </select>
85
+ <label for="data-label-offset"> <ox-i18n msgid="label.data-label-offset">Offset</ox-i18n> </label>
86
+ <input
87
+ id="data-label-offset"
88
+ type="number"
89
+ value-key="series.dataLabelOffset"
90
+ .value=${configurer.series.dataLabelOffset || 0}
91
+ />
92
+ <label for="data-label-rotation"> <ox-i18n msgid="label.data-label-rotation">Rotation</ox-i18n> </label>
93
+ <input
94
+ id="data-label-rotation"
95
+ type="number"
96
+ value-key="series.dataLabelRotation"
97
+ .value=${configurer.series.dataLabelRotation || 0}
98
+ />
99
+ `
100
+ : html``}
101
+ </div>
102
+ `
103
+ }
104
+ }
105
+
106
+ declare global {
107
+ interface HTMLElementTagNameMap {
108
+ 'ox-chart-display-value': DisplayValue
109
+ }
110
+ }