@operato/chart 2.0.0-beta.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +29 -0
- package/.storybook/main.js +3 -0
- package/.storybook/preview.js +29 -0
- package/.storybook/server.mjs +8 -0
- package/CHANGELOG.md +17 -0
- package/README.md +0 -0
- package/assets/images/icon-editor-gradient-direction.png +0 -0
- package/assets/images/icon-properties-label.png +0 -0
- package/assets/images/icon-properties-line-type.png +0 -0
- package/assets/images/icon-properties-table.png +0 -0
- package/assets/images/no-image.png +0 -0
- package/demo/index.html +33 -0
- package/dist/src/chartjs/config-converter.d.ts +29 -0
- package/dist/src/chartjs/config-converter.js +218 -0
- package/dist/src/chartjs/config-converter.js.map +1 -0
- package/dist/src/chartjs/ox-chart-js.d.ts +17 -0
- package/dist/src/chartjs/ox-chart-js.js +46 -0
- package/dist/src/chartjs/ox-chart-js.js.map +1 -0
- package/dist/src/editors/configurer.d.ts +52 -0
- package/dist/src/editors/configurer.js +198 -0
- package/dist/src/editors/configurer.js.map +1 -0
- package/dist/src/editors/index.d.ts +6 -0
- package/dist/src/editors/index.js +8 -0
- package/dist/src/editors/index.js.map +1 -0
- package/dist/src/editors/input-chart-abstract.d.ts +27 -0
- package/dist/src/editors/input-chart-abstract.js +273 -0
- package/dist/src/editors/input-chart-abstract.js.map +1 -0
- package/dist/src/editors/input-chart-multi-series-abstract.d.ts +17 -0
- package/dist/src/editors/input-chart-multi-series-abstract.js +418 -0
- package/dist/src/editors/input-chart-multi-series-abstract.js.map +1 -0
- package/dist/src/editors/input-chart-styles.d.ts +1 -0
- package/dist/src/editors/input-chart-styles.js +167 -0
- package/dist/src/editors/input-chart-styles.js.map +1 -0
- package/dist/src/editors/ox-input-chart-hbar.d.ts +11 -0
- package/dist/src/editors/ox-input-chart-hbar.js +220 -0
- package/dist/src/editors/ox-input-chart-hbar.js.map +1 -0
- package/dist/src/editors/ox-input-chart-mixed.d.ts +8 -0
- package/dist/src/editors/ox-input-chart-mixed.js +237 -0
- package/dist/src/editors/ox-input-chart-mixed.js.map +1 -0
- package/dist/src/editors/ox-input-chart-pie.d.ts +11 -0
- package/dist/src/editors/ox-input-chart-pie.js +67 -0
- package/dist/src/editors/ox-input-chart-pie.js.map +1 -0
- package/dist/src/editors/ox-input-chart-radar.d.ts +8 -0
- package/dist/src/editors/ox-input-chart-radar.js +52 -0
- package/dist/src/editors/ox-input-chart-radar.js.map +1 -0
- package/dist/src/editors/ox-property-editor-chart.d.ts +10 -0
- package/dist/src/editors/ox-property-editor-chart.js +79 -0
- package/dist/src/editors/ox-property-editor-chart.js.map +1 -0
- package/dist/src/index.d.ts +0 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/scichart/ox-scichart.d.ts +35 -0
- package/dist/src/scichart/ox-scichart.js +122 -0
- package/dist/src/scichart/ox-scichart.js.map +1 -0
- package/dist/src/scichart/scichart-builder.d.ts +8 -0
- package/dist/src/scichart/scichart-builder.js +46 -0
- package/dist/src/scichart/scichart-builder.js.map +1 -0
- package/dist/stories/common.d.ts +2 -0
- package/dist/stories/common.js +44 -0
- package/dist/stories/common.js.map +1 -0
- package/dist/stories/ox-input-chart-hbar.stories.d.ts +25 -0
- package/dist/stories/ox-input-chart-hbar.stories.js +171 -0
- package/dist/stories/ox-input-chart-hbar.stories.js.map +1 -0
- package/dist/stories/ox-input-chart-mixed.stories.d.ts +25 -0
- package/dist/stories/ox-input-chart-mixed.stories.js +180 -0
- package/dist/stories/ox-input-chart-mixed.stories.js.map +1 -0
- package/dist/stories/ox-input-chart-pie.stories.d.ts +27 -0
- package/dist/stories/ox-input-chart-pie.stories.js +111 -0
- package/dist/stories/ox-input-chart-pie.stories.js.map +1 -0
- package/dist/stories/ox-input-chart-radar.stories.d.ts +27 -0
- package/dist/stories/ox-input-chart-radar.stories.js +122 -0
- package/dist/stories/ox-input-chart-radar.stories.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +104 -0
- package/src/chartjs/config-converter.ts +307 -0
- package/src/chartjs/ox-chart-js.ts +46 -0
- package/src/editors/configurer.ts +243 -0
- package/src/editors/index.ts +8 -0
- package/src/editors/input-chart-abstract.ts +315 -0
- package/src/editors/input-chart-multi-series-abstract.ts +429 -0
- package/src/editors/input-chart-styles.ts +167 -0
- package/src/editors/ox-input-chart-hbar.ts +226 -0
- package/src/editors/ox-input-chart-mixed.ts +240 -0
- package/src/editors/ox-input-chart-pie.ts +75 -0
- package/src/editors/ox-input-chart-radar.ts +54 -0
- package/src/editors/ox-property-editor-chart.ts +79 -0
- package/src/globat.d.ts +1 -0
- package/src/index.ts +0 -0
- package/src/scichart/ox-scichart.ts +143 -0
- package/src/scichart/scichart-builder.ts +87 -0
- package/src/types.d.ts +74 -0
- package/stories/common.ts +47 -0
- package/stories/ox-input-chart-hbar.stories.ts +185 -0
- package/stories/ox-input-chart-mixed.stories.ts +194 -0
- package/stories/ox-input-chart-pie.stories.ts +126 -0
- package/stories/ox-input-chart-radar.stories.ts +137 -0
- package/themes/dark-hc.css +151 -0
- package/themes/dark-mc.css +151 -0
- package/themes/dark.css +151 -0
- package/themes/grist-theme.css +177 -0
- package/themes/light-hc.css +151 -0
- package/themes/light-mc.css +151 -0
- package/themes/light.css +151 -0
- package/themes/md-typescale-styles.css +100 -0
- package/themes/spacing.css +43 -0
- package/themes/state-color.css +6 -0
- package/translations/en.json +44 -0
- package/translations/ja.json +44 -0
- package/translations/ko.json +44 -0
- package/translations/ms.json +8 -0
- package/translations/zh.json +44 -0
- package/tsconfig.json +24 -0
- package/web-dev-server.config.mjs +27 -0
- package/web-test-runner.config.mjs +41 -0
|
@@ -0,0 +1,52 @@
|
|
|
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 { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
|
+
import { InputChartMultiSeriesAbstract } from './input-chart-multi-series-abstract';
|
|
7
|
+
let OxInputChartRadar = class OxInputChartRadar extends InputChartMultiSeriesAbstract {
|
|
8
|
+
static { this.styles = InputChartMultiSeriesAbstract.styles; }
|
|
9
|
+
getChartType() {
|
|
10
|
+
return 'radar';
|
|
11
|
+
}
|
|
12
|
+
subTemplate() {
|
|
13
|
+
const configurer = this.configurer;
|
|
14
|
+
return html `
|
|
15
|
+
<legend><ox-i18n msgid="label.series">Series</ox-i18n></legend>
|
|
16
|
+
|
|
17
|
+
<div fullwidth>${this.multiSeriesTabTemplate()}</div>
|
|
18
|
+
|
|
19
|
+
<legend><ox-i18n msgid="label.axes">Axes</ox-i18n></legend>
|
|
20
|
+
|
|
21
|
+
<label for="series-data-key"> <ox-i18n msgid="label.data-key">Data Key</ox-i18n> </label>
|
|
22
|
+
<input id="series-data-key" type="text" value-key="labelDataKey" value=${ifDefined(configurer.labelDataKey)} />
|
|
23
|
+
`;
|
|
24
|
+
}
|
|
25
|
+
getDefaultDatasets() {
|
|
26
|
+
return [
|
|
27
|
+
{
|
|
28
|
+
label: 'Radar Series 1',
|
|
29
|
+
data: [10, 20, 30],
|
|
30
|
+
backgroundColor: 'rgba(255, 99, 132, 0.2)',
|
|
31
|
+
borderColor: 'rgba(255, 99, 132, 1)',
|
|
32
|
+
borderWidth: 1,
|
|
33
|
+
pointStyle: 'circle',
|
|
34
|
+
pointRadius: 3
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: 'Radar Series 2',
|
|
38
|
+
data: [15, 25, 35],
|
|
39
|
+
backgroundColor: 'rgba(54, 162, 235, 0.2)',
|
|
40
|
+
borderColor: 'rgba(54, 162, 235, 1)',
|
|
41
|
+
borderWidth: 1,
|
|
42
|
+
pointStyle: 'circle',
|
|
43
|
+
pointRadius: 3
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
OxInputChartRadar = __decorate([
|
|
49
|
+
customElement('ox-input-chart-radar')
|
|
50
|
+
], OxInputChartRadar);
|
|
51
|
+
export default OxInputChartRadar;
|
|
52
|
+
//# sourceMappingURL=ox-input-chart-radar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-input-chart-radar.js","sourceRoot":"","sources":["../../../src/editors/ox-input-chart-radar.ts"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAExD,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAA;AAGpE,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,6BAA6B;aACnE,WAAM,GAAG,6BAA6B,CAAC,MAAM,AAAvC,CAAuC;IAEpD,YAAY;QACV,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,WAAW;QACT,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAA;QAElC,OAAO,IAAI,CAAA;;;uBAGQ,IAAI,CAAC,sBAAsB,EAAE;;;;;+EAK2B,SAAS,CAAC,UAAU,CAAC,YAAY,CAAC;KAC5G,CAAA;IACH,CAAC;IAED,kBAAkB;QAChB,OAAO;YACL;gBACE,KAAK,EAAE,gBAAgB;gBACvB,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;gBAClB,eAAe,EAAE,yBAAyB;gBAC1C,WAAW,EAAE,uBAAuB;gBACpC,WAAW,EAAE,CAAC;gBACd,UAAU,EAAE,QAAQ;gBACpB,WAAW,EAAE,CAAC;aACf;YACD;gBACE,KAAK,EAAE,gBAAgB;gBACvB,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;gBAClB,eAAe,EAAE,yBAAyB;gBAC1C,WAAW,EAAE,uBAAuB;gBACpC,WAAW,EAAE,CAAC;gBACd,UAAU,EAAE,QAAQ;gBACpB,WAAW,EAAE,CAAC;aACf;SACF,CAAA;IACH,CAAC;;AA3CkB,iBAAiB;IADrC,aAAa,CAAC,sBAAsB,CAAC;GACjB,iBAAiB,CA4CrC;eA5CoB,iBAAiB","sourcesContent":["import '@operato/i18n/ox-i18n.js'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\n\nimport { InputChartMultiSeriesAbstract } from './input-chart-multi-series-abstract'\n\n@customElement('ox-input-chart-radar')\nexport default class OxInputChartRadar extends InputChartMultiSeriesAbstract {\n static styles = InputChartMultiSeriesAbstract.styles\n\n getChartType(): 'bar' | 'line' | 'pie' | 'radar' {\n return 'radar'\n }\n\n subTemplate() {\n const configurer = this.configurer\n\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 for=\"series-data-key\"> <ox-i18n msgid=\"label.data-key\">Data Key</ox-i18n> </label>\n <input id=\"series-data-key\" type=\"text\" value-key=\"labelDataKey\" value=${ifDefined(configurer.labelDataKey)} />\n `\n }\n\n getDefaultDatasets(): OperatoChart.Dataset[] {\n return [\n {\n label: 'Radar Series 1',\n data: [10, 20, 30],\n backgroundColor: 'rgba(255, 99, 132, 0.2)',\n borderColor: 'rgba(255, 99, 132, 1)',\n borderWidth: 1,\n pointStyle: 'circle',\n pointRadius: 3\n },\n {\n label: 'Radar Series 2',\n data: [15, 25, 35],\n backgroundColor: 'rgba(54, 162, 235, 0.2)',\n borderColor: 'rgba(54, 162, 235, 1)',\n borderWidth: 1,\n pointStyle: 'circle',\n pointRadius: 3\n }\n ]\n }\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import '@operato/i18n/ox-i18n.js';
|
|
2
|
+
import './ox-input-chart-hbar';
|
|
3
|
+
import './ox-input-chart-mixed';
|
|
4
|
+
import './ox-input-chart-pie';
|
|
5
|
+
import './ox-input-chart-radar';
|
|
6
|
+
import { OxPropertyEditor, PropertySpec } from '@operato/property-editor';
|
|
7
|
+
export declare class ChartEditor extends OxPropertyEditor {
|
|
8
|
+
static styles: import("lit").CSSResult[];
|
|
9
|
+
editorTemplate(value: any, spec: PropertySpec): import("lit-html").TemplateResult<1>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import '@operato/i18n/ox-i18n.js';
|
|
3
|
+
import './ox-input-chart-hbar';
|
|
4
|
+
import './ox-input-chart-mixed';
|
|
5
|
+
import './ox-input-chart-pie';
|
|
6
|
+
import './ox-input-chart-radar';
|
|
7
|
+
import { css, html } from 'lit';
|
|
8
|
+
import { customElement } from 'lit/decorators.js';
|
|
9
|
+
import { OxPropertyEditor } from '@operato/property-editor';
|
|
10
|
+
let ChartEditor = class ChartEditor extends OxPropertyEditor {
|
|
11
|
+
static { this.styles = [
|
|
12
|
+
css `
|
|
13
|
+
:host {
|
|
14
|
+
display: block;
|
|
15
|
+
padding: 5px;
|
|
16
|
+
|
|
17
|
+
--md-elevated-button-container-height: 20px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
#chart-type {
|
|
21
|
+
display: grid;
|
|
22
|
+
grid-template-columns: repeat(10, 1fr);
|
|
23
|
+
grid-gap: 5px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
#chart-type > label {
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
grid-column: span 3;
|
|
29
|
+
|
|
30
|
+
text-align: right;
|
|
31
|
+
|
|
32
|
+
color: var(--md-sys-color-on-secondary-container);
|
|
33
|
+
font-size: 0.8em;
|
|
34
|
+
line-height: 2;
|
|
35
|
+
text-transform: capitalize;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
#chart-type > input {
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
grid-column: span 7;
|
|
41
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
|
42
|
+
}
|
|
43
|
+
`
|
|
44
|
+
]; }
|
|
45
|
+
editorTemplate(value, spec) {
|
|
46
|
+
return html `
|
|
47
|
+
${value
|
|
48
|
+
? html `
|
|
49
|
+
<div id="chart-type">
|
|
50
|
+
<label> <ox-i18n msgid="label.chart-type">Chart Type</ox-i18n> </label>
|
|
51
|
+
<input type="text" .value=${value.type} readonly />
|
|
52
|
+
</div>
|
|
53
|
+
`
|
|
54
|
+
: html ``}
|
|
55
|
+
${!value
|
|
56
|
+
? html ``
|
|
57
|
+
: value.type == 'line'
|
|
58
|
+
? html ` <ox-input-chart-mixed .value=${value} fullwidth></ox-input-chart-mixed> `
|
|
59
|
+
: value.type == 'horizontalBar'
|
|
60
|
+
? html ` <ox-input-chart-hbar .value=${value} fullwidth></ox-input-chart-hbar> `
|
|
61
|
+
: value.type == 'bar'
|
|
62
|
+
? html ` <ox-input-chart-mixed .value=${value} fullwidth></ox-input-chart-mixed> `
|
|
63
|
+
: value.type == 'pie'
|
|
64
|
+
? html ` <ox-input-chart-pie .value=${value} fullwidth></ox-input-chart-pie> `
|
|
65
|
+
: value.type == 'doughnut'
|
|
66
|
+
? html ` <ox-input-chart-pie .value=${value} fullwidth></ox-input-chart-pie> `
|
|
67
|
+
: value.type == 'polarArea'
|
|
68
|
+
? html ` <ox-input-chart-pie .value=${value} fullwidth></ox-input-chart-pie> `
|
|
69
|
+
: value.type == 'radar'
|
|
70
|
+
? html ` <ox-input-chart-radar .value=${value} fullwidth></ox-input-chart-radar> `
|
|
71
|
+
: html ``}
|
|
72
|
+
`;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
ChartEditor = __decorate([
|
|
76
|
+
customElement('ox-property-editor-chart')
|
|
77
|
+
], ChartEditor);
|
|
78
|
+
export { ChartEditor };
|
|
79
|
+
//# sourceMappingURL=ox-property-editor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7E,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,UAAU;gCACxB,CAAC,CAAC,IAAI,CAAA,+BAA+B,KAAK,mCAAmC;gCAC7E,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,WAAW;oCACzB,CAAC,CAAC,IAAI,CAAA,+BAA+B,KAAK,mCAAmC;oCAC7E,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,OAAO;wCACrB,CAAC,CAAC,IAAI,CAAA,iCAAiC,KAAK,qCAAqC;wCACjF,CAAC,CAAC,IAAI,CAAA,EAAE;KACzB,CAAA;IACH,CAAC;;AAhEU,WAAW;IADvB,aAAa,CAAC,0BAA0B,CAAC;GAC7B,WAAW,CAiEvB","sourcesContent":["import '@operato/i18n/ox-i18n.js'\n\nimport './ox-input-chart-hbar'\nimport './ox-input-chart-mixed'\nimport './ox-input-chart-pie'\nimport './ox-input-chart-radar'\n\nimport { css, html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxPropertyEditor, PropertySpec } from '@operato/property-editor'\n\n@customElement('ox-property-editor-chart')\nexport class ChartEditor extends OxPropertyEditor {\n static styles = [\n css`\n :host {\n display: block;\n padding: 5px;\n\n --md-elevated-button-container-height: 20px;\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(--md-sys-color-on-secondary-container);\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` <ox-input-chart-mixed .value=${value} fullwidth></ox-input-chart-mixed> `\n : value.type == 'horizontalBar'\n ? html` <ox-input-chart-hbar .value=${value} fullwidth></ox-input-chart-hbar> `\n : value.type == 'bar'\n ? html` <ox-input-chart-mixed .value=${value} fullwidth></ox-input-chart-mixed> `\n : value.type == 'pie'\n ? html` <ox-input-chart-pie .value=${value} fullwidth></ox-input-chart-pie> `\n : value.type == 'doughnut'\n ? html` <ox-input-chart-pie .value=${value} fullwidth></ox-input-chart-pie> `\n : value.type == 'polarArea'\n ? html` <ox-input-chart-pie .value=${value} fullwidth></ox-input-chart-pie> `\n : value.type == 'radar'\n ? html` <ox-input-chart-radar .value=${value} fullwidth></ox-input-chart-radar> `\n : html``}\n `\n }\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"","sourcesContent":[""]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
sciChartLoaded: boolean;
|
|
5
|
+
sciChartLoadingPromise: Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
declare class OxSciChart extends LitElement {
|
|
9
|
+
data: {
|
|
10
|
+
[attr: string]: any;
|
|
11
|
+
}[];
|
|
12
|
+
attrX: string;
|
|
13
|
+
attrY: string;
|
|
14
|
+
config: any;
|
|
15
|
+
private chart;
|
|
16
|
+
dataSeries?: any;
|
|
17
|
+
container: HTMLDivElement;
|
|
18
|
+
static styles: import("lit").CSSResult;
|
|
19
|
+
firstUpdated(): void;
|
|
20
|
+
loadSciChart(): Promise<void>;
|
|
21
|
+
initializeSciChart(): Promise<void>;
|
|
22
|
+
updated(changedProperties: Map<string | number | symbol, unknown>): Promise<void>;
|
|
23
|
+
updateDataSeries(): void;
|
|
24
|
+
get dataSet(): {
|
|
25
|
+
xValue: number;
|
|
26
|
+
yValue: number;
|
|
27
|
+
}[];
|
|
28
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
29
|
+
}
|
|
30
|
+
declare global {
|
|
31
|
+
interface HTMLElementTagNameMap {
|
|
32
|
+
'ox-scichart': OxSciChart;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { LitElement, html, css } from 'lit';
|
|
3
|
+
import { property, query, customElement } from 'lit/decorators.js';
|
|
4
|
+
import { buildSciChart } from './scichart-builder';
|
|
5
|
+
let OxSciChart = class OxSciChart extends LitElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.data = [
|
|
9
|
+
{ x: 1718612376646, y: 10 },
|
|
10
|
+
{ x: 1718612386646, y: 20 },
|
|
11
|
+
{ x: 1718612396646, y: 15 },
|
|
12
|
+
{ x: 1718612406646, y: 25 },
|
|
13
|
+
{ x: 1718612416646, y: 22 },
|
|
14
|
+
{ x: 1718612426646, y: 30 },
|
|
15
|
+
{ x: 1718612436646, y: 28 }
|
|
16
|
+
];
|
|
17
|
+
this.attrX = 'x';
|
|
18
|
+
this.attrY = 'y';
|
|
19
|
+
this.config = null;
|
|
20
|
+
this.chart = null;
|
|
21
|
+
}
|
|
22
|
+
static { this.styles = css `
|
|
23
|
+
:host {
|
|
24
|
+
display: block;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
div {
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 100%;
|
|
30
|
+
}
|
|
31
|
+
`; }
|
|
32
|
+
firstUpdated() {
|
|
33
|
+
this.loadSciChart();
|
|
34
|
+
}
|
|
35
|
+
async loadSciChart() {
|
|
36
|
+
if (!window.sciChartLoaded) {
|
|
37
|
+
if (!window.sciChartLoadingPromise) {
|
|
38
|
+
window.sciChartLoadingPromise = new Promise(resolve => {
|
|
39
|
+
const script = document.createElement('script');
|
|
40
|
+
script.src = 'https://cdn.jsdelivr.net/npm/scichart/index.min.js';
|
|
41
|
+
script.crossOrigin = 'anonymous';
|
|
42
|
+
script.onload = () => {
|
|
43
|
+
window.sciChartLoaded = true;
|
|
44
|
+
SciChart.SciChartSurface.UseCommunityLicense();
|
|
45
|
+
resolve();
|
|
46
|
+
};
|
|
47
|
+
document.head.appendChild(script);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
await window.sciChartLoadingPromise;
|
|
51
|
+
}
|
|
52
|
+
this.initializeSciChart();
|
|
53
|
+
}
|
|
54
|
+
async initializeSciChart() {
|
|
55
|
+
const { chart, dataSeries } = (await buildSciChart(this.config, this.container, {})) || {};
|
|
56
|
+
this.chart = chart;
|
|
57
|
+
this.dataSeries = dataSeries;
|
|
58
|
+
this.updateDataSeries();
|
|
59
|
+
}
|
|
60
|
+
async updated(changedProperties) {
|
|
61
|
+
if (changedProperties.has('config')) {
|
|
62
|
+
await this.initializeSciChart();
|
|
63
|
+
}
|
|
64
|
+
if (changedProperties.has('data')) {
|
|
65
|
+
this.updateDataSeries();
|
|
66
|
+
this.chart?.sciChartSurface.zoomExtents();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
updateDataSeries() {
|
|
70
|
+
if (!this.dataSeries)
|
|
71
|
+
return;
|
|
72
|
+
this.dataSeries.clear();
|
|
73
|
+
const newData = this.dataSet;
|
|
74
|
+
this.dataSeries.appendRange(newData.map(d => d.xValue), newData.map(d => d.yValue));
|
|
75
|
+
this.chart?.sciChartSurface.zoomExtents();
|
|
76
|
+
this.chart?.sciChartSurface.invalidateElement();
|
|
77
|
+
}
|
|
78
|
+
get dataSet() {
|
|
79
|
+
const { attrX, attrY, data } = this;
|
|
80
|
+
if (!(data instanceof Array)) {
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
return data
|
|
84
|
+
.map(item => {
|
|
85
|
+
if (!item || typeof item !== 'object') {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const xValue = new Date(item[attrX]);
|
|
89
|
+
if (isNaN(xValue.getTime())) {
|
|
90
|
+
console.error('Invalid date:', item[attrX]);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
xValue: xValue.getTime() / 1000,
|
|
95
|
+
yValue: item[attrY]
|
|
96
|
+
};
|
|
97
|
+
})
|
|
98
|
+
.filter(Boolean);
|
|
99
|
+
}
|
|
100
|
+
render() {
|
|
101
|
+
return html `<div id="container"></div>`;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
__decorate([
|
|
105
|
+
property({ type: Array })
|
|
106
|
+
], OxSciChart.prototype, "data", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
property({ type: String })
|
|
109
|
+
], OxSciChart.prototype, "attrX", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
property({ type: String })
|
|
112
|
+
], OxSciChart.prototype, "attrY", void 0);
|
|
113
|
+
__decorate([
|
|
114
|
+
property({ type: Object })
|
|
115
|
+
], OxSciChart.prototype, "config", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
query('div#container')
|
|
118
|
+
], OxSciChart.prototype, "container", void 0);
|
|
119
|
+
OxSciChart = __decorate([
|
|
120
|
+
customElement('ox-scichart')
|
|
121
|
+
], OxSciChart);
|
|
122
|
+
//# sourceMappingURL=ox-scichart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-scichart.js","sourceRoot":"","sources":["../../../src/scichart/ox-scichart.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAWlD,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QAC6B,SA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AAM,EAAE,CAAC;0CAAmB;AAKtB;IAAvB,KAAK,CAAC,eAAe,CAAC;6CAA2B;AAjB9C,UAAU;IADf,aAAa,CAAC,aAAa,CAAC;GACvB,UAAU,CA2Hf","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { property, query, customElement } from 'lit/decorators.js'\nimport { buildSciChart } from './scichart-builder'\n\n// 전역 변수로 SciChart 로딩 상태 관리\ndeclare global {\n interface Window {\n sciChartLoaded: boolean\n sciChartLoadingPromise: Promise<void>\n }\n}\n\n@customElement('ox-scichart')\nclass OxSciChart extends LitElement {\n @property({ type: Array }) data: { [attr: string]: any }[] = [\n { x: 1718612376646, y: 10 },\n { x: 1718612386646, y: 20 },\n { x: 1718612396646, y: 15 },\n { x: 1718612406646, y: 25 },\n { x: 1718612416646, y: 22 },\n { x: 1718612426646, y: 30 },\n { x: 1718612436646, y: 28 }\n ]\n @property({ type: String }) attrX: string = 'x'\n @property({ type: String }) attrY: string = 'y'\n @property({ type: Object }) config: any = null\n\n private chart: any = null\n dataSeries?: any\n\n @query('div#container') container!: HTMLDivElement\n\n static styles = css`\n :host {\n display: block;\n }\n\n div {\n width: 100%;\n height: 100%;\n }\n `\n\n firstUpdated() {\n this.loadSciChart()\n }\n\n async loadSciChart() {\n if (!window.sciChartLoaded) {\n if (!window.sciChartLoadingPromise) {\n window.sciChartLoadingPromise = new Promise<void>(resolve => {\n const script = document.createElement('script')\n script.src = 'https://cdn.jsdelivr.net/npm/scichart/index.min.js'\n script.crossOrigin = 'anonymous'\n script.onload = () => {\n window.sciChartLoaded = true\n\n SciChart.SciChartSurface.UseCommunityLicense()\n\n resolve()\n }\n document.head.appendChild(script)\n })\n }\n\n await window.sciChartLoadingPromise\n }\n\n this.initializeSciChart()\n }\n\n async initializeSciChart() {\n const { chart, dataSeries } = (await buildSciChart(this.config, this.container, {})) || {}\n\n this.chart = chart\n this.dataSeries = dataSeries\n\n this.updateDataSeries()\n }\n\n async updated(changedProperties: Map<string | number | symbol, unknown>) {\n if (changedProperties.has('config')) {\n await this.initializeSciChart()\n }\n\n if (changedProperties.has('data')) {\n this.updateDataSeries()\n this.chart?.sciChartSurface.zoomExtents()\n }\n }\n\n updateDataSeries() {\n if (!this.dataSeries) return\n\n this.dataSeries.clear()\n const newData = this.dataSet\n\n this.dataSeries.appendRange(\n newData.map(d => d.xValue),\n newData.map(d => d.yValue)\n )\n\n this.chart?.sciChartSurface.zoomExtents()\n this.chart?.sciChartSurface.invalidateElement()\n }\n\n get dataSet(): { xValue: number; yValue: number }[] {\n const { attrX, attrY, data } = this\n\n if (!(data instanceof Array)) {\n return []\n }\n\n return data\n .map(item => {\n if (!item || typeof item !== 'object') {\n return\n }\n\n const xValue = new Date(item[attrX])\n if (isNaN(xValue.getTime())) {\n console.error('Invalid date:', item[attrX])\n return\n }\n\n return {\n xValue: xValue.getTime() / 1000,\n yValue: item[attrY]\n }\n })\n .filter(Boolean) as { xValue: number; yValue: number }[]\n }\n\n render() {\n return html`<div id=\"container\"></div>`\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ox-scichart': OxSciChart\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function buildSciChart(config: OperatoChart.ChartConfig | undefined | null, container: any, { fontSize, fontFamily, fontColor }: {
|
|
2
|
+
fontSize?: number;
|
|
3
|
+
fontFamily?: string;
|
|
4
|
+
fontColor?: string;
|
|
5
|
+
}): Promise<{
|
|
6
|
+
chart: any;
|
|
7
|
+
dataSeries: any;
|
|
8
|
+
} | undefined>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export async function buildSciChart(config, container, { fontSize, fontFamily, fontColor }) {
|
|
2
|
+
if (!config) {
|
|
3
|
+
return;
|
|
4
|
+
}
|
|
5
|
+
const { SciChartSurface, SciChartDefaults, chartBuilder, SciChartJsNavyTheme, XyDataSeries, FastLineRenderableSeries, NumberRange, EAutoRange, EAxisAlignment, NumericAxis, DateTimeNumericAxis } = SciChart;
|
|
6
|
+
const { type: chartType, options, data: fromData } = config;
|
|
7
|
+
const { theme, animation, tooltip, stacked, legend, scales: fromScales, xGridLine, yGridLine, y2ndGridLine, multiAxis } = options || {};
|
|
8
|
+
const { datasets = [] } = fromData || {};
|
|
9
|
+
const { xAxes = [], yAxes = [] } = fromScales || {};
|
|
10
|
+
const toScales = {};
|
|
11
|
+
const chart = await SciChartSurface.create(container, {
|
|
12
|
+
theme: new SciChartJsNavyTheme()
|
|
13
|
+
});
|
|
14
|
+
const { sciChartSurface, wasmContext } = chart;
|
|
15
|
+
xAxes.forEach((axis, index) => {
|
|
16
|
+
const { axisTitle, barSpacing, categorySpacing, barPercentage, ticks } = axis;
|
|
17
|
+
const { autoMax, autoMin } = ticks || {};
|
|
18
|
+
const id = xAxes.length > 1 ? `x${index + 1}` : 'x';
|
|
19
|
+
const xAxis = new DateTimeNumericAxis(wasmContext, {
|
|
20
|
+
axisTitle,
|
|
21
|
+
autoRange: EAutoRange.Always,
|
|
22
|
+
axisAlignment: EAxisAlignment.Bottom
|
|
23
|
+
// visibleRange: new NumberRange(minDate.getTime() / 1000, maxDate.getTime() / 1000)
|
|
24
|
+
});
|
|
25
|
+
sciChartSurface.xAxes.add(xAxis);
|
|
26
|
+
});
|
|
27
|
+
yAxes.forEach((axis, index) => {
|
|
28
|
+
const { axisTitle, barSpacing, categorySpacing, barPercentage, ticks } = axis;
|
|
29
|
+
const { autoMax, autoMin } = ticks || {};
|
|
30
|
+
const id = yAxes.length > 1 ? `right` : 'left';
|
|
31
|
+
const yAxis = new NumericAxis(wasmContext, {
|
|
32
|
+
axisTitle,
|
|
33
|
+
autoRange: EAutoRange.Always,
|
|
34
|
+
axisAlignment: yAxes.length > 1 ? EAxisAlignment.Right : EAxisAlignment.Left
|
|
35
|
+
});
|
|
36
|
+
sciChartSurface.yAxes.add(yAxis);
|
|
37
|
+
});
|
|
38
|
+
const dataSeries = new XyDataSeries(wasmContext);
|
|
39
|
+
const lineSeries = new FastLineRenderableSeries(wasmContext);
|
|
40
|
+
lineSeries.strokeThickness = 2;
|
|
41
|
+
lineSeries.stroke = '#FF6600';
|
|
42
|
+
lineSeries.dataSeries = dataSeries;
|
|
43
|
+
sciChartSurface.renderableSeries.add(lineSeries);
|
|
44
|
+
return { chart, dataSeries };
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=scichart-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scichart-builder.js","sourceRoot":"","sources":["../../../src/scichart/scichart-builder.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAmD,EACnD,SAAc,EACd,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAkE;IAEnG,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAM;IACR,CAAC;IAED,MAAM,EACJ,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,wBAAwB,EACxB,WAAW,EACX,UAAU,EACV,cAAc,EACd,WAAW,EACX,mBAAmB,EACpB,GAAG,QAAQ,CAAA;IAEZ,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAA;IAC3D,MAAM,EACJ,KAAK,EACL,SAAS,EACT,OAAO,EACP,OAAO,EACP,MAAM,EACN,MAAM,EAAE,UAAU,EAClB,SAAS,EACT,SAAS,EACT,YAAY,EACZ,SAAS,EACV,GAAG,OAAO,IAAI,EAAE,CAAA;IACjB,MAAM,EAAE,QAAQ,GAAG,EAAE,EAAE,GAAG,QAAQ,IAAI,EAAE,CAAA;IAExC,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,UAAU,IAAI,EAAE,CAAA;IACnD,MAAM,QAAQ,GAAG,EAAS,CAAA;IAE1B,MAAM,KAAK,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,SAAS,EAAE;QAC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G,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI;SAC7E,CAAC,CAAA;QACF,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,MAAM,UAAU,GAAG,IAAI,YAAY,CAAC,WAAW,CAAC,CAAA;IAEhD,MAAM,UAAU,GAAG,IAAI,wBAAwB,CAAC,WAAW,CAAC,CAAA;IAC5D,UAAU,CAAC,eAAe,GAAG,CAAC,CAAA;IAC9B,UAAU,CAAC,MAAM,GAAG,SAAS,CAAA;IAC7B,UAAU,CAAC,UAAU,GAAG,UAAU,CAAA;IAElC,eAAe,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IAEhD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAA;AAC9B,CAAC","sourcesContent":["export async function buildSciChart(\n config: OperatoChart.ChartConfig | undefined | null,\n container: any,\n { fontSize, fontFamily, fontColor }: { fontSize?: number; fontFamily?: string; fontColor?: string }\n): Promise<{ chart: any; dataSeries: any } | undefined> {\n if (!config) {\n return\n }\n\n const {\n SciChartSurface,\n SciChartDefaults,\n chartBuilder,\n SciChartJsNavyTheme,\n XyDataSeries,\n FastLineRenderableSeries,\n NumberRange,\n EAutoRange,\n EAxisAlignment,\n NumericAxis,\n DateTimeNumericAxis\n } = SciChart\n\n const { type: chartType, options, data: fromData } = config\n const {\n theme,\n animation,\n tooltip,\n stacked,\n legend,\n scales: fromScales,\n xGridLine,\n yGridLine,\n y2ndGridLine,\n multiAxis\n } = options || {}\n const { datasets = [] } = fromData || {}\n\n const { xAxes = [], yAxes = [] } = fromScales || {}\n const toScales = {} as any\n\n const chart = await SciChartSurface.create(container, {\n theme: new SciChartJsNavyTheme()\n })\n const { sciChartSurface, wasmContext } = chart\n\n xAxes.forEach((axis, index) => {\n const { axisTitle, barSpacing, categorySpacing, barPercentage, ticks } = axis\n const { autoMax, autoMin } = ticks || {}\n const id = xAxes.length > 1 ? `x${index + 1}` : 'x'\n\n const xAxis = new DateTimeNumericAxis(wasmContext, {\n axisTitle,\n autoRange: EAutoRange.Always,\n axisAlignment: EAxisAlignment.Bottom\n\n // visibleRange: new NumberRange(minDate.getTime() / 1000, maxDate.getTime() / 1000)\n })\n\n sciChartSurface.xAxes.add(xAxis)\n })\n\n yAxes.forEach((axis, index) => {\n const { axisTitle, barSpacing, categorySpacing, barPercentage, ticks } = axis\n const { autoMax, autoMin } = ticks || {}\n\n const id = yAxes.length > 1 ? `right` : 'left'\n\n const yAxis = new NumericAxis(wasmContext, {\n axisTitle,\n autoRange: EAutoRange.Always,\n axisAlignment: yAxes.length > 1 ? EAxisAlignment.Right : EAxisAlignment.Left\n })\n sciChartSurface.yAxes.add(yAxis)\n })\n\n const dataSeries = new XyDataSeries(wasmContext)\n\n const lineSeries = new FastLineRenderableSeries(wasmContext)\n lineSeries.strokeThickness = 2\n lineSeries.stroke = '#FF6600'\n lineSeries.dataSeries = dataSeries\n\n sciChartSurface.renderableSeries.add(lineSeries)\n\n return { chart, dataSeries }\n}\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export function getDefaultChartConfig(type, datasets) {
|
|
2
|
+
return {
|
|
3
|
+
data: {
|
|
4
|
+
datasets: datasets || [],
|
|
5
|
+
labelDataKey: ''
|
|
6
|
+
},
|
|
7
|
+
options: {
|
|
8
|
+
theme: 'light',
|
|
9
|
+
tooltip: true,
|
|
10
|
+
animation: true,
|
|
11
|
+
legend: {
|
|
12
|
+
display: true,
|
|
13
|
+
position: 'top'
|
|
14
|
+
},
|
|
15
|
+
scales: {
|
|
16
|
+
xAxes: [getDefaultAxisOptions()],
|
|
17
|
+
yAxes: [getDefaultAxisOptions(), getDefaultAxisOptions()] // Two y-axes for multi-axis support
|
|
18
|
+
},
|
|
19
|
+
stacked: false,
|
|
20
|
+
xGridLine: true,
|
|
21
|
+
yGridLine: true,
|
|
22
|
+
y2ndGridLine: false,
|
|
23
|
+
multiAxis: false
|
|
24
|
+
},
|
|
25
|
+
type
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export function getDefaultAxisOptions() {
|
|
29
|
+
return {
|
|
30
|
+
axisTitle: '',
|
|
31
|
+
barSpacing: 0,
|
|
32
|
+
categorySpacing: 0,
|
|
33
|
+
barPercentage: 0.9,
|
|
34
|
+
ticks: {
|
|
35
|
+
display: true,
|
|
36
|
+
autoMin: true,
|
|
37
|
+
autoMax: true,
|
|
38
|
+
min: undefined,
|
|
39
|
+
max: undefined,
|
|
40
|
+
stepSize: undefined
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../stories/common.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,qBAAqB,CACnC,IAAgD,EAChD,QAAiC;IAEjC,OAAO;QACL,IAAI,EAAE;YACJ,QAAQ,EAAE,QAAQ,IAAI,EAAE;YACxB,YAAY,EAAE,EAAE;SACjB;QACD,OAAO,EAAE;YACP,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,IAAI;YACb,SAAS,EAAE,IAAI;YACf,MAAM,EAAE;gBACN,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,KAAK;aAChB;YACD,MAAM,EAAE;gBACN,KAAK,EAAE,CAAC,qBAAqB,EAAE,CAAC;gBAChC,KAAK,EAAE,CAAC,qBAAqB,EAAE,EAAE,qBAAqB,EAAE,CAAC,CAAC,oCAAoC;aAC/F;YACD,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,IAAI;YACf,SAAS,EAAE,IAAI;YACf,YAAY,EAAE,KAAK;YACnB,SAAS,EAAE,KAAK;SACjB;QACD,IAAI;KACL,CAAA;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,OAAO;QACL,SAAS,EAAE,EAAE;QACb,UAAU,EAAE,CAAC;QACb,eAAe,EAAE,CAAC;QAClB,aAAa,EAAE,GAAG;QAClB,KAAK,EAAE;YACL,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;YACb,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,QAAQ,EAAE,SAAS;SACpB;KACF,CAAA;AACH,CAAC","sourcesContent":["export function getDefaultChartConfig(\n type: 'bar' | 'line' | 'pie' | 'radar' | 'mixed',\n datasets?: OperatoChart.Dataset[]\n): 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: [getDefaultAxisOptions()],\n yAxes: [getDefaultAxisOptions(), getDefaultAxisOptions()] // Two y-axes for multi-axis support\n },\n stacked: false,\n xGridLine: true,\n yGridLine: true,\n y2ndGridLine: false,\n multiAxis: false\n },\n type\n }\n}\n\nexport function 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"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit';
|
|
2
|
+
import '../src/editors/ox-input-chart-hbar.js';
|
|
3
|
+
import '../src/chartjs/ox-chart-js.js';
|
|
4
|
+
import '../src/scichart/ox-scichart.js';
|
|
5
|
+
declare const _default: {
|
|
6
|
+
title: string;
|
|
7
|
+
component: string;
|
|
8
|
+
argTypes: {
|
|
9
|
+
value: {
|
|
10
|
+
control: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
15
|
+
interface Story<T> {
|
|
16
|
+
(args: T): TemplateResult;
|
|
17
|
+
args?: Partial<T>;
|
|
18
|
+
argTypes?: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
interface ArgTypes {
|
|
21
|
+
value: OperatoChart.ChartConfig;
|
|
22
|
+
}
|
|
23
|
+
export declare const Default: Story<ArgTypes>;
|
|
24
|
+
export declare const WithData: Story<ArgTypes>;
|
|
25
|
+
export declare const MultiAxis: Story<ArgTypes>;
|