@operato/chart 2.0.0-beta.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +29 -0
- package/.storybook/main.js +3 -0
- package/.storybook/preview.js +29 -0
- package/.storybook/server.mjs +8 -0
- package/CHANGELOG.md +17 -0
- package/README.md +0 -0
- package/assets/images/icon-editor-gradient-direction.png +0 -0
- package/assets/images/icon-properties-label.png +0 -0
- package/assets/images/icon-properties-line-type.png +0 -0
- package/assets/images/icon-properties-table.png +0 -0
- package/assets/images/no-image.png +0 -0
- package/demo/index.html +33 -0
- package/dist/src/chartjs/config-converter.d.ts +29 -0
- package/dist/src/chartjs/config-converter.js +218 -0
- package/dist/src/chartjs/config-converter.js.map +1 -0
- package/dist/src/chartjs/ox-chart-js.d.ts +17 -0
- package/dist/src/chartjs/ox-chart-js.js +46 -0
- package/dist/src/chartjs/ox-chart-js.js.map +1 -0
- package/dist/src/editors/configurer.d.ts +52 -0
- package/dist/src/editors/configurer.js +198 -0
- package/dist/src/editors/configurer.js.map +1 -0
- package/dist/src/editors/index.d.ts +6 -0
- package/dist/src/editors/index.js +8 -0
- package/dist/src/editors/index.js.map +1 -0
- package/dist/src/editors/input-chart-abstract.d.ts +27 -0
- package/dist/src/editors/input-chart-abstract.js +273 -0
- package/dist/src/editors/input-chart-abstract.js.map +1 -0
- package/dist/src/editors/input-chart-multi-series-abstract.d.ts +17 -0
- package/dist/src/editors/input-chart-multi-series-abstract.js +418 -0
- package/dist/src/editors/input-chart-multi-series-abstract.js.map +1 -0
- package/dist/src/editors/input-chart-styles.d.ts +1 -0
- package/dist/src/editors/input-chart-styles.js +167 -0
- package/dist/src/editors/input-chart-styles.js.map +1 -0
- package/dist/src/editors/ox-input-chart-hbar.d.ts +11 -0
- package/dist/src/editors/ox-input-chart-hbar.js +220 -0
- package/dist/src/editors/ox-input-chart-hbar.js.map +1 -0
- package/dist/src/editors/ox-input-chart-mixed.d.ts +8 -0
- package/dist/src/editors/ox-input-chart-mixed.js +237 -0
- package/dist/src/editors/ox-input-chart-mixed.js.map +1 -0
- package/dist/src/editors/ox-input-chart-pie.d.ts +11 -0
- package/dist/src/editors/ox-input-chart-pie.js +67 -0
- package/dist/src/editors/ox-input-chart-pie.js.map +1 -0
- package/dist/src/editors/ox-input-chart-radar.d.ts +8 -0
- package/dist/src/editors/ox-input-chart-radar.js +52 -0
- package/dist/src/editors/ox-input-chart-radar.js.map +1 -0
- package/dist/src/editors/ox-property-editor-chart.d.ts +10 -0
- package/dist/src/editors/ox-property-editor-chart.js +79 -0
- package/dist/src/editors/ox-property-editor-chart.js.map +1 -0
- package/dist/src/index.d.ts +0 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/scichart/ox-scichart.d.ts +35 -0
- package/dist/src/scichart/ox-scichart.js +122 -0
- package/dist/src/scichart/ox-scichart.js.map +1 -0
- package/dist/src/scichart/scichart-builder.d.ts +8 -0
- package/dist/src/scichart/scichart-builder.js +46 -0
- package/dist/src/scichart/scichart-builder.js.map +1 -0
- package/dist/stories/common.d.ts +2 -0
- package/dist/stories/common.js +44 -0
- package/dist/stories/common.js.map +1 -0
- package/dist/stories/ox-input-chart-hbar.stories.d.ts +25 -0
- package/dist/stories/ox-input-chart-hbar.stories.js +171 -0
- package/dist/stories/ox-input-chart-hbar.stories.js.map +1 -0
- package/dist/stories/ox-input-chart-mixed.stories.d.ts +25 -0
- package/dist/stories/ox-input-chart-mixed.stories.js +180 -0
- package/dist/stories/ox-input-chart-mixed.stories.js.map +1 -0
- package/dist/stories/ox-input-chart-pie.stories.d.ts +27 -0
- package/dist/stories/ox-input-chart-pie.stories.js +111 -0
- package/dist/stories/ox-input-chart-pie.stories.js.map +1 -0
- package/dist/stories/ox-input-chart-radar.stories.d.ts +27 -0
- package/dist/stories/ox-input-chart-radar.stories.js +122 -0
- package/dist/stories/ox-input-chart-radar.stories.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +104 -0
- package/src/chartjs/config-converter.ts +307 -0
- package/src/chartjs/ox-chart-js.ts +46 -0
- package/src/editors/configurer.ts +243 -0
- package/src/editors/index.ts +8 -0
- package/src/editors/input-chart-abstract.ts +315 -0
- package/src/editors/input-chart-multi-series-abstract.ts +429 -0
- package/src/editors/input-chart-styles.ts +167 -0
- package/src/editors/ox-input-chart-hbar.ts +226 -0
- package/src/editors/ox-input-chart-mixed.ts +240 -0
- package/src/editors/ox-input-chart-pie.ts +75 -0
- package/src/editors/ox-input-chart-radar.ts +54 -0
- package/src/editors/ox-property-editor-chart.ts +79 -0
- package/src/globat.d.ts +1 -0
- package/src/index.ts +0 -0
- package/src/scichart/ox-scichart.ts +143 -0
- package/src/scichart/scichart-builder.ts +87 -0
- package/src/types.d.ts +74 -0
- package/stories/common.ts +47 -0
- package/stories/ox-input-chart-hbar.stories.ts +185 -0
- package/stories/ox-input-chart-mixed.stories.ts +194 -0
- package/stories/ox-input-chart-pie.stories.ts +126 -0
- package/stories/ox-input-chart-radar.stories.ts +137 -0
- package/themes/dark-hc.css +151 -0
- package/themes/dark-mc.css +151 -0
- package/themes/dark.css +151 -0
- package/themes/grist-theme.css +177 -0
- package/themes/light-hc.css +151 -0
- package/themes/light-mc.css +151 -0
- package/themes/light.css +151 -0
- package/themes/md-typescale-styles.css +100 -0
- package/themes/spacing.css +43 -0
- package/themes/state-color.css +6 -0
- package/translations/en.json +44 -0
- package/translations/ja.json +44 -0
- package/translations/ko.json +44 -0
- package/translations/ms.json +8 -0
- package/translations/zh.json +44 -0
- package/tsconfig.json +24 -0
- package/web-dev-server.config.mjs +27 -0
- package/web-test-runner.config.mjs +41 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
|
+
import '@operato/input/ox-input-color.js'
|
|
3
|
+
import '@operato/i18n/ox-i18n.js'
|
|
4
|
+
|
|
5
|
+
import { html } from 'lit'
|
|
6
|
+
import { customElement } from 'lit/decorators.js'
|
|
7
|
+
import { ifDefined } from 'lit/directives/if-defined.js'
|
|
8
|
+
|
|
9
|
+
import { InputChartMultiSeriesAbstract } from './input-chart-multi-series-abstract'
|
|
10
|
+
|
|
11
|
+
@customElement('ox-input-chart-hbar')
|
|
12
|
+
export class OxInputChartHBar extends InputChartMultiSeriesAbstract {
|
|
13
|
+
static styles = [...InputChartMultiSeriesAbstract.styles]
|
|
14
|
+
|
|
15
|
+
getChartType(): 'bar' | 'horizontalBar' | 'line' | 'radar' | 'pie' | 'mixed' {
|
|
16
|
+
return 'horizontalBar'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
subTemplate() {
|
|
20
|
+
const configurer = this.configurer
|
|
21
|
+
|
|
22
|
+
return html`
|
|
23
|
+
<legend><ox-i18n msgid="label.series">Series</ox-i18n></legend>
|
|
24
|
+
${this.multiSeriesTabTemplate()}
|
|
25
|
+
|
|
26
|
+
<legend><ox-i18n msgid="label.y-axes">Y Axes</ox-i18n></legend>
|
|
27
|
+
|
|
28
|
+
<label for="label-data-key"> <ox-i18n msgid="label.data-key">Data Key</ox-i18n> </label>
|
|
29
|
+
<input id="label-data-key" type="text" value-key="labelDataKey" value=${ifDefined(configurer.labelDataKey)} />
|
|
30
|
+
|
|
31
|
+
<label for="y-axes0-axis-title"> <ox-i18n msgid="label.title">Title</ox-i18n> </label>
|
|
32
|
+
<input
|
|
33
|
+
id="y-axes0-axis-title"
|
|
34
|
+
type="text"
|
|
35
|
+
value-key="yAxes0.axisTitle"
|
|
36
|
+
value=${ifDefined(configurer.yAxes0.axisTitle)}
|
|
37
|
+
/>
|
|
38
|
+
|
|
39
|
+
<label for="y-axes0-bar-spacing"><ox-i18n msgid="label.bar-spacing">Bar Spacing</ox-i18n></label>
|
|
40
|
+
<input
|
|
41
|
+
id="y-axes0-bar-spacing"
|
|
42
|
+
type="number"
|
|
43
|
+
min="0"
|
|
44
|
+
max="1"
|
|
45
|
+
step="0.1"
|
|
46
|
+
value-key="yAxes0.barSpacing"
|
|
47
|
+
value=${ifDefined(configurer.yAxes0.barSpacing)}
|
|
48
|
+
/>
|
|
49
|
+
<label for="y-axes0-category-spacing"><ox-i18n msgid="label.tick-spacing">Tick Spacing</ox-i18n></label>
|
|
50
|
+
<input
|
|
51
|
+
id="y-axes0-category-spacing"
|
|
52
|
+
type="number"
|
|
53
|
+
min="0"
|
|
54
|
+
max="1"
|
|
55
|
+
step="0.1"
|
|
56
|
+
value-key="yAxes0.categorySpacing"
|
|
57
|
+
value=${ifDefined(configurer.yAxes0.categorySpacing)}
|
|
58
|
+
/>
|
|
59
|
+
|
|
60
|
+
<input
|
|
61
|
+
id="x-grid-line"
|
|
62
|
+
type="checkbox"
|
|
63
|
+
value-key="value.options.xGridLine"
|
|
64
|
+
?checked=${configurer.config.options?.xGridLine}
|
|
65
|
+
/>
|
|
66
|
+
<label for="x-grid-line"> <ox-i18n msgid="label.grid-line">Grid Line</ox-i18n> </label>
|
|
67
|
+
|
|
68
|
+
<input
|
|
69
|
+
id="x-axes0-ticks-display"
|
|
70
|
+
type="checkbox"
|
|
71
|
+
value-key="xAxes0.ticks.display"
|
|
72
|
+
?checked=${configurer.xAxes0.ticks?.display}
|
|
73
|
+
/>
|
|
74
|
+
<label for="x-axes0-ticks-display"> <ox-i18n msgid="label.display-tick">Display Tick</ox-i18n> </label>
|
|
75
|
+
|
|
76
|
+
<legend><ox-i18n msgid="label.x-axes">X Axes</ox-i18n></legend>
|
|
77
|
+
|
|
78
|
+
<label for="x-axes0-axis-title"> <ox-i18n msgid="label.title">Title</ox-i18n> </label>
|
|
79
|
+
<input
|
|
80
|
+
id="x-axes0-axis-title"
|
|
81
|
+
type="text"
|
|
82
|
+
value-key="xAxes0.axisTitle"
|
|
83
|
+
.value=${configurer.xAxes0.axisTitle || ''}
|
|
84
|
+
/>
|
|
85
|
+
|
|
86
|
+
<input
|
|
87
|
+
id="x-axes0-axis-min-auto"
|
|
88
|
+
type="checkbox"
|
|
89
|
+
value-key="xAxes0.ticks.autoMin"
|
|
90
|
+
?checked=${configurer.xAxes0.ticks?.autoMin}
|
|
91
|
+
/>
|
|
92
|
+
<label for="x-axes0-axis-min-auto"> <ox-i18n msgid="label.axis-min-auto">Axis Min Auto</ox-i18n> </label>
|
|
93
|
+
|
|
94
|
+
<input
|
|
95
|
+
id="x-axes0-ticks-auto-max"
|
|
96
|
+
type="checkbox"
|
|
97
|
+
value-key="xAxes0.ticks.autoMax"
|
|
98
|
+
?checked=${configurer.xAxes0.ticks?.autoMax}
|
|
99
|
+
/>
|
|
100
|
+
<label for="x-axes0-ticks-auto-max"> <ox-i18n msgid="label.axis-max-auto">Axis Max Auto</ox-i18n> </label>
|
|
101
|
+
|
|
102
|
+
${!configurer.xAxes0.ticks?.autoMin
|
|
103
|
+
? html`
|
|
104
|
+
<label for="x-axes0-ticks-min"> <ox-i18n msgid="label.axis-min">Axis Min</ox-i18n> </label>
|
|
105
|
+
<input
|
|
106
|
+
id="x-axes0-ticks-min"
|
|
107
|
+
type="number"
|
|
108
|
+
value-key="xAxes0.ticks.min"
|
|
109
|
+
value=${ifDefined(configurer.xAxes0.ticks?.min)}
|
|
110
|
+
/>
|
|
111
|
+
`
|
|
112
|
+
: html``}
|
|
113
|
+
${!configurer.xAxes0.ticks?.autoMax
|
|
114
|
+
? html`
|
|
115
|
+
<label for="x-axes0-ticks-max"> <ox-i18n msgid="label.axis-max">Axis Max</ox-i18n> </label>
|
|
116
|
+
<input
|
|
117
|
+
id="x-axes0-ticks-max"
|
|
118
|
+
type="number"
|
|
119
|
+
value-key="xAxes0.ticks.max"
|
|
120
|
+
value=${ifDefined(configurer.xAxes0.ticks?.max)}
|
|
121
|
+
/>
|
|
122
|
+
`
|
|
123
|
+
: html``}
|
|
124
|
+
|
|
125
|
+
<label for="y-axes0-ticks-step-size"> <ox-i18n msgid="label.axis-step-size">Axis Step Size</ox-i18n> </label>
|
|
126
|
+
<input
|
|
127
|
+
id="y-axes0-ticks-step-size"
|
|
128
|
+
type="number"
|
|
129
|
+
value-key="yAxes0.ticks.stepSize"
|
|
130
|
+
value=${ifDefined(configurer.yAxes0.ticks?.stepSize)}
|
|
131
|
+
/>
|
|
132
|
+
|
|
133
|
+
<input
|
|
134
|
+
id="y-grid-line"
|
|
135
|
+
type="checkbox"
|
|
136
|
+
value-key="value.options.yGridLine"
|
|
137
|
+
?checked=${configurer.config.options?.yGridLine}
|
|
138
|
+
/>
|
|
139
|
+
<label for="y-grid-line"> <ox-i18n msgid="label.grid-line">Grid Line</ox-i18n> </label>
|
|
140
|
+
|
|
141
|
+
<input
|
|
142
|
+
id="y-axes0-ticks-display"
|
|
143
|
+
type="checkbox"
|
|
144
|
+
value-key="yAxes0.ticks.display"
|
|
145
|
+
?checked=${configurer.yAxes0.ticks?.display}
|
|
146
|
+
/>
|
|
147
|
+
<label for="y-axes0-ticks-display"> <ox-i18n msgid="label.display-tick">Display Tick</ox-i18n> </label>
|
|
148
|
+
`
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
multiSeriesTabTemplate() {
|
|
152
|
+
const configurer = this.configurer
|
|
153
|
+
|
|
154
|
+
return html`
|
|
155
|
+
<div id="series-properties-container" fullwidth>
|
|
156
|
+
<div id="tab-header">
|
|
157
|
+
<md-icon
|
|
158
|
+
id="tab-nav-left-button"
|
|
159
|
+
@tap=${(e: Event) => {
|
|
160
|
+
this._onTabScrollNavLeft(e)
|
|
161
|
+
}}
|
|
162
|
+
disabled
|
|
163
|
+
>chevron_left</md-icon
|
|
164
|
+
>
|
|
165
|
+
<div
|
|
166
|
+
id="tabs"
|
|
167
|
+
@change=${(e: Event) => {
|
|
168
|
+
configurer.currentSeriesIndex = (e.target as any).activeTabIndex
|
|
169
|
+
}}
|
|
170
|
+
active-tab-index=${configurer.currentSeriesIndex}
|
|
171
|
+
fit-container
|
|
172
|
+
>
|
|
173
|
+
${configurer.datasets.map(
|
|
174
|
+
(dataset: any, index: number) => html`
|
|
175
|
+
<div
|
|
176
|
+
data-series=${index + 1}
|
|
177
|
+
data-tab-index=${index}
|
|
178
|
+
tab
|
|
179
|
+
?selected=${index == configurer.currentSeriesIndex}
|
|
180
|
+
@click=${(e: Event) => {
|
|
181
|
+
const target = e.target as HTMLDivElement
|
|
182
|
+
this.configurer.setCurrentSeriesIndex(Number(target.getAttribute('data-tab-index')))
|
|
183
|
+
this.value = { ...this.configurer.value }
|
|
184
|
+
}}
|
|
185
|
+
>
|
|
186
|
+
${index + 1}
|
|
187
|
+
${!configurer.datasets || (configurer.datasets.length != 1 && configurer.currentSeriesIndex == index)
|
|
188
|
+
? html` <md-icon @tap="${(e: Event) => this.onTapRemoveCurrentTab(e)}"> close </md-icon> `
|
|
189
|
+
: html``}
|
|
190
|
+
</div>
|
|
191
|
+
`
|
|
192
|
+
)}
|
|
193
|
+
</div>
|
|
194
|
+
<md-icon
|
|
195
|
+
id="tab-nav-right-button"
|
|
196
|
+
@click=${(e: Event) => {
|
|
197
|
+
this._onTabScrollNavRight(e)
|
|
198
|
+
}}
|
|
199
|
+
disabled
|
|
200
|
+
>chevron_right</md-icon
|
|
201
|
+
>
|
|
202
|
+
</div>
|
|
203
|
+
<div id="add-series-button-container">
|
|
204
|
+
<md-icon id="add-series-button" @tap=${(e: Event) => this.onTapAddTab(e)}>add</md-icon>
|
|
205
|
+
</div>
|
|
206
|
+
|
|
207
|
+
<div class="tab-content">
|
|
208
|
+
<label for="data-key"> <ox-i18n msgid="label.data-key">Data Key</ox-i18n> </label>
|
|
209
|
+
<input id="data-key" type="text" value-key="dataKey" .value=${configurer.dataKey || ''} />
|
|
210
|
+
<label for="series-label"> <ox-i18n msgid="label.label">Label</ox-i18n> </label>
|
|
211
|
+
<input id="series-label" type="text" value-key="series.label" .value=${configurer.series.label || ''} />
|
|
212
|
+
<label for="series-color"> <ox-i18n msgid="label.color">Color</ox-i18n> </label>
|
|
213
|
+
<ox-input-color id="series-color" value-key="color" .value=${configurer.color || '#000'}></ox-input-color>
|
|
214
|
+
<label for="series-stack"> <ox-i18n msgid="label.stack-group">Stack Group</ox-i18n> </label>
|
|
215
|
+
<input id="series-stack" type="text" value-key="series.stack" .value=${configurer.series.stack || ''} />
|
|
216
|
+
|
|
217
|
+
${this.displayValueTemplate()}
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
`
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
getDefaultDatasets(): OperatoChart.Dataset[] {
|
|
224
|
+
return [this.getDefaultDataset('horizontalBar')]
|
|
225
|
+
}
|
|
226
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import '@operato/i18n/ox-i18n.js'
|
|
2
|
+
|
|
3
|
+
import { html } from 'lit'
|
|
4
|
+
import { customElement } from 'lit/decorators.js'
|
|
5
|
+
import { ifDefined } from 'lit/directives/if-defined.js'
|
|
6
|
+
|
|
7
|
+
import { InputChartMultiSeriesAbstract } from './input-chart-multi-series-abstract'
|
|
8
|
+
|
|
9
|
+
@customElement('ox-input-chart-mixed')
|
|
10
|
+
export class OxInputChartMixed extends InputChartMultiSeriesAbstract {
|
|
11
|
+
static styles = InputChartMultiSeriesAbstract.styles
|
|
12
|
+
|
|
13
|
+
getChartType(): 'bar' | 'line' | 'pie' | 'radar' | 'mixed' {
|
|
14
|
+
return 'mixed'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
subTemplate() {
|
|
18
|
+
const configurer = this.configurer
|
|
19
|
+
|
|
20
|
+
return html`
|
|
21
|
+
<input id="multi-axis" type="checkbox" value-key="multiAxis" ?checked=${configurer.multiAxis} />
|
|
22
|
+
<label for="multi-axis"> <ox-i18n msgid="label.multi-axis">Multi Axis</ox-i18n> </label>
|
|
23
|
+
|
|
24
|
+
<legend><ox-i18n msgid="label.series">Series</ox-i18n></legend>
|
|
25
|
+
|
|
26
|
+
<div fullwidth>${this.multiSeriesTabTemplate()}</div>
|
|
27
|
+
|
|
28
|
+
<legend><ox-i18n msgid="label.x-axes">X Axes</ox-i18n></legend>
|
|
29
|
+
|
|
30
|
+
<label for="series-data-key"> <ox-i18n msgid="label.data-key">Data Key</ox-i18n> </label>
|
|
31
|
+
<input id="series-data-key" type="text" value-key="labelDataKey" value=${ifDefined(configurer.labelDataKey)} />
|
|
32
|
+
|
|
33
|
+
<label for="x-axes0-axis-title"> <ox-i18n msgid="label.title">Title</ox-i18n> </label>
|
|
34
|
+
<input
|
|
35
|
+
id="x-axes0-axis-title"
|
|
36
|
+
type="text"
|
|
37
|
+
value-key="xAxes0.axisTitle"
|
|
38
|
+
value=${ifDefined(configurer.xAxes0.axisTitle)}
|
|
39
|
+
/>
|
|
40
|
+
|
|
41
|
+
${this._hasBarSeries(configurer.value)
|
|
42
|
+
? html`
|
|
43
|
+
<label for="bar-spacing"><ox-i18n msgid="label.bar-spacing">Bar Spacing</ox-i18n></label>
|
|
44
|
+
<input
|
|
45
|
+
id="bar-spacing"
|
|
46
|
+
type="number"
|
|
47
|
+
min="0"
|
|
48
|
+
max="1"
|
|
49
|
+
step="0.1"
|
|
50
|
+
value-key="xAxes0.barSpacing"
|
|
51
|
+
value=${ifDefined(configurer.xAxes0.barSpacing)}
|
|
52
|
+
/>
|
|
53
|
+
<label for="tick-spacing"><ox-i18n msgid="label.tick-spacing">Tick Spacing</ox-i18n></label>
|
|
54
|
+
<input
|
|
55
|
+
id="tick-spacing"
|
|
56
|
+
type="number"
|
|
57
|
+
min="0"
|
|
58
|
+
max="1"
|
|
59
|
+
step="0.1"
|
|
60
|
+
value-key="xAxes0.categorySpacing"
|
|
61
|
+
value=${ifDefined(configurer.xAxes0.categorySpacing)}
|
|
62
|
+
/>
|
|
63
|
+
`
|
|
64
|
+
: html``}
|
|
65
|
+
|
|
66
|
+
<input
|
|
67
|
+
id="x-grid-line"
|
|
68
|
+
type="checkbox"
|
|
69
|
+
value-key="value.options.xGridLine"
|
|
70
|
+
?checked=${configurer.config.options?.xGridLine}
|
|
71
|
+
/>
|
|
72
|
+
<label for="x-grid-line"> <ox-i18n msgid="label.grid-line">Grid Line</ox-i18n> </label>
|
|
73
|
+
|
|
74
|
+
<input
|
|
75
|
+
id="x-axes0-ticks-display"
|
|
76
|
+
type="checkbox"
|
|
77
|
+
value-key="xAxes0.ticks.display"
|
|
78
|
+
?checked=${configurer.xAxes0.ticks?.display}
|
|
79
|
+
/>
|
|
80
|
+
<label for="x-axes0-ticks-display"> <ox-i18n msgid="label.display-tick">Display Tick</ox-i18n> </label>
|
|
81
|
+
|
|
82
|
+
<legend><ox-i18n msgid="label.y-axes">Y Axes</ox-i18n></legend>
|
|
83
|
+
|
|
84
|
+
<label for="y-axes0-axis-title"> <ox-i18n msgid="label.title">Title</ox-i18n> </label>
|
|
85
|
+
<input
|
|
86
|
+
id="y-axes0-axis-title"
|
|
87
|
+
type="text"
|
|
88
|
+
value-key="yAxes0.axisTitle"
|
|
89
|
+
value=${configurer.yAxes0.axisTitle || ''}
|
|
90
|
+
/>
|
|
91
|
+
|
|
92
|
+
<input
|
|
93
|
+
id="axis-min-auto"
|
|
94
|
+
type="checkbox"
|
|
95
|
+
value-key="yAxes0.ticks.autoMin"
|
|
96
|
+
?checked=${configurer.yAxes0.ticks?.autoMin}
|
|
97
|
+
/>
|
|
98
|
+
<label for="axis-min-auto"> <ox-i18n msgid="label.axis-min-auto">Min Auto</ox-i18n> </label>
|
|
99
|
+
|
|
100
|
+
<input
|
|
101
|
+
id="axis-max-auto"
|
|
102
|
+
type="checkbox"
|
|
103
|
+
value-key="yAxes0.ticks.autoMax"
|
|
104
|
+
?checked=${configurer.yAxes0.ticks?.autoMax}
|
|
105
|
+
/>
|
|
106
|
+
<label for="axis-max-auto"> <ox-i18n msgid="label.axis-max-auto">Max Auto</ox-i18n> </label>
|
|
107
|
+
|
|
108
|
+
${!configurer.yAxes0.ticks?.autoMin
|
|
109
|
+
? html`
|
|
110
|
+
<label for="y-axes0-ticks-min"> <ox-i18n msgid="label.axis-min">Min</ox-i18n> </label>
|
|
111
|
+
<input
|
|
112
|
+
id="y-axes0-ticks-min"
|
|
113
|
+
type="number"
|
|
114
|
+
value-key="yAxes0.ticks.min"
|
|
115
|
+
value=${ifDefined(configurer.yAxes0.ticks?.min)}
|
|
116
|
+
/>
|
|
117
|
+
`
|
|
118
|
+
: html``}
|
|
119
|
+
${!configurer.yAxes0.ticks?.autoMax
|
|
120
|
+
? html`
|
|
121
|
+
<label for="y-axes0-ticks-max"> <ox-i18n msgid="label.axis-max">Max</ox-i18n> </label>
|
|
122
|
+
<input
|
|
123
|
+
id="y-axes0-ticks-max"
|
|
124
|
+
type="number"
|
|
125
|
+
value-key="yAxes0.ticks.max"
|
|
126
|
+
value=${ifDefined(configurer.yAxes0.ticks?.max)}
|
|
127
|
+
/>
|
|
128
|
+
`
|
|
129
|
+
: html``}
|
|
130
|
+
|
|
131
|
+
<label for="y-axes0-ticks-step-size"> <ox-i18n msgid="label.axis-step-size">StepSize</ox-i18n> </label>
|
|
132
|
+
<input
|
|
133
|
+
id="y-axes0-ticks-step-size"
|
|
134
|
+
type="number"
|
|
135
|
+
value-key="yAxes0.ticks.stepSize"
|
|
136
|
+
value=${ifDefined(configurer.yAxes0.ticks?.stepSize)}
|
|
137
|
+
/>
|
|
138
|
+
|
|
139
|
+
<input
|
|
140
|
+
id="y-grid-line"
|
|
141
|
+
type="checkbox"
|
|
142
|
+
value-key="value.options.yGridLine"
|
|
143
|
+
?checked=${configurer.config.options?.yGridLine}
|
|
144
|
+
/>
|
|
145
|
+
<label for="y-grid-line"> <ox-i18n msgid="label.grid-line">Grid Line</ox-i18n> </label>
|
|
146
|
+
|
|
147
|
+
<input
|
|
148
|
+
id="y-axes0-ticks-display"
|
|
149
|
+
type="checkbox"
|
|
150
|
+
value-key="yAxes0.ticks.display"
|
|
151
|
+
?checked=${configurer.yAxes0.ticks?.display}
|
|
152
|
+
/>
|
|
153
|
+
<label for="y-axes0-ticks-display"> <ox-i18n msgid="label.display-tick">Display Tick</ox-i18n> </label>
|
|
154
|
+
|
|
155
|
+
${configurer.config.options?.multiAxis
|
|
156
|
+
? html`
|
|
157
|
+
<legend><ox-i18n msgid="label.y-2nd-axes">Y 2nd Axes</ox-i18n></legend>
|
|
158
|
+
|
|
159
|
+
<label for="y-axes1.axis-title"> <ox-i18n msgid="label.title">Title</ox-i18n> </label>
|
|
160
|
+
<input
|
|
161
|
+
id="y-axes1.axis-title"
|
|
162
|
+
type="text"
|
|
163
|
+
value-key="yAxes1.axisTitle"
|
|
164
|
+
value=${ifDefined(configurer.yAxes1?.axisTitle)}
|
|
165
|
+
/>
|
|
166
|
+
|
|
167
|
+
<input
|
|
168
|
+
id="y-axes1-ticks-auto-min"
|
|
169
|
+
type="checkbox"
|
|
170
|
+
value-key="yAxes1.ticks.autoMin"
|
|
171
|
+
?checked=${configurer.yAxes1?.ticks?.autoMin}
|
|
172
|
+
/>
|
|
173
|
+
<label for="y-axes1-ticks-auto-min"> <ox-i18n msgid="label.axis-min-auto">Min Auto</ox-i18n> </label>
|
|
174
|
+
|
|
175
|
+
<input
|
|
176
|
+
id="y-axes1-ticks-auto-max"
|
|
177
|
+
type="checkbox"
|
|
178
|
+
value-key="yAxes1.ticks.autoMax"
|
|
179
|
+
?checked=${configurer.yAxes1?.ticks?.autoMax}
|
|
180
|
+
/>
|
|
181
|
+
<label for="y-axes1-ticks-auto-max"> <ox-i18n msgid="label.axis-max-auto">Max Auto</ox-i18n> </label>
|
|
182
|
+
|
|
183
|
+
${!configurer.yAxes1?.ticks?.autoMin
|
|
184
|
+
? html`
|
|
185
|
+
<label for="y-axes1-ticks-min"> <ox-i18n msgid="label.axis-min">Min</ox-i18n> </label>
|
|
186
|
+
<input
|
|
187
|
+
id="y-axes1-ticks-min"
|
|
188
|
+
type="number"
|
|
189
|
+
value-key="yAxes1.ticks.min"
|
|
190
|
+
value=${ifDefined(configurer.yAxes1?.ticks?.min)}
|
|
191
|
+
/>
|
|
192
|
+
`
|
|
193
|
+
: html``}
|
|
194
|
+
${!configurer.yAxes1?.ticks?.autoMax
|
|
195
|
+
? html`
|
|
196
|
+
<label for="y-axes1-ticks-max"> <ox-i18n msgid="label.axis-max">Max</ox-i18n> </label>
|
|
197
|
+
<input
|
|
198
|
+
id="y-axes1-ticks-max"
|
|
199
|
+
type="number"
|
|
200
|
+
value-key="yAxes1.ticks.max"
|
|
201
|
+
value=${ifDefined(configurer.yAxes1?.ticks?.max)}
|
|
202
|
+
/>
|
|
203
|
+
`
|
|
204
|
+
: html``}
|
|
205
|
+
|
|
206
|
+
<label for="y-axes1-ticks-step-size"> <ox-i18n msgid="label.axis-step-size">StepSize</ox-i18n> </label>
|
|
207
|
+
<input
|
|
208
|
+
id="y-axes1-ticks-step-size"
|
|
209
|
+
type="number"
|
|
210
|
+
value-key="yAxes1.ticks.stepSize"
|
|
211
|
+
value=${ifDefined(configurer.yAxes1?.ticks?.stepSize)}
|
|
212
|
+
/>
|
|
213
|
+
|
|
214
|
+
<input
|
|
215
|
+
id="y-2nd-grid-line"
|
|
216
|
+
type="checkbox"
|
|
217
|
+
value-key="value.options.y2ndGridLine"
|
|
218
|
+
?checked=${configurer.config.options?.y2ndGridLine}
|
|
219
|
+
/>
|
|
220
|
+
<label for="y-2nd-grid-line"> <ox-i18n msgid="label.grid-line">Grid Line</ox-i18n> </label>
|
|
221
|
+
|
|
222
|
+
<input
|
|
223
|
+
id="y-axes1-ticks-display"
|
|
224
|
+
type="checkbox"
|
|
225
|
+
value-key="yAxes1.ticks.display"
|
|
226
|
+
?checked=${configurer.yAxes1?.ticks?.display}
|
|
227
|
+
/>
|
|
228
|
+
<label for="y-axes1-ticks-display"> <ox-i18n msgid="label.display-tick">Display Tick</ox-i18n> </label>
|
|
229
|
+
`
|
|
230
|
+
: html``}
|
|
231
|
+
`
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
_hasBarSeries(config: any) {
|
|
235
|
+
var hasBarSeries = false
|
|
236
|
+
hasBarSeries = config.data.datasets?.some((s: any) => s.type == 'bar')
|
|
237
|
+
|
|
238
|
+
return hasBarSeries
|
|
239
|
+
}
|
|
240
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import '@operato/i18n/ox-i18n.js'
|
|
2
|
+
import '@operato/input/ox-input-multiple-colors.js'
|
|
3
|
+
|
|
4
|
+
import { html } from 'lit'
|
|
5
|
+
import { customElement } from 'lit/decorators.js'
|
|
6
|
+
import { ifDefined } from 'lit/directives/if-defined.js'
|
|
7
|
+
|
|
8
|
+
import { InputChartAbstract } from './input-chart-abstract'
|
|
9
|
+
|
|
10
|
+
@customElement('ox-input-chart-pie')
|
|
11
|
+
export default class OxInputChartPie extends InputChartAbstract {
|
|
12
|
+
static styles = InputChartAbstract.styles
|
|
13
|
+
|
|
14
|
+
getChartType(): 'bar' | 'line' | 'pie' | 'radar' {
|
|
15
|
+
return 'pie'
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
subTemplate() {
|
|
19
|
+
const configurer = this.configurer
|
|
20
|
+
|
|
21
|
+
return html`
|
|
22
|
+
<legend><ox-i18n msgid="label.series">Series</ox-i18n></legend>
|
|
23
|
+
|
|
24
|
+
<label for="series-data-key"> <ox-i18n msgid="label.data-key">Data Key</ox-i18n> </label>
|
|
25
|
+
<input id="series-data-key" type="text" value-key="dataKey" .value=${configurer.series.dataKey || ''} />
|
|
26
|
+
|
|
27
|
+
<label for="series-colors"> <ox-i18n msgid="label.color">Color</ox-i18n> </label>
|
|
28
|
+
<ox-input-multiple-colors
|
|
29
|
+
id="series-colors"
|
|
30
|
+
value-key="color"
|
|
31
|
+
.value=${configurer.color || []}
|
|
32
|
+
></ox-input-multiple-colors>
|
|
33
|
+
|
|
34
|
+
${this.displayValueTemplate()}
|
|
35
|
+
|
|
36
|
+
<legend><ox-i18n msgid="label.axes">Axes</ox-i18n></legend>
|
|
37
|
+
|
|
38
|
+
<label for="series-data-key"> <ox-i18n msgid="label.data-key">Data Key</ox-i18n> </label>
|
|
39
|
+
<input id="series-data-key" type="text" value-key="labelDataKey" .value=${configurer.labelDataKey || ''} />
|
|
40
|
+
`
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
getDefaultChartConfig(
|
|
44
|
+
type: 'bar' | 'horizontalBar' | 'line' | 'radar' | 'pie' | 'mixed',
|
|
45
|
+
datasets?: OperatoChart.Dataset[]
|
|
46
|
+
): OperatoChart.ChartConfig {
|
|
47
|
+
return {
|
|
48
|
+
type: 'pie',
|
|
49
|
+
data: {
|
|
50
|
+
labels: [],
|
|
51
|
+
datasets: this.getDefaultDatasets(),
|
|
52
|
+
labelDataKey: 'label'
|
|
53
|
+
},
|
|
54
|
+
options: {
|
|
55
|
+
theme: 'dark',
|
|
56
|
+
legend: {
|
|
57
|
+
display: true,
|
|
58
|
+
position: 'top'
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
getDefaultDatasets(): OperatoChart.Dataset[] {
|
|
65
|
+
return [this.getDefaultDataset('pie')]
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
getDefaultDataset(seriesType: 'bar' | 'horizontalBar' | 'line' | 'radar' | 'pie'): OperatoChart.Dataset {
|
|
69
|
+
return {
|
|
70
|
+
backgroundColor: ['#FF6384', '#36A2EB', '#FFCE56'],
|
|
71
|
+
borderWidth: 0,
|
|
72
|
+
dataKey: 'value'
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import '@operato/i18n/ox-i18n.js'
|
|
2
|
+
|
|
3
|
+
import { html } from 'lit'
|
|
4
|
+
import { customElement } from 'lit/decorators.js'
|
|
5
|
+
import { ifDefined } from 'lit/directives/if-defined.js'
|
|
6
|
+
|
|
7
|
+
import { InputChartMultiSeriesAbstract } from './input-chart-multi-series-abstract'
|
|
8
|
+
|
|
9
|
+
@customElement('ox-input-chart-radar')
|
|
10
|
+
export default class OxInputChartRadar extends InputChartMultiSeriesAbstract {
|
|
11
|
+
static styles = InputChartMultiSeriesAbstract.styles
|
|
12
|
+
|
|
13
|
+
getChartType(): 'bar' | 'line' | 'pie' | 'radar' {
|
|
14
|
+
return 'radar'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
subTemplate() {
|
|
18
|
+
const configurer = this.configurer
|
|
19
|
+
|
|
20
|
+
return html`
|
|
21
|
+
<legend><ox-i18n msgid="label.series">Series</ox-i18n></legend>
|
|
22
|
+
|
|
23
|
+
<div fullwidth>${this.multiSeriesTabTemplate()}</div>
|
|
24
|
+
|
|
25
|
+
<legend><ox-i18n msgid="label.axes">Axes</ox-i18n></legend>
|
|
26
|
+
|
|
27
|
+
<label for="series-data-key"> <ox-i18n msgid="label.data-key">Data Key</ox-i18n> </label>
|
|
28
|
+
<input id="series-data-key" type="text" value-key="labelDataKey" value=${ifDefined(configurer.labelDataKey)} />
|
|
29
|
+
`
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getDefaultDatasets(): OperatoChart.Dataset[] {
|
|
33
|
+
return [
|
|
34
|
+
{
|
|
35
|
+
label: 'Radar Series 1',
|
|
36
|
+
data: [10, 20, 30],
|
|
37
|
+
backgroundColor: 'rgba(255, 99, 132, 0.2)',
|
|
38
|
+
borderColor: 'rgba(255, 99, 132, 1)',
|
|
39
|
+
borderWidth: 1,
|
|
40
|
+
pointStyle: 'circle',
|
|
41
|
+
pointRadius: 3
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: 'Radar Series 2',
|
|
45
|
+
data: [15, 25, 35],
|
|
46
|
+
backgroundColor: 'rgba(54, 162, 235, 0.2)',
|
|
47
|
+
borderColor: 'rgba(54, 162, 235, 1)',
|
|
48
|
+
borderWidth: 1,
|
|
49
|
+
pointStyle: 'circle',
|
|
50
|
+
pointRadius: 3
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
|
|
8
|
+
import { css, html } from 'lit'
|
|
9
|
+
import { customElement } from 'lit/decorators.js'
|
|
10
|
+
|
|
11
|
+
import { OxPropertyEditor, PropertySpec } from '@operato/property-editor'
|
|
12
|
+
|
|
13
|
+
@customElement('ox-property-editor-chart')
|
|
14
|
+
export class ChartEditor extends OxPropertyEditor {
|
|
15
|
+
static styles = [
|
|
16
|
+
css`
|
|
17
|
+
:host {
|
|
18
|
+
display: block;
|
|
19
|
+
padding: 5px;
|
|
20
|
+
|
|
21
|
+
--md-elevated-button-container-height: 20px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#chart-type {
|
|
25
|
+
display: grid;
|
|
26
|
+
grid-template-columns: repeat(10, 1fr);
|
|
27
|
+
grid-gap: 5px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
#chart-type > label {
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
grid-column: span 3;
|
|
33
|
+
|
|
34
|
+
text-align: right;
|
|
35
|
+
|
|
36
|
+
color: var(--md-sys-color-on-secondary-container);
|
|
37
|
+
font-size: 0.8em;
|
|
38
|
+
line-height: 2;
|
|
39
|
+
text-transform: capitalize;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#chart-type > input {
|
|
43
|
+
box-sizing: border-box;
|
|
44
|
+
grid-column: span 7;
|
|
45
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
|
46
|
+
}
|
|
47
|
+
`
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
editorTemplate(value: any, spec: PropertySpec) {
|
|
51
|
+
return html`
|
|
52
|
+
${value
|
|
53
|
+
? html`
|
|
54
|
+
<div id="chart-type">
|
|
55
|
+
<label> <ox-i18n msgid="label.chart-type">Chart Type</ox-i18n> </label>
|
|
56
|
+
<input type="text" .value=${value.type} readonly />
|
|
57
|
+
</div>
|
|
58
|
+
`
|
|
59
|
+
: html``}
|
|
60
|
+
${!value
|
|
61
|
+
? html``
|
|
62
|
+
: value.type == 'line'
|
|
63
|
+
? html` <ox-input-chart-mixed .value=${value} fullwidth></ox-input-chart-mixed> `
|
|
64
|
+
: value.type == 'horizontalBar'
|
|
65
|
+
? html` <ox-input-chart-hbar .value=${value} fullwidth></ox-input-chart-hbar> `
|
|
66
|
+
: value.type == 'bar'
|
|
67
|
+
? html` <ox-input-chart-mixed .value=${value} fullwidth></ox-input-chart-mixed> `
|
|
68
|
+
: value.type == 'pie'
|
|
69
|
+
? html` <ox-input-chart-pie .value=${value} fullwidth></ox-input-chart-pie> `
|
|
70
|
+
: value.type == 'doughnut'
|
|
71
|
+
? html` <ox-input-chart-pie .value=${value} fullwidth></ox-input-chart-pie> `
|
|
72
|
+
: value.type == 'polarArea'
|
|
73
|
+
? html` <ox-input-chart-pie .value=${value} fullwidth></ox-input-chart-pie> `
|
|
74
|
+
: value.type == 'radar'
|
|
75
|
+
? html` <ox-input-chart-radar .value=${value} fullwidth></ox-input-chart-radar> `
|
|
76
|
+
: html``}
|
|
77
|
+
`
|
|
78
|
+
}
|
|
79
|
+
}
|
package/src/globat.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare const SciChart: any
|
package/src/index.ts
ADDED
|
File without changes
|