@operato/chart 8.0.0-beta.0 → 8.0.0-beta.2

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 (40) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/package.json +6 -6
  3. package/.editorconfig +0 -29
  4. package/.storybook/main.js +0 -3
  5. package/.storybook/preview.js +0 -52
  6. package/.storybook/server.mjs +0 -8
  7. package/demo/index.html +0 -33
  8. package/src/chartjs/config-converter.ts +0 -341
  9. package/src/chartjs/ox-chart-js.ts +0 -207
  10. package/src/editors/configurer.ts +0 -336
  11. package/src/editors/index.ts +0 -8
  12. package/src/editors/input-chart-abstract.ts +0 -202
  13. package/src/editors/input-chart-styles.ts +0 -206
  14. package/src/editors/ox-input-chart-hbar.ts +0 -157
  15. package/src/editors/ox-input-chart-mixed.ts +0 -241
  16. package/src/editors/ox-input-chart-pie.ts +0 -69
  17. package/src/editors/ox-input-chart-radar.ts +0 -56
  18. package/src/editors/ox-input-chart-timeseries.ts +0 -279
  19. package/src/editors/ox-property-editor-chart.ts +0 -72
  20. package/src/editors/templates/annotations.ts +0 -295
  21. package/src/editors/templates/display-value.ts +0 -111
  22. package/src/editors/templates/series.ts +0 -316
  23. package/src/global.d.ts +0 -1
  24. package/src/index.ts +0 -0
  25. package/src/progress/ox-progress-circle.ts +0 -133
  26. package/src/scichart/ox-scichart.ts +0 -151
  27. package/src/scichart/scichart-builder.ts +0 -508
  28. package/src/types.d.ts +0 -124
  29. package/stories/common.ts +0 -87
  30. package/stories/ox-input-chart-bar.stories.ts +0 -188
  31. package/stories/ox-input-chart-doughnut.stories.ts +0 -130
  32. package/stories/ox-input-chart-hbar.stories.ts +0 -188
  33. package/stories/ox-input-chart-line.stories.ts +0 -198
  34. package/stories/ox-input-chart-pie.stories.ts +0 -130
  35. package/stories/ox-input-chart-polar-area.stories.ts +0 -130
  36. package/stories/ox-input-chart-radar.stories.ts +0 -141
  37. package/stories/ox-input-chart-timeseries.stories.ts +0 -268
  38. package/tsconfig.json +0 -25
  39. package/web-dev-server.config.mjs +0 -27
  40. package/web-test-runner.config.mjs +0 -41
@@ -1,72 +0,0 @@
1
- import '@operato/i18n/ox-i18n.js'
2
-
3
- import './ox-input-chart-hbar'
4
- import './ox-input-chart-mixed'
5
- import './ox-input-chart-pie'
6
- import './ox-input-chart-radar'
7
- import './ox-input-chart-timeseries'
8
-
9
- import { css, html } from 'lit'
10
- import { customElement } from 'lit/decorators.js'
11
-
12
- import { OxPropertyEditor, PropertySpec } from '@operato/property-editor'
13
-
14
- @customElement('ox-property-editor-chart')
15
- export class ChartEditor extends OxPropertyEditor {
16
- static styles = [
17
- css`
18
- :host {
19
- display: block;
20
- padding: 5px;
21
-
22
- --md-elevated-button-container-height: 20px;
23
- }
24
-
25
- #chart-type {
26
- display: grid;
27
- grid-template-columns: repeat(10, 1fr);
28
- grid-gap: 5px;
29
- }
30
-
31
- #chart-type > label {
32
- box-sizing: border-box;
33
- grid-column: span 3;
34
-
35
- text-align: right;
36
-
37
- color: var(--md-sys-color-on-secondary-container);
38
- font-size: 0.8em;
39
- line-height: 2;
40
- text-transform: capitalize;
41
- }
42
-
43
- #chart-type > input {
44
- box-sizing: border-box;
45
- grid-column: span 7;
46
- border: 1px solid rgba(0, 0, 0, 0.2);
47
- }
48
- `
49
- ]
50
-
51
- editorTemplate(value: any, spec: PropertySpec) {
52
- switch (value.type) {
53
- case 'line':
54
- case 'bar':
55
- return html` <ox-input-chart-mixed .value=${value} chart-type=${value.type} fullwidth></ox-input-chart-mixed> `
56
- case 'horizontalBar':
57
- return html` <ox-input-chart-hbar .value=${value} chart-type=${value.type} fullwidth></ox-input-chart-hbar> `
58
- case 'pie':
59
- case 'doughnut':
60
- case 'polarArea':
61
- return html` <ox-input-chart-pie .value=${value} chart-type=${value.type} fullwidth></ox-input-chart-pie> `
62
- case 'radar':
63
- return html` <ox-input-chart-radar .value=${value} chart-type=${value.type} fullwidth></ox-input-chart-radar> `
64
- case 'timeseries':
65
- return html`
66
- <ox-input-chart-timeseries .value=${value} chart-type=${value.type} fullwidth></ox-input-chart-timeseries>
67
- `
68
- }
69
-
70
- return html``
71
- }
72
- }
@@ -1,295 +0,0 @@
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
- get value() {
29
- return this.configurer.annotations
30
- }
31
-
32
- render() {
33
- return keyed(
34
- this.configurer.currentAnnotationIndex,
35
- html`
36
- <div id="annotations-properties-container" fullwidth>
37
- <div id="annotations-tab-header" @wheel=${this._onWheelScroll}>
38
- <md-icon id="annotations-tab-nav-left-button" @click=${this._scrollLeft}>chevron_left</md-icon>
39
- <div id="annotations-tabs" active-tab-index=${this.configurer.currentAnnotationIndex} fit-container>
40
- ${this._renderTabs()}
41
- </div>
42
- <md-icon id="annotations-tab-nav-right-button" @click=${this._scrollRight}>chevron_right</md-icon>
43
- </div>
44
- <div id="add-annotation-button-container">
45
- <md-icon id="add-annotation-button" @click=${this._addAnnotation}>add</md-icon>
46
- </div>
47
- ${this._renderAnnotationForm()}
48
- </div>
49
- `
50
- )
51
- }
52
-
53
- private _renderTabs() {
54
- return this.configurer.annotations.map(
55
- (annotation: OperatoChart.Annotation, index: number) => html`
56
- <div
57
- data-annotation=${index + 1}
58
- data-tab-index=${index}
59
- tab
60
- ?selected=${index === this.configurer.currentAnnotationIndex}
61
- @click=${() => this._selectTab(index)}
62
- >
63
- ${index + 1}
64
- ${this.configurer.annotations.length > 0 && this.configurer.currentAnnotationIndex === index
65
- ? html`<md-icon @click=${() => this._removeAnnotation(index)}>close</md-icon>`
66
- : html``}
67
- </div>
68
- `
69
- )
70
- }
71
-
72
- private _renderAnnotationForm() {
73
- const currentAnnotation =
74
- this.configurer.currentAnnotationIndex >= 0
75
- ? this.configurer.annotations[this.configurer.currentAnnotationIndex]
76
- : undefined
77
-
78
- if (!currentAnnotation) {
79
- return html`<p>No annotations available. Add one using the button above.</p>`
80
- }
81
-
82
- return html`
83
- <div class="tab-content">
84
- <label for="annotation-type"> <ox-i18n msgid="label.chart-annotation-type">Type</ox-i18n> </label>
85
- <select
86
- id="annotation-type"
87
- class="select-content"
88
- value-key="annotation.type"
89
- .value=${currentAnnotation!.type || ''}
90
- >
91
- <option value="">&nbsp;</option>
92
- <option value="line">Line</option>
93
- <option value="text">Text</option>
94
- <option value="box">Box</option>
95
- <option value="horizontalLine">Horizontal Line</option>
96
- <option value="verticalLine">Vertical Line</option>
97
- </select>
98
-
99
- <label for="annotation-x1">X1</label>
100
- <input
101
- id="annotation-x1"
102
- type="number"
103
- value-key="annotation.x1"
104
- .value=${String(currentAnnotation!.x1 || 0)}
105
- />
106
-
107
- <label for="annotation-y1">Y1</label>
108
- <input
109
- id="annotation-y1"
110
- type="number"
111
- value-key="annotation.y1"
112
- .value=${String(currentAnnotation!.y1 || 0)}
113
- />
114
-
115
- <label for="annotation-x2">X2</label>
116
- <input
117
- id="annotation-x2"
118
- type="number"
119
- value-key="annotation.x2"
120
- .value=${String(currentAnnotation!.x2 || 0)}
121
- />
122
-
123
- <label for="annotation-y2">Y2</label>
124
- <input
125
- id="annotation-y2"
126
- type="number"
127
- value-key="annotation.y2"
128
- .value=${String(currentAnnotation!.y2 || 0)}
129
- />
130
-
131
- <label for="annotation-stroke"> <ox-i18n msgid="label.stroke-style">Stroke Style</ox-i18n> </label>
132
- <ox-input-color
133
- id="annotation-stroke"
134
- value-key="annotation.stroke"
135
- .value=${currentAnnotation!.stroke}
136
- ></ox-input-color>
137
-
138
- <label for="annotation-stroke-thickness">
139
- <ox-i18n msgid="label.stroke-thickness">Stroke Thickness</ox-i18n>
140
- </label>
141
- <input
142
- id="annotation-stroke-thickness"
143
- type="number"
144
- value-key="annotation.strokeThickness"
145
- .value=${String(currentAnnotation!.strokeThickness || 1)}
146
- />
147
-
148
- <label for="annotation-fill"> <ox-i18n msgid="label.fill">Fill</ox-i18n> </label>
149
- <ox-input-color
150
- id="annotation-fill"
151
- value-key="annotation.fill"
152
- .value=${currentAnnotation!.fill}
153
- ></ox-input-color>
154
-
155
- <label for="annotation-text"> <ox-i18n msgid="label.annotation-text">Text</ox-i18n> </label>
156
- <input id="annotation-text" type="text" value-key="annotation.text" .value=${currentAnnotation!.text || ''} />
157
-
158
- <label for="annotation-horizontal-anchor">
159
- <ox-i18n msgid="label.horizontal-anchor">Horizontal Anchor</ox-i18n>
160
- </label>
161
- <select
162
- id="annotation-horizontal-anchor"
163
- class="select-content"
164
- value-key="annotation.horizontalAnchorPoint"
165
- .value=${currentAnnotation!.horizontalAnchorPoint || ''}
166
- >
167
- <option value="">&nbsp;</option>
168
- <option value="Left">Left</option>
169
- <option value="Center">Center</option>
170
- <option value="Right">Right</option>
171
- </select>
172
-
173
- <label for="annotation-vertical-anchor">
174
- <ox-i18n msgid="label.vertical-anchor">Vertical Anchor</ox-i18n>
175
- </label>
176
- <select
177
- id="annotation-vertical-anchor"
178
- class="select-content"
179
- value-key="annotation.verticalAnchorPoint"
180
- .value=${currentAnnotation!.verticalAnchorPoint || ''}
181
- >
182
- <option value="">&nbsp;</option>
183
- <option value="Top">Top</option>
184
- <option value="Center">Center</option>
185
- <option value="Bottom">Bottom</option>
186
- </select>
187
-
188
- <label for="annotation-x-coordinate-mode">X Coordinate Mode</label>
189
- <select
190
- id="annotation-x-coordinate-mode"
191
- class="select-content"
192
- value-key="annotation.xCoordinateMode"
193
- .value=${currentAnnotation!.xCoordinateMode || 'DataValue'}
194
- >
195
- <option value="">&nbsp;</option>
196
- <option value="DataValue">DataValue</option>
197
- <option value="Pixel">Pixel</option>
198
- <option value="Relative">Relative</option>
199
- </select>
200
-
201
- <label for="annotation-y-coordinate-mode">Y Coordinate Mode</label>
202
- <select
203
- id="annotation-y-coordinate-mode"
204
- class="select-content"
205
- value-key="annotation.yCoordinateMode"
206
- .value=${currentAnnotation!.yCoordinateMode || 'DataValue'}
207
- >
208
- <option value="">&nbsp;</option>
209
- <option value="DataValue">DataValue</option>
210
- <option value="Pixel">Pixel</option>
211
- <option value="Relative">Relative</option>
212
- </select>
213
- </div>
214
- `
215
- }
216
-
217
- private _selectTab(index: number) {
218
- this.configurer.setCurrentAnnotationIndex(index)
219
- this.requestUpdate()
220
- }
221
-
222
- private _removeAnnotation(index: number) {
223
- this.configurer.removeAnnotation(index)
224
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
225
-
226
- this.requestUpdate()
227
- }
228
-
229
- private _addAnnotation() {
230
- this.configurer.addAnnotation()
231
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
232
-
233
- this.requestUpdate()
234
- }
235
-
236
- private _onWheelScroll(event: WheelEvent) {
237
- const tabContainer = this.annotationsTabs
238
- if (tabContainer) {
239
- event.preventDefault()
240
-
241
- tabContainer.scrollLeft += event.deltaY
242
-
243
- this._onTabScroll()
244
- }
245
- }
246
-
247
- private _scrollLeft() {
248
- this._scrollTabContainer(-1)
249
- }
250
-
251
- private _scrollRight() {
252
- this._scrollTabContainer(1)
253
- }
254
-
255
- private _scrollTabContainer(direction: number) {
256
- const tabContainer = this.renderRoot!.querySelector<HTMLElement>('#annotations-tabs')
257
- if (tabContainer) {
258
- tabContainer.style.scrollBehavior = 'smooth'
259
- tabContainer.scrollLeft += direction * tabContainer.clientWidth
260
- }
261
-
262
- setTimeout(() => {
263
- tabContainer!.style.scrollBehavior = 'auto'
264
- this._onTabScroll()
265
- }, 300)
266
- }
267
-
268
- private _onTabScroll() {
269
- let tabContainer: HTMLElement | null | undefined
270
- let tabNavLeftButton: MdIcon
271
- let tabNavRightButton: MdIcon
272
-
273
- tabContainer = this.annotationsTabs
274
- tabNavLeftButton = this.annotationsTabNavLeftButton
275
- tabNavRightButton = this.annotationsTabNavRightButton
276
-
277
- if (!tabContainer) {
278
- return
279
- }
280
-
281
- if (tabContainer.clientWidth == tabContainer.scrollWidth) {
282
- tabNavLeftButton.setAttribute('disabled', '')
283
- tabNavRightButton.setAttribute('disabled', '')
284
- } else if (tabContainer.scrollLeft <= 0) {
285
- tabNavLeftButton.setAttribute('disabled', '')
286
- tabNavRightButton.removeAttribute('disabled')
287
- } else if (tabContainer.scrollLeft + tabContainer.clientWidth >= tabContainer.scrollWidth) {
288
- tabNavLeftButton.removeAttribute('disabled')
289
- tabNavRightButton.setAttribute('disabled', '')
290
- } else {
291
- tabNavLeftButton.removeAttribute('disabled')
292
- tabNavRightButton.removeAttribute('disabled')
293
- }
294
- }
295
- }
@@ -1,111 +0,0 @@
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
- const displayValue = configurer.series.displayValue
17
- configurer.series.displayValue = displayValue === true ? 'T' : displayValue === false ? 'F' : displayValue
18
-
19
- return html`
20
- <div id="display-value-container">
21
- <label for="value-format"> <ox-i18n msgid="label.value-format">Value Format</ox-i18n> </label>
22
- <input
23
- id="value-format"
24
- type="text"
25
- value-key="series.valueFormat"
26
- .value=${configurer.series.valueFormat || ''}
27
- list="format-list"
28
- />
29
- <datalist id="format-list">
30
- <option value="#,###."></option>
31
- <option value="#,###.#"></option>
32
- <option value="#,###.0"></option>
33
- <option value="#,##0.#"></option>
34
- <option value="#,##0.0"></option>
35
- <option value="#,##0.0%"></option>
36
- </datalist>
37
-
38
- <label for="value-prefix"> <ox-i18n msgid="label.value-prefix">Value Prefix</ox-i18n> </label>
39
- <input
40
- id="value-prefix"
41
- type="text"
42
- value-key="series.valuePrefix"
43
- .value=${configurer.series.valuePrefix || ''}
44
- />
45
-
46
- <label for="value-suffix"> <ox-i18n msgid="label.value-suffix">Value Suffix</ox-i18n> </label>
47
- <input
48
- id="value-suffix"
49
- type="text"
50
- value-key="series.valueSuffix"
51
- .value=${configurer.series.valueSuffix || ''}
52
- />
53
-
54
- <label for="display-value"> <ox-i18n msgid="label.value-display">Value Display</ox-i18n> </label>
55
- <select id="display-value" value-key="series.displayValue" .value=${configurer.series.displayValue || 'F'}>
56
- <option value="T">Show</option>
57
- <option value="F">Hide</option>
58
- <option value="auto">Hide to Overlap</option>
59
- </select>
60
-
61
- ${configurer.series.displayValue
62
- ? html`
63
- <label for="font-color"> <ox-i18n msgid="label.font-color">Font Color</ox-i18n> </label>
64
- <ox-input-color
65
- id="font-color"
66
- value-key="series.defaultFontColor"
67
- .value=${configurer.series.defaultFontColor || '#000'}
68
- ></ox-input-color>
69
- <label for="font-size"> <ox-i18n msgid="label.font-size">Font Size</ox-i18n> </label>
70
- <input
71
- id="font-size"
72
- type="number"
73
- value-key="series.defaultFontSize"
74
- .value=${configurer.series.defaultFontSize || 10}
75
- />
76
- <label for="data-label-anchor"> <ox-i18n msgid="label.data-label-anchor">Position</ox-i18n> </label>
77
- <select
78
- id="data-label-anchor"
79
- value-key="series.dataLabelAnchor"
80
- .value=${configurer.series.dataLabelAnchor || 'center'}
81
- >
82
- <option value="center">Center</option>
83
- <option value="start">Start</option>
84
- <option value="end">End</option>
85
- </select>
86
- <label for="data-label-offset"> <ox-i18n msgid="label.data-label-offset">Offset</ox-i18n> </label>
87
- <input
88
- id="data-label-offset"
89
- type="number"
90
- value-key="series.dataLabelOffset"
91
- .value=${configurer.series.dataLabelOffset || 0}
92
- />
93
- <label for="data-label-rotation"> <ox-i18n msgid="label.data-label-rotation">Rotation</ox-i18n> </label>
94
- <input
95
- id="data-label-rotation"
96
- type="number"
97
- value-key="series.dataLabelRotation"
98
- .value=${configurer.series.dataLabelRotation || 0}
99
- />
100
- `
101
- : html``}
102
- </div>
103
- `
104
- }
105
- }
106
-
107
- declare global {
108
- interface HTMLElementTagNameMap {
109
- 'ox-chart-display-value': DisplayValue
110
- }
111
- }