@operato/scene-chartjs 0.0.5
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 +17 -0
- package/LICENSE +21 -0
- package/README.md +21 -0
- package/assets/bar-chart.png +0 -0
- package/assets/doughnut-chart.png +0 -0
- package/assets/horizontal-bar-chart.png +0 -0
- package/assets/line-chart.png +0 -0
- package/assets/mixed-chart.png +0 -0
- package/assets/pie-chart.png +0 -0
- package/assets/polar-area-chart.png +0 -0
- package/assets/radar-chart.png +0 -0
- package/demo/bar.html +266 -0
- package/demo/chartjs.html +73 -0
- package/demo/index.html +547 -0
- package/demo/legend.html +267 -0
- package/demo/things-scene-chartjs.html +7 -0
- package/dist/chartjs.d.ts +27 -0
- package/dist/chartjs.js +109 -0
- package/dist/chartjs.js.map +1 -0
- package/dist/config-converter.d.ts +1 -0
- package/dist/config-converter.js +343 -0
- package/dist/config-converter.js.map +1 -0
- package/dist/editors/index.d.ts +5 -0
- package/dist/editors/index.js +11 -0
- package/dist/editors/index.js.map +1 -0
- package/dist/editors/property-editor-chartjs-abstract.d.ts +44 -0
- package/dist/editors/property-editor-chartjs-abstract.js +250 -0
- package/dist/editors/property-editor-chartjs-abstract.js.map +1 -0
- package/dist/editors/property-editor-chartjs-hbar.d.ts +9 -0
- package/dist/editors/property-editor-chartjs-hbar.js +160 -0
- package/dist/editors/property-editor-chartjs-hbar.js.map +1 -0
- package/dist/editors/property-editor-chartjs-mixed.d.ts +20 -0
- package/dist/editors/property-editor-chartjs-mixed.js +193 -0
- package/dist/editors/property-editor-chartjs-mixed.js.map +1 -0
- package/dist/editors/property-editor-chartjs-multi-series-abstract.d.ts +31 -0
- package/dist/editors/property-editor-chartjs-multi-series-abstract.js +373 -0
- package/dist/editors/property-editor-chartjs-multi-series-abstract.js.map +1 -0
- package/dist/editors/property-editor-chartjs-pie.d.ts +14 -0
- package/dist/editors/property-editor-chartjs-pie.js +70 -0
- package/dist/editors/property-editor-chartjs-pie.js.map +1 -0
- package/dist/editors/property-editor-chartjs-radar.d.ts +10 -0
- package/dist/editors/property-editor-chartjs-radar.js +42 -0
- package/dist/editors/property-editor-chartjs-radar.js.map +1 -0
- package/dist/editors/property-editor-chartjs-styles.d.ts +1 -0
- package/dist/editors/property-editor-chartjs-styles.js +165 -0
- package/dist/editors/property-editor-chartjs-styles.js.map +1 -0
- package/dist/editors/property-editor-chartjs.d.ts +14 -0
- package/dist/editors/property-editor-chartjs.js +83 -0
- package/dist/editors/property-editor-chartjs.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/ox-chart.d.ts +20 -0
- package/dist/ox-chart.js +137 -0
- package/dist/ox-chart.js.map +1 -0
- package/dist/plugins/chart-series-highlight.d.ts +5 -0
- package/dist/plugins/chart-series-highlight.js +37 -0
- package/dist/plugins/chart-series-highlight.js.map +1 -0
- package/dist/plugins/chartjs-plugin-data-binder.d.ts +5 -0
- package/dist/plugins/chartjs-plugin-data-binder.js +111 -0
- package/dist/plugins/chartjs-plugin-data-binder.js.map +1 -0
- package/helps/scene/component/chartjs.ko.md +332 -0
- package/helps/scene/component/chartjs.md +333 -0
- package/helps/scene/component/chartjs.zh.md +331 -0
- package/helps/scene/images/chart-bar-01.png +0 -0
- package/helps/scene/images/chart-bar-02.png +0 -0
- package/helps/scene/images/chart-bar-03.png +0 -0
- package/helps/scene/images/chart-bar-08.png +0 -0
- package/helps/scene/images/chart-bar-12.png +0 -0
- package/helps/scene/images/chart-data-01.png +0 -0
- package/helps/scene/images/chart-data-04.png +0 -0
- package/helps/scene/images/chart-doughnut-01.png +0 -0
- package/helps/scene/images/chart-horizontal-bar-01.png +0 -0
- package/helps/scene/images/chart-line-01.png +0 -0
- package/helps/scene/images/chart-mix-01.png +0 -0
- package/helps/scene/images/chart-mix-02.png +0 -0
- package/helps/scene/images/chart-pie-01.png +0 -0
- package/helps/scene/images/chart-polar-01.png +0 -0
- package/helps/scene/images/chart-radar-01.png +0 -0
- package/package.json +78 -0
- package/src/chartjs.ts +134 -0
- package/src/config-converter.ts +401 -0
- package/src/editors/index.ts +11 -0
- package/src/editors/property-editor-chartjs-abstract.ts +301 -0
- package/src/editors/property-editor-chartjs-hbar.ts +163 -0
- package/src/editors/property-editor-chartjs-mixed.ts +204 -0
- package/src/editors/property-editor-chartjs-multi-series-abstract.ts +393 -0
- package/src/editors/property-editor-chartjs-pie.ts +79 -0
- package/src/editors/property-editor-chartjs-radar.ts +43 -0
- package/src/editors/property-editor-chartjs-styles.ts +165 -0
- package/src/editors/property-editor-chartjs.ts +88 -0
- package/src/index.ts +7 -0
- package/src/ox-chart.ts +150 -0
- package/src/plugins/chart-series-highlight.ts +43 -0
- package/src/plugins/chartjs-plugin-data-binder.ts +138 -0
- package/src/scene-chart.d.ts +152 -0
- package/templates/bar-chart.js +124 -0
- package/templates/doughnut-chart.js +58 -0
- package/templates/horizontal-bar-chart.js +121 -0
- package/templates/index.js +22 -0
- package/templates/line-chart.js +155 -0
- package/templates/mixed-chart.js +152 -0
- package/templates/pie-chart.js +58 -0
- package/templates/polar-area-chart.js +92 -0
- package/templates/radar-chart.js +98 -0
- package/test/basic-test.html +61 -0
- package/test/index.html +20 -0
- package/things-scene.config.js +7 -0
- package/translations/en.json +5 -0
- package/translations/ko.json +5 -0
- package/translations/ms.json +5 -0
- package/translations/zh.json +5 -0
- package/tsconfig.json +22 -0
- package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,393 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
3
|
+
*/
|
4
|
+
|
5
|
+
import '@polymer/iron-icon/iron-icon'
|
6
|
+
import '@polymer/iron-pages/iron-pages'
|
7
|
+
import '@polymer/paper-button/paper-button'
|
8
|
+
import '@polymer/paper-icon-button/paper-icon-button'
|
9
|
+
import '@polymer/paper-tabs/paper-tabs'
|
10
|
+
|
11
|
+
import { css, html } from 'lit'
|
12
|
+
import { query } from 'lit/decorators.js'
|
13
|
+
|
14
|
+
import { PaperIconButtonElement } from '@polymer/paper-icon-button/paper-icon-button'
|
15
|
+
|
16
|
+
import PropertyEditorChartJSAbstract from './property-editor-chartjs-abstract'
|
17
|
+
|
18
|
+
export default class PropertyEditorChartJSMultiSeriesAbstract extends PropertyEditorChartJSAbstract {
|
19
|
+
static styles = [
|
20
|
+
...PropertyEditorChartJSAbstract.styles,
|
21
|
+
css`
|
22
|
+
paper-tabs {
|
23
|
+
background-color: rgb(204, 204, 204);
|
24
|
+
}
|
25
|
+
input[type='text'],
|
26
|
+
input[type='number'] {
|
27
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
28
|
+
}
|
29
|
+
`
|
30
|
+
]
|
31
|
+
|
32
|
+
constructor() {
|
33
|
+
super()
|
34
|
+
|
35
|
+
this.value = {
|
36
|
+
options: {
|
37
|
+
legend: {},
|
38
|
+
scales: {
|
39
|
+
xAxes: [
|
40
|
+
{
|
41
|
+
ticks: {}
|
42
|
+
}
|
43
|
+
],
|
44
|
+
yAxes: [
|
45
|
+
{
|
46
|
+
ticks: {}
|
47
|
+
}
|
48
|
+
]
|
49
|
+
}
|
50
|
+
},
|
51
|
+
data: {
|
52
|
+
datasets: []
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
@query('#tabs') tabs!: HTMLElement
|
58
|
+
@query('#tab-nav-left-button') tabNavLeftButton!: PaperIconButtonElement
|
59
|
+
@query('#tab-nav-right-button') tabNavRightButton!: PaperIconButtonElement
|
60
|
+
|
61
|
+
get color() {
|
62
|
+
var oldVersionColor = this.series.backgroundColor
|
63
|
+
if (this.series.type == 'line') oldVersionColor = this.series.borderColor
|
64
|
+
if (this.series.type == 'radar') oldVersionColor = this.series.borderColor
|
65
|
+
return this.series.color || oldVersionColor
|
66
|
+
}
|
67
|
+
|
68
|
+
set color(color) {
|
69
|
+
this.series.color = color
|
70
|
+
delete this.series.backgroundColor
|
71
|
+
delete this.series.borderColor
|
72
|
+
}
|
73
|
+
|
74
|
+
get xAxes0() {
|
75
|
+
return this.scales.xAxes[0]
|
76
|
+
}
|
77
|
+
|
78
|
+
set xAxes0(xAxes0) {
|
79
|
+
this.scales.xAxes[0] = xAxes0
|
80
|
+
}
|
81
|
+
|
82
|
+
get yAxes0() {
|
83
|
+
return this.scales.yAxes[0]
|
84
|
+
}
|
85
|
+
|
86
|
+
set yAxes0(yAxes0) {
|
87
|
+
this.scales.yAxes[0] = yAxes0
|
88
|
+
}
|
89
|
+
|
90
|
+
get yAxes1() {
|
91
|
+
return this.scales.yAxes[1]
|
92
|
+
}
|
93
|
+
|
94
|
+
set yAxes1(yAxes1) {
|
95
|
+
this.scales.yAxes[1] = yAxes1
|
96
|
+
}
|
97
|
+
|
98
|
+
get multiAxis() {
|
99
|
+
return this.value.options.multiAxis
|
100
|
+
}
|
101
|
+
|
102
|
+
set multiAxis(multiAxis) {
|
103
|
+
this.value.options.multiAxis = multiAxis
|
104
|
+
}
|
105
|
+
|
106
|
+
get tabContainer(): HTMLElement | null | undefined {
|
107
|
+
return this.tabs.shadowRoot?.querySelector('#tabsContainer')
|
108
|
+
}
|
109
|
+
|
110
|
+
firstUpdated() {
|
111
|
+
this.tabContainer?.addEventListener('scroll', e => {
|
112
|
+
this._onTabScroll(e)
|
113
|
+
})
|
114
|
+
}
|
115
|
+
|
116
|
+
editorTemplate(props: any) {
|
117
|
+
return html`
|
118
|
+
<input type="checkbox" value-key="multiAxis" .checked=${this.multiAxis} />
|
119
|
+
<label> <i18n-msg msgid="label.multi-axis">Multi Axis</i18n-msg> </label>
|
120
|
+
|
121
|
+
<legend><i18n-msg msgid="label.series">Series</i18n-msg></legend>
|
122
|
+
|
123
|
+
${this.multiSeriesTabTemplate()}
|
124
|
+
|
125
|
+
<legend><i18n-msg msgid="label.x-axes">X Axes</i18n-msg></legend>
|
126
|
+
|
127
|
+
<label> <i18n-msg msgid="label.data-key">Data Key</i18n-msg> </label>
|
128
|
+
<input type="text" value-key="labelDataKey" .value=${this.labelDataKey} />
|
129
|
+
|
130
|
+
<label> <i18n-msg msgid="label.title">Title</i18n-msg> </label>
|
131
|
+
<input type="text" value-key="xAxes0.axisTitle" .value=${this.xAxes0.axisTitle || ''} />
|
132
|
+
|
133
|
+
<label> <i18n-msg msgid="label.thickness">Thickness</i18n-msg> </label>
|
134
|
+
<input type="number" value-key="xAxes0.barPercentage" .value=${this.xAxes0.barPercentage} />
|
135
|
+
|
136
|
+
<input type="checkbox" value-key="value.options.xGridLine" .checked=${this.value.options.xGridLine} />
|
137
|
+
<label> <i18n-msg msgid="label.grid-line">Grid Line</i18n-msg> </label>
|
138
|
+
|
139
|
+
<input type="checkbox" value-key="xAxes0.ticks.display" .checked=${this.xAxes0.ticks.display} />
|
140
|
+
<label> <i18n-msg msgid="label.display-tick">Display Tick</i18n-msg> </label>
|
141
|
+
|
142
|
+
<legend><i18n-msg msgid="label.y-axes">Y Axes</i18n-msg></legend>
|
143
|
+
|
144
|
+
<label> <i18n-msg msgid="label.title">Title</i18n-msg> </label>
|
145
|
+
<input type="text" value-key="yAxes0.axisTitle" .value=${this.yAxes0.axisTitle || ''} />
|
146
|
+
|
147
|
+
<input type="checkbox" value-key="yAxes0.ticks.autoMin" .checked=${this.yAxes0.ticks.autoMin} />
|
148
|
+
<label> <i18n-msg msgid="label.axis-min-auto">Min Auto</i18n-msg> </label>
|
149
|
+
|
150
|
+
<input type="checkbox" value-key="yAxes0.ticks.autoMax" .checked=${this.yAxes0.ticks.autoMax} />
|
151
|
+
<label> <i18n-msg msgid="label.axis-max-auto">Max Auto</i18n-msg> </label>
|
152
|
+
|
153
|
+
${!this.yAxes0.ticks.autoMin
|
154
|
+
? html`
|
155
|
+
<label> <i18n-msg msgid="label.axis-min">Min</i18n-msg> </label>
|
156
|
+
<input type="number" value-key="yAxes0.ticks.min" .value=${this.yAxes0.ticks.min} />
|
157
|
+
`
|
158
|
+
: html``}
|
159
|
+
${!this.yAxes0.ticks.autoMax
|
160
|
+
? html`
|
161
|
+
<label> <i18n-msg msgid="label.axis-max">Max</i18n-msg> </label>
|
162
|
+
<input type="number" value-key="yAxes0.ticks.max" .value=${this.yAxes0.ticks.max} />
|
163
|
+
`
|
164
|
+
: html``}
|
165
|
+
|
166
|
+
<label> <i18n-msg msgid="label.axis-step-size">StepSize</i18n-msg> </label>
|
167
|
+
<input type="number" value-key="yAxes0.ticks.stepSize" .value=${this.yAxes0.ticks.stepSize} />
|
168
|
+
|
169
|
+
<input type="checkbox" value-key="value.options.yGridLine" .checked=${this.value.options.yGridLine} />
|
170
|
+
<label> <i18n-msg msgid="label.grid-line">Grid Line</i18n-msg> </label>
|
171
|
+
|
172
|
+
<input type="checkbox" value-key="yAxes0.ticks.display" .checked=${this.yAxes0.ticks.display} />
|
173
|
+
<label> <i18n-msg msgid="label.display-tick">Display Tick</i18n-msg> </label>
|
174
|
+
|
175
|
+
${this.value.options.multiAxis
|
176
|
+
? html`
|
177
|
+
<legend><i18n-msg msgid="label.y-2nd-axes">Y 2nd Axes</i18n-msg></legend>
|
178
|
+
|
179
|
+
<label> <i18n-msg msgid="label.title">Title</i18n-msg> </label>
|
180
|
+
<input type="text" value-key="yAxes1.axisTitle" .value=${this.yAxes1.axisTitle || ''} />
|
181
|
+
|
182
|
+
<input type="checkbox" value-key="yAxes1.ticks.autoMin" .checked=${this.yAxes1.ticks.autoMin} />
|
183
|
+
<label> <i18n-msg msgid="label.axis-min-auto">Min Auto</i18n-msg> </label>
|
184
|
+
|
185
|
+
<input type="checkbox" value-key="yAxes1.ticks.autoMax" .checked=${this.yAxes1.ticks.autoMax} />
|
186
|
+
<label> <i18n-msg msgid="label.axis-max-auto">Max Auto</i18n-msg> </label>
|
187
|
+
|
188
|
+
${!this.yAxes1.ticks.autoMin
|
189
|
+
? html`
|
190
|
+
<label> <i18n-msg msgid="label.axis-min">Min</i18n-msg> </label>
|
191
|
+
<input type="number" value-key="yAxes1.ticks.min" .value=${this.yAxes1.ticks.min} />
|
192
|
+
`
|
193
|
+
: html``}
|
194
|
+
${!this.yAxes1.ticks.autoMax
|
195
|
+
? html`
|
196
|
+
<label> <i18n-msg msgid="label.axis-max">Max</i18n-msg> </label>
|
197
|
+
<input type="number" value-key="yAxes1.ticks.max" .value=${this.yAxes1.ticks.max} />
|
198
|
+
`
|
199
|
+
: html``}
|
200
|
+
|
201
|
+
<label> <i18n-msg msgid="label.axis-step-size">StepSize</i18n-msg> </label>
|
202
|
+
<input type="number" value-key="yAxes1.ticks.stepSize" .value=${this.yAxes1.ticks.stepSize} />
|
203
|
+
|
204
|
+
<input type="checkbox" value-key="value.options.y2ndGridLine" .checked=${this.value.options.y2ndGridLine} />
|
205
|
+
<label> <i18n-msg msgid="label.grid-line">Grid Line</i18n-msg> </label>
|
206
|
+
|
207
|
+
<input type="checkbox" value-key="yAxes1.ticks.display" .checked=${this.yAxes1.ticks.display} />
|
208
|
+
<label> <i18n-msg msgid="label.display-tick">Display Tick</i18n-msg> </label>
|
209
|
+
`
|
210
|
+
: html``}
|
211
|
+
`
|
212
|
+
}
|
213
|
+
|
214
|
+
multiSeriesTabTemplate() {
|
215
|
+
return html`
|
216
|
+
<div id="series-properties-container" fullwidth>
|
217
|
+
<div id="tab-header">
|
218
|
+
<paper-icon-button
|
219
|
+
id="tab-nav-left-button"
|
220
|
+
icon="chevron-left"
|
221
|
+
@click=${(e: Event) => {
|
222
|
+
this._onTabScrollNavLeft(e)
|
223
|
+
}}
|
224
|
+
disabled
|
225
|
+
></paper-icon-button>
|
226
|
+
<paper-tabs
|
227
|
+
id="tabs"
|
228
|
+
@iron-select=${(e: Event) => (this.currentSeriesIndex = (e.target as any).selected)}
|
229
|
+
.selected=${this.currentSeriesIndex}
|
230
|
+
no-bar
|
231
|
+
noink
|
232
|
+
scrollable
|
233
|
+
hide-scroll-buttons
|
234
|
+
fit-container
|
235
|
+
>
|
236
|
+
${this.datasets.map(
|
237
|
+
(dataset: any, index: number) => html`
|
238
|
+
<paper-tab data-series="${index + 1}" noink
|
239
|
+
>${index + 1}
|
240
|
+
${!this.datasets || (this.datasets.length != 1 && this.currentSeriesIndex == index)
|
241
|
+
? html`
|
242
|
+
<paper-icon-button icon="close" @tap=${(e: Event) => this.onTapRemoveCurrentTab(e)}>
|
243
|
+
</paper-icon-button>
|
244
|
+
`
|
245
|
+
: html``}
|
246
|
+
</paper-tab>
|
247
|
+
`
|
248
|
+
)}
|
249
|
+
</paper-tabs>
|
250
|
+
<paper-icon-button
|
251
|
+
id="tab-nav-right-button"
|
252
|
+
icon="chevron-right"
|
253
|
+
@click=${(e: Event) => {
|
254
|
+
this._onTabScrollNavRight(e)
|
255
|
+
}}
|
256
|
+
disabled
|
257
|
+
></paper-icon-button>
|
258
|
+
</div>
|
259
|
+
<div id="add-series-button-container">
|
260
|
+
<paper-icon-button
|
261
|
+
id="add-series-button"
|
262
|
+
icon="add"
|
263
|
+
@tap=${(e: Event) => this.onTapAddTab(e)}
|
264
|
+
></paper-icon-button>
|
265
|
+
</div>
|
266
|
+
|
267
|
+
<iron-pages .selected=${this.currentSeriesIndex} .attr-for-selected="series-index">
|
268
|
+
${this.datasets.map(
|
269
|
+
(dataset: any, index: number) => html`
|
270
|
+
<div class="tab-content" series-index="${index}">
|
271
|
+
<label> <i18n-msg msgid="label.data-key">Data Key</i18n-msg> </label>
|
272
|
+
<input type="text" value-key="dataKey" .value=${this.dataKey} />
|
273
|
+
|
274
|
+
${this.value.type == 'bar'
|
275
|
+
? html`
|
276
|
+
<label> <i18n-msg msgid="label.type">type</i18n-msg> </label>
|
277
|
+
<select class="select-content" value-key="series.type" .value=${this.series.type}>
|
278
|
+
<option value="bar" selected>bar</option>
|
279
|
+
<option value="line">line</option>
|
280
|
+
</select>
|
281
|
+
`
|
282
|
+
: html``}
|
283
|
+
|
284
|
+
<label> <i18n-msg msgid="label.label">label</i18n-msg> </label>
|
285
|
+
<input type="text" value-key="series.label" .value=${this.series.label} />
|
286
|
+
|
287
|
+
${this.series.type == 'line'
|
288
|
+
? html`
|
289
|
+
<label> <i18n-msg msgid="label.line-tension">line tension</i18n-msg> </label>
|
290
|
+
<select class="select-content" value-key="series.lineTension" .value=${this.series.lineTension}>
|
291
|
+
<option value="0.4">smooth</option>
|
292
|
+
<option value="0">angled</option>
|
293
|
+
</select>
|
294
|
+
`
|
295
|
+
: html``}
|
296
|
+
${this.series.type == 'line'
|
297
|
+
? html`
|
298
|
+
<label> <i18n-msg msgid="label.border-width">border width</i18n-msg> </label>
|
299
|
+
<input type="number" value-key="series.borderWidth" .value=${this.series.borderWidth} />
|
300
|
+
`
|
301
|
+
: html``}
|
302
|
+
|
303
|
+
<label> <i18n-msg msgid="label.color">color</i18n-msg> </label>
|
304
|
+
<things-editor-color value-key="color" .value=${this.color}></things-editor-color>
|
305
|
+
|
306
|
+
${this.series.type == 'line'
|
307
|
+
? html`
|
308
|
+
<label> <i18n-msg msgid="label.point-shape">point shape</i18n-msg> </label>
|
309
|
+
<select class="select-content" value-key="series.pointStyle" .value=${this.series.pointStyle}>
|
310
|
+
<option value="circle">⚬</option>
|
311
|
+
<option value="triangle">▵</option>
|
312
|
+
<option value="rect">□</option>
|
313
|
+
<option value="rectRot">◇</option>
|
314
|
+
<option value="cross">+</option>
|
315
|
+
<option value="crossRot">⨉</option>
|
316
|
+
<option value="star">✱</option>
|
317
|
+
<option value="line">―</option>
|
318
|
+
<option value="dash">┄</option>
|
319
|
+
</select>
|
320
|
+
|
321
|
+
<label> <i18n-msg msgid="label.point-size">point size</i18n-msg> </label>
|
322
|
+
<input type="number" value-key="series.pointRadius" .value=${this.series.pointRadius} />
|
323
|
+
`
|
324
|
+
: html``} <label> <i18n-msg msgid="label.stack-group">Stack group</i18n-msg> </label>
|
325
|
+
<input type="text" value-key="series.stack" .value=${this.series.stack || ''} /> ${this.series.type ==
|
326
|
+
'line'
|
327
|
+
? html`
|
328
|
+
<input type="checkbox" value-key="series.fill" .checked=${this.series.fill} />
|
329
|
+
<label> <i18n-msg msgid="label.fill">fill</i18n-msg> </label>
|
330
|
+
`
|
331
|
+
: html``}
|
332
|
+
${this.multiAxis
|
333
|
+
? html`
|
334
|
+
<label> <i18n-msg msgid="label.target-axis">target axis</i18n-msg> </label>
|
335
|
+
<select class="select-content" value-key="series.yAxisID" .value=${this.series.yAxisID}>
|
336
|
+
<option value="left">left</option>
|
337
|
+
<option value="right">right</option>
|
338
|
+
</select>
|
339
|
+
`
|
340
|
+
: html``}
|
341
|
+
${this.displayValueTemplate()}
|
342
|
+
</div>
|
343
|
+
`
|
344
|
+
)}
|
345
|
+
</iron-pages>
|
346
|
+
</div>
|
347
|
+
`
|
348
|
+
}
|
349
|
+
|
350
|
+
_onTabScroll(e: Event) {
|
351
|
+
if (!this.tabContainer) {
|
352
|
+
return
|
353
|
+
}
|
354
|
+
|
355
|
+
if (this.tabContainer.clientWidth == this.tabContainer.scrollWidth) {
|
356
|
+
this.tabNavLeftButton.disabled = true
|
357
|
+
this.tabNavRightButton.disabled = true
|
358
|
+
}
|
359
|
+
// left-end
|
360
|
+
else if (this.tabContainer.scrollLeft == 0) {
|
361
|
+
this.tabNavLeftButton.disabled = true
|
362
|
+
this.tabNavRightButton.disabled = false
|
363
|
+
}
|
364
|
+
// right-end
|
365
|
+
else if (this.tabContainer.scrollLeft + this.tabContainer.clientWidth >= this.tabContainer.scrollWidth) {
|
366
|
+
this.tabNavLeftButton.disabled = false
|
367
|
+
this.tabNavRightButton.disabled = true
|
368
|
+
} else {
|
369
|
+
this.tabNavLeftButton.disabled = false
|
370
|
+
this.tabNavRightButton.disabled = false
|
371
|
+
}
|
372
|
+
}
|
373
|
+
|
374
|
+
_onTabScrollNavLeft(e: Event) {
|
375
|
+
if (!this.tabContainer) {
|
376
|
+
return
|
377
|
+
}
|
378
|
+
|
379
|
+
this.tabContainer.style.scrollBehavior = 'smooth'
|
380
|
+
this.tabContainer.scrollLeft -= this.tabContainer.clientWidth
|
381
|
+
this.tabContainer.style.scrollBehavior = 'auto'
|
382
|
+
}
|
383
|
+
|
384
|
+
_onTabScrollNavRight(e: Event) {
|
385
|
+
if (!this.tabContainer) {
|
386
|
+
return
|
387
|
+
}
|
388
|
+
|
389
|
+
this.tabContainer.style.scrollBehavior = 'smooth'
|
390
|
+
this.tabContainer.scrollLeft += this.tabContainer.clientWidth
|
391
|
+
this.tabContainer.style.scrollBehavior = 'auto'
|
392
|
+
}
|
393
|
+
}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
3
|
+
*/
|
4
|
+
import { html } from 'lit'
|
5
|
+
import { customElement } from 'lit/decorators.js'
|
6
|
+
|
7
|
+
import PropertyEditorChartJSAbstract from './property-editor-chartjs-abstract'
|
8
|
+
|
9
|
+
@customElement('property-editor-chartjs-pie')
|
10
|
+
export default class PropertyEditorChartJSPie extends PropertyEditorChartJSAbstract {
|
11
|
+
static styles = PropertyEditorChartJSAbstract.styles
|
12
|
+
|
13
|
+
constructor() {
|
14
|
+
super()
|
15
|
+
|
16
|
+
this.value = {
|
17
|
+
options: {
|
18
|
+
legend: {}
|
19
|
+
},
|
20
|
+
data: {
|
21
|
+
datasets: []
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
this.currentSeriesIndex = 0
|
26
|
+
}
|
27
|
+
|
28
|
+
get valuePrefix() {
|
29
|
+
return this.series.valuePrefix
|
30
|
+
}
|
31
|
+
|
32
|
+
set valuePrefix(valuePrefix) {
|
33
|
+
this.series.valuePrefix = valuePrefix
|
34
|
+
}
|
35
|
+
|
36
|
+
get valueSuffix() {
|
37
|
+
return this.series.valueSuffix
|
38
|
+
}
|
39
|
+
|
40
|
+
set valueSuffix(valueSuffix) {
|
41
|
+
this.series.valueSuffix = valueSuffix
|
42
|
+
}
|
43
|
+
|
44
|
+
get color() {
|
45
|
+
return this.series.color || this.series.backgroundColor
|
46
|
+
}
|
47
|
+
|
48
|
+
set color(color) {
|
49
|
+
this.series.color = color
|
50
|
+
delete this.series.backgroundColor
|
51
|
+
}
|
52
|
+
|
53
|
+
get displayValue() {
|
54
|
+
return this.series.displayValue
|
55
|
+
}
|
56
|
+
|
57
|
+
set displayValue(displayValue) {
|
58
|
+
this.series.displayValue = displayValue
|
59
|
+
}
|
60
|
+
|
61
|
+
editorTemplate(props: any) {
|
62
|
+
return html`
|
63
|
+
<legend><i18n-msg msgid="label.series">Series</i18n-msg></legend>
|
64
|
+
|
65
|
+
<label> <i18n-msg msgid="label.data-key">Data Key</i18n-msg> </label>
|
66
|
+
<input type="text" value-key="dataKey" .value=${this.series.dataKey} />
|
67
|
+
|
68
|
+
<label> <i18n-msg msgid="label.color">color</i18n-msg> </label>
|
69
|
+
<things-editor-multiple-color value-key="color" .values=${this.color}></things-editor-multiple-color>
|
70
|
+
|
71
|
+
${this.displayValueTemplate()}
|
72
|
+
|
73
|
+
<legend><i18n-msg msgid="label.axes">Axes</i18n-msg></legend>
|
74
|
+
|
75
|
+
<label> <i18n-msg msgid="label.data-key">Data Key</i18n-msg> </label>
|
76
|
+
<input type="text" value-key="labelDataKey" .value=${this.labelDataKey} />
|
77
|
+
`
|
78
|
+
}
|
79
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
3
|
+
*/
|
4
|
+
import '@polymer/iron-icon/iron-icon'
|
5
|
+
import '@polymer/paper-button/paper-button'
|
6
|
+
import '@polymer/paper-icon-button/paper-icon-button'
|
7
|
+
import '@polymer/paper-tabs/paper-tabs'
|
8
|
+
|
9
|
+
import { html } from 'lit'
|
10
|
+
import { customElement } from 'lit/decorators.js'
|
11
|
+
|
12
|
+
import PropertyEditorChartJSMultiSeriesAbstract from './property-editor-chartjs-multi-series-abstract'
|
13
|
+
|
14
|
+
@customElement('property-editor-chartjs-radar')
|
15
|
+
export default class PropertyEditorChartJSRadar extends PropertyEditorChartJSMultiSeriesAbstract {
|
16
|
+
static styles = PropertyEditorChartJSMultiSeriesAbstract.styles
|
17
|
+
|
18
|
+
constructor() {
|
19
|
+
super()
|
20
|
+
|
21
|
+
this.value = {
|
22
|
+
options: {
|
23
|
+
legend: {}
|
24
|
+
},
|
25
|
+
data: {
|
26
|
+
datasets: []
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
editorTemplate(props: any) {
|
32
|
+
return html`
|
33
|
+
<legend><i18n-msg msgid="label.series">Series</i18n-msg></legend>
|
34
|
+
|
35
|
+
<div fullwidth>${this.multiSeriesTabTemplate()}</div>
|
36
|
+
|
37
|
+
<legend><i18n-msg msgid="label.axes">Axes</i18n-msg></legend>
|
38
|
+
|
39
|
+
<label> <i18n-msg msgid="label.data-key">Data Key</i18n-msg> </label>
|
40
|
+
<input type="text" value-key="labelDataKey" .value=${this.labelDataKey} />
|
41
|
+
`
|
42
|
+
}
|
43
|
+
}
|
@@ -0,0 +1,165 @@
|
|
1
|
+
import { css } from 'lit'
|
2
|
+
|
3
|
+
export const PropertyEditorChartJSStyles = css`
|
4
|
+
:host {
|
5
|
+
display: grid;
|
6
|
+
grid-template-columns: repeat(10, 1fr);
|
7
|
+
grid-gap: 5px;
|
8
|
+
}
|
9
|
+
|
10
|
+
:host > * {
|
11
|
+
box-sizing: border-box;
|
12
|
+
grid-column: span 7;
|
13
|
+
}
|
14
|
+
|
15
|
+
:host > label {
|
16
|
+
box-sizing: border-box;
|
17
|
+
grid-column: span 3;
|
18
|
+
}
|
19
|
+
|
20
|
+
:host > legend {
|
21
|
+
box-sizing: border-box;
|
22
|
+
grid-column: 1 / -1;
|
23
|
+
color: var(--secondary-text-color, #e46c2e);
|
24
|
+
font: var(--property-sidebar-fieldset-legend, bold 13px var(--theme-font));
|
25
|
+
text-transform: capitalize;
|
26
|
+
}
|
27
|
+
|
28
|
+
#series-properties-container {
|
29
|
+
display: grid;
|
30
|
+
grid-template-columns: 1fr 25px;
|
31
|
+
align-items: center;
|
32
|
+
justify-content: center;
|
33
|
+
}
|
34
|
+
|
35
|
+
#series-properties-container > iron-pages {
|
36
|
+
grid-column: span 2;
|
37
|
+
}
|
38
|
+
|
39
|
+
#tab-header {
|
40
|
+
display: grid;
|
41
|
+
grid-template-columns: 25px 1fr 25px;
|
42
|
+
grid-gap: 5px;
|
43
|
+
overflow: hidden;
|
44
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
45
|
+
border-bottom: 0;
|
46
|
+
background-color: #ccc;
|
47
|
+
box-sizing: border-box;
|
48
|
+
padding-top: 3px;
|
49
|
+
align-items: center;
|
50
|
+
}
|
51
|
+
|
52
|
+
#tab-header > paper-tabs {
|
53
|
+
height: 25px;
|
54
|
+
}
|
55
|
+
|
56
|
+
#tab-header > paper-icon-button {
|
57
|
+
padding: 0px;
|
58
|
+
width: 25px;
|
59
|
+
height: 25px;
|
60
|
+
}
|
61
|
+
|
62
|
+
#tab-header paper-tabs paper-icon-button {
|
63
|
+
display: flex;
|
64
|
+
margin-left: 5px;
|
65
|
+
width: 15px;
|
66
|
+
height: 15px;
|
67
|
+
padding: 2px;
|
68
|
+
color: #585858;
|
69
|
+
}
|
70
|
+
|
71
|
+
#add-series-button-container {
|
72
|
+
height: 100%;
|
73
|
+
box-sizing: border-box;
|
74
|
+
align-items: center;
|
75
|
+
justify-content: center;
|
76
|
+
padding-top: 3px;
|
77
|
+
display: flex;
|
78
|
+
border-bottom: rgba(0, 0, 0, 0.2) 1px solid;
|
79
|
+
}
|
80
|
+
|
81
|
+
#add-series-button {
|
82
|
+
width: 20px;
|
83
|
+
height: 20px;
|
84
|
+
padding: 0;
|
85
|
+
color: var(--primary-text-color);
|
86
|
+
}
|
87
|
+
|
88
|
+
.tab-content {
|
89
|
+
background-color: rgba(255, 255, 255, 0.5);
|
90
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
91
|
+
border-width: 0 1px 1px 1px;
|
92
|
+
padding: 5px;
|
93
|
+
display: grid;
|
94
|
+
grid-template-columns: repeat(10, 1fr);
|
95
|
+
grid-gap: 5px;
|
96
|
+
}
|
97
|
+
|
98
|
+
.tab-content > * {
|
99
|
+
box-sizing: border-box;
|
100
|
+
grid-column: span 7;
|
101
|
+
}
|
102
|
+
|
103
|
+
label,
|
104
|
+
.tab-content > label {
|
105
|
+
grid-column: span 3;
|
106
|
+
text-align: right;
|
107
|
+
color: var(--primary-text-color);
|
108
|
+
font-size: 0.8em;
|
109
|
+
line-height: 2;
|
110
|
+
text-transform: capitalize;
|
111
|
+
}
|
112
|
+
|
113
|
+
input[type='checkbox'],
|
114
|
+
.tab-content > input[type='checkbox'] {
|
115
|
+
grid-column: span 4;
|
116
|
+
justify-self: end;
|
117
|
+
align-self: center;
|
118
|
+
}
|
119
|
+
|
120
|
+
input[type='checkbox'] + label,
|
121
|
+
.tab-content > input[type='checkbox'] + label {
|
122
|
+
grid-column: span 6;
|
123
|
+
|
124
|
+
text-align: left;
|
125
|
+
}
|
126
|
+
|
127
|
+
[fullwidth] {
|
128
|
+
grid-column: 1 / -1;
|
129
|
+
margin: 0;
|
130
|
+
border: 0;
|
131
|
+
}
|
132
|
+
|
133
|
+
select {
|
134
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
135
|
+
background: url(/images/bg-input-select.png) 100% 50% no-repeat #fff;
|
136
|
+
}
|
137
|
+
input[type='text'] {
|
138
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
139
|
+
}
|
140
|
+
|
141
|
+
paper-tab {
|
142
|
+
background-color: rgba(0, 0, 0, 0.2);
|
143
|
+
background-color: #ccc;
|
144
|
+
border-width: 1px 1px 0 1px;
|
145
|
+
padding: 0 5px;
|
146
|
+
color: #fff;
|
147
|
+
font-size: 13px;
|
148
|
+
box-sizing: border-box;
|
149
|
+
min-width: 45px;
|
150
|
+
}
|
151
|
+
|
152
|
+
paper-tab[disabled] {
|
153
|
+
background-color: rgba(0, 0, 0, 0.1);
|
154
|
+
}
|
155
|
+
|
156
|
+
paper-tab:last-child {
|
157
|
+
border-width: 0;
|
158
|
+
}
|
159
|
+
|
160
|
+
paper-tabs paper-tab.iron-selected {
|
161
|
+
background-color: #f6f8f9;
|
162
|
+
border-radius: 5px 5px 0 0;
|
163
|
+
color: #585858;
|
164
|
+
}
|
165
|
+
`
|