@operato/chart 7.0.12 → 7.0.13
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 +9 -0
- package/dist/src/editors/configurer.d.ts +10 -1
- package/dist/src/editors/configurer.js +62 -2
- package/dist/src/editors/configurer.js.map +1 -1
- package/dist/src/editors/input-chart-abstract.d.ts +18 -0
- package/dist/src/editors/input-chart-abstract.js +438 -1
- package/dist/src/editors/input-chart-abstract.js.map +1 -1
- package/dist/src/editors/input-chart-styles.js +18 -9
- package/dist/src/editors/input-chart-styles.js.map +1 -1
- package/dist/src/editors/ox-input-chart-hbar.d.ts +2 -2
- package/dist/src/editors/ox-input-chart-hbar.js +10 -10
- package/dist/src/editors/ox-input-chart-hbar.js.map +1 -1
- package/dist/src/editors/ox-input-chart-mixed.d.ts +2 -2
- package/dist/src/editors/ox-input-chart-mixed.js +3 -3
- package/dist/src/editors/ox-input-chart-mixed.js.map +1 -1
- package/dist/src/editors/ox-input-chart-radar.d.ts +2 -2
- package/dist/src/editors/ox-input-chart-radar.js +3 -3
- package/dist/src/editors/ox-input-chart-radar.js.map +1 -1
- package/dist/src/editors/ox-input-chart-timeseries.d.ts +2 -2
- package/dist/src/editors/ox-input-chart-timeseries.js +6 -4
- package/dist/src/editors/ox-input-chart-timeseries.js.map +1 -1
- package/dist/src/scichart/scichart-builder.js +65 -5
- package/dist/src/scichart/scichart-builder.js.map +1 -1
- package/dist/stories/ox-input-chart-timeseries.stories.js +0 -4
- package/dist/stories/ox-input-chart-timeseries.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/editors/configurer.ts +73 -2
- package/src/editors/input-chart-abstract.ts +459 -2
- package/src/editors/input-chart-styles.ts +18 -9
- package/src/editors/ox-input-chart-hbar.ts +10 -10
- package/src/editors/ox-input-chart-mixed.ts +3 -3
- package/src/editors/ox-input-chart-radar.ts +3 -3
- package/src/editors/ox-input-chart-timeseries.ts +6 -4
- package/src/scichart/scichart-builder.ts +74 -4
- package/src/types.d.ts +19 -0
- package/stories/ox-input-chart-timeseries.stories.ts +0 -4
- package/translations/ko.json +7 -0
- package/dist/src/editors/input-chart-multi-series-abstract.d.ts +0 -17
- package/dist/src/editors/input-chart-multi-series-abstract.js +0 -419
- package/dist/src/editors/input-chart-multi-series-abstract.js.map +0 -1
- package/src/editors/input-chart-multi-series-abstract.ts +0 -430
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import '@operato/i18n/ox-i18n.js';
|
|
3
3
|
import { html } from 'lit';
|
|
4
|
-
import { property } from 'lit/decorators.js';
|
|
4
|
+
import { property, query } from 'lit/decorators.js';
|
|
5
5
|
import { random as randomColor, TinyColor } from '@ctrl/tinycolor';
|
|
6
6
|
import { InputChartStyles } from './input-chart-styles';
|
|
7
7
|
import { Configurer } from './configurer';
|
|
@@ -62,6 +62,20 @@ export class InputChartAbstract extends OxFormField {
|
|
|
62
62
|
super.connectedCallback();
|
|
63
63
|
this.renderRoot.addEventListener('change', this.onValuesChanged.bind(this));
|
|
64
64
|
}
|
|
65
|
+
firstUpdated(_changedProperties) {
|
|
66
|
+
this.seriesTabContainer?.addEventListener('scroll', e => {
|
|
67
|
+
this._onTabScroll(e, 'series');
|
|
68
|
+
});
|
|
69
|
+
this.annotationsTabContainer?.addEventListener('scroll', e => {
|
|
70
|
+
this._onTabScroll(e, 'annotations');
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
get seriesTabContainer() {
|
|
74
|
+
return this.seriesTabs;
|
|
75
|
+
}
|
|
76
|
+
get annotationsTabContainer() {
|
|
77
|
+
return this.annotationsTabs;
|
|
78
|
+
}
|
|
65
79
|
displayValueTemplate() {
|
|
66
80
|
const configurer = this.configurer;
|
|
67
81
|
return html `
|
|
@@ -255,6 +269,24 @@ export class InputChartAbstract extends OxFormField {
|
|
|
255
269
|
configurer.currentSeriesIndex = Math.max(0, configurer.currentSeriesIndex - 1);
|
|
256
270
|
this.requestUpdate();
|
|
257
271
|
}
|
|
272
|
+
onTapAddAnnotation(e) {
|
|
273
|
+
const configurer = this.configurer;
|
|
274
|
+
const lastAnnotationIndex = configurer.annotations.length;
|
|
275
|
+
configurer.annotations.push({ type: 'line', x1: 0, y1: 0 });
|
|
276
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
|
|
277
|
+
configurer.currentAnnotationIndex = lastAnnotationIndex;
|
|
278
|
+
this.value = { ...this.configurer.value };
|
|
279
|
+
}
|
|
280
|
+
onTapRemoveCurrentAnnotation(index) {
|
|
281
|
+
const configurer = this.configurer;
|
|
282
|
+
if (!configurer.config.data.datasets) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
this.configurer.data.datasets.splice(index, 1);
|
|
286
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
|
|
287
|
+
configurer.currentSeriesIndex = Math.max(0, configurer.currentSeriesIndex - 1);
|
|
288
|
+
this.requestUpdate();
|
|
289
|
+
}
|
|
258
290
|
_getSeriesModel({ chartType, datasetsLength, lastSeriesColor }) {
|
|
259
291
|
const addSeriesOption = {
|
|
260
292
|
label: `series ${datasetsLength + 1}`,
|
|
@@ -285,6 +317,393 @@ export class InputChartAbstract extends OxFormField {
|
|
|
285
317
|
return element.value;
|
|
286
318
|
}
|
|
287
319
|
}
|
|
320
|
+
annotationsTabTemplate() {
|
|
321
|
+
const configurer = this.configurer;
|
|
322
|
+
const currentAnnotation = configurer.annotations[configurer.currentAnnotationIndex] || {};
|
|
323
|
+
return html `
|
|
324
|
+
<div id="annotations-properties-container" fullwidth>
|
|
325
|
+
<div id="annotations-tab-header">
|
|
326
|
+
<md-icon
|
|
327
|
+
id="annotations-tab-nav-left-button"
|
|
328
|
+
@tap=${(e) => {
|
|
329
|
+
this._onTabScrollNavLeft(e, 'annotations');
|
|
330
|
+
}}
|
|
331
|
+
disabled
|
|
332
|
+
>chevron_left</md-icon
|
|
333
|
+
>
|
|
334
|
+
<div
|
|
335
|
+
id="annotations-tabs"
|
|
336
|
+
@change=${(e) => {
|
|
337
|
+
configurer.currentAnnotationIndex = e.target.activeTabIndex;
|
|
338
|
+
}}
|
|
339
|
+
active-tab-index=${configurer.currentAnnotationIndex}
|
|
340
|
+
fit-container
|
|
341
|
+
>
|
|
342
|
+
${configurer.annotations.map((annotation, index) => html `
|
|
343
|
+
<div
|
|
344
|
+
data-annotation=${index + 1}
|
|
345
|
+
data-tab-index=${index}
|
|
346
|
+
tab
|
|
347
|
+
?selected=${index == configurer.currentAnnotationIndex}
|
|
348
|
+
@click=${(e) => {
|
|
349
|
+
const target = e.target;
|
|
350
|
+
this.configurer.setCurrentAnnotationIndex(Number(target.getAttribute('data-tab-index')));
|
|
351
|
+
this.value = { ...this.configurer.value };
|
|
352
|
+
}}
|
|
353
|
+
>
|
|
354
|
+
${index + 1}
|
|
355
|
+
${!configurer.annotations ||
|
|
356
|
+
(configurer.annotations.length != 1 && configurer.currentAnnotationIndex == index)
|
|
357
|
+
? html ` <md-icon @tap=${(e) => this.onTapRemoveCurrentAnnotation(index)}> close </md-icon> `
|
|
358
|
+
: html ``}
|
|
359
|
+
</div>
|
|
360
|
+
`)}
|
|
361
|
+
</div>
|
|
362
|
+
<md-icon
|
|
363
|
+
id="annotations-tab-nav-right-button"
|
|
364
|
+
@click=${(e) => {
|
|
365
|
+
this._onTabScrollNavRight(e, 'annotations');
|
|
366
|
+
}}
|
|
367
|
+
disabled
|
|
368
|
+
>chevron_right</md-icon
|
|
369
|
+
>
|
|
370
|
+
</div>
|
|
371
|
+
<div id="add-annotation-button-container">
|
|
372
|
+
<md-icon id="add-annotation-button" @tap=${(e) => this.onTapAddAnnotation(e)}>add</md-icon>
|
|
373
|
+
</div>
|
|
374
|
+
|
|
375
|
+
<div class="tab-content">
|
|
376
|
+
<label for="annotation-type"> <ox-i18n msgid="label.chart-annotation-type">Type</ox-i18n> </label>
|
|
377
|
+
<select
|
|
378
|
+
id="annotation-type"
|
|
379
|
+
class="select-content"
|
|
380
|
+
value-key="annotation.type"
|
|
381
|
+
.value=${currentAnnotation.type || ''}
|
|
382
|
+
>
|
|
383
|
+
<option value="line">Line</option>
|
|
384
|
+
<option value="text">Text</option>
|
|
385
|
+
<option value="box">Box</option>
|
|
386
|
+
<option value="horizontalLine">Horizontal Line</option>
|
|
387
|
+
<option value="verticalLine">Vertical Line</option>
|
|
388
|
+
<option value="custom">Custom</option>
|
|
389
|
+
</select>
|
|
390
|
+
|
|
391
|
+
<label for="annotation-x1">X1</label>
|
|
392
|
+
<input
|
|
393
|
+
id="annotation-x1"
|
|
394
|
+
type="number"
|
|
395
|
+
value-key="annotation.x1"
|
|
396
|
+
.value=${String(currentAnnotation.x1 || 0)}
|
|
397
|
+
/>
|
|
398
|
+
|
|
399
|
+
<label for="annotation-y1">Y1</label>
|
|
400
|
+
<input
|
|
401
|
+
id="annotation-y1"
|
|
402
|
+
type="number"
|
|
403
|
+
value-key="annotation.y1"
|
|
404
|
+
.value=${String(currentAnnotation.y1 || 0)}
|
|
405
|
+
/>
|
|
406
|
+
|
|
407
|
+
<label for="annotation-x2">X2</label>
|
|
408
|
+
<input
|
|
409
|
+
id="annotation-x2"
|
|
410
|
+
type="number"
|
|
411
|
+
value-key="annotation.x2"
|
|
412
|
+
.value=${String(currentAnnotation.x2 || 0)}
|
|
413
|
+
/>
|
|
414
|
+
|
|
415
|
+
<label for="annotation-y2">Y2</label>
|
|
416
|
+
<input
|
|
417
|
+
id="annotation-y2"
|
|
418
|
+
type="number"
|
|
419
|
+
value-key="annotation.y2"
|
|
420
|
+
.value=${String(currentAnnotation.y2 || 0)}
|
|
421
|
+
/>
|
|
422
|
+
|
|
423
|
+
<label for="annotation-stroke"> <ox-i18n msgid="label.stroke-style">Stroke Style</ox-i18n> </label>
|
|
424
|
+
<ox-input-color
|
|
425
|
+
id="annotation-stroke"
|
|
426
|
+
value-key="annotation.stroke"
|
|
427
|
+
.value=${currentAnnotation.stroke}
|
|
428
|
+
></ox-input-color>
|
|
429
|
+
|
|
430
|
+
<label for="annotation-stroke-thickness">
|
|
431
|
+
<ox-i18n msgid="label.stroke-thickness">Stroke Thickness</ox-i18n>
|
|
432
|
+
</label>
|
|
433
|
+
<input
|
|
434
|
+
id="annotation-stroke-thickness"
|
|
435
|
+
type="number"
|
|
436
|
+
value-key="annotation.strokeThickness"
|
|
437
|
+
.value=${String(currentAnnotation.strokeThickness || 1)}
|
|
438
|
+
/>
|
|
439
|
+
|
|
440
|
+
<label for="annotation-fill"> <ox-i18n msgid="label.fill">Fill</ox-i18n> </label>
|
|
441
|
+
<ox-input-color
|
|
442
|
+
id="annotation-fill"
|
|
443
|
+
value-key="annotation.fill"
|
|
444
|
+
.value=${currentAnnotation.fill}
|
|
445
|
+
></ox-input-color>
|
|
446
|
+
|
|
447
|
+
<label for="annotation-text"> <ox-i18n msgid="label.annotation-text">Text</ox-i18n> </label>
|
|
448
|
+
<input id="annotation-text" type="text" value-key="annotation.text" .value=${currentAnnotation.text || ''} />
|
|
449
|
+
|
|
450
|
+
<label for="annotation-horizontal-anchor">
|
|
451
|
+
<ox-i18n msgid="label.horizontal-anchor">Horizontal Anchor</ox-i18n>
|
|
452
|
+
</label>
|
|
453
|
+
<select
|
|
454
|
+
id="annotation-horizontal-anchor"
|
|
455
|
+
class="select-content"
|
|
456
|
+
value-key="annotation.horizontalAnchorPoint"
|
|
457
|
+
.value=${currentAnnotation.horizontalAnchorPoint || ''}
|
|
458
|
+
>
|
|
459
|
+
<option value="Left">Left</option>
|
|
460
|
+
<option value="Center">Center</option>
|
|
461
|
+
<option value="Right">Right</option>
|
|
462
|
+
</select>
|
|
463
|
+
|
|
464
|
+
<label for="annotation-vertical-anchor">
|
|
465
|
+
<ox-i18n msgid="label.vertical-anchor">Vertical Anchor</ox-i18n>
|
|
466
|
+
</label>
|
|
467
|
+
<select
|
|
468
|
+
id="annotation-vertical-anchor"
|
|
469
|
+
class="select-content"
|
|
470
|
+
value-key="annotation.verticalAnchorPoint"
|
|
471
|
+
.value=${currentAnnotation.verticalAnchorPoint || ''}
|
|
472
|
+
>
|
|
473
|
+
<option value="Top">Top</option>
|
|
474
|
+
<option value="Center">Center</option>
|
|
475
|
+
<option value="Bottom">Bottom</option>
|
|
476
|
+
</select>
|
|
477
|
+
</div>
|
|
478
|
+
</div>
|
|
479
|
+
`;
|
|
480
|
+
}
|
|
481
|
+
multiSeriesTabTemplate() {
|
|
482
|
+
const configurer = this.configurer;
|
|
483
|
+
return html `
|
|
484
|
+
<div id="series-properties-container" fullwidth>
|
|
485
|
+
<div id="series-tab-header">
|
|
486
|
+
<md-icon
|
|
487
|
+
id="series-tab-nav-left-button"
|
|
488
|
+
@tap=${(e) => {
|
|
489
|
+
this._onTabScrollNavLeft(e, 'series');
|
|
490
|
+
}}
|
|
491
|
+
disabled
|
|
492
|
+
>chevron_left</md-icon
|
|
493
|
+
>
|
|
494
|
+
<div
|
|
495
|
+
id="series-tabs"
|
|
496
|
+
@change=${(e) => {
|
|
497
|
+
configurer.currentSeriesIndex = e.target.activeTabIndex;
|
|
498
|
+
}}
|
|
499
|
+
active-tab-index=${configurer.currentSeriesIndex}
|
|
500
|
+
fit-container
|
|
501
|
+
>
|
|
502
|
+
${configurer.datasets.map((dataset, index) => html `
|
|
503
|
+
<div
|
|
504
|
+
data-series=${index + 1}
|
|
505
|
+
data-tab-index=${index}
|
|
506
|
+
tab
|
|
507
|
+
?selected=${index == configurer.currentSeriesIndex}
|
|
508
|
+
@click=${(e) => {
|
|
509
|
+
const target = e.target;
|
|
510
|
+
this.configurer.setCurrentSeriesIndex(Number(target.getAttribute('data-tab-index')));
|
|
511
|
+
this.value = { ...this.configurer.value };
|
|
512
|
+
}}
|
|
513
|
+
>
|
|
514
|
+
${index + 1}
|
|
515
|
+
${!configurer.datasets || (configurer.datasets.length != 1 && configurer.currentSeriesIndex == index)
|
|
516
|
+
? html ` <md-icon @tap=${(e) => this.onTapRemoveCurrentTab(index)}> close </md-icon> `
|
|
517
|
+
: html ``}
|
|
518
|
+
</div>
|
|
519
|
+
`)}
|
|
520
|
+
</div>
|
|
521
|
+
<md-icon
|
|
522
|
+
id="series-tab-nav-right-button"
|
|
523
|
+
@click=${(e) => {
|
|
524
|
+
this._onTabScrollNavRight(e, 'series');
|
|
525
|
+
}}
|
|
526
|
+
disabled
|
|
527
|
+
>chevron_right</md-icon
|
|
528
|
+
>
|
|
529
|
+
</div>
|
|
530
|
+
<div id="add-series-button-container">
|
|
531
|
+
<md-icon id="add-series-button" @tap=${(e) => this.onTapAddTab(e)}>add</md-icon>
|
|
532
|
+
</div>
|
|
533
|
+
|
|
534
|
+
<div class="tab-content">
|
|
535
|
+
<label for="data-key"> <ox-i18n msgid="label.data-key">Data Key</ox-i18n> </label>
|
|
536
|
+
<input id="data-key" type="text" value-key="dataKey" .value=${configurer.dataKey || ''} />
|
|
537
|
+
|
|
538
|
+
${this.chartType == 'line' || this.chartType == 'bar'
|
|
539
|
+
? html `
|
|
540
|
+
<label for="series-type"> <ox-i18n msgid="label.series-type">Type</ox-i18n> </label>
|
|
541
|
+
<select
|
|
542
|
+
id="series-type"
|
|
543
|
+
class="select-content"
|
|
544
|
+
value-key="series.type"
|
|
545
|
+
.value=${configurer.series.type || ''}
|
|
546
|
+
>
|
|
547
|
+
<option value="bar" selected>Bar</option>
|
|
548
|
+
<option value="line">Line</option>
|
|
549
|
+
</select>
|
|
550
|
+
`
|
|
551
|
+
: html ``}
|
|
552
|
+
|
|
553
|
+
<label for="series-label"> <ox-i18n msgid="label.label">Label</ox-i18n> </label>
|
|
554
|
+
<input id="series-label" type="text" value-key="series.label" .value=${configurer.series.label || ''} />
|
|
555
|
+
|
|
556
|
+
${configurer.series.type == 'line'
|
|
557
|
+
? html `
|
|
558
|
+
<label for="series-line-tension"> <ox-i18n msgid="label.line-tension">Line Tension</ox-i18n> </label>
|
|
559
|
+
<select
|
|
560
|
+
id="series-line-tension"
|
|
561
|
+
class="select-content"
|
|
562
|
+
value-key="series.lineTension"
|
|
563
|
+
.value=${String(configurer.series.lineTension || 0)}
|
|
564
|
+
>
|
|
565
|
+
<option value="0.4">Smooth</option>
|
|
566
|
+
<option value="0">Angled</option>
|
|
567
|
+
</select>
|
|
568
|
+
`
|
|
569
|
+
: html ``}
|
|
570
|
+
${configurer.series.type == 'line'
|
|
571
|
+
? html `
|
|
572
|
+
<label for="series-border-width"> <ox-i18n msgid="label.border-width">Border Width</ox-i18n> </label>
|
|
573
|
+
<input
|
|
574
|
+
id="series-border-width"
|
|
575
|
+
type="number"
|
|
576
|
+
value-key="series.borderWidth"
|
|
577
|
+
.value=${String(configurer.series.borderWidth || 0)}
|
|
578
|
+
/>
|
|
579
|
+
`
|
|
580
|
+
: html ``}
|
|
581
|
+
|
|
582
|
+
<label for="series-color"> <ox-i18n msgid="label.color">Color</ox-i18n> </label>
|
|
583
|
+
<ox-input-color id="series-color" value-key="color" .value=${configurer.color}></ox-input-color>
|
|
584
|
+
|
|
585
|
+
${configurer.series.type == 'line'
|
|
586
|
+
? html `
|
|
587
|
+
<label for="series-point-style"> <ox-i18n msgid="label.point-shape">Point Shape</ox-i18n> </label>
|
|
588
|
+
<select
|
|
589
|
+
id="series-point-style"
|
|
590
|
+
class="select-content"
|
|
591
|
+
value-key="series.pointStyle"
|
|
592
|
+
.value=${configurer.series.pointStyle || ''}
|
|
593
|
+
>
|
|
594
|
+
<option value=""> </option>
|
|
595
|
+
<option value="circle">⚬</option>
|
|
596
|
+
<option value="triangle">▵</option>
|
|
597
|
+
<option value="rect">□</option>
|
|
598
|
+
<option value="rectRot">◇</option>
|
|
599
|
+
<option value="cross">+</option>
|
|
600
|
+
<option value="crossRot">⨉</option>
|
|
601
|
+
<option value="star">✱</option>
|
|
602
|
+
<option value="line">―</option>
|
|
603
|
+
<option value="dash">┄</option>
|
|
604
|
+
</select>
|
|
605
|
+
|
|
606
|
+
<label for="series-point-radius"> <ox-i18n msgid="label.point-size">Point Size</ox-i18n> </label>
|
|
607
|
+
<input
|
|
608
|
+
id="series-point-radius"
|
|
609
|
+
type="number"
|
|
610
|
+
value-key="series.pointRadius"
|
|
611
|
+
.value=${String(configurer.series.pointRadius || 0)}
|
|
612
|
+
/>
|
|
613
|
+
`
|
|
614
|
+
: html ``} <label for="series-stack"> <ox-i18n msgid="label.stack-group">Stack group</ox-i18n> </label>
|
|
615
|
+
<input id="series-stack" type="text" value-key="series.stack" .value=${configurer.series.stack || ''} />
|
|
616
|
+
${configurer.series.type == 'line'
|
|
617
|
+
? html `
|
|
618
|
+
<input id="seires-fill" type="checkbox" value-key="series.fill" ?checked=${configurer.series.fill} />
|
|
619
|
+
<label for="seires-fill"> <ox-i18n msgid="label.fill">Fill</ox-i18n> </label>
|
|
620
|
+
`
|
|
621
|
+
: html ``}
|
|
622
|
+
${configurer.multiAxis
|
|
623
|
+
? html `
|
|
624
|
+
<label for="series-y-axis-id"> <ox-i18n msgid="label.target-axis">Target Axis</ox-i18n> </label>
|
|
625
|
+
<select
|
|
626
|
+
id="series-y-axis-id"
|
|
627
|
+
class="select-content"
|
|
628
|
+
value-key="series.yAxisID"
|
|
629
|
+
.value=${configurer.series.yAxisID || ''}
|
|
630
|
+
>
|
|
631
|
+
<option value="left">Left</option>
|
|
632
|
+
<option value="right">Right</option>
|
|
633
|
+
</select>
|
|
634
|
+
`
|
|
635
|
+
: html ``}
|
|
636
|
+
${this.displayValueTemplate()}
|
|
637
|
+
</div>
|
|
638
|
+
</div>
|
|
639
|
+
`;
|
|
640
|
+
}
|
|
641
|
+
_onTabScroll(e, type) {
|
|
642
|
+
let tabContainer;
|
|
643
|
+
let tabNavLeftButton;
|
|
644
|
+
let tabNavRightButton;
|
|
645
|
+
if (type === 'series') {
|
|
646
|
+
tabContainer = this.seriesTabContainer;
|
|
647
|
+
tabNavLeftButton = this.seriesTabNavLeftButton;
|
|
648
|
+
tabNavRightButton = this.seriesTabNavRightButton;
|
|
649
|
+
}
|
|
650
|
+
else {
|
|
651
|
+
tabContainer = this.annotationsTabContainer;
|
|
652
|
+
tabNavLeftButton = this.annotationsTabNavLeftButton;
|
|
653
|
+
tabNavRightButton = this.annotationsTabNavRightButton;
|
|
654
|
+
}
|
|
655
|
+
if (!tabContainer) {
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
if (tabContainer.clientWidth == tabContainer.scrollWidth) {
|
|
659
|
+
tabNavLeftButton.setAttribute('disabled', '');
|
|
660
|
+
tabNavRightButton.setAttribute('disabled', '');
|
|
661
|
+
}
|
|
662
|
+
// left-end
|
|
663
|
+
else if (tabContainer.scrollLeft == 0) {
|
|
664
|
+
tabNavLeftButton.setAttribute('disabled', '');
|
|
665
|
+
tabNavRightButton.removeAttribute('disabled');
|
|
666
|
+
}
|
|
667
|
+
// right-end
|
|
668
|
+
else if (tabContainer.scrollLeft + tabContainer.clientWidth >= tabContainer.scrollWidth) {
|
|
669
|
+
tabNavLeftButton.removeAttribute('disabled');
|
|
670
|
+
tabNavRightButton.setAttribute('disabled', '');
|
|
671
|
+
}
|
|
672
|
+
else {
|
|
673
|
+
tabNavLeftButton.removeAttribute('disabled');
|
|
674
|
+
tabNavRightButton.removeAttribute('disabled');
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
_onTabScrollNavLeft(e, type) {
|
|
678
|
+
let tabContainer;
|
|
679
|
+
if (type === 'series') {
|
|
680
|
+
tabContainer = this.seriesTabContainer;
|
|
681
|
+
}
|
|
682
|
+
else {
|
|
683
|
+
tabContainer = this.annotationsTabContainer;
|
|
684
|
+
}
|
|
685
|
+
if (!tabContainer) {
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
tabContainer.style.scrollBehavior = 'smooth';
|
|
689
|
+
tabContainer.scrollLeft -= tabContainer.clientWidth;
|
|
690
|
+
tabContainer.style.scrollBehavior = 'auto';
|
|
691
|
+
}
|
|
692
|
+
_onTabScrollNavRight(e, type) {
|
|
693
|
+
let tabContainer;
|
|
694
|
+
if (type === 'series') {
|
|
695
|
+
tabContainer = this.seriesTabContainer;
|
|
696
|
+
}
|
|
697
|
+
else {
|
|
698
|
+
tabContainer = this.annotationsTabContainer;
|
|
699
|
+
}
|
|
700
|
+
if (!tabContainer) {
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
tabContainer.style.scrollBehavior = 'smooth';
|
|
704
|
+
tabContainer.scrollLeft += tabContainer.clientWidth;
|
|
705
|
+
tabContainer.style.scrollBehavior = 'auto';
|
|
706
|
+
}
|
|
288
707
|
}
|
|
289
708
|
__decorate([
|
|
290
709
|
property({ type: Object })
|
|
@@ -292,4 +711,22 @@ __decorate([
|
|
|
292
711
|
__decorate([
|
|
293
712
|
property({ type: String, attribute: 'chart-type' })
|
|
294
713
|
], InputChartAbstract.prototype, "chartType", void 0);
|
|
714
|
+
__decorate([
|
|
715
|
+
query('#annotations-tabs')
|
|
716
|
+
], InputChartAbstract.prototype, "annotationsTabs", void 0);
|
|
717
|
+
__decorate([
|
|
718
|
+
query('#annotations-tab-nav-left-button')
|
|
719
|
+
], InputChartAbstract.prototype, "annotationsTabNavLeftButton", void 0);
|
|
720
|
+
__decorate([
|
|
721
|
+
query('#annotations-tab-nav-right-button')
|
|
722
|
+
], InputChartAbstract.prototype, "annotationsTabNavRightButton", void 0);
|
|
723
|
+
__decorate([
|
|
724
|
+
query('#series-tabs')
|
|
725
|
+
], InputChartAbstract.prototype, "seriesTabs", void 0);
|
|
726
|
+
__decorate([
|
|
727
|
+
query('#series-tab-nav-left-button')
|
|
728
|
+
], InputChartAbstract.prototype, "seriesTabNavLeftButton", void 0);
|
|
729
|
+
__decorate([
|
|
730
|
+
query('#series-tab-nav-right-button')
|
|
731
|
+
], InputChartAbstract.prototype, "seriesTabNavRightButton", void 0);
|
|
295
732
|
//# sourceMappingURL=input-chart-abstract.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-chart-abstract.js","sourceRoot":"","sources":["../../../src/editors/input-chart-abstract.ts"],"names":[],"mappings":";AAA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;iDAA8C;AACpB;IAApD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;qDAAkC","sourcesContent":["import '@operato/i18n/ox-i18n.js'\n\nimport { html } from 'lit'\nimport { property } from 'lit/decorators.js'\nimport { random as randomColor, TinyColor } from '@ctrl/tinycolor'\n\nimport { InputChartStyles } from './input-chart-styles'\nimport { Configurer } from './configurer'\nimport { OxFormField } from '@operato/input'\n\nexport class InputChartAbstract extends OxFormField {\n static styles = [InputChartStyles]\n\n @property({ type: Object }) value: OperatoChart.ChartConfig | null = null\n @property({ type: String, attribute: 'chart-type' }) chartType: OperatoChart.ChartType\n\n private _configurer?: Configurer\n\n get configurer() {\n if (!this._configurer) {\n this._configurer = new Configurer(this.value, () => {\n return this.value || this.getDefaultChartConfig(this.chartType, this.getDefaultDatasets())\n })\n }\n return this._configurer\n }\n\n render() {\n const configurer = this.configurer\n\n return html`\n <legend><ox-i18n msgid=\"label.chart\">Chart</ox-i18n></legend>\n\n <label for=\"theme\"> <ox-i18n msgid=\"label.theme\">Theme</ox-i18n> </label>\n <select id=\"theme\" value-key=\"theme\" class=\"select-content\" .value=${configurer.theme || 'light'}>\n <option value=\"auto\">auto</option>\n <option value=\"dark\">dark</option>\n <option value=\"light\" checked>light</option>\n </select>\n\n <input id=\"tooltip\" type=\"checkbox\" value-key=\"tooltip\" ?checked=${configurer.tooltip} />\n <label for=\"tooltip\"> <ox-i18n msgid=\"label.tooltip\">Tooltip</ox-i18n> </label>\n\n <input id=\"animation\" type=\"checkbox\" value-key=\"animation\" ?checked=${configurer.animation} />\n <label for=\"animation\"> <ox-i18n msgid=\"label.animation\">Animation</ox-i18n> </label>\n\n <input id=\"display\" type=\"checkbox\" value-key=\"display\" ?checked=${configurer.display} />\n <label for=\"display\"> <ox-i18n msgid=\"label.legend\">Legend</ox-i18n> </label>\n\n <input id=\"stacked\" type=\"checkbox\" value-key=\"stacked\" ?checked=${configurer.stacked} />\n <label for=\"stacked\"> <ox-i18n msgid=\"label.stacked\">Stacked</ox-i18n> </label>\n\n ${configurer.display\n ? html`\n <label for=\"position\"> <ox-i18n msgid=\"label.position\">Position</ox-i18n> </label>\n <select id=\"position\" value-key=\"position\" class=\"select-content\" .value=${configurer.position || ''}>\n <option value=\"top\">top</option>\n <option value=\"right\">right</option>\n <option value=\"bottom\">bottom</option>\n <option value=\"left\">left</option>\n </select>\n `\n : html``}\n ${this.subTemplate()}\n `\n }\n\n connectedCallback() {\n super.connectedCallback()\n\n this.renderRoot.addEventListener('change', this.onValuesChanged.bind(this))\n }\n\n displayValueTemplate() {\n const configurer = this.configurer\n\n return html`\n <label for=\"value-format\"> <ox-i18n msgid=\"label.value-format\">Value Format</ox-i18n> </label>\n <input\n id=\"value-format\"\n type=\"text\"\n value-key=\"series.valueFormat\"\n .value=${configurer.series.valueFormat || ''}\n list=\"format-list\"\n />\n <datalist id=\"format-list\">\n <option value=\"#,###.\"></option>\n <option value=\"#,###.#\"></option>\n <option value=\"#,###.0\"></option>\n <option value=\"#,##0.#\"></option>\n <option value=\"#,##0.0\"></option>\n <option value=\"#,##0.0%\"></option>\n </datalist>\n\n <label for=\"value-prefix\"> <ox-i18n msgid=\"label.value-prefix\">Value Prefix</ox-i18n> </label>\n <input\n id=\"value-prefix\"\n type=\"text\"\n value-key=\"series.valuePrefix\"\n .value=${configurer.series.valuePrefix || ''}\n />\n\n <label for=\"value-suffix\"> <ox-i18n msgid=\"label.value-suffix\">Value Suffix</ox-i18n> </label>\n <input\n id=\"value-suffix\"\n type=\"text\"\n value-key=\"series.valueSuffix\"\n .value=${configurer.series.valueSuffix || ''}\n />\n\n <input\n id=\"display-value\"\n type=\"checkbox\"\n value-key=\"series.displayValue\"\n ?checked=${!!configurer.series.displayValue}\n />\n <label for=\"display-value\"> <ox-i18n msgid=\"label.value-display\">Value Display</ox-i18n> </label>\n\n ${configurer.series.displayValue\n ? html`\n <label for=\"font-color\"> <ox-i18n msgid=\"label.font-color\">Font Color</ox-i18n> </label>\n <ox-input-color\n id=\"font-color\"\n value-key=\"series.defaultFontColor\"\n .value=${configurer.series.defaultFontColor || '#000'}\n ></ox-input-color>\n <label for=\"font-size\"> <ox-i18n msgid=\"label.font-size\">Font Size</ox-i18n> </label>\n <input\n id=\"font-size\"\n type=\"number\"\n value-key=\"series.defaultFontSize\"\n value=${configurer.series.defaultFontSize || 10}\n />\n <label for=\"data-label-anchor\"> <ox-i18n msgid=\"label.position\">Position</ox-i18n> </label>\n <select\n id=\"data-label-anchor\"\n value-key=\"series.dataLabelAnchor\"\n value=${configurer.series.dataLabelAnchor || 'center'}\n >\n <option value=\"start\">Start</option>\n <option value=\"center\" selected>Center</option>\n <option value=\"end\">End</option>\n </select>\n `\n : html``}\n `\n }\n\n subTemplate() {\n return html``\n }\n\n getDefaultDatasets(): OperatoChart.Dataset[] {\n return [this.getDefaultDataset('bar')]\n }\n\n getDefaultDataset(seriesType: 'bar' | 'horizontalBar' | 'line' | 'radar' | 'pie'): OperatoChart.Dataset {\n return {\n label: 'Series 1',\n data: [],\n borderWidth: 1,\n dataKey: '',\n yAxisID: 'left',\n color: randomColor({\n hue: new TinyColor('#fff').clone().toString()\n }).toRgbString(),\n backgroundColor: '#FFFFFF',\n type: seriesType,\n stack: '',\n fill: false,\n lineTension: 0.4,\n pointStyle: 'circle',\n pointRadius: 3,\n valuePrefix: '',\n valueSuffix: '',\n displayValue: false\n }\n }\n\n getDefaultChartConfig(type: OperatoChart.ChartType, datasets?: OperatoChart.Dataset[]): OperatoChart.ChartConfig {\n return {\n data: {\n datasets: datasets || [],\n labelDataKey: ''\n },\n options: {\n theme: 'light',\n tooltip: true,\n animation: true,\n legend: {\n display: true,\n position: 'top'\n },\n scales: {\n xAxes: [this.getDefaultAxisOptions()],\n yAxes: [this.getDefaultAxisOptions()]\n },\n stacked: false,\n xGridLine: true,\n yGridLine: true,\n y2ndGridLine: false,\n multiAxis: false\n },\n type\n }\n }\n\n getDefaultAxisOptions(): OperatoChart.AxisOptions {\n return {\n axisTitle: '',\n barSpacing: 0,\n categorySpacing: 0,\n barPercentage: 0.9,\n ticks: {\n display: true,\n autoMin: true,\n autoMax: true,\n min: undefined,\n max: undefined,\n stepSize: undefined\n }\n }\n }\n\n onValuesChanged(e: Event) {\n e.stopPropagation()\n\n const element = e.target as HTMLInputElement\n let key = element.getAttribute('value-key')\n let value = element.value\n\n if (!key) {\n return\n }\n\n value = this._getElementValue(element)\n\n const attrs = key.split('.')\n let attr = attrs.shift() || ''\n let variable: any = this.configurer\n\n while (attrs.length > 0) {\n variable = variable[attr]\n attr = attrs.shift() || ''\n }\n\n variable[attr] = value\n\n this.value = { ...this.configurer.value }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n this.requestUpdate()\n }\n\n onTapAddTab(e: Event) {\n const configurer = this.configurer\n\n if (!configurer.config.data.datasets) return\n\n const lastSeriesIndex = configurer.config.data.datasets.length\n const chartType = configurer.series.type || configurer.config.type\n const color = configurer.datasets[lastSeriesIndex - 1]?.backgroundColor\n const lastSeriesColor = new TinyColor(Array.isArray(color) ? color[0] : color)\n\n const seriesModel = this._getSeriesModel({\n chartType: chartType!,\n datasetsLength: lastSeriesIndex,\n lastSeriesColor\n })\n\n configurer.config.data.datasets.push(seriesModel)\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n configurer.currentSeriesIndex = lastSeriesIndex\n\n this.value = { ...this.configurer.value }\n }\n\n onTapRemoveCurrentTab(index: number) {\n const configurer = this.configurer\n\n if (!configurer.config.data.datasets) {\n return\n }\n\n this.configurer.data.datasets.splice(index, 1)\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n configurer.currentSeriesIndex = Math.max(0, configurer.currentSeriesIndex - 1)\n\n this.requestUpdate()\n }\n\n _getSeriesModel({\n chartType,\n datasetsLength,\n lastSeriesColor\n }: {\n chartType: string\n datasetsLength: number\n lastSeriesColor: TinyColor\n }) {\n const addSeriesOption: any = {\n label: `series ${datasetsLength + 1}`,\n data: [],\n borderWidth: 1,\n dataKey: '',\n yAxisID: 'left',\n color: randomColor({\n hue: lastSeriesColor.toHsv().h\n }).toRgbString(),\n stack: ''\n }\n\n addSeriesOption.type = addSeriesOption.chartType = chartType\n return addSeriesOption\n }\n\n _getElementValue(element: HTMLElement) {\n switch (element.tagName) {\n case 'INPUT':\n switch ((element as HTMLInputElement).type) {\n case 'checkbox':\n return (element as HTMLInputElement).checked\n case 'number':\n return Number((element as HTMLInputElement).value) || 0\n case 'text':\n return String((element as HTMLInputElement).value)\n }\n default:\n return (element as any).value\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"input-chart-abstract.js","sourceRoot":"","sources":["../../../src/editors/input-chart-abstract.ts"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAGlE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,MAAM,OAAO,kBAAmB,SAAQ,WAAW;IAAnD;;QAG8B,UAAK,GAAoC,IAAI,CAAA;IAuwB3E,CAAC;aAzwBQ,WAAM,GAAG,CAAC,gBAAgB,CAAC,AAArB,CAAqB;IAelC,IAAI,UAAU;QACZ,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,IAAI,CAAC,WAAW,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE;gBACjD,OAAO,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,SAAS,EAA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,MAAM,CAAA;IAC5C,CAAC;IAED,oBAAoB,CAAC,CAAQ,EAAE,IAA8B;QAC3D,IAAI,YAA4C,CAAA;QAEhD,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtB,YAAY,GAAG,IAAI,CAAC,kBAAkB,CAAA;QACxC,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,IAAI,CAAC,uBAAuB,CAAA;QAC7C,CAAC;QAED,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,OAAM;QACR,CAAC;QAED,YAAY,CAAC,KAAK,CAAC,cAAc,GAAG,QAAQ,CAAA;QAC5C,YAAY,CAAC,UAAU,IAAI,YAAY,CAAC,WAAW,CAAA;QACnD,YAAY,CAAC,KAAK,CAAC,cAAc,GAAG,MAAM,CAAA;IAC5C,CAAC;;AAtwB2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAA8C;AACpB;IAApD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;qDAAkC;AAE1D;IAA3B,KAAK,CAAC,mBAAmB,CAAC;2DAA8B;AACd;IAA1C,KAAK,CAAC,kCAAkC,CAAC;uEAAqC;AACnC;IAA3C,KAAK,CAAC,mCAAmC,CAAC;wEAAsC;AAE1D;IAAtB,KAAK,CAAC,cAAc,CAAC;sDAAyB;AACT;IAArC,KAAK,CAAC,6BAA6B,CAAC;kEAAgC;AAC9B;IAAtC,KAAK,CAAC,8BAA8B,CAAC;mEAAiC","sourcesContent":["import '@operato/i18n/ox-i18n.js'\n\nimport { html, PropertyValues } from 'lit'\nimport { property, query } from 'lit/decorators.js'\nimport { random as randomColor, TinyColor } from '@ctrl/tinycolor'\nimport { MdIcon } from '@material/web/icon/icon.js'\n\nimport { InputChartStyles } from './input-chart-styles'\nimport { Configurer } from './configurer'\nimport { OxFormField } from '@operato/input'\n\nexport class InputChartAbstract extends OxFormField {\n static styles = [InputChartStyles]\n\n @property({ type: Object }) value: OperatoChart.ChartConfig | null = null\n @property({ type: String, attribute: 'chart-type' }) chartType: OperatoChart.ChartType\n\n @query('#annotations-tabs') annotationsTabs!: HTMLElement\n @query('#annotations-tab-nav-left-button') annotationsTabNavLeftButton!: MdIcon\n @query('#annotations-tab-nav-right-button') annotationsTabNavRightButton!: MdIcon\n\n @query('#series-tabs') seriesTabs!: HTMLElement\n @query('#series-tab-nav-left-button') seriesTabNavLeftButton!: MdIcon\n @query('#series-tab-nav-right-button') seriesTabNavRightButton!: MdIcon\n\n private _configurer?: Configurer\n\n get configurer() {\n if (!this._configurer) {\n this._configurer = new Configurer(this.value, () => {\n return this.value || this.getDefaultChartConfig(this.chartType, this.getDefaultDatasets())\n })\n }\n return this._configurer\n }\n\n render() {\n const configurer = this.configurer\n\n return html`\n <legend><ox-i18n msgid=\"label.chart\">Chart</ox-i18n></legend>\n\n <label for=\"theme\"> <ox-i18n msgid=\"label.theme\">Theme</ox-i18n> </label>\n <select id=\"theme\" value-key=\"theme\" class=\"select-content\" .value=${configurer.theme || 'light'}>\n <option value=\"auto\">auto</option>\n <option value=\"dark\">dark</option>\n <option value=\"light\" checked>light</option>\n </select>\n\n <input id=\"tooltip\" type=\"checkbox\" value-key=\"tooltip\" ?checked=${configurer.tooltip} />\n <label for=\"tooltip\"> <ox-i18n msgid=\"label.tooltip\">Tooltip</ox-i18n> </label>\n\n <input id=\"animation\" type=\"checkbox\" value-key=\"animation\" ?checked=${configurer.animation} />\n <label for=\"animation\"> <ox-i18n msgid=\"label.animation\">Animation</ox-i18n> </label>\n\n <input id=\"display\" type=\"checkbox\" value-key=\"display\" ?checked=${configurer.display} />\n <label for=\"display\"> <ox-i18n msgid=\"label.legend\">Legend</ox-i18n> </label>\n\n <input id=\"stacked\" type=\"checkbox\" value-key=\"stacked\" ?checked=${configurer.stacked} />\n <label for=\"stacked\"> <ox-i18n msgid=\"label.stacked\">Stacked</ox-i18n> </label>\n\n ${configurer.display\n ? html`\n <label for=\"position\"> <ox-i18n msgid=\"label.position\">Position</ox-i18n> </label>\n <select id=\"position\" value-key=\"position\" class=\"select-content\" .value=${configurer.position || ''}>\n <option value=\"top\">top</option>\n <option value=\"right\">right</option>\n <option value=\"bottom\">bottom</option>\n <option value=\"left\">left</option>\n </select>\n `\n : html``}\n ${this.subTemplate()}\n `\n }\n\n connectedCallback() {\n super.connectedCallback()\n\n this.renderRoot.addEventListener('change', this.onValuesChanged.bind(this))\n }\n\n protected firstUpdated(_changedProperties: PropertyValues): void {\n this.seriesTabContainer?.addEventListener('scroll', e => {\n this._onTabScroll(e, 'series')\n })\n\n this.annotationsTabContainer?.addEventListener('scroll', e => {\n this._onTabScroll(e, 'annotations')\n })\n }\n\n get seriesTabContainer(): HTMLElement | null | undefined {\n return this.seriesTabs\n }\n\n get annotationsTabContainer(): HTMLElement | null | undefined {\n return this.annotationsTabs\n }\n\n displayValueTemplate() {\n const configurer = this.configurer\n\n return html`\n <label for=\"value-format\"> <ox-i18n msgid=\"label.value-format\">Value Format</ox-i18n> </label>\n <input\n id=\"value-format\"\n type=\"text\"\n value-key=\"series.valueFormat\"\n .value=${configurer.series.valueFormat || ''}\n list=\"format-list\"\n />\n <datalist id=\"format-list\">\n <option value=\"#,###.\"></option>\n <option value=\"#,###.#\"></option>\n <option value=\"#,###.0\"></option>\n <option value=\"#,##0.#\"></option>\n <option value=\"#,##0.0\"></option>\n <option value=\"#,##0.0%\"></option>\n </datalist>\n\n <label for=\"value-prefix\"> <ox-i18n msgid=\"label.value-prefix\">Value Prefix</ox-i18n> </label>\n <input\n id=\"value-prefix\"\n type=\"text\"\n value-key=\"series.valuePrefix\"\n .value=${configurer.series.valuePrefix || ''}\n />\n\n <label for=\"value-suffix\"> <ox-i18n msgid=\"label.value-suffix\">Value Suffix</ox-i18n> </label>\n <input\n id=\"value-suffix\"\n type=\"text\"\n value-key=\"series.valueSuffix\"\n .value=${configurer.series.valueSuffix || ''}\n />\n\n <input\n id=\"display-value\"\n type=\"checkbox\"\n value-key=\"series.displayValue\"\n ?checked=${!!configurer.series.displayValue}\n />\n <label for=\"display-value\"> <ox-i18n msgid=\"label.value-display\">Value Display</ox-i18n> </label>\n\n ${configurer.series.displayValue\n ? html`\n <label for=\"font-color\"> <ox-i18n msgid=\"label.font-color\">Font Color</ox-i18n> </label>\n <ox-input-color\n id=\"font-color\"\n value-key=\"series.defaultFontColor\"\n .value=${configurer.series.defaultFontColor || '#000'}\n ></ox-input-color>\n <label for=\"font-size\"> <ox-i18n msgid=\"label.font-size\">Font Size</ox-i18n> </label>\n <input\n id=\"font-size\"\n type=\"number\"\n value-key=\"series.defaultFontSize\"\n value=${configurer.series.defaultFontSize || 10}\n />\n <label for=\"data-label-anchor\"> <ox-i18n msgid=\"label.position\">Position</ox-i18n> </label>\n <select\n id=\"data-label-anchor\"\n value-key=\"series.dataLabelAnchor\"\n value=${configurer.series.dataLabelAnchor || 'center'}\n >\n <option value=\"start\">Start</option>\n <option value=\"center\" selected>Center</option>\n <option value=\"end\">End</option>\n </select>\n `\n : html``}\n `\n }\n\n subTemplate() {\n return html``\n }\n\n getDefaultDatasets(): OperatoChart.Dataset[] {\n return [this.getDefaultDataset('bar')]\n }\n\n getDefaultDataset(seriesType: 'bar' | 'horizontalBar' | 'line' | 'radar' | 'pie'): OperatoChart.Dataset {\n return {\n label: 'Series 1',\n data: [],\n borderWidth: 1,\n dataKey: '',\n yAxisID: 'left',\n color: randomColor({\n hue: new TinyColor('#fff').clone().toString()\n }).toRgbString(),\n backgroundColor: '#FFFFFF',\n type: seriesType,\n stack: '',\n fill: false,\n lineTension: 0.4,\n pointStyle: 'circle',\n pointRadius: 3,\n valuePrefix: '',\n valueSuffix: '',\n displayValue: false\n }\n }\n\n getDefaultChartConfig(type: OperatoChart.ChartType, datasets?: OperatoChart.Dataset[]): OperatoChart.ChartConfig {\n return {\n data: {\n datasets: datasets || [],\n labelDataKey: ''\n },\n options: {\n theme: 'light',\n tooltip: true,\n animation: true,\n legend: {\n display: true,\n position: 'top'\n },\n scales: {\n xAxes: [this.getDefaultAxisOptions()],\n yAxes: [this.getDefaultAxisOptions()]\n },\n stacked: false,\n xGridLine: true,\n yGridLine: true,\n y2ndGridLine: false,\n multiAxis: false\n },\n type\n }\n }\n\n getDefaultAxisOptions(): OperatoChart.AxisOptions {\n return {\n axisTitle: '',\n barSpacing: 0,\n categorySpacing: 0,\n barPercentage: 0.9,\n ticks: {\n display: true,\n autoMin: true,\n autoMax: true,\n min: undefined,\n max: undefined,\n stepSize: undefined\n }\n }\n }\n\n onValuesChanged(e: Event) {\n e.stopPropagation()\n\n const element = e.target as HTMLInputElement\n let key = element.getAttribute('value-key')\n let value = element.value\n\n if (!key) {\n return\n }\n\n value = this._getElementValue(element)\n\n const attrs = key.split('.')\n let attr = attrs.shift() || ''\n let variable: any = this.configurer\n\n while (attrs.length > 0) {\n variable = variable[attr]\n attr = attrs.shift() || ''\n }\n\n variable[attr] = value\n\n this.value = { ...this.configurer.value }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n this.requestUpdate()\n }\n\n onTapAddTab(e: Event) {\n const configurer = this.configurer\n\n if (!configurer.config.data.datasets) return\n\n const lastSeriesIndex = configurer.config.data.datasets.length\n const chartType = configurer.series.type || configurer.config.type\n const color = configurer.datasets[lastSeriesIndex - 1]?.backgroundColor\n const lastSeriesColor = new TinyColor(Array.isArray(color) ? color[0] : color)\n\n const seriesModel = this._getSeriesModel({\n chartType: chartType!,\n datasetsLength: lastSeriesIndex,\n lastSeriesColor\n })\n\n configurer.config.data.datasets.push(seriesModel)\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n configurer.currentSeriesIndex = lastSeriesIndex\n\n this.value = { ...this.configurer.value }\n }\n\n onTapRemoveCurrentTab(index: number) {\n const configurer = this.configurer\n\n if (!configurer.config.data.datasets) {\n return\n }\n\n this.configurer.data.datasets.splice(index, 1)\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n configurer.currentSeriesIndex = Math.max(0, configurer.currentSeriesIndex - 1)\n\n this.requestUpdate()\n }\n\n onTapAddAnnotation(e: Event) {\n const configurer = this.configurer\n\n const lastAnnotationIndex = configurer.annotations.length\n configurer.annotations.push({ type: 'line', x1: 0, y1: 0 })\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n configurer.currentAnnotationIndex = lastAnnotationIndex\n\n this.value = { ...this.configurer.value }\n }\n\n onTapRemoveCurrentAnnotation(index: number) {\n const configurer = this.configurer\n\n if (!configurer.config.data.datasets) {\n return\n }\n\n this.configurer.data.datasets.splice(index, 1)\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n configurer.currentSeriesIndex = Math.max(0, configurer.currentSeriesIndex - 1)\n\n this.requestUpdate()\n }\n\n _getSeriesModel({\n chartType,\n datasetsLength,\n lastSeriesColor\n }: {\n chartType: string\n datasetsLength: number\n lastSeriesColor: TinyColor\n }) {\n const addSeriesOption: any = {\n label: `series ${datasetsLength + 1}`,\n data: [],\n borderWidth: 1,\n dataKey: '',\n yAxisID: 'left',\n color: randomColor({\n hue: lastSeriesColor.toHsv().h\n }).toRgbString(),\n stack: ''\n }\n\n addSeriesOption.type = addSeriesOption.chartType = chartType\n return addSeriesOption\n }\n\n _getElementValue(element: HTMLElement) {\n switch (element.tagName) {\n case 'INPUT':\n switch ((element as HTMLInputElement).type) {\n case 'checkbox':\n return (element as HTMLInputElement).checked\n case 'number':\n return Number((element as HTMLInputElement).value) || 0\n case 'text':\n return String((element as HTMLInputElement).value)\n }\n default:\n return (element as any).value\n }\n }\n\n annotationsTabTemplate() {\n const configurer = this.configurer\n const currentAnnotation = configurer.annotations[configurer.currentAnnotationIndex] || {}\n\n return html`\n <div id=\"annotations-properties-container\" fullwidth>\n <div id=\"annotations-tab-header\">\n <md-icon\n id=\"annotations-tab-nav-left-button\"\n @tap=${(e: Event) => {\n this._onTabScrollNavLeft(e, 'annotations')\n }}\n disabled\n >chevron_left</md-icon\n >\n <div\n id=\"annotations-tabs\"\n @change=${(e: Event) => {\n configurer.currentAnnotationIndex = (e.target as any).activeTabIndex\n }}\n active-tab-index=${configurer.currentAnnotationIndex}\n fit-container\n >\n ${configurer.annotations!.map(\n (annotation: any, index: number) => html`\n <div\n data-annotation=${index + 1}\n data-tab-index=${index}\n tab\n ?selected=${index == configurer.currentAnnotationIndex}\n @click=${(e: Event) => {\n const target = e.target as HTMLDivElement\n this.configurer.setCurrentAnnotationIndex(Number(target.getAttribute('data-tab-index')))\n this.value = { ...this.configurer.value }\n }}\n >\n ${index + 1}\n ${!configurer.annotations ||\n (configurer.annotations.length != 1 && configurer.currentAnnotationIndex == index)\n ? html` <md-icon @tap=${(e: Event) => this.onTapRemoveCurrentAnnotation(index)}> close </md-icon> `\n : html``}\n </div>\n `\n )}\n </div>\n <md-icon\n id=\"annotations-tab-nav-right-button\"\n @click=${(e: Event) => {\n this._onTabScrollNavRight(e, 'annotations')\n }}\n disabled\n >chevron_right</md-icon\n >\n </div>\n <div id=\"add-annotation-button-container\">\n <md-icon id=\"add-annotation-button\" @tap=${(e: Event) => this.onTapAddAnnotation(e)}>add</md-icon>\n </div>\n\n <div class=\"tab-content\">\n <label for=\"annotation-type\"> <ox-i18n msgid=\"label.chart-annotation-type\">Type</ox-i18n> </label>\n <select\n id=\"annotation-type\"\n class=\"select-content\"\n value-key=\"annotation.type\"\n .value=${currentAnnotation.type || ''}\n >\n <option value=\"line\">Line</option>\n <option value=\"text\">Text</option>\n <option value=\"box\">Box</option>\n <option value=\"horizontalLine\">Horizontal Line</option>\n <option value=\"verticalLine\">Vertical Line</option>\n <option value=\"custom\">Custom</option>\n </select>\n\n <label for=\"annotation-x1\">X1</label>\n <input\n id=\"annotation-x1\"\n type=\"number\"\n value-key=\"annotation.x1\"\n .value=${String(currentAnnotation.x1 || 0)}\n />\n\n <label for=\"annotation-y1\">Y1</label>\n <input\n id=\"annotation-y1\"\n type=\"number\"\n value-key=\"annotation.y1\"\n .value=${String(currentAnnotation.y1 || 0)}\n />\n\n <label for=\"annotation-x2\">X2</label>\n <input\n id=\"annotation-x2\"\n type=\"number\"\n value-key=\"annotation.x2\"\n .value=${String(currentAnnotation.x2 || 0)}\n />\n\n <label for=\"annotation-y2\">Y2</label>\n <input\n id=\"annotation-y2\"\n type=\"number\"\n value-key=\"annotation.y2\"\n .value=${String(currentAnnotation.y2 || 0)}\n />\n\n <label for=\"annotation-stroke\"> <ox-i18n msgid=\"label.stroke-style\">Stroke Style</ox-i18n> </label>\n <ox-input-color\n id=\"annotation-stroke\"\n value-key=\"annotation.stroke\"\n .value=${currentAnnotation.stroke}\n ></ox-input-color>\n\n <label for=\"annotation-stroke-thickness\">\n <ox-i18n msgid=\"label.stroke-thickness\">Stroke Thickness</ox-i18n>\n </label>\n <input\n id=\"annotation-stroke-thickness\"\n type=\"number\"\n value-key=\"annotation.strokeThickness\"\n .value=${String(currentAnnotation.strokeThickness || 1)}\n />\n\n <label for=\"annotation-fill\"> <ox-i18n msgid=\"label.fill\">Fill</ox-i18n> </label>\n <ox-input-color\n id=\"annotation-fill\"\n value-key=\"annotation.fill\"\n .value=${currentAnnotation.fill}\n ></ox-input-color>\n\n <label for=\"annotation-text\"> <ox-i18n msgid=\"label.annotation-text\">Text</ox-i18n> </label>\n <input id=\"annotation-text\" type=\"text\" value-key=\"annotation.text\" .value=${currentAnnotation.text || ''} />\n\n <label for=\"annotation-horizontal-anchor\">\n <ox-i18n msgid=\"label.horizontal-anchor\">Horizontal Anchor</ox-i18n>\n </label>\n <select\n id=\"annotation-horizontal-anchor\"\n class=\"select-content\"\n value-key=\"annotation.horizontalAnchorPoint\"\n .value=${currentAnnotation.horizontalAnchorPoint || ''}\n >\n <option value=\"Left\">Left</option>\n <option value=\"Center\">Center</option>\n <option value=\"Right\">Right</option>\n </select>\n\n <label for=\"annotation-vertical-anchor\">\n <ox-i18n msgid=\"label.vertical-anchor\">Vertical Anchor</ox-i18n>\n </label>\n <select\n id=\"annotation-vertical-anchor\"\n class=\"select-content\"\n value-key=\"annotation.verticalAnchorPoint\"\n .value=${currentAnnotation.verticalAnchorPoint || ''}\n >\n <option value=\"Top\">Top</option>\n <option value=\"Center\">Center</option>\n <option value=\"Bottom\">Bottom</option>\n </select>\n </div>\n </div>\n `\n }\n\n multiSeriesTabTemplate() {\n const configurer = this.configurer\n\n return html`\n <div id=\"series-properties-container\" fullwidth>\n <div id=\"series-tab-header\">\n <md-icon\n id=\"series-tab-nav-left-button\"\n @tap=${(e: Event) => {\n this._onTabScrollNavLeft(e, 'series')\n }}\n disabled\n >chevron_left</md-icon\n >\n <div\n id=\"series-tabs\"\n @change=${(e: Event) => {\n configurer.currentSeriesIndex = (e.target as any).activeTabIndex\n }}\n active-tab-index=${configurer.currentSeriesIndex}\n fit-container\n >\n ${configurer.datasets.map(\n (dataset: any, index: number) => html`\n <div\n data-series=${index + 1}\n data-tab-index=${index}\n tab\n ?selected=${index == configurer.currentSeriesIndex}\n @click=${(e: Event) => {\n const target = e.target as HTMLDivElement\n this.configurer.setCurrentSeriesIndex(Number(target.getAttribute('data-tab-index')))\n this.value = { ...this.configurer.value }\n }}\n >\n ${index + 1}\n ${!configurer.datasets || (configurer.datasets.length != 1 && configurer.currentSeriesIndex == index)\n ? html` <md-icon @tap=${(e: Event) => this.onTapRemoveCurrentTab(index)}> close </md-icon> `\n : html``}\n </div>\n `\n )}\n </div>\n <md-icon\n id=\"series-tab-nav-right-button\"\n @click=${(e: Event) => {\n this._onTabScrollNavRight(e, 'series')\n }}\n disabled\n >chevron_right</md-icon\n >\n </div>\n <div id=\"add-series-button-container\">\n <md-icon id=\"add-series-button\" @tap=${(e: Event) => this.onTapAddTab(e)}>add</md-icon>\n </div>\n\n <div class=\"tab-content\">\n <label for=\"data-key\"> <ox-i18n msgid=\"label.data-key\">Data Key</ox-i18n> </label>\n <input id=\"data-key\" type=\"text\" value-key=\"dataKey\" .value=${configurer.dataKey || ''} />\n\n ${this.chartType == 'line' || this.chartType == 'bar'\n ? html`\n <label for=\"series-type\"> <ox-i18n msgid=\"label.series-type\">Type</ox-i18n> </label>\n <select\n id=\"series-type\"\n class=\"select-content\"\n value-key=\"series.type\"\n .value=${configurer.series.type || ''}\n >\n <option value=\"bar\" selected>Bar</option>\n <option value=\"line\">Line</option>\n </select>\n `\n : html``}\n\n <label for=\"series-label\"> <ox-i18n msgid=\"label.label\">Label</ox-i18n> </label>\n <input id=\"series-label\" type=\"text\" value-key=\"series.label\" .value=${configurer.series.label || ''} />\n\n ${configurer.series.type == 'line'\n ? html`\n <label for=\"series-line-tension\"> <ox-i18n msgid=\"label.line-tension\">Line Tension</ox-i18n> </label>\n <select\n id=\"series-line-tension\"\n class=\"select-content\"\n value-key=\"series.lineTension\"\n .value=${String(configurer.series.lineTension || 0)}\n >\n <option value=\"0.4\">Smooth</option>\n <option value=\"0\">Angled</option>\n </select>\n `\n : html``}\n ${configurer.series.type == 'line'\n ? html`\n <label for=\"series-border-width\"> <ox-i18n msgid=\"label.border-width\">Border Width</ox-i18n> </label>\n <input\n id=\"series-border-width\"\n type=\"number\"\n value-key=\"series.borderWidth\"\n .value=${String(configurer.series.borderWidth || 0)}\n />\n `\n : html``}\n\n <label for=\"series-color\"> <ox-i18n msgid=\"label.color\">Color</ox-i18n> </label>\n <ox-input-color id=\"series-color\" value-key=\"color\" .value=${configurer.color}></ox-input-color>\n\n ${configurer.series.type == 'line'\n ? html`\n <label for=\"series-point-style\"> <ox-i18n msgid=\"label.point-shape\">Point Shape</ox-i18n> </label>\n <select\n id=\"series-point-style\"\n class=\"select-content\"\n value-key=\"series.pointStyle\"\n .value=${configurer.series.pointStyle || ''}\n >\n <option value=\"\"> </option>\n <option value=\"circle\">⚬</option>\n <option value=\"triangle\">▵</option>\n <option value=\"rect\">□</option>\n <option value=\"rectRot\">◇</option>\n <option value=\"cross\">+</option>\n <option value=\"crossRot\">⨉</option>\n <option value=\"star\">✱</option>\n <option value=\"line\">―</option>\n <option value=\"dash\">┄</option>\n </select>\n\n <label for=\"series-point-radius\"> <ox-i18n msgid=\"label.point-size\">Point Size</ox-i18n> </label>\n <input\n id=\"series-point-radius\"\n type=\"number\"\n value-key=\"series.pointRadius\"\n .value=${String(configurer.series.pointRadius || 0)}\n />\n `\n : html``} <label for=\"series-stack\"> <ox-i18n msgid=\"label.stack-group\">Stack group</ox-i18n> </label>\n <input id=\"series-stack\" type=\"text\" value-key=\"series.stack\" .value=${configurer.series.stack || ''} />\n ${configurer.series.type == 'line'\n ? html`\n <input id=\"seires-fill\" type=\"checkbox\" value-key=\"series.fill\" ?checked=${configurer.series.fill} />\n <label for=\"seires-fill\"> <ox-i18n msgid=\"label.fill\">Fill</ox-i18n> </label>\n `\n : html``}\n ${configurer.multiAxis\n ? html`\n <label for=\"series-y-axis-id\"> <ox-i18n msgid=\"label.target-axis\">Target Axis</ox-i18n> </label>\n <select\n id=\"series-y-axis-id\"\n class=\"select-content\"\n value-key=\"series.yAxisID\"\n .value=${configurer.series.yAxisID || ''}\n >\n <option value=\"left\">Left</option>\n <option value=\"right\">Right</option>\n </select>\n `\n : html``}\n ${this.displayValueTemplate()}\n </div>\n </div>\n `\n }\n\n _onTabScroll(e: Event, type: 'series' | 'annotations') {\n let tabContainer: HTMLElement | null | undefined\n let tabNavLeftButton: MdIcon\n let tabNavRightButton: MdIcon\n\n if (type === 'series') {\n tabContainer = this.seriesTabContainer\n tabNavLeftButton = this.seriesTabNavLeftButton\n tabNavRightButton = this.seriesTabNavRightButton\n } else {\n tabContainer = this.annotationsTabContainer\n tabNavLeftButton = this.annotationsTabNavLeftButton\n tabNavRightButton = this.annotationsTabNavRightButton\n }\n\n if (!tabContainer) {\n return\n }\n\n if (tabContainer.clientWidth == tabContainer.scrollWidth) {\n tabNavLeftButton.setAttribute('disabled', '')\n tabNavRightButton.setAttribute('disabled', '')\n }\n // left-end\n else if (tabContainer.scrollLeft == 0) {\n tabNavLeftButton.setAttribute('disabled', '')\n tabNavRightButton.removeAttribute('disabled')\n }\n // right-end\n else if (tabContainer.scrollLeft + tabContainer.clientWidth >= tabContainer.scrollWidth) {\n tabNavLeftButton.removeAttribute('disabled')\n tabNavRightButton.setAttribute('disabled', '')\n } else {\n tabNavLeftButton.removeAttribute('disabled')\n tabNavRightButton.removeAttribute('disabled')\n }\n }\n\n _onTabScrollNavLeft(e: Event, type: 'series' | 'annotations') {\n let tabContainer: HTMLElement | null | undefined\n\n if (type === 'series') {\n tabContainer = this.seriesTabContainer\n } else {\n tabContainer = this.annotationsTabContainer\n }\n\n if (!tabContainer) {\n return\n }\n\n tabContainer.style.scrollBehavior = 'smooth'\n tabContainer.scrollLeft -= tabContainer.clientWidth\n tabContainer.style.scrollBehavior = 'auto'\n }\n\n _onTabScrollNavRight(e: Event, type: 'series' | 'annotations') {\n let tabContainer: HTMLElement | null | undefined\n\n if (type === 'series') {\n tabContainer = this.seriesTabContainer\n } else {\n tabContainer = this.annotationsTabContainer\n }\n\n if (!tabContainer) {\n return\n }\n\n tabContainer.style.scrollBehavior = 'smooth'\n tabContainer.scrollLeft += tabContainer.clientWidth\n tabContainer.style.scrollBehavior = 'auto'\n }\n}\n"]}
|