@operato/scene-chartjs 2.0.0-alpha.9 → 2.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/dist/editors/property-editor-chartjs-abstract.d.ts +3 -3
- package/dist/editors/property-editor-chartjs-abstract.js +0 -8
- package/dist/editors/property-editor-chartjs-abstract.js.map +1 -1
- package/dist/editors/property-editor-chartjs-hbar.d.ts +5 -5
- package/dist/editors/property-editor-chartjs-hbar.js +42 -46
- package/dist/editors/property-editor-chartjs-hbar.js.map +1 -1
- package/dist/editors/property-editor-chartjs-mixed.d.ts +1 -1
- package/dist/editors/property-editor-chartjs-multi-series-abstract.d.ts +6 -8
- package/dist/editors/property-editor-chartjs-multi-series-abstract.js +92 -100
- package/dist/editors/property-editor-chartjs-multi-series-abstract.js.map +1 -1
- package/dist/editors/property-editor-chartjs-pie.d.ts +1 -1
- package/dist/editors/property-editor-chartjs-radar.d.ts +1 -1
- package/dist/editors/property-editor-chartjs-styles.js +35 -29
- package/dist/editors/property-editor-chartjs-styles.js.map +1 -1
- package/dist/editors/property-editor-chartjs.d.ts +1 -1
- package/dist/editors/property-editor-chartjs.js +3 -1
- package/dist/editors/property-editor-chartjs.js.map +1 -1
- package/dist/ox-chart.d.ts +1 -1
- package/dist/plugins/chart-series-highlight.d.ts +1 -0
- package/dist/plugins/chart-series-highlight.js +3 -1
- package/dist/plugins/chart-series-highlight.js.map +1 -1
- package/package.json +7 -8
- package/schema.graphql +61 -42
- package/src/editors/property-editor-chartjs-abstract.ts +0 -12
- package/src/editors/property-editor-chartjs-hbar.ts +42 -48
- package/src/editors/property-editor-chartjs-multi-series-abstract.ts +113 -123
- package/src/editors/property-editor-chartjs-styles.ts +35 -29
- package/src/editors/property-editor-chartjs.ts +3 -1
- package/src/plugins/chart-series-highlight.ts +3 -2
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
@@ -1,14 +1,11 @@
|
|
1
|
-
import '@material/
|
2
|
-
import '@polymer/iron-pages/iron-pages'
|
3
|
-
import '@polymer/paper-tabs/paper-tabs'
|
4
|
-
|
1
|
+
import '@material/web/icon/icon.js'
|
5
2
|
import '@operato/i18n/ox-i18n.js'
|
6
3
|
|
7
4
|
import { css, html } from 'lit'
|
8
5
|
import { query } from 'lit/decorators.js'
|
9
6
|
|
10
7
|
import { Properties } from '@hatiolab/things-scene'
|
11
|
-
import {
|
8
|
+
import { MdIcon } from '@material/web/icon/icon.js'
|
12
9
|
|
13
10
|
import PropertyEditorChartJSAbstract from './property-editor-chartjs-abstract'
|
14
11
|
|
@@ -16,7 +13,7 @@ export default class PropertyEditorChartJSMultiSeriesAbstract extends PropertyEd
|
|
16
13
|
static styles = [
|
17
14
|
...PropertyEditorChartJSAbstract.styles,
|
18
15
|
css`
|
19
|
-
|
16
|
+
md-tabs {
|
20
17
|
background-color: rgb(204, 204, 204);
|
21
18
|
}
|
22
19
|
input[type='text'],
|
@@ -52,8 +49,8 @@ export default class PropertyEditorChartJSMultiSeriesAbstract extends PropertyEd
|
|
52
49
|
}
|
53
50
|
|
54
51
|
@query('#tabs') tabs!: HTMLElement
|
55
|
-
@query('#tab-nav-left-button') tabNavLeftButton!:
|
56
|
-
@query('#tab-nav-right-button') tabNavRightButton!:
|
52
|
+
@query('#tab-nav-left-button') tabNavLeftButton!: MdIcon
|
53
|
+
@query('#tab-nav-right-button') tabNavRightButton!: MdIcon
|
57
54
|
|
58
55
|
get color() {
|
59
56
|
var oldVersionColor = this.series.backgroundColor
|
@@ -101,7 +98,7 @@ export default class PropertyEditorChartJSMultiSeriesAbstract extends PropertyEd
|
|
101
98
|
}
|
102
99
|
|
103
100
|
get tabContainer(): HTMLElement | null | undefined {
|
104
|
-
return this.tabs
|
101
|
+
return this.tabs
|
105
102
|
}
|
106
103
|
|
107
104
|
firstUpdated() {
|
@@ -214,134 +211,127 @@ export default class PropertyEditorChartJSMultiSeriesAbstract extends PropertyEd
|
|
214
211
|
return html`
|
215
212
|
<div id="series-properties-container" fullwidth>
|
216
213
|
<div id="tab-header">
|
217
|
-
<
|
214
|
+
<md-icon
|
218
215
|
id="tab-nav-left-button"
|
219
|
-
|
220
|
-
@click=${(e: Event) => {
|
216
|
+
@tap=${(e: Event) => {
|
221
217
|
this._onTabScrollNavLeft(e)
|
222
218
|
}}
|
223
219
|
disabled
|
224
|
-
|
225
|
-
|
220
|
+
>chevron_left</md-icon
|
221
|
+
>
|
222
|
+
<div
|
226
223
|
id="tabs"
|
227
|
-
@
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
scrollable
|
232
|
-
hide-scroll-buttons
|
224
|
+
@change=${(e: Event) => {
|
225
|
+
this.currentSeriesIndex = (e.target as any).activeTabIndex
|
226
|
+
}}
|
227
|
+
active-tab-index=${this.currentSeriesIndex}
|
233
228
|
fit-container
|
234
229
|
>
|
235
230
|
${this.datasets.map(
|
236
231
|
(dataset: any, index: number) => html`
|
237
|
-
<
|
238
|
-
|
232
|
+
<div
|
233
|
+
data-series=${index + 1}
|
234
|
+
data-tab-index=${index}
|
235
|
+
tab
|
236
|
+
?selected=${index == this.currentSeriesIndex}
|
237
|
+
@click=${(e: Event) => {
|
238
|
+
const target = e.target as HTMLDivElement
|
239
|
+
this.currentSeriesIndex = Number(target.getAttribute('data-tab-index'))
|
240
|
+
}}
|
241
|
+
>
|
242
|
+
${index + 1}
|
239
243
|
${!this.datasets || (this.datasets.length != 1 && this.currentSeriesIndex == index)
|
240
|
-
? html`
|
241
|
-
<mwc-icon-button icon="close" @tap=${(e: Event) => this.onTapRemoveCurrentTab(e)}>
|
242
|
-
</mwc-icon-button>
|
243
|
-
`
|
244
|
+
? html` <md-icon @tap="${(e: Event) => this.onTapRemoveCurrentTab(e)}"> close </md-icon> `
|
244
245
|
: html``}
|
245
|
-
</
|
246
|
+
</div>
|
246
247
|
`
|
247
248
|
)}
|
248
|
-
</
|
249
|
-
<
|
249
|
+
</div>
|
250
|
+
<md-icon
|
250
251
|
id="tab-nav-right-button"
|
251
|
-
icon="chevron_right"
|
252
252
|
@click=${(e: Event) => {
|
253
253
|
this._onTabScrollNavRight(e)
|
254
254
|
}}
|
255
255
|
disabled
|
256
|
-
|
256
|
+
>chevron_right</md-icon
|
257
|
+
>
|
257
258
|
</div>
|
258
259
|
<div id="add-series-button-container">
|
259
|
-
<
|
260
|
-
id="add-series-button"
|
261
|
-
icon="add"
|
262
|
-
@tap=${(e: Event) => this.onTapAddTab(e)}
|
263
|
-
></mwc-icon-button>
|
260
|
+
<md-icon id="add-series-button" @tap=${(e: Event) => this.onTapAddTab(e)}>add</md-icon>
|
264
261
|
</div>
|
265
262
|
|
266
|
-
<
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
<
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
`
|
339
|
-
: html``}
|
340
|
-
${this.displayValueTemplate()}
|
341
|
-
</div>
|
342
|
-
`
|
343
|
-
)}
|
344
|
-
</iron-pages>
|
263
|
+
<div class="tab-content">
|
264
|
+
<label> <ox-i18n msgid="label.data-key">Data Key</ox-i18n> </label>
|
265
|
+
<input type="text" value-key="dataKey" .value=${this.dataKey} />
|
266
|
+
|
267
|
+
${this.value.type == 'bar'
|
268
|
+
? html`
|
269
|
+
<label> <ox-i18n msgid="label.type">type</ox-i18n> </label>
|
270
|
+
<select class="select-content" value-key="series.type" .value=${this.series.type}>
|
271
|
+
<option value="bar" selected>bar</option>
|
272
|
+
<option value="line">line</option>
|
273
|
+
</select>
|
274
|
+
`
|
275
|
+
: html``}
|
276
|
+
|
277
|
+
<label> <ox-i18n msgid="label.label">label</ox-i18n> </label>
|
278
|
+
<input type="text" value-key="series.label" .value=${this.series.label} />
|
279
|
+
|
280
|
+
${this.series.type == 'line'
|
281
|
+
? html`
|
282
|
+
<label> <ox-i18n msgid="label.line-tension">line tension</ox-i18n> </label>
|
283
|
+
<select class="select-content" value-key="series.lineTension" .value=${this.series.lineTension}>
|
284
|
+
<option value="0.4">smooth</option>
|
285
|
+
<option value="0">angled</option>
|
286
|
+
</select>
|
287
|
+
`
|
288
|
+
: html``}
|
289
|
+
${this.series.type == 'line'
|
290
|
+
? html`
|
291
|
+
<label> <ox-i18n msgid="label.border-width">border width</ox-i18n> </label>
|
292
|
+
<input type="number" value-key="series.borderWidth" .value=${this.series.borderWidth} />
|
293
|
+
`
|
294
|
+
: html``}
|
295
|
+
|
296
|
+
<label> <ox-i18n msgid="label.color">color</ox-i18n> </label>
|
297
|
+
<ox-input-color value-key="color" .value=${this.color}></ox-input-color>
|
298
|
+
|
299
|
+
${this.series.type == 'line'
|
300
|
+
? html`
|
301
|
+
<label> <ox-i18n msgid="label.point-shape">point shape</ox-i18n> </label>
|
302
|
+
<select class="select-content" value-key="series.pointStyle" .value=${this.series.pointStyle}>
|
303
|
+
<option value="circle">⚬</option>
|
304
|
+
<option value="triangle">▵</option>
|
305
|
+
<option value="rect">□</option>
|
306
|
+
<option value="rectRot">◇</option>
|
307
|
+
<option value="cross">+</option>
|
308
|
+
<option value="crossRot">⨉</option>
|
309
|
+
<option value="star">✱</option>
|
310
|
+
<option value="line">―</option>
|
311
|
+
<option value="dash">┄</option>
|
312
|
+
</select>
|
313
|
+
|
314
|
+
<label> <ox-i18n msgid="label.point-size">point size</ox-i18n> </label>
|
315
|
+
<input type="number" value-key="series.pointRadius" .value=${this.series.pointRadius} />
|
316
|
+
`
|
317
|
+
: html``} <label> <ox-i18n msgid="label.stack-group">Stack group</ox-i18n> </label>
|
318
|
+
<input type="text" value-key="series.stack" .value=${this.series.stack || ''} /> ${this.series.type == 'line'
|
319
|
+
? html`
|
320
|
+
<input type="checkbox" value-key="series.fill" .checked=${this.series.fill} />
|
321
|
+
<label> <ox-i18n msgid="label.fill">fill</ox-i18n> </label>
|
322
|
+
`
|
323
|
+
: html``}
|
324
|
+
${this.multiAxis
|
325
|
+
? html`
|
326
|
+
<label> <ox-i18n msgid="label.target-axis">target axis</ox-i18n> </label>
|
327
|
+
<select class="select-content" value-key="series.yAxisID" .value=${this.series.yAxisID}>
|
328
|
+
<option value="left">left</option>
|
329
|
+
<option value="right">right</option>
|
330
|
+
</select>
|
331
|
+
`
|
332
|
+
: html``}
|
333
|
+
${this.displayValueTemplate()}
|
334
|
+
</div>
|
345
335
|
</div>
|
346
336
|
`
|
347
337
|
}
|
@@ -352,21 +342,21 @@ export default class PropertyEditorChartJSMultiSeriesAbstract extends PropertyEd
|
|
352
342
|
}
|
353
343
|
|
354
344
|
if (this.tabContainer.clientWidth == this.tabContainer.scrollWidth) {
|
355
|
-
this.tabNavLeftButton.disabled
|
356
|
-
this.tabNavRightButton.disabled
|
345
|
+
this.tabNavLeftButton.setAttribute('disabled', '')
|
346
|
+
this.tabNavRightButton.setAttribute('disabled', '')
|
357
347
|
}
|
358
348
|
// left-end
|
359
349
|
else if (this.tabContainer.scrollLeft == 0) {
|
360
|
-
this.tabNavLeftButton.disabled
|
361
|
-
this.tabNavRightButton.disabled
|
350
|
+
this.tabNavLeftButton.setAttribute('disabled', '')
|
351
|
+
this.tabNavRightButton.removeAttribute('disabled')
|
362
352
|
}
|
363
353
|
// right-end
|
364
354
|
else if (this.tabContainer.scrollLeft + this.tabContainer.clientWidth >= this.tabContainer.scrollWidth) {
|
365
|
-
this.tabNavLeftButton.disabled
|
366
|
-
this.tabNavRightButton.disabled
|
355
|
+
this.tabNavLeftButton.removeAttribute('disabled')
|
356
|
+
this.tabNavRightButton.setAttribute('disabled', '')
|
367
357
|
} else {
|
368
|
-
this.tabNavLeftButton.disabled
|
369
|
-
this.tabNavRightButton.disabled
|
358
|
+
this.tabNavLeftButton.removeAttribute('disabled')
|
359
|
+
this.tabNavRightButton.removeAttribute('disabled')
|
370
360
|
}
|
371
361
|
}
|
372
362
|
|
@@ -5,9 +5,6 @@ export const PropertyEditorChartJSStyles = css`
|
|
5
5
|
display: grid;
|
6
6
|
grid-template-columns: repeat(10, 1fr);
|
7
7
|
grid-gap: 5px;
|
8
|
-
|
9
|
-
--mdc-icon-button-size: 24px;
|
10
|
-
--mdc-icon-size: 24px;
|
11
8
|
}
|
12
9
|
|
13
10
|
:host > * {
|
@@ -23,7 +20,7 @@ export const PropertyEditorChartJSStyles = css`
|
|
23
20
|
:host > legend {
|
24
21
|
box-sizing: border-box;
|
25
22
|
grid-column: 1 / -1;
|
26
|
-
color: var(--
|
23
|
+
color: var(--md-sys-color-on-secondary-container, #e46c2e);
|
27
24
|
font: var(--property-sidebar-fieldset-legend, bold 13px var(--theme-font));
|
28
25
|
text-transform: capitalize;
|
29
26
|
}
|
@@ -35,7 +32,7 @@ export const PropertyEditorChartJSStyles = css`
|
|
35
32
|
justify-content: center;
|
36
33
|
}
|
37
34
|
|
38
|
-
#series-properties-container >
|
35
|
+
#series-properties-container > [tab-content] {
|
39
36
|
grid-column: span 2;
|
40
37
|
}
|
41
38
|
|
@@ -46,23 +43,32 @@ export const PropertyEditorChartJSStyles = css`
|
|
46
43
|
overflow: hidden;
|
47
44
|
border: 1px solid rgba(0, 0, 0, 0.2);
|
48
45
|
border-bottom: 0;
|
49
|
-
background-color:
|
46
|
+
background-color: var(--md-sys-color-surface-variant);
|
47
|
+
color: var(--md-sys-color-on-surface);
|
50
48
|
box-sizing: border-box;
|
51
49
|
padding-top: 3px;
|
52
50
|
align-items: center;
|
53
51
|
}
|
54
52
|
|
55
|
-
#tab-header >
|
53
|
+
#tab-header > div {
|
56
54
|
height: 25px;
|
57
55
|
}
|
58
56
|
|
59
|
-
#tab-header
|
57
|
+
#tab-header md-icon[disabled] {
|
58
|
+
opacity: 0.1;
|
59
|
+
}
|
60
|
+
|
61
|
+
#tabs {
|
60
62
|
display: flex;
|
63
|
+
overflow: hidden;
|
64
|
+
}
|
65
|
+
|
66
|
+
#tab-header #tabs [tab] md-icon {
|
61
67
|
margin-left: 5px;
|
62
68
|
padding: 2px;
|
63
|
-
color:
|
69
|
+
color: var(--md-sys-color-on-surface);
|
64
70
|
|
65
|
-
--
|
71
|
+
--md-icon-size: 12px;
|
66
72
|
}
|
67
73
|
|
68
74
|
#add-series-button-container {
|
@@ -79,10 +85,12 @@ export const PropertyEditorChartJSStyles = css`
|
|
79
85
|
width: 20px;
|
80
86
|
height: 20px;
|
81
87
|
padding: 0;
|
82
|
-
color: var(--
|
88
|
+
color: var(--md-sys-color-on-secondary-container);
|
83
89
|
}
|
84
90
|
|
85
91
|
.tab-content {
|
92
|
+
grid-column: 1 / -1;
|
93
|
+
|
86
94
|
background-color: rgba(255, 255, 255, 0.5);
|
87
95
|
border: 1px solid rgba(0, 0, 0, 0.2);
|
88
96
|
border-width: 0 1px 1px 1px;
|
@@ -101,12 +109,18 @@ export const PropertyEditorChartJSStyles = css`
|
|
101
109
|
.tab-content > label {
|
102
110
|
grid-column: span 3;
|
103
111
|
text-align: right;
|
104
|
-
color: var(--
|
112
|
+
color: var(--md-sys-color-on-secondary-container);
|
105
113
|
font-size: 0.8em;
|
106
114
|
line-height: 2;
|
107
115
|
text-transform: capitalize;
|
108
116
|
}
|
109
117
|
|
118
|
+
input,
|
119
|
+
select {
|
120
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
121
|
+
border-radius: var(--spacing-small);
|
122
|
+
}
|
123
|
+
|
110
124
|
input[type='checkbox'],
|
111
125
|
.tab-content > input[type='checkbox'] {
|
112
126
|
grid-column: span 4;
|
@@ -127,35 +141,27 @@ export const PropertyEditorChartJSStyles = css`
|
|
127
141
|
border: 0;
|
128
142
|
}
|
129
143
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
input[type='text'] {
|
134
|
-
border: 1px solid rgba(0, 0, 0, 0.2);
|
135
|
-
}
|
136
|
-
|
137
|
-
paper-tab {
|
144
|
+
div[tab] {
|
145
|
+
display: flex;
|
146
|
+
align-items: center;
|
138
147
|
background-color: rgba(0, 0, 0, 0.2);
|
139
|
-
background-color: #ccc;
|
140
148
|
border-width: 1px 1px 0 1px;
|
141
149
|
padding: 0 5px;
|
142
|
-
color:
|
143
|
-
font-size: 13px;
|
150
|
+
color: var(--md-sys-color-on-surface);
|
144
151
|
box-sizing: border-box;
|
145
152
|
min-width: 45px;
|
146
153
|
}
|
147
154
|
|
148
|
-
|
155
|
+
div[tab][disabled] {
|
149
156
|
background-color: rgba(0, 0, 0, 0.1);
|
150
157
|
}
|
151
158
|
|
152
|
-
|
159
|
+
div[tab]:last-child {
|
153
160
|
border-width: 0;
|
154
161
|
}
|
155
162
|
|
156
|
-
|
157
|
-
background-color:
|
158
|
-
|
159
|
-
color: #585858;
|
163
|
+
div[tab][selected] {
|
164
|
+
background-color: var(--md-sys-color-surface);
|
165
|
+
color: var(--md-sys-color-on-surface);
|
160
166
|
}
|
161
167
|
`
|
@@ -17,6 +17,8 @@ export default class ChartJSEditor extends OxPropertyEditor {
|
|
17
17
|
:host {
|
18
18
|
display: block;
|
19
19
|
padding: 5px;
|
20
|
+
|
21
|
+
--md-elevated-button-container-height: 20px;
|
20
22
|
}
|
21
23
|
|
22
24
|
#chart-type {
|
@@ -31,7 +33,7 @@ export default class ChartJSEditor extends OxPropertyEditor {
|
|
31
33
|
|
32
34
|
text-align: right;
|
33
35
|
|
34
|
-
color: var(--
|
36
|
+
color: var(--md-sys-color-on-secondary-container);
|
35
37
|
font-size: 0.8em;
|
36
38
|
line-height: 2;
|
37
39
|
text-transform: capitalize;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import 'ses'
|
2
2
|
|
3
3
|
function seriesHighlight(chartInstance: SceneChart, seriesData: SceneChart.DataSeries) {
|
4
4
|
chartInstance.data.datasets?.forEach(dataset => {
|
@@ -9,10 +9,11 @@ function seriesHighlight(chartInstance: SceneChart, seriesData: SceneChart.DataS
|
|
9
9
|
|
10
10
|
let highlightColor = highlight.color
|
11
11
|
let highlightCondition = highlight.condition
|
12
|
+
const c = new Compartment()
|
12
13
|
|
13
14
|
seriesData.forEach((sdata, sIndex) => {
|
14
15
|
sdata.forEach((data: SceneChart.Data, i: number) => {
|
15
|
-
if (!
|
16
|
+
if (!c.evaluate(highlightCondition)) {
|
16
17
|
return
|
17
18
|
}
|
18
19
|
|