@operato/scene-chartjs 8.0.0-alpha.2 → 8.0.0-alpha.4
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +9 -0
- package/dist/chartjs.js +2 -0
- package/dist/chartjs.js.map +1 -1
- package/dist/editors/property-editor-chartjs-abstract.d.ts +50 -0
- package/dist/editors/property-editor-chartjs-abstract.js +285 -0
- package/dist/editors/property-editor-chartjs-abstract.js.map +1 -0
- package/dist/editors/property-editor-chartjs-hbar.d.ts +10 -0
- package/dist/editors/property-editor-chartjs-hbar.js +158 -0
- package/dist/editors/property-editor-chartjs-hbar.js.map +1 -0
- package/dist/editors/property-editor-chartjs-mixed.d.ts +17 -0
- package/dist/editors/property-editor-chartjs-mixed.js +186 -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 +371 -0
- package/dist/editors/property-editor-chartjs-multi-series-abstract.js.map +1 -0
- package/dist/editors/property-editor-chartjs-pie.d.ts +18 -0
- package/dist/editors/property-editor-chartjs-pie.js +74 -0
- package/dist/editors/property-editor-chartjs-pie.js.map +1 -0
- package/dist/editors/property-editor-chartjs-radar.d.ts +8 -0
- package/dist/editors/property-editor-chartjs-radar.js +36 -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 +161 -0
- package/dist/editors/property-editor-chartjs-styles.js.map +1 -0
- package/dist/editors/property-editor-chartjs.d.ts +10 -0
- package/dist/editors/property-editor-chartjs.js +77 -0
- package/dist/editors/property-editor-chartjs.js.map +1 -0
- package/dist/ox-chart.d.ts +1 -2
- package/dist/ox-chart.js +1 -3
- package/dist/ox-chart.js.map +1 -1
- package/package.json +2 -2
- package/src/chartjs.ts +1 -0
- package/src/ox-chart.ts +1 -5
- package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"property-editor-chartjs-multi-series-abstract.js","sourceRoot":"","sources":["../../src/editors/property-editor-chartjs-multi-series-abstract.ts"],"names":[],"mappings":";AAAA,OAAO,2BAA2B,CAAA;AAClC,OAAO,gCAAgC,CAAA;AACvC,OAAO,gCAAgC,CAAA;AAEvC,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAKzC,OAAO,6BAA6B,MAAM,oCAAoC,CAAA;AAE9E,MAAqB,wCAAyC,SAAQ,6BAA6B;IAcjG;QACE,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,KAAK,GAAG;YACX,OAAO,EAAE;gBACP,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE;oBACN,KAAK,EAAE;wBACL;4BACE,KAAK,EAAE,EAAE;yBACV;qBACF;oBACD,KAAK,EAAE;wBACL;4BACE,KAAK,EAAE,EAAE;yBACV;qBACF;iBACF;aACF;YACD,IAAI,EAAE;gBACJ,QAAQ,EAAE,EAAE;aACb;SACF,CAAA;IACH,CAAC;IAMD,IAAI,KAAK;QACP,IAAI,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,CAAA;QACjD,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,MAAM;YAAE,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAA;QACzE,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,OAAO;YAAE,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAA;QAC1E,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,eAAe,CAAA;IAC7C,CAAC;IAED,IAAI,KAAK,CAAC,KAAK;QACb,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAA;QAClC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AC,gBAAgB,CAAC,QAAQ,GAAG,KAAK,CAAA;YACtC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,GAAG,KAAK,CAAA;QACzC,CAAC;IACH,CAAC;IAED,mBAAmB,CAAC,CAAQ;QAC1B,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,OAAM;QACR,CAAC;QAED,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,cAAc,GAAG,QAAQ,CAAA;QACjD,IAAI,CAAC,YAAY,CAAC,UAAU,IAAI,IAAI,CAAC,YAAY,CAAC,WAAW,CAAA;QAC7D,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,cAAc,GAAG,MAAM,CAAA;IACjD,CAAC;IAED,oBAAoB,CAAC,CAAQ;QAC3B,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,OAAM;QACR,CAAC;QAED,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,cAAc,GAAG,QAAQ,CAAA;QACjD,IAAI,CAAC,YAAY,CAAC,UAAU,IAAI,IAAI,CAAC,YAAY,CAAC,WAAW,CAAA;QAC7D,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,cAAc,GAAG,MAAM,CAAA;IACjD,CAAC;;AAvXM,+CAAM,GAAG;IACd,GAAG,6BAA6B,CAAC,MAAM;IACvC,GAAG,CAAA;;;;;;;;KAQF;CACF,CAAA;eAZkB,wCAAwC;AAuC3C;IAAf,KAAK,CAAC,OAAO,CAAC;sEAAmB;AACH;IAA9B,KAAK,CAAC,sBAAsB,CAAC;kFAA8B;AAC5B;IAA/B,KAAK,CAAC,uBAAuB,CAAC;mFAA+B","sourcesContent":["import '@material/mwc-icon-button'\nimport '@polymer/iron-pages/iron-pages'\nimport '@polymer/paper-tabs/paper-tabs'\n\nimport '@operato/i18n/ox-i18n.js'\n\nimport { css, html } from 'lit'\nimport { query } from 'lit/decorators.js'\n\nimport { Properties } from '@hatiolab/things-scene'\nimport { IconButton } from '@material/mwc-icon-button'\n\nimport PropertyEditorChartJSAbstract from './property-editor-chartjs-abstract'\n\nexport default class PropertyEditorChartJSMultiSeriesAbstract extends PropertyEditorChartJSAbstract {\n static styles = [\n ...PropertyEditorChartJSAbstract.styles,\n css`\n paper-tabs {\n background-color: rgb(204, 204, 204);\n }\n input[type='text'],\n input[type='number'] {\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n `\n ]\n\n constructor() {\n super()\n\n this.value = {\n options: {\n legend: {},\n scales: {\n xAxes: [\n {\n ticks: {}\n }\n ],\n yAxes: [\n {\n ticks: {}\n }\n ]\n }\n },\n data: {\n datasets: []\n }\n }\n }\n\n @query('#tabs') tabs!: HTMLElement\n @query('#tab-nav-left-button') tabNavLeftButton!: IconButton\n @query('#tab-nav-right-button') tabNavRightButton!: IconButton\n\n get color() {\n var oldVersionColor = this.series.backgroundColor\n if (this.series.type == 'line') oldVersionColor = this.series.borderColor\n if (this.series.type == 'radar') oldVersionColor = this.series.borderColor\n return this.series.color || oldVersionColor\n }\n\n set color(color) {\n this.series.color = color\n delete this.series.backgroundColor\n delete this.series.borderColor\n }\n\n get xAxes0() {\n return this.scales.xAxes[0]\n }\n\n set xAxes0(xAxes0) {\n this.scales.xAxes[0] = xAxes0\n }\n\n get yAxes0() {\n return this.scales.yAxes[0]\n }\n\n set yAxes0(yAxes0) {\n this.scales.yAxes[0] = yAxes0\n }\n\n get yAxes1() {\n return this.scales.yAxes[1]\n }\n\n set yAxes1(yAxes1) {\n this.scales.yAxes[1] = yAxes1\n }\n\n get multiAxis() {\n return this.value.options.multiAxis\n }\n\n set multiAxis(multiAxis) {\n this.value.options.multiAxis = multiAxis\n }\n\n get tabContainer(): HTMLElement | null | undefined {\n return this.tabs.shadowRoot?.querySelector('#tabsContainer')\n }\n\n firstUpdated() {\n super.firstUpdated()\n\n this.tabContainer?.addEventListener('scroll', e => {\n this._onTabScroll(e)\n })\n }\n\n editorTemplate(props: Properties) {\n return html`\n <input type=\"checkbox\" value-key=\"multiAxis\" .checked=${this.multiAxis} />\n <label> <ox-i18n msgid=\"label.multi-axis\">Multi Axis</ox-i18n> </label>\n\n <legend><ox-i18n msgid=\"label.series\">Series</ox-i18n></legend>\n\n ${this.multiSeriesTabTemplate()}\n\n <legend><ox-i18n msgid=\"label.x-axes\">X Axes</ox-i18n></legend>\n\n <label> <ox-i18n msgid=\"label.data-key\">Data Key</ox-i18n> </label>\n <input type=\"text\" value-key=\"labelDataKey\" .value=${this.labelDataKey} />\n\n <label> <ox-i18n msgid=\"label.title\">Title</ox-i18n> </label>\n <input type=\"text\" value-key=\"xAxes0.axisTitle\" .value=${this.xAxes0.axisTitle || ''} />\n\n <label> <ox-i18n msgid=\"label.thickness\">Thickness</ox-i18n> </label>\n <input type=\"number\" value-key=\"xAxes0.barPercentage\" .value=${this.xAxes0.barPercentage} />\n\n <input type=\"checkbox\" value-key=\"value.options.xGridLine\" .checked=${this.value.options.xGridLine} />\n <label> <ox-i18n msgid=\"label.grid-line\">Grid Line</ox-i18n> </label>\n\n <input type=\"checkbox\" value-key=\"xAxes0.ticks.display\" .checked=${this.xAxes0.ticks.display} />\n <label> <ox-i18n msgid=\"label.display-tick\">Display Tick</ox-i18n> </label>\n\n <legend><ox-i18n msgid=\"label.y-axes\">Y Axes</ox-i18n></legend>\n\n <label> <ox-i18n msgid=\"label.title\">Title</ox-i18n> </label>\n <input type=\"text\" value-key=\"yAxes0.axisTitle\" .value=${this.yAxes0.axisTitle || ''} />\n\n <input type=\"checkbox\" value-key=\"yAxes0.ticks.autoMin\" .checked=${this.yAxes0.ticks.autoMin} />\n <label> <ox-i18n msgid=\"label.axis-min-auto\">Min Auto</ox-i18n> </label>\n\n <input type=\"checkbox\" value-key=\"yAxes0.ticks.autoMax\" .checked=${this.yAxes0.ticks.autoMax} />\n <label> <ox-i18n msgid=\"label.axis-max-auto\">Max Auto</ox-i18n> </label>\n\n ${!this.yAxes0.ticks.autoMin\n ? html`\n <label> <ox-i18n msgid=\"label.axis-min\">Min</ox-i18n> </label>\n <input type=\"number\" value-key=\"yAxes0.ticks.min\" .value=${this.yAxes0.ticks.min} />\n `\n : html``}\n ${!this.yAxes0.ticks.autoMax\n ? html`\n <label> <ox-i18n msgid=\"label.axis-max\">Max</ox-i18n> </label>\n <input type=\"number\" value-key=\"yAxes0.ticks.max\" .value=${this.yAxes0.ticks.max} />\n `\n : html``}\n\n <label> <ox-i18n msgid=\"label.axis-step-size\">StepSize</ox-i18n> </label>\n <input type=\"number\" value-key=\"yAxes0.ticks.stepSize\" .value=${this.yAxes0.ticks.stepSize} />\n\n <input type=\"checkbox\" value-key=\"value.options.yGridLine\" .checked=${this.value.options.yGridLine} />\n <label> <ox-i18n msgid=\"label.grid-line\">Grid Line</ox-i18n> </label>\n\n <input type=\"checkbox\" value-key=\"yAxes0.ticks.display\" .checked=${this.yAxes0.ticks.display} />\n <label> <ox-i18n msgid=\"label.display-tick\">Display Tick</ox-i18n> </label>\n\n ${this.value.options.multiAxis\n ? html`\n <legend><ox-i18n msgid=\"label.y-2nd-axes\">Y 2nd Axes</ox-i18n></legend>\n\n <label> <ox-i18n msgid=\"label.title\">Title</ox-i18n> </label>\n <input type=\"text\" value-key=\"yAxes1.axisTitle\" .value=${this.yAxes1.axisTitle || ''} />\n\n <input type=\"checkbox\" value-key=\"yAxes1.ticks.autoMin\" .checked=${this.yAxes1.ticks.autoMin} />\n <label> <ox-i18n msgid=\"label.axis-min-auto\">Min Auto</ox-i18n> </label>\n\n <input type=\"checkbox\" value-key=\"yAxes1.ticks.autoMax\" .checked=${this.yAxes1.ticks.autoMax} />\n <label> <ox-i18n msgid=\"label.axis-max-auto\">Max Auto</ox-i18n> </label>\n\n ${!this.yAxes1.ticks.autoMin\n ? html`\n <label> <ox-i18n msgid=\"label.axis-min\">Min</ox-i18n> </label>\n <input type=\"number\" value-key=\"yAxes1.ticks.min\" .value=${this.yAxes1.ticks.min} />\n `\n : html``}\n ${!this.yAxes1.ticks.autoMax\n ? html`\n <label> <ox-i18n msgid=\"label.axis-max\">Max</ox-i18n> </label>\n <input type=\"number\" value-key=\"yAxes1.ticks.max\" .value=${this.yAxes1.ticks.max} />\n `\n : html``}\n\n <label> <ox-i18n msgid=\"label.axis-step-size\">StepSize</ox-i18n> </label>\n <input type=\"number\" value-key=\"yAxes1.ticks.stepSize\" .value=${this.yAxes1.ticks.stepSize} />\n\n <input type=\"checkbox\" value-key=\"value.options.y2ndGridLine\" .checked=${this.value.options.y2ndGridLine} />\n <label> <ox-i18n msgid=\"label.grid-line\">Grid Line</ox-i18n> </label>\n\n <input type=\"checkbox\" value-key=\"yAxes1.ticks.display\" .checked=${this.yAxes1.ticks.display} />\n <label> <ox-i18n msgid=\"label.display-tick\">Display Tick</ox-i18n> </label>\n `\n : html``}\n `\n }\n\n multiSeriesTabTemplate() {\n return html`\n <div id=\"series-properties-container\" fullwidth>\n <div id=\"tab-header\">\n <mwc-icon-button\n id=\"tab-nav-left-button\"\n icon=\"chevron_left\"\n @click=${(e: Event) => {\n this._onTabScrollNavLeft(e)\n }}\n disabled\n ></mwc-icon-button>\n <paper-tabs\n id=\"tabs\"\n @iron-select=${(e: Event) => (this.currentSeriesIndex = (e.target as any).selected)}\n .selected=${this.currentSeriesIndex}\n no-bar\n noink\n scrollable\n hide-scroll-buttons\n fit-container\n >\n ${this.datasets.map(\n (dataset: any, index: number) => html`\n <paper-tab data-series=\"${index + 1}\" noink\n >${index + 1}\n ${!this.datasets || (this.datasets.length != 1 && this.currentSeriesIndex == index)\n ? html`\n <mwc-icon-button icon=\"close\" @tap=${(e: Event) => this.onTapRemoveCurrentTab(e)}>\n </mwc-icon-button>\n `\n : html``}\n </paper-tab>\n `\n )}\n </paper-tabs>\n <mwc-icon-button\n id=\"tab-nav-right-button\"\n icon=\"chevron_right\"\n @click=${(e: Event) => {\n this._onTabScrollNavRight(e)\n }}\n disabled\n ></mwc-icon-button>\n </div>\n <div id=\"add-series-button-container\">\n <mwc-icon-button\n id=\"add-series-button\"\n icon=\"add\"\n @tap=${(e: Event) => this.onTapAddTab(e)}\n ></mwc-icon-button>\n </div>\n\n <iron-pages .selected=${this.currentSeriesIndex} .attr-for-selected=\"series-index\">\n ${this.datasets.map(\n (dataset: any, index: number) => html`\n <div class=\"tab-content\" series-index=\"${index}\">\n <label> <ox-i18n msgid=\"label.data-key\">Data Key</ox-i18n> </label>\n <input type=\"text\" value-key=\"dataKey\" .value=${this.dataKey} />\n\n ${this.value.type == 'bar'\n ? html`\n <label> <ox-i18n msgid=\"label.type\">type</ox-i18n> </label>\n <select class=\"select-content\" value-key=\"series.type\" .value=${this.series.type}>\n <option value=\"bar\" selected>bar</option>\n <option value=\"line\">line</option>\n </select>\n `\n : html``}\n\n <label> <ox-i18n msgid=\"label.label\">label</ox-i18n> </label>\n <input type=\"text\" value-key=\"series.label\" .value=${this.series.label} />\n\n ${this.series.type == 'line'\n ? html`\n <label> <ox-i18n msgid=\"label.line-tension\">line tension</ox-i18n> </label>\n <select class=\"select-content\" value-key=\"series.lineTension\" .value=${this.series.lineTension}>\n <option value=\"0.4\">smooth</option>\n <option value=\"0\">angled</option>\n </select>\n `\n : html``}\n ${this.series.type == 'line'\n ? html`\n <label> <ox-i18n msgid=\"label.border-width\">border width</ox-i18n> </label>\n <input type=\"number\" value-key=\"series.borderWidth\" .value=${this.series.borderWidth} />\n `\n : html``}\n\n <label> <ox-i18n msgid=\"label.color\">color</ox-i18n> </label>\n <ox-input-color value-key=\"color\" .value=${this.color}></ox-input-color>\n\n ${this.series.type == 'line'\n ? html`\n <label> <ox-i18n msgid=\"label.point-shape\">point shape</ox-i18n> </label>\n <select class=\"select-content\" value-key=\"series.pointStyle\" .value=${this.series.pointStyle}>\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> <ox-i18n msgid=\"label.point-size\">point size</ox-i18n> </label>\n <input type=\"number\" value-key=\"series.pointRadius\" .value=${this.series.pointRadius} />\n `\n : html``} <label> <ox-i18n msgid=\"label.stack-group\">Stack group</ox-i18n> </label>\n <input type=\"text\" value-key=\"series.stack\" .value=${this.series.stack || ''} /> ${this.series.type ==\n 'line'\n ? html`\n <input type=\"checkbox\" value-key=\"series.fill\" .checked=${this.series.fill} />\n <label> <ox-i18n msgid=\"label.fill\">fill</ox-i18n> </label>\n `\n : html``}\n ${this.multiAxis\n ? html`\n <label> <ox-i18n msgid=\"label.target-axis\">target axis</ox-i18n> </label>\n <select class=\"select-content\" value-key=\"series.yAxisID\" .value=${this.series.yAxisID}>\n <option value=\"left\">left</option>\n <option value=\"right\">right</option>\n </select>\n `\n : html``}\n ${this.displayValueTemplate()}\n </div>\n `\n )}\n </iron-pages>\n </div>\n `\n }\n\n _onTabScroll(e: Event) {\n if (!this.tabContainer) {\n return\n }\n\n if (this.tabContainer.clientWidth == this.tabContainer.scrollWidth) {\n this.tabNavLeftButton.disabled = true\n this.tabNavRightButton.disabled = true\n }\n // left-end\n else if (this.tabContainer.scrollLeft == 0) {\n this.tabNavLeftButton.disabled = true\n this.tabNavRightButton.disabled = false\n }\n // right-end\n else if (this.tabContainer.scrollLeft + this.tabContainer.clientWidth >= this.tabContainer.scrollWidth) {\n this.tabNavLeftButton.disabled = false\n this.tabNavRightButton.disabled = true\n } else {\n this.tabNavLeftButton.disabled = false\n this.tabNavRightButton.disabled = false\n }\n }\n\n _onTabScrollNavLeft(e: Event) {\n if (!this.tabContainer) {\n return\n }\n\n this.tabContainer.style.scrollBehavior = 'smooth'\n this.tabContainer.scrollLeft -= this.tabContainer.clientWidth\n this.tabContainer.style.scrollBehavior = 'auto'\n }\n\n _onTabScrollNavRight(e: Event) {\n if (!this.tabContainer) {\n return\n }\n\n this.tabContainer.style.scrollBehavior = 'smooth'\n this.tabContainer.scrollLeft += this.tabContainer.clientWidth\n this.tabContainer.style.scrollBehavior = 'auto'\n }\n}\n"]}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import '@operato/i18n/ox-i18n.js';
|
2
|
+
import { Properties } from '@hatiolab/things-scene';
|
3
|
+
import PropertyEditorChartJSAbstract from './property-editor-chartjs-abstract';
|
4
|
+
export default class PropertyEditorChartJSPie extends PropertyEditorChartJSAbstract {
|
5
|
+
static styles: import("lit").CSSResult[];
|
6
|
+
constructor();
|
7
|
+
get valueFormat(): any;
|
8
|
+
set valueFormat(valueFormat: any);
|
9
|
+
get valuePrefix(): any;
|
10
|
+
set valuePrefix(valuePrefix: any);
|
11
|
+
get valueSuffix(): any;
|
12
|
+
set valueSuffix(valueSuffix: any);
|
13
|
+
get color(): any;
|
14
|
+
set color(color: any);
|
15
|
+
get displayValue(): any;
|
16
|
+
set displayValue(displayValue: any);
|
17
|
+
editorTemplate(props: Properties): import("lit-html").TemplateResult<1>;
|
18
|
+
}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import { __decorate } from "tslib";
|
2
|
+
import '@operato/i18n/ox-i18n.js';
|
3
|
+
import PropertyEditorChartJSAbstract from './property-editor-chartjs-abstract';
|
4
|
+
import { customElement } from 'lit/decorators.js';
|
5
|
+
import { html } from 'lit';
|
6
|
+
let PropertyEditorChartJSPie = class PropertyEditorChartJSPie extends PropertyEditorChartJSAbstract {
|
7
|
+
constructor() {
|
8
|
+
super();
|
9
|
+
this.value = {
|
10
|
+
options: {
|
11
|
+
legend: {}
|
12
|
+
},
|
13
|
+
data: {
|
14
|
+
datasets: []
|
15
|
+
}
|
16
|
+
};
|
17
|
+
this.currentSeriesIndex = 0;
|
18
|
+
}
|
19
|
+
get valueFormat() {
|
20
|
+
return this.series.valueFormat;
|
21
|
+
}
|
22
|
+
set valueFormat(valueFormat) {
|
23
|
+
this.series.valueFormat = valueFormat;
|
24
|
+
}
|
25
|
+
get valuePrefix() {
|
26
|
+
return this.series.valuePrefix;
|
27
|
+
}
|
28
|
+
set valuePrefix(valuePrefix) {
|
29
|
+
this.series.valuePrefix = valuePrefix;
|
30
|
+
}
|
31
|
+
get valueSuffix() {
|
32
|
+
return this.series.valueSuffix;
|
33
|
+
}
|
34
|
+
set valueSuffix(valueSuffix) {
|
35
|
+
this.series.valueSuffix = valueSuffix;
|
36
|
+
}
|
37
|
+
get color() {
|
38
|
+
return this.series.color || this.series.backgroundColor;
|
39
|
+
}
|
40
|
+
set color(color) {
|
41
|
+
this.series.color = color;
|
42
|
+
delete this.series.backgroundColor;
|
43
|
+
}
|
44
|
+
get displayValue() {
|
45
|
+
return this.series.displayValue;
|
46
|
+
}
|
47
|
+
set displayValue(displayValue) {
|
48
|
+
this.series.displayValue = displayValue;
|
49
|
+
}
|
50
|
+
editorTemplate(props) {
|
51
|
+
return html `
|
52
|
+
<legend><ox-i18n msgid="label.series">Series</ox-i18n></legend>
|
53
|
+
|
54
|
+
<label> <ox-i18n msgid="label.data-key">Data Key</ox-i18n> </label>
|
55
|
+
<input type="text" value-key="dataKey" .value=${this.series.dataKey} />
|
56
|
+
|
57
|
+
<label> <ox-i18n msgid="label.color">color</ox-i18n> </label>
|
58
|
+
<ox-input-multiple-colors value-key="color" .value=${this.color}></ox-input-multiple-colors>
|
59
|
+
|
60
|
+
${this.displayValueTemplate()}
|
61
|
+
|
62
|
+
<legend><ox-i18n msgid="label.axes">Axes</ox-i18n></legend>
|
63
|
+
|
64
|
+
<label> <ox-i18n msgid="label.data-key">Data Key</ox-i18n> </label>
|
65
|
+
<input type="text" value-key="labelDataKey" .value=${this.labelDataKey} />
|
66
|
+
`;
|
67
|
+
}
|
68
|
+
};
|
69
|
+
PropertyEditorChartJSPie.styles = PropertyEditorChartJSAbstract.styles;
|
70
|
+
PropertyEditorChartJSPie = __decorate([
|
71
|
+
customElement('property-editor-chartjs-pie')
|
72
|
+
], PropertyEditorChartJSPie);
|
73
|
+
export default PropertyEditorChartJSPie;
|
74
|
+
//# sourceMappingURL=property-editor-chartjs-pie.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"property-editor-chartjs-pie.js","sourceRoot":"","sources":["../../src/editors/property-editor-chartjs-pie.ts"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAA;AAGjC,OAAO,6BAA6B,MAAM,oCAAoC,CAAA;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAGX,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,6BAA6B;IAGjF;QACE,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,KAAK,GAAG;YACX,OAAO,EAAE;gBACP,MAAM,EAAE,EAAE;aACX;YACD,IAAI,EAAE;gBACJ,QAAQ,EAAE,EAAE;aACb;SACF,CAAA;QAED,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAA;IAC7B,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAA;IAChC,CAAC;IAED,IAAI,WAAW,CAAC,WAAW;QACzB,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,WAAW,CAAA;IACvC,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAA;IAChC,CAAC;IAED,IAAI,WAAW,CAAC,WAAW;QACzB,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,WAAW,CAAA;IACvC,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAA;IAChC,CAAC;IAED,IAAI,WAAW,CAAC,WAAW;QACzB,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,WAAW,CAAA;IACvC,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,eAAe,CAAA;IACzD,CAAC;IAED,IAAI,KAAK,CAAC,KAAK;QACb,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAA;IACpC,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAA;IACjC,CAAC;IAED,IAAI,YAAY,CAAC,YAAY;QAC3B,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,YAAY,CAAA;IACzC,CAAC;IAED,cAAc,CAAC,KAAiB;QAC9B,OAAO,IAAI,CAAA;;;;sDAIuC,IAAI,CAAC,MAAM,CAAC,OAAO;;;2DAGd,IAAI,CAAC,KAAK;;QAE7D,IAAI,CAAC,oBAAoB,EAAE;;;;;2DAKwB,IAAI,CAAC,YAAY;KACvE,CAAA;IACH,CAAC;;AA3EM,+BAAM,GAAG,6BAA6B,CAAC,MAAM,AAAvC,CAAuC;AADjC,wBAAwB;IAD5C,aAAa,CAAC,6BAA6B,CAAC;GACxB,wBAAwB,CA6E5C;eA7EoB,wBAAwB","sourcesContent":["import '@operato/i18n/ox-i18n.js'\n\nimport { Properties } from '@hatiolab/things-scene'\nimport PropertyEditorChartJSAbstract from './property-editor-chartjs-abstract'\nimport { customElement } from 'lit/decorators.js'\nimport { html } from 'lit'\n\n@customElement('property-editor-chartjs-pie')\nexport default class PropertyEditorChartJSPie extends PropertyEditorChartJSAbstract {\n static styles = PropertyEditorChartJSAbstract.styles\n\n constructor() {\n super()\n\n this.value = {\n options: {\n legend: {}\n },\n data: {\n datasets: []\n }\n }\n\n this.currentSeriesIndex = 0\n }\n\n get valueFormat() {\n return this.series.valueFormat\n }\n\n set valueFormat(valueFormat) {\n this.series.valueFormat = valueFormat\n }\n\n get valuePrefix() {\n return this.series.valuePrefix\n }\n\n set valuePrefix(valuePrefix) {\n this.series.valuePrefix = valuePrefix\n }\n\n get valueSuffix() {\n return this.series.valueSuffix\n }\n\n set valueSuffix(valueSuffix) {\n this.series.valueSuffix = valueSuffix\n }\n\n get color() {\n return this.series.color || this.series.backgroundColor\n }\n\n set color(color) {\n this.series.color = color\n delete this.series.backgroundColor\n }\n\n get displayValue() {\n return this.series.displayValue\n }\n\n set displayValue(displayValue) {\n this.series.displayValue = displayValue\n }\n\n editorTemplate(props: Properties) {\n return html`\n <legend><ox-i18n msgid=\"label.series\">Series</ox-i18n></legend>\n\n <label> <ox-i18n msgid=\"label.data-key\">Data Key</ox-i18n> </label>\n <input type=\"text\" value-key=\"dataKey\" .value=${this.series.dataKey} />\n\n <label> <ox-i18n msgid=\"label.color\">color</ox-i18n> </label>\n <ox-input-multiple-colors value-key=\"color\" .value=${this.color}></ox-input-multiple-colors>\n\n ${this.displayValueTemplate()}\n\n <legend><ox-i18n msgid=\"label.axes\">Axes</ox-i18n></legend>\n\n <label> <ox-i18n msgid=\"label.data-key\">Data Key</ox-i18n> </label>\n <input type=\"text\" value-key=\"labelDataKey\" .value=${this.labelDataKey} />\n `\n }\n}\n"]}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import '@operato/i18n/ox-i18n.js';
|
2
|
+
import { Properties } from '@hatiolab/things-scene';
|
3
|
+
import PropertyEditorChartJSMultiSeriesAbstract from './property-editor-chartjs-multi-series-abstract';
|
4
|
+
export default class PropertyEditorChartJSRadar extends PropertyEditorChartJSMultiSeriesAbstract {
|
5
|
+
static styles: import("lit").CSSResult[];
|
6
|
+
constructor();
|
7
|
+
editorTemplate(props: Properties): import("lit-html").TemplateResult<1>;
|
8
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { __decorate } from "tslib";
|
2
|
+
import '@operato/i18n/ox-i18n.js';
|
3
|
+
import { html } from 'lit';
|
4
|
+
import { customElement } from 'lit/decorators.js';
|
5
|
+
import PropertyEditorChartJSMultiSeriesAbstract from './property-editor-chartjs-multi-series-abstract';
|
6
|
+
let PropertyEditorChartJSRadar = class PropertyEditorChartJSRadar extends PropertyEditorChartJSMultiSeriesAbstract {
|
7
|
+
constructor() {
|
8
|
+
super();
|
9
|
+
this.value = {
|
10
|
+
options: {
|
11
|
+
legend: {}
|
12
|
+
},
|
13
|
+
data: {
|
14
|
+
datasets: []
|
15
|
+
}
|
16
|
+
};
|
17
|
+
}
|
18
|
+
editorTemplate(props) {
|
19
|
+
return html `
|
20
|
+
<legend><ox-i18n msgid="label.series">Series</ox-i18n></legend>
|
21
|
+
|
22
|
+
<div fullwidth>${this.multiSeriesTabTemplate()}</div>
|
23
|
+
|
24
|
+
<legend><ox-i18n msgid="label.axes">Axes</ox-i18n></legend>
|
25
|
+
|
26
|
+
<label> <ox-i18n msgid="label.data-key">Data Key</ox-i18n> </label>
|
27
|
+
<input type="text" value-key="labelDataKey" .value=${this.labelDataKey} />
|
28
|
+
`;
|
29
|
+
}
|
30
|
+
};
|
31
|
+
PropertyEditorChartJSRadar.styles = PropertyEditorChartJSMultiSeriesAbstract.styles;
|
32
|
+
PropertyEditorChartJSRadar = __decorate([
|
33
|
+
customElement('property-editor-chartjs-radar')
|
34
|
+
], PropertyEditorChartJSRadar);
|
35
|
+
export default PropertyEditorChartJSRadar;
|
36
|
+
//# sourceMappingURL=property-editor-chartjs-radar.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"property-editor-chartjs-radar.js","sourceRoot":"","sources":["../../src/editors/property-editor-chartjs-radar.ts"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAIjD,OAAO,wCAAwC,MAAM,iDAAiD,CAAA;AAGvF,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,wCAAwC;IAG9F;QACE,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,KAAK,GAAG;YACX,OAAO,EAAE;gBACP,MAAM,EAAE,EAAE;aACX;YACD,IAAI,EAAE;gBACJ,QAAQ,EAAE,EAAE;aACb;SACF,CAAA;IACH,CAAC;IAED,cAAc,CAAC,KAAiB;QAC9B,OAAO,IAAI,CAAA;;;uBAGQ,IAAI,CAAC,sBAAsB,EAAE;;;;;2DAKO,IAAI,CAAC,YAAY;KACvE,CAAA;IACH,CAAC;;AA1BM,iCAAM,GAAG,wCAAwC,CAAC,MAAM,AAAlD,CAAkD;AAD5C,0BAA0B;IAD9C,aAAa,CAAC,+BAA+B,CAAC;GAC1B,0BAA0B,CA4B9C;eA5BoB,0BAA0B","sourcesContent":["import '@operato/i18n/ox-i18n.js'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { Properties } from '@hatiolab/things-scene'\n\nimport PropertyEditorChartJSMultiSeriesAbstract from './property-editor-chartjs-multi-series-abstract'\n\n@customElement('property-editor-chartjs-radar')\nexport default class PropertyEditorChartJSRadar extends PropertyEditorChartJSMultiSeriesAbstract {\n static styles = PropertyEditorChartJSMultiSeriesAbstract.styles\n\n constructor() {\n super()\n\n this.value = {\n options: {\n legend: {}\n },\n data: {\n datasets: []\n }\n }\n }\n\n editorTemplate(props: Properties) {\n return html`\n <legend><ox-i18n msgid=\"label.series\">Series</ox-i18n></legend>\n\n <div fullwidth>${this.multiSeriesTabTemplate()}</div>\n\n <legend><ox-i18n msgid=\"label.axes\">Axes</ox-i18n></legend>\n\n <label> <ox-i18n msgid=\"label.data-key\">Data Key</ox-i18n> </label>\n <input type=\"text\" value-key=\"labelDataKey\" .value=${this.labelDataKey} />\n `\n }\n}\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const PropertyEditorChartJSStyles: import("lit").CSSResult;
|
@@ -0,0 +1,161 @@
|
|
1
|
+
import { css } from 'lit';
|
2
|
+
export const PropertyEditorChartJSStyles = css `
|
3
|
+
:host {
|
4
|
+
display: grid;
|
5
|
+
grid-template-columns: repeat(10, 1fr);
|
6
|
+
grid-gap: 5px;
|
7
|
+
|
8
|
+
--mdc-icon-button-size: 24px;
|
9
|
+
--mdc-icon-size: 24px;
|
10
|
+
}
|
11
|
+
|
12
|
+
:host > * {
|
13
|
+
box-sizing: border-box;
|
14
|
+
grid-column: span 7;
|
15
|
+
}
|
16
|
+
|
17
|
+
:host > label {
|
18
|
+
box-sizing: border-box;
|
19
|
+
grid-column: span 3;
|
20
|
+
}
|
21
|
+
|
22
|
+
:host > legend {
|
23
|
+
box-sizing: border-box;
|
24
|
+
grid-column: 1 / -1;
|
25
|
+
color: var(--secondary-text-color, #e46c2e);
|
26
|
+
font: var(--property-sidebar-fieldset-legend, bold 13px var(--theme-font));
|
27
|
+
text-transform: capitalize;
|
28
|
+
}
|
29
|
+
|
30
|
+
#series-properties-container {
|
31
|
+
display: grid;
|
32
|
+
grid-template-columns: 1fr 25px;
|
33
|
+
align-items: center;
|
34
|
+
justify-content: center;
|
35
|
+
}
|
36
|
+
|
37
|
+
#series-properties-container > iron-pages {
|
38
|
+
grid-column: span 2;
|
39
|
+
}
|
40
|
+
|
41
|
+
#tab-header {
|
42
|
+
display: grid;
|
43
|
+
grid-template-columns: 25px 1fr 25px;
|
44
|
+
grid-gap: 5px;
|
45
|
+
overflow: hidden;
|
46
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
47
|
+
border-bottom: 0;
|
48
|
+
background-color: #ccc;
|
49
|
+
box-sizing: border-box;
|
50
|
+
padding-top: 3px;
|
51
|
+
align-items: center;
|
52
|
+
}
|
53
|
+
|
54
|
+
#tab-header > paper-tabs {
|
55
|
+
height: 25px;
|
56
|
+
}
|
57
|
+
|
58
|
+
#tab-header paper-tabs mwc-icon-button {
|
59
|
+
display: flex;
|
60
|
+
margin-left: 5px;
|
61
|
+
padding: 2px;
|
62
|
+
color: #585858;
|
63
|
+
|
64
|
+
--mdc-icon-size: 16px;
|
65
|
+
}
|
66
|
+
|
67
|
+
#add-series-button-container {
|
68
|
+
height: 100%;
|
69
|
+
box-sizing: border-box;
|
70
|
+
align-items: center;
|
71
|
+
justify-content: center;
|
72
|
+
padding-top: 3px;
|
73
|
+
display: flex;
|
74
|
+
border-bottom: rgba(0, 0, 0, 0.2) 1px solid;
|
75
|
+
}
|
76
|
+
|
77
|
+
#add-series-button {
|
78
|
+
width: 20px;
|
79
|
+
height: 20px;
|
80
|
+
padding: 0;
|
81
|
+
color: var(--primary-text-color);
|
82
|
+
}
|
83
|
+
|
84
|
+
.tab-content {
|
85
|
+
background-color: rgba(255, 255, 255, 0.5);
|
86
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
87
|
+
border-width: 0 1px 1px 1px;
|
88
|
+
padding: 5px;
|
89
|
+
display: grid;
|
90
|
+
grid-template-columns: repeat(10, 1fr);
|
91
|
+
grid-gap: 5px;
|
92
|
+
}
|
93
|
+
|
94
|
+
.tab-content > * {
|
95
|
+
box-sizing: border-box;
|
96
|
+
grid-column: span 7;
|
97
|
+
}
|
98
|
+
|
99
|
+
label,
|
100
|
+
.tab-content > label {
|
101
|
+
grid-column: span 3;
|
102
|
+
text-align: right;
|
103
|
+
color: var(--primary-text-color);
|
104
|
+
font-size: 0.8em;
|
105
|
+
line-height: 2;
|
106
|
+
text-transform: capitalize;
|
107
|
+
}
|
108
|
+
|
109
|
+
input[type='checkbox'],
|
110
|
+
.tab-content > input[type='checkbox'] {
|
111
|
+
grid-column: span 4;
|
112
|
+
justify-self: end;
|
113
|
+
align-self: center;
|
114
|
+
}
|
115
|
+
|
116
|
+
input[type='checkbox'] + label,
|
117
|
+
.tab-content > input[type='checkbox'] + label {
|
118
|
+
grid-column: span 6;
|
119
|
+
|
120
|
+
text-align: left;
|
121
|
+
}
|
122
|
+
|
123
|
+
[fullwidth] {
|
124
|
+
grid-column: 1 / -1;
|
125
|
+
margin: 0;
|
126
|
+
border: 0;
|
127
|
+
}
|
128
|
+
|
129
|
+
select {
|
130
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
131
|
+
}
|
132
|
+
input[type='text'] {
|
133
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
134
|
+
}
|
135
|
+
|
136
|
+
paper-tab {
|
137
|
+
background-color: rgba(0, 0, 0, 0.2);
|
138
|
+
background-color: #ccc;
|
139
|
+
border-width: 1px 1px 0 1px;
|
140
|
+
padding: 0 5px;
|
141
|
+
color: #fff;
|
142
|
+
font-size: 13px;
|
143
|
+
box-sizing: border-box;
|
144
|
+
min-width: 45px;
|
145
|
+
}
|
146
|
+
|
147
|
+
paper-tab[disabled] {
|
148
|
+
background-color: rgba(0, 0, 0, 0.1);
|
149
|
+
}
|
150
|
+
|
151
|
+
paper-tab:last-child {
|
152
|
+
border-width: 0;
|
153
|
+
}
|
154
|
+
|
155
|
+
paper-tabs paper-tab.iron-selected {
|
156
|
+
background-color: #f6f8f9;
|
157
|
+
border-radius: 5px 5px 0 0;
|
158
|
+
color: #585858;
|
159
|
+
}
|
160
|
+
`;
|
161
|
+
//# sourceMappingURL=property-editor-chartjs-styles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"property-editor-chartjs-styles.js","sourceRoot":"","sources":["../../src/editors/property-editor-chartjs-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8J7C,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport const PropertyEditorChartJSStyles = css`\n :host {\n display: grid;\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 5px;\n\n --mdc-icon-button-size: 24px;\n --mdc-icon-size: 24px;\n }\n\n :host > * {\n box-sizing: border-box;\n grid-column: span 7;\n }\n\n :host > label {\n box-sizing: border-box;\n grid-column: span 3;\n }\n\n :host > legend {\n box-sizing: border-box;\n grid-column: 1 / -1;\n color: var(--secondary-text-color, #e46c2e);\n font: var(--property-sidebar-fieldset-legend, bold 13px var(--theme-font));\n text-transform: capitalize;\n }\n\n #series-properties-container {\n display: grid;\n grid-template-columns: 1fr 25px;\n align-items: center;\n justify-content: center;\n }\n\n #series-properties-container > iron-pages {\n grid-column: span 2;\n }\n\n #tab-header {\n display: grid;\n grid-template-columns: 25px 1fr 25px;\n grid-gap: 5px;\n overflow: hidden;\n border: 1px solid rgba(0, 0, 0, 0.2);\n border-bottom: 0;\n background-color: #ccc;\n box-sizing: border-box;\n padding-top: 3px;\n align-items: center;\n }\n\n #tab-header > paper-tabs {\n height: 25px;\n }\n\n #tab-header paper-tabs mwc-icon-button {\n display: flex;\n margin-left: 5px;\n padding: 2px;\n color: #585858;\n\n --mdc-icon-size: 16px;\n }\n\n #add-series-button-container {\n height: 100%;\n box-sizing: border-box;\n align-items: center;\n justify-content: center;\n padding-top: 3px;\n display: flex;\n border-bottom: rgba(0, 0, 0, 0.2) 1px solid;\n }\n\n #add-series-button {\n width: 20px;\n height: 20px;\n padding: 0;\n color: var(--primary-text-color);\n }\n\n .tab-content {\n background-color: rgba(255, 255, 255, 0.5);\n border: 1px solid rgba(0, 0, 0, 0.2);\n border-width: 0 1px 1px 1px;\n padding: 5px;\n display: grid;\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 5px;\n }\n\n .tab-content > * {\n box-sizing: border-box;\n grid-column: span 7;\n }\n\n label,\n .tab-content > label {\n grid-column: span 3;\n text-align: right;\n color: var(--primary-text-color);\n font-size: 0.8em;\n line-height: 2;\n text-transform: capitalize;\n }\n\n input[type='checkbox'],\n .tab-content > input[type='checkbox'] {\n grid-column: span 4;\n justify-self: end;\n align-self: center;\n }\n\n input[type='checkbox'] + label,\n .tab-content > input[type='checkbox'] + label {\n grid-column: span 6;\n\n text-align: left;\n }\n\n [fullwidth] {\n grid-column: 1 / -1;\n margin: 0;\n border: 0;\n }\n\n select {\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n input[type='text'] {\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n\n paper-tab {\n background-color: rgba(0, 0, 0, 0.2);\n background-color: #ccc;\n border-width: 1px 1px 0 1px;\n padding: 0 5px;\n color: #fff;\n font-size: 13px;\n box-sizing: border-box;\n min-width: 45px;\n }\n\n paper-tab[disabled] {\n background-color: rgba(0, 0, 0, 0.1);\n }\n\n paper-tab:last-child {\n border-width: 0;\n }\n\n paper-tabs paper-tab.iron-selected {\n background-color: #f6f8f9;\n border-radius: 5px 5px 0 0;\n color: #585858;\n }\n`\n"]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import '@operato/i18n/ox-i18n.js';
|
2
|
+
import './property-editor-chartjs-hbar';
|
3
|
+
import './property-editor-chartjs-mixed';
|
4
|
+
import './property-editor-chartjs-pie';
|
5
|
+
import './property-editor-chartjs-radar';
|
6
|
+
import { OxPropertyEditor, PropertySpec } from '@operato/property-editor';
|
7
|
+
export default class ChartJSEditor extends OxPropertyEditor {
|
8
|
+
static styles: import("lit").CSSResult[];
|
9
|
+
editorTemplate(value: any, spec: PropertySpec): import("lit-html").TemplateResult<1>;
|
10
|
+
}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
import { __decorate } from "tslib";
|
2
|
+
import '@operato/i18n/ox-i18n.js';
|
3
|
+
import './property-editor-chartjs-hbar';
|
4
|
+
import './property-editor-chartjs-mixed';
|
5
|
+
import './property-editor-chartjs-pie';
|
6
|
+
import './property-editor-chartjs-radar';
|
7
|
+
import { css, html } from 'lit';
|
8
|
+
import { customElement } from 'lit/decorators.js';
|
9
|
+
import { OxPropertyEditor } from '@operato/property-editor';
|
10
|
+
let ChartJSEditor = class ChartJSEditor extends OxPropertyEditor {
|
11
|
+
editorTemplate(value, spec) {
|
12
|
+
return html `
|
13
|
+
${value
|
14
|
+
? html `
|
15
|
+
<div id="chart-type">
|
16
|
+
<label> <ox-i18n msgid="label.chart-type">Chart Type</ox-i18n> </label>
|
17
|
+
<input type="text" .value=${value.type} readonly />
|
18
|
+
</div>
|
19
|
+
`
|
20
|
+
: html ``}
|
21
|
+
${!value
|
22
|
+
? html ``
|
23
|
+
: value.type == 'line'
|
24
|
+
? html ` <property-editor-chartjs-mixed .value=${value} fullwidth></property-editor-chartjs-mixed> `
|
25
|
+
: value.type == 'horizontalBar'
|
26
|
+
? html ` <property-editor-chartjs-hbar .value=${value} fullwidth></property-editor-chartjs-hbar> `
|
27
|
+
: value.type == 'bar'
|
28
|
+
? html ` <property-editor-chartjs-mixed .value=${value} fullwidth></property-editor-chartjs-mixed> `
|
29
|
+
: value.type == 'pie'
|
30
|
+
? html ` <property-editor-chartjs-pie .value=${value} fullwidth></property-editor-chartjs-pie> `
|
31
|
+
: value.type == 'doughnut'
|
32
|
+
? html ` <property-editor-chartjs-pie .value=${value} fullwidth></property-editor-chartjs-pie> `
|
33
|
+
: value.type == 'polarArea'
|
34
|
+
? html ` <property-editor-chartjs-pie .value=${value} fullwidth></property-editor-chartjs-pie> `
|
35
|
+
: value.type == 'radar'
|
36
|
+
? html ` <property-editor-chartjs-radar .value=${value} fullwidth></property-editor-chartjs-radar> `
|
37
|
+
: html ``}
|
38
|
+
`;
|
39
|
+
}
|
40
|
+
};
|
41
|
+
ChartJSEditor.styles = [
|
42
|
+
css `
|
43
|
+
:host {
|
44
|
+
display: block;
|
45
|
+
padding: 5px;
|
46
|
+
}
|
47
|
+
|
48
|
+
#chart-type {
|
49
|
+
display: grid;
|
50
|
+
grid-template-columns: repeat(10, 1fr);
|
51
|
+
grid-gap: 5px;
|
52
|
+
}
|
53
|
+
|
54
|
+
#chart-type > label {
|
55
|
+
box-sizing: border-box;
|
56
|
+
grid-column: span 3;
|
57
|
+
|
58
|
+
text-align: right;
|
59
|
+
|
60
|
+
color: var(--primary-text-color);
|
61
|
+
font-size: 0.8em;
|
62
|
+
line-height: 2;
|
63
|
+
text-transform: capitalize;
|
64
|
+
}
|
65
|
+
|
66
|
+
#chart-type > input {
|
67
|
+
box-sizing: border-box;
|
68
|
+
grid-column: span 7;
|
69
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
70
|
+
}
|
71
|
+
`
|
72
|
+
];
|
73
|
+
ChartJSEditor = __decorate([
|
74
|
+
customElement('property-editor-chartjs')
|
75
|
+
], ChartJSEditor);
|
76
|
+
export default ChartJSEditor;
|
77
|
+
//# sourceMappingURL=property-editor-chartjs.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"property-editor-chartjs.js","sourceRoot":"","sources":["../../src/editors/property-editor-chartjs.ts"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAA;AAEjC,OAAO,gCAAgC,CAAA;AACvC,OAAO,iCAAiC,CAAA;AACxC,OAAO,+BAA+B,CAAA;AACtC,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAgB,MAAM,0BAA0B,CAAA;AAG1D,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,gBAAgB;IAkCzD,cAAc,CAAC,KAAU,EAAE,IAAkB;QAC3C,OAAO,IAAI,CAAA;QACP,KAAK;YACL,CAAC,CAAC,IAAI,CAAA;;;0CAG4B,KAAK,CAAC,IAAI;;WAEzC;YACH,CAAC,CAAC,IAAI,CAAA,EAAE;QACR,CAAC,KAAK;YACN,CAAC,CAAC,IAAI,CAAA,EAAE;YACR,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,MAAM;gBACtB,CAAC,CAAC,IAAI,CAAA,0CAA0C,KAAK,8CAA8C;gBACnG,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,eAAe;oBAC/B,CAAC,CAAC,IAAI,CAAA,yCAAyC,KAAK,6CAA6C;oBACjG,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK;wBACrB,CAAC,CAAC,IAAI,CAAA,0CAA0C,KAAK,8CAA8C;wBACnG,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK;4BACrB,CAAC,CAAC,IAAI,CAAA,wCAAwC,KAAK,4CAA4C;4BAC/F,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,UAAU;gCAC1B,CAAC,CAAC,IAAI,CAAA,wCAAwC,KAAK,4CAA4C;gCAC/F,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,WAAW;oCAC3B,CAAC,CAAC,IAAI,CAAA,wCAAwC,KAAK,4CAA4C;oCAC/F,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,OAAO;wCACvB,CAAC,CAAC,IAAI,CAAA,0CAA0C,KAAK,8CAA8C;wCACnG,CAAC,CAAC,IAAI,CAAA,EAAE;KACX,CAAA;IACH,CAAC;;AA7DM,oBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6BF;CACF,AA/BY,CA+BZ;AAhCkB,aAAa;IADjC,aAAa,CAAC,yBAAyB,CAAC;GACpB,aAAa,CA+DjC;eA/DoB,aAAa","sourcesContent":["import '@operato/i18n/ox-i18n.js'\n\nimport './property-editor-chartjs-hbar'\nimport './property-editor-chartjs-mixed'\nimport './property-editor-chartjs-pie'\nimport './property-editor-chartjs-radar'\n\nimport { css, html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxPropertyEditor, PropertySpec } from '@operato/property-editor'\n\n@customElement('property-editor-chartjs')\nexport default class ChartJSEditor extends OxPropertyEditor {\n static styles = [\n css`\n :host {\n display: block;\n padding: 5px;\n }\n\n #chart-type {\n display: grid;\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 5px;\n }\n\n #chart-type > label {\n box-sizing: border-box;\n grid-column: span 3;\n\n text-align: right;\n\n color: var(--primary-text-color);\n font-size: 0.8em;\n line-height: 2;\n text-transform: capitalize;\n }\n\n #chart-type > input {\n box-sizing: border-box;\n grid-column: span 7;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n `\n ]\n\n editorTemplate(value: any, spec: PropertySpec) {\n return html`\n ${value\n ? html`\n <div id=\"chart-type\">\n <label> <ox-i18n msgid=\"label.chart-type\">Chart Type</ox-i18n> </label>\n <input type=\"text\" .value=${value.type} readonly />\n </div>\n `\n : html``}\n ${!value\n ? html``\n : value.type == 'line'\n ? html` <property-editor-chartjs-mixed .value=${value} fullwidth></property-editor-chartjs-mixed> `\n : value.type == 'horizontalBar'\n ? html` <property-editor-chartjs-hbar .value=${value} fullwidth></property-editor-chartjs-hbar> `\n : value.type == 'bar'\n ? html` <property-editor-chartjs-mixed .value=${value} fullwidth></property-editor-chartjs-mixed> `\n : value.type == 'pie'\n ? html` <property-editor-chartjs-pie .value=${value} fullwidth></property-editor-chartjs-pie> `\n : value.type == 'doughnut'\n ? html` <property-editor-chartjs-pie .value=${value} fullwidth></property-editor-chartjs-pie> `\n : value.type == 'polarArea'\n ? html` <property-editor-chartjs-pie .value=${value} fullwidth></property-editor-chartjs-pie> `\n : value.type == 'radar'\n ? html` <property-editor-chartjs-radar .value=${value} fullwidth></property-editor-chartjs-radar> `\n : html``}\n `\n }\n}\n"]}
|
package/dist/ox-chart.d.ts
CHANGED
@@ -6,12 +6,11 @@ export declare class OxChart extends LitElement {
|
|
6
6
|
height: number;
|
7
7
|
options: SceneChart.ChartConfig;
|
8
8
|
data: SceneChart.ChartData;
|
9
|
-
private _initialized?;
|
10
9
|
private _chart?;
|
11
10
|
_canvas: HTMLCanvasElement;
|
12
11
|
firstUpdated(): void;
|
13
12
|
render(): import("lit-html").TemplateResult<1>;
|
14
|
-
|
13
|
+
dispose(): void;
|
15
14
|
updated(changes: PropertyValues<this>): void;
|
16
15
|
initChart(): void;
|
17
16
|
updateChartSize(): void;
|
package/dist/ox-chart.js
CHANGED
@@ -15,9 +15,8 @@ let OxChart = class OxChart extends LitElement {
|
|
15
15
|
render() {
|
16
16
|
return html ` <canvas></canvas> `;
|
17
17
|
}
|
18
|
-
|
18
|
+
dispose() {
|
19
19
|
var _a;
|
20
|
-
super.disconnectedCallback();
|
21
20
|
(_a = this._chart) === null || _a === void 0 ? void 0 : _a.destroy();
|
22
21
|
}
|
23
22
|
updated(changes) {
|
@@ -45,7 +44,6 @@ let OxChart = class OxChart extends LitElement {
|
|
45
44
|
options
|
46
45
|
});
|
47
46
|
this.updateChartSize();
|
48
|
-
this._initialized = true;
|
49
47
|
}
|
50
48
|
updateChartSize() {
|
51
49
|
const width = Math.floor(this.width);
|
package/dist/ox-chart.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ox-chart.js","sourceRoot":"","sources":["../src/ox-chart.ts"],"names":[],"mappings":";AAAA,OAAO,2BAA2B,CAAA;AAClC,OAAO,sBAAsB,CAAA;AAE7B,OAAO,EAAE,UAAU,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,gBAAgB,MAAM,sCAAsC,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAA;AAGjC,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,UAAU;
|
1
|
+
{"version":3,"file":"ox-chart.js","sourceRoot":"","sources":["../src/ox-chart.ts"],"names":[],"mappings":";AAAA,OAAO,2BAA2B,CAAA;AAClC,OAAO,sBAAsB,CAAA;AAE7B,OAAO,EAAE,UAAU,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MA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A4B;AAItC;IAAhB,KAAK,CAAC,QAAQ,CAAC;wCAA4B;AARjC,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAwJnB","sourcesContent":["import 'chartjs-plugin-datalabels'\nimport 'chartjs-plugin-style'\n\nimport { LitElement, PropertyValues, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { Chart } from 'chart.js'\nimport { format as formatText } from '@operato/utils/format.js'\nimport DataBinderPlugin from './plugins/chartjs-plugin-data-binder'\nimport { convertConfigure } from './config-converter'\n\nChart.plugins.register(DataBinderPlugin)\n\n@customElement('ox-chart')\nexport class OxChart extends LitElement {\n @property({ type: Number }) width!: number\n @property({ type: Number }) height!: number\n @property({ type: Object }) options!: SceneChart.ChartConfig\n @property({ type: Object }) data!: SceneChart.ChartData\n\n private _chart?: SceneChart\n\n @query('canvas') _canvas!: HTMLCanvasElement\n\n firstUpdated() {\n this.initChart()\n }\n\n render() {\n return html` <canvas></canvas> `\n }\n\n dispose() {\n this._chart?.destroy()\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('width') || changes.has('height')) {\n this.updateChartSize()\n }\n\n if (changes.has('options')) {\n this.updateChartConfig()\n }\n\n if (changes.has('data')) {\n this._chart!.data.rawData = this.data\n this._chart!.update()\n }\n }\n\n initChart() {\n const { data, options, type } = this.options\n this.options.options.tooltip = this.options.options.tooltip ?? true\n options!.maintainAspectRatio = false\n\n this.attachPluginOptions(options)\n convertConfigure(this.options as SceneChart.ChartConfig)\n\n this._chart = new Chart(this._canvas, {\n type,\n data,\n options\n }) as SceneChart\n\n this.updateChartSize()\n }\n\n updateChartSize() {\n const width = Math.floor(this.width)\n const height = Math.floor(this.height)\n\n this._canvas.style.width = `${width}px`\n this._canvas.style.height = `${height}px`\n\n const _ = () => {\n if (this._canvas.offsetWidth == 0 || this._canvas.offsetHeight == 0) {\n requestAnimationFrame(_)\n } else {\n /*\n 주의 : chart.resize() 내에서 pixel ratio를 감안해서, canvas 의 width, height를 설정하기때문에,\n 별도 처리가 필요하지 않다.\n */\n this._chart!.resize()\n }\n }\n\n requestAnimationFrame(_)\n }\n\n updateChartConfig() {\n if (!this._chart) return\n\n const { data, options, type } = this.options\n options!.maintainAspectRatio = false\n\n this.attachPluginOptions(options)\n convertConfigure(this.options as SceneChart.ChartConfig)\n\n this._chart.type = type\n this._chart.data = data\n this._chart.options = options\n this._chart.data.rawData = this.data\n this._chart.update()\n }\n\n attachPluginOptions(options: SceneChart.ChartOptions) {\n if (!options.plugins) {\n options.plugins = {}\n }\n\n this.attachDatalabelPluginOptions(options.plugins)\n }\n\n attachDatalabelPluginOptions(pluginOptions: SceneChart.ChartPluginsOptions) {\n pluginOptions.datalabels = {\n ...pluginOptions.datalabels,\n display: function (context) {\n //@ts-ignore\n return !!context.dataset.displayValue\n },\n anchor: function (context) {\n //@ts-ignore\n return context.dataset.dataLabelAnchor || 'center'\n },\n offset: function (context) {\n //@ts-ignore\n return context.dataset.dataLabelOffset || 0\n },\n //@ts-ignore\n align: function (context) {\n //@ts-ignore\n return context.dataset.dataLabelAnchor || 'center'\n },\n //@ts-ignore\n rotation: function (context) {\n //@ts-ignore\n return context.dataset.dataLabelRotation || 0\n },\n color: function (context) {\n //@ts-ignore\n return context.dataset?.defaultFontColor || '#000'\n },\n font: function (context) {\n return {\n //@ts-ignore\n size: context.dataset?.defaultFontSize,\n //@ts-ignore\n family: context.chart.options?.defaultFontFamily\n }\n },\n clamp: true,\n formatter: function (value, context) {\n //@ts-ignore\n var format = context.dataset.valueFormat || ''\n //@ts-ignore\n var prefix = context.dataset.valuePrefix || ''\n //@ts-ignore\n var suffix = context.dataset.valueSuffix || ''\n if (value == undefined) return value\n\n var stringValue = format ? formatText(format, Number(value)) : Number(value).toLocaleString()\n return prefix + stringValue + suffix\n }\n }\n }\n}\n"]}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@operato/scene-chartjs",
|
3
3
|
"description": "Things Scene ChartJS Component",
|
4
|
-
"version": "8.0.0-alpha.
|
4
|
+
"version": "8.0.0-alpha.4",
|
5
5
|
"author": "heartyoh",
|
6
6
|
"main": "dist/index.js",
|
7
7
|
"module": "dist/index.js",
|
@@ -73,5 +73,5 @@
|
|
73
73
|
"prettier --write"
|
74
74
|
]
|
75
75
|
},
|
76
|
-
"gitHead": "
|
76
|
+
"gitHead": "aa91b38327a19beab811f95d1d87a2248aa7d92a"
|
77
77
|
}
|
package/src/chartjs.ts
CHANGED
package/src/ox-chart.ts
CHANGED
@@ -18,7 +18,6 @@ export class OxChart extends LitElement {
|
|
18
18
|
@property({ type: Object }) options!: SceneChart.ChartConfig
|
19
19
|
@property({ type: Object }) data!: SceneChart.ChartData
|
20
20
|
|
21
|
-
private _initialized?: boolean
|
22
21
|
private _chart?: SceneChart
|
23
22
|
|
24
23
|
@query('canvas') _canvas!: HTMLCanvasElement
|
@@ -31,8 +30,7 @@ export class OxChart extends LitElement {
|
|
31
30
|
return html` <canvas></canvas> `
|
32
31
|
}
|
33
32
|
|
34
|
-
|
35
|
-
super.disconnectedCallback()
|
33
|
+
dispose() {
|
36
34
|
this._chart?.destroy()
|
37
35
|
}
|
38
36
|
|
@@ -66,8 +64,6 @@ export class OxChart extends LitElement {
|
|
66
64
|
}) as SceneChart
|
67
65
|
|
68
66
|
this.updateChartSize()
|
69
|
-
|
70
|
-
this._initialized = true
|
71
67
|
}
|
72
68
|
|
73
69
|
updateChartSize() {
|