@operato/chart 8.0.0-beta.0 → 8.0.0-beta.2
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 +18 -0
- package/package.json +6 -6
- package/.editorconfig +0 -29
- package/.storybook/main.js +0 -3
- package/.storybook/preview.js +0 -52
- package/.storybook/server.mjs +0 -8
- package/demo/index.html +0 -33
- package/src/chartjs/config-converter.ts +0 -341
- package/src/chartjs/ox-chart-js.ts +0 -207
- package/src/editors/configurer.ts +0 -336
- package/src/editors/index.ts +0 -8
- package/src/editors/input-chart-abstract.ts +0 -202
- package/src/editors/input-chart-styles.ts +0 -206
- package/src/editors/ox-input-chart-hbar.ts +0 -157
- package/src/editors/ox-input-chart-mixed.ts +0 -241
- package/src/editors/ox-input-chart-pie.ts +0 -69
- package/src/editors/ox-input-chart-radar.ts +0 -56
- package/src/editors/ox-input-chart-timeseries.ts +0 -279
- package/src/editors/ox-property-editor-chart.ts +0 -72
- package/src/editors/templates/annotations.ts +0 -295
- package/src/editors/templates/display-value.ts +0 -111
- package/src/editors/templates/series.ts +0 -316
- package/src/global.d.ts +0 -1
- package/src/index.ts +0 -0
- package/src/progress/ox-progress-circle.ts +0 -133
- package/src/scichart/ox-scichart.ts +0 -151
- package/src/scichart/scichart-builder.ts +0 -508
- package/src/types.d.ts +0 -124
- package/stories/common.ts +0 -87
- package/stories/ox-input-chart-bar.stories.ts +0 -188
- package/stories/ox-input-chart-doughnut.stories.ts +0 -130
- package/stories/ox-input-chart-hbar.stories.ts +0 -188
- package/stories/ox-input-chart-line.stories.ts +0 -198
- package/stories/ox-input-chart-pie.stories.ts +0 -130
- package/stories/ox-input-chart-polar-area.stories.ts +0 -130
- package/stories/ox-input-chart-radar.stories.ts +0 -141
- package/stories/ox-input-chart-timeseries.stories.ts +0 -268
- package/tsconfig.json +0 -25
- package/web-dev-server.config.mjs +0 -27
- package/web-test-runner.config.mjs +0 -41
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { html, TemplateResult } from 'lit'
|
|
2
|
-
|
|
3
|
-
import '../src/editors/ox-input-chart-mixed.js'
|
|
4
|
-
import '../src/chartjs/ox-chart-js.js'
|
|
5
|
-
import '../src/scichart/ox-scichart.js'
|
|
6
|
-
|
|
7
|
-
import { data, getDefaultChartConfig } from './common.js'
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
title: 'ox-input-chart-mixed for bar',
|
|
11
|
-
component: 'ox-input-chart-mixed',
|
|
12
|
-
argTypes: {
|
|
13
|
-
value: { control: 'object' }
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface Story<T> {
|
|
18
|
-
(args: T): TemplateResult
|
|
19
|
-
args?: Partial<T>
|
|
20
|
-
argTypes?: Record<string, unknown>
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface ArgTypes {
|
|
24
|
-
value: OperatoChart.ChartConfig
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function showCharts(e: Event) {
|
|
28
|
-
const target = e.currentTarget as any
|
|
29
|
-
const config = target.value
|
|
30
|
-
const chartjs = document.querySelector('#chartjs') as HTMLElement
|
|
31
|
-
if (chartjs) {
|
|
32
|
-
;(chartjs as any).config = { ...config }
|
|
33
|
-
}
|
|
34
|
-
const scichart = document.querySelector('#scichart') as HTMLElement
|
|
35
|
-
if (scichart) {
|
|
36
|
-
;(scichart as any).config = config
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const Template: Story<ArgTypes> = ({ value }: ArgTypes) => html`
|
|
41
|
-
<link
|
|
42
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
|
|
43
|
-
rel="stylesheet"
|
|
44
|
-
/>
|
|
45
|
-
<link
|
|
46
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
|
|
47
|
-
rel="stylesheet"
|
|
48
|
-
/>
|
|
49
|
-
<link
|
|
50
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
|
|
51
|
-
rel="stylesheet"
|
|
52
|
-
/>
|
|
53
|
-
|
|
54
|
-
<link href="/themes/light.css" rel="stylesheet" />
|
|
55
|
-
<link href="/themes/dark.css" rel="stylesheet" />
|
|
56
|
-
<link href="/themes/spacing.css" rel="stylesheet" />
|
|
57
|
-
|
|
58
|
-
<style>
|
|
59
|
-
.desc {
|
|
60
|
-
color: var(--md-sys-color-background);
|
|
61
|
-
background-color: var(--md-sys-color-on-background);
|
|
62
|
-
padding: var(--spacing-small);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.container {
|
|
66
|
-
display: flex;
|
|
67
|
-
flex-direction: row;
|
|
68
|
-
overflow-y: auto;
|
|
69
|
-
padding: var(--spacing-medium);
|
|
70
|
-
gap: var(--spacing-medium);
|
|
71
|
-
|
|
72
|
-
color: var(--md-sys-color-on-background);
|
|
73
|
-
background-color: var(--md-sys-color-background);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
#editor {
|
|
77
|
-
width: 300px;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
#charts {
|
|
81
|
-
flex: 1;
|
|
82
|
-
|
|
83
|
-
display: flex;
|
|
84
|
-
flex-direction: column;
|
|
85
|
-
gap: var(--spacing-medium);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
#chartjs {
|
|
89
|
-
flex: 1;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
#scichart {
|
|
93
|
-
flex: 1;
|
|
94
|
-
}
|
|
95
|
-
</style>
|
|
96
|
-
|
|
97
|
-
<div class="desc">Type 'count' or 'average' for series dataKey, type 'timestamp' for axis's dataKey</div>
|
|
98
|
-
|
|
99
|
-
<div class="container">
|
|
100
|
-
<ox-input-chart-mixed chart-type="bar" id="editor" .value=${value} @change=${showCharts}></ox-input-chart-mixed>
|
|
101
|
-
<div id="charts">
|
|
102
|
-
<ox-chart-js id="chartjs" .data=${data}></ox-chart-js>
|
|
103
|
-
<ox-scichart id="scichart"></ox-scichart>
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
`
|
|
107
|
-
|
|
108
|
-
export const Default = Template.bind({})
|
|
109
|
-
Default.args = {
|
|
110
|
-
value: {
|
|
111
|
-
...getDefaultChartConfig('bar')
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export const WithData = Template.bind({})
|
|
116
|
-
WithData.args = {
|
|
117
|
-
value: {
|
|
118
|
-
...getDefaultChartConfig('bar'),
|
|
119
|
-
data: {
|
|
120
|
-
datasets: [
|
|
121
|
-
{
|
|
122
|
-
label: 'Bar Series',
|
|
123
|
-
type: 'bar',
|
|
124
|
-
dataKey: 'count',
|
|
125
|
-
backgroundColor: 'rgba(255, 99, 132, 0.2)',
|
|
126
|
-
borderColor: 'rgba(255, 99, 132, 1)',
|
|
127
|
-
borderWidth: 1
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
label: 'Line Series',
|
|
131
|
-
type: 'line',
|
|
132
|
-
dataKey: 'average',
|
|
133
|
-
borderColor: 'rgba(54, 162, 235, 1)',
|
|
134
|
-
borderWidth: 1,
|
|
135
|
-
fill: false,
|
|
136
|
-
lineTension: 0.4,
|
|
137
|
-
pointStyle: 'circle',
|
|
138
|
-
pointRadius: 3
|
|
139
|
-
}
|
|
140
|
-
],
|
|
141
|
-
labelDataKey: 'timestamp'
|
|
142
|
-
},
|
|
143
|
-
options: {
|
|
144
|
-
scales: {
|
|
145
|
-
xAxes: [{ ticks: { beginAtZero: true } }],
|
|
146
|
-
yAxes: [{ ticks: { beginAtZero: true } }]
|
|
147
|
-
},
|
|
148
|
-
legend: { display: true }
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export const MultiAxis = Template.bind({})
|
|
154
|
-
MultiAxis.args = {
|
|
155
|
-
value: {
|
|
156
|
-
...getDefaultChartConfig('bar'),
|
|
157
|
-
options: {
|
|
158
|
-
...getDefaultChartConfig('bar').options,
|
|
159
|
-
multiAxis: true
|
|
160
|
-
},
|
|
161
|
-
data: {
|
|
162
|
-
datasets: [
|
|
163
|
-
{
|
|
164
|
-
label: 'Bar Series',
|
|
165
|
-
type: 'bar',
|
|
166
|
-
dataKey: 'count',
|
|
167
|
-
backgroundColor: 'rgba(255, 99, 132, 0.2)',
|
|
168
|
-
borderColor: 'rgba(255, 99, 132, 1)',
|
|
169
|
-
borderWidth: 1,
|
|
170
|
-
yAxisID: 'left'
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
label: 'Line Series',
|
|
174
|
-
type: 'line',
|
|
175
|
-
dataKey: 'average',
|
|
176
|
-
borderColor: 'rgba(54, 162, 235, 1)',
|
|
177
|
-
borderWidth: 1,
|
|
178
|
-
fill: false,
|
|
179
|
-
lineTension: 0.4,
|
|
180
|
-
pointStyle: 'circle',
|
|
181
|
-
pointRadius: 3,
|
|
182
|
-
yAxisID: 'right'
|
|
183
|
-
}
|
|
184
|
-
],
|
|
185
|
-
labelDataKey: 'timestamp'
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { html, TemplateResult } from 'lit'
|
|
2
|
-
|
|
3
|
-
import '../src/editors/ox-input-chart-pie.js'
|
|
4
|
-
import '../src/chartjs/ox-chart-js.js'
|
|
5
|
-
|
|
6
|
-
import { data, getDefaultChartConfig } from './common.js'
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
title: 'ox-input-chart-pie for doughnut',
|
|
10
|
-
component: 'ox-input-chart-pie',
|
|
11
|
-
argTypes: {
|
|
12
|
-
value: { control: 'object' },
|
|
13
|
-
currentSeriesIndex: { control: 'number' }
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface Story<T> {
|
|
18
|
-
(args: T): TemplateResult
|
|
19
|
-
args?: Partial<T>
|
|
20
|
-
argTypes?: Record<string, unknown>
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface ArgTypes {
|
|
24
|
-
value: OperatoChart.ChartConfig
|
|
25
|
-
currentSeriesIndex: number
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const Template: Story<ArgTypes> = ({ value, currentSeriesIndex }: ArgTypes) => html`
|
|
29
|
-
<link
|
|
30
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
|
|
31
|
-
rel="stylesheet"
|
|
32
|
-
/>
|
|
33
|
-
<link
|
|
34
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
|
|
35
|
-
rel="stylesheet"
|
|
36
|
-
/>
|
|
37
|
-
<link
|
|
38
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
|
|
39
|
-
rel="stylesheet"
|
|
40
|
-
/>
|
|
41
|
-
|
|
42
|
-
<link href="/themes/light.css" rel="stylesheet" />
|
|
43
|
-
<link href="/themes/dark.css" rel="stylesheet" />
|
|
44
|
-
<link href="/themes/spacing.css" rel="stylesheet" />
|
|
45
|
-
|
|
46
|
-
<style>
|
|
47
|
-
.container {
|
|
48
|
-
width: 100%;
|
|
49
|
-
height: 100%;
|
|
50
|
-
|
|
51
|
-
display: flex;
|
|
52
|
-
flex-direction: row;
|
|
53
|
-
overflow-y: auto;
|
|
54
|
-
padding: var(--spacing-medium);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.container.dark {
|
|
58
|
-
background-color: black;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
#editor {
|
|
62
|
-
width: 300px;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
#chart {
|
|
66
|
-
flex: 1;
|
|
67
|
-
}
|
|
68
|
-
</style>
|
|
69
|
-
|
|
70
|
-
<div style="background-color: black; color: white;">
|
|
71
|
-
Type 'count' or 'average' for series dataKey, type 'timestamp' for axis's dataKey
|
|
72
|
-
</div>
|
|
73
|
-
|
|
74
|
-
<div class="container light">
|
|
75
|
-
<ox-input-chart-pie
|
|
76
|
-
chart-type="doughnut"
|
|
77
|
-
id="editor"
|
|
78
|
-
.value=${value}
|
|
79
|
-
@change=${(e: CustomEvent) => {
|
|
80
|
-
const target = e.currentTarget as any
|
|
81
|
-
const config = target.value
|
|
82
|
-
const chartjs = document.querySelector('#chartjs') as HTMLElement
|
|
83
|
-
if (chartjs) {
|
|
84
|
-
;(chartjs as any).config = { ...config }
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const container = document.querySelector('.container') as HTMLElement
|
|
88
|
-
if (container) {
|
|
89
|
-
const theme = config.options.theme
|
|
90
|
-
if (theme == 'dark') {
|
|
91
|
-
container.classList.remove('light')
|
|
92
|
-
container.classList.add('dark')
|
|
93
|
-
} else {
|
|
94
|
-
container.classList.remove('dark')
|
|
95
|
-
container.classList.add('light')
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}}
|
|
99
|
-
></ox-input-chart-pie>
|
|
100
|
-
<ox-chart-js id="chartjs" .data=${data}></ox-chart-js>
|
|
101
|
-
</div>
|
|
102
|
-
`
|
|
103
|
-
|
|
104
|
-
export const Default = Template.bind({})
|
|
105
|
-
Default.args = {
|
|
106
|
-
currentSeriesIndex: 0
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export const WithData = Template.bind({})
|
|
110
|
-
WithData.args = {
|
|
111
|
-
value: {
|
|
112
|
-
...getDefaultChartConfig('doughnut'),
|
|
113
|
-
data: {
|
|
114
|
-
datasets: [
|
|
115
|
-
{
|
|
116
|
-
label: 'Doughnut Series',
|
|
117
|
-
data: [10, 20, 30],
|
|
118
|
-
backgroundColor: ['rgba(255, 99, 132, 0.2)', 'rgba(54, 162, 235, 0.2)', 'rgba(75, 192, 192, 0.2)'],
|
|
119
|
-
borderColor: ['rgba(255, 99, 132, 1)', 'rgba(54, 162, 235, 1)', 'rgba(75, 192, 192, 1)'],
|
|
120
|
-
borderWidth: 1
|
|
121
|
-
}
|
|
122
|
-
],
|
|
123
|
-
labelDataKey: 'labels'
|
|
124
|
-
},
|
|
125
|
-
options: {
|
|
126
|
-
legend: { display: true }
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
currentSeriesIndex: 0
|
|
130
|
-
}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { html, TemplateResult } from 'lit'
|
|
2
|
-
|
|
3
|
-
import '../src/editors/ox-input-chart-hbar.js'
|
|
4
|
-
import '../src/chartjs/ox-chart-js.js'
|
|
5
|
-
import '../src/scichart/ox-scichart.js'
|
|
6
|
-
|
|
7
|
-
import { data, getDefaultChartConfig } from './common.js'
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
title: 'ox-input-chart-hbar',
|
|
11
|
-
component: 'ox-input-chart-hbar',
|
|
12
|
-
argTypes: {
|
|
13
|
-
value: { control: 'object' }
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface Story<T> {
|
|
18
|
-
(args: T): TemplateResult
|
|
19
|
-
args?: Partial<T>
|
|
20
|
-
argTypes?: Record<string, unknown>
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface ArgTypes {
|
|
24
|
-
value: OperatoChart.ChartConfig
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const Template: Story<ArgTypes> = ({ value }: ArgTypes) => html`
|
|
28
|
-
<link
|
|
29
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
|
|
30
|
-
rel="stylesheet"
|
|
31
|
-
/>
|
|
32
|
-
<link
|
|
33
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
|
|
34
|
-
rel="stylesheet"
|
|
35
|
-
/>
|
|
36
|
-
<link
|
|
37
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
|
|
38
|
-
rel="stylesheet"
|
|
39
|
-
/>
|
|
40
|
-
|
|
41
|
-
<link href="/themes/light.css" rel="stylesheet" />
|
|
42
|
-
<link href="/themes/dark.css" rel="stylesheet" />
|
|
43
|
-
<link href="/themes/spacing.css" rel="stylesheet" />
|
|
44
|
-
|
|
45
|
-
<style>
|
|
46
|
-
.container {
|
|
47
|
-
width: 100%;
|
|
48
|
-
height: 100%;
|
|
49
|
-
|
|
50
|
-
display: flex;
|
|
51
|
-
flex-direction: row;
|
|
52
|
-
overflow-y: auto;
|
|
53
|
-
padding: var(--spacing-medium);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.container.dark {
|
|
57
|
-
background-color: black;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
#editor {
|
|
61
|
-
width: 300px;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
#charts {
|
|
65
|
-
flex: 1;
|
|
66
|
-
|
|
67
|
-
display: flex;
|
|
68
|
-
flex-direction: column;
|
|
69
|
-
padding: 10px;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
#chartjs {
|
|
73
|
-
flex: 1;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
#scichart {
|
|
77
|
-
flex: 1;
|
|
78
|
-
}
|
|
79
|
-
</style>
|
|
80
|
-
|
|
81
|
-
<div style="background-color: black; color: white;">
|
|
82
|
-
Type 'count' or 'average' for series dataKey, type 'timestamp' for axis's dataKey
|
|
83
|
-
</div>
|
|
84
|
-
<div class="container light">
|
|
85
|
-
<ox-input-chart-hbar
|
|
86
|
-
chart-type="horizontalBar"
|
|
87
|
-
id="editor"
|
|
88
|
-
.value=${value}
|
|
89
|
-
@change=${async (e: CustomEvent) => {
|
|
90
|
-
const target = e.currentTarget as any
|
|
91
|
-
const config = target.value
|
|
92
|
-
const chartjs = document.querySelector('#chartjs') as HTMLElement
|
|
93
|
-
if (chartjs) {
|
|
94
|
-
;(chartjs as any).config = { ...config }
|
|
95
|
-
}
|
|
96
|
-
const scichart = document.querySelector('#scichart') as HTMLElement
|
|
97
|
-
if (scichart) {
|
|
98
|
-
;(scichart as any).config = config
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const container = document.querySelector('.container') as HTMLElement
|
|
102
|
-
if (container) {
|
|
103
|
-
const theme = config.options.theme
|
|
104
|
-
if (theme == 'dark') {
|
|
105
|
-
container.classList.remove('light')
|
|
106
|
-
container.classList.add('dark')
|
|
107
|
-
} else {
|
|
108
|
-
container.classList.remove('dark')
|
|
109
|
-
container.classList.add('light')
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}}
|
|
113
|
-
></ox-input-chart-hbar>
|
|
114
|
-
<div id="charts">
|
|
115
|
-
<ox-chart-js id="chartjs" .data=${data}></ox-chart-js>
|
|
116
|
-
<ox-scichart id="scichart"></ox-scichart>
|
|
117
|
-
</div>
|
|
118
|
-
</div>
|
|
119
|
-
`
|
|
120
|
-
|
|
121
|
-
export const Default = Template.bind({})
|
|
122
|
-
Default.args = {}
|
|
123
|
-
|
|
124
|
-
// 다양한 데이터셋과 함께 사용하는 스토리
|
|
125
|
-
export const WithData = Template.bind({})
|
|
126
|
-
WithData.args = {
|
|
127
|
-
value: {
|
|
128
|
-
...getDefaultChartConfig('bar'),
|
|
129
|
-
data: {
|
|
130
|
-
datasets: [
|
|
131
|
-
{
|
|
132
|
-
label: 'Series 1',
|
|
133
|
-
data: [10, 20, 30],
|
|
134
|
-
backgroundColor: 'rgba(255, 99, 132, 0.2)',
|
|
135
|
-
borderColor: 'rgba(255, 99, 132, 1)',
|
|
136
|
-
borderWidth: 1
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
label: 'Series 2',
|
|
140
|
-
data: [15, 25, 35],
|
|
141
|
-
backgroundColor: 'rgba(54, 162, 235, 0.2)',
|
|
142
|
-
borderColor: 'rgba(54, 162, 235, 1)',
|
|
143
|
-
borderWidth: 1
|
|
144
|
-
}
|
|
145
|
-
],
|
|
146
|
-
labelDataKey: 'labels'
|
|
147
|
-
},
|
|
148
|
-
options: {
|
|
149
|
-
scales: {
|
|
150
|
-
xAxes: [{ ticks: { beginAtZero: true } }],
|
|
151
|
-
yAxes: [{ ticks: { beginAtZero: true } }]
|
|
152
|
-
},
|
|
153
|
-
legend: { display: true }
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export const MultiAxis = Template.bind({})
|
|
159
|
-
MultiAxis.args = {
|
|
160
|
-
value: {
|
|
161
|
-
...getDefaultChartConfig('bar'),
|
|
162
|
-
options: {
|
|
163
|
-
...getDefaultChartConfig('bar').options,
|
|
164
|
-
multiAxis: true
|
|
165
|
-
},
|
|
166
|
-
data: {
|
|
167
|
-
datasets: [
|
|
168
|
-
{
|
|
169
|
-
label: 'Series 1',
|
|
170
|
-
data: [10, 20, 30],
|
|
171
|
-
backgroundColor: 'rgba(255, 99, 132, 0.2)',
|
|
172
|
-
borderColor: 'rgba(255, 99, 132, 1)',
|
|
173
|
-
borderWidth: 1,
|
|
174
|
-
yAxisID: 'left'
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
label: 'Series 2',
|
|
178
|
-
data: [15, 25, 35],
|
|
179
|
-
backgroundColor: 'rgba(54, 162, 235, 0.2)',
|
|
180
|
-
borderColor: 'rgba(54, 162, 235, 1)',
|
|
181
|
-
borderWidth: 1,
|
|
182
|
-
yAxisID: 'right'
|
|
183
|
-
}
|
|
184
|
-
],
|
|
185
|
-
labelDataKey: 'labels'
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { html, TemplateResult } from 'lit'
|
|
2
|
-
|
|
3
|
-
import '../src/editors/ox-input-chart-mixed.js'
|
|
4
|
-
import '../src/chartjs/ox-chart-js.js'
|
|
5
|
-
import '../src/scichart/ox-scichart.js'
|
|
6
|
-
|
|
7
|
-
import { data, getDefaultChartConfig } from './common.js'
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
title: 'ox-input-chart-mixed for line',
|
|
11
|
-
component: 'ox-input-chart-mixed',
|
|
12
|
-
argTypes: {
|
|
13
|
-
value: { control: 'object' }
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface Story<T> {
|
|
18
|
-
(args: T): TemplateResult
|
|
19
|
-
args?: Partial<T>
|
|
20
|
-
argTypes?: Record<string, unknown>
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface ArgTypes {
|
|
24
|
-
value: OperatoChart.ChartConfig
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const Template: Story<ArgTypes> = ({ value }: ArgTypes) => html`
|
|
28
|
-
<link
|
|
29
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
|
|
30
|
-
rel="stylesheet"
|
|
31
|
-
/>
|
|
32
|
-
<link
|
|
33
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
|
|
34
|
-
rel="stylesheet"
|
|
35
|
-
/>
|
|
36
|
-
<link
|
|
37
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
|
|
38
|
-
rel="stylesheet"
|
|
39
|
-
/>
|
|
40
|
-
|
|
41
|
-
<link href="/themes/light.css" rel="stylesheet" />
|
|
42
|
-
<link href="/themes/dark.css" rel="stylesheet" />
|
|
43
|
-
<link href="/themes/spacing.css" rel="stylesheet" />
|
|
44
|
-
|
|
45
|
-
<style>
|
|
46
|
-
.container {
|
|
47
|
-
width: 100%;
|
|
48
|
-
height: 100%;
|
|
49
|
-
|
|
50
|
-
display: flex;
|
|
51
|
-
flex-direction: row;
|
|
52
|
-
overflow-y: auto;
|
|
53
|
-
padding: var(--spacing-medium);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.container.dark {
|
|
57
|
-
background-color: black;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
#editor {
|
|
61
|
-
width: 300px;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
#charts {
|
|
65
|
-
flex: 1;
|
|
66
|
-
|
|
67
|
-
display: flex;
|
|
68
|
-
flex-direction: column;
|
|
69
|
-
padding: 10px;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
#chartjs {
|
|
73
|
-
flex: 1;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
#scichart {
|
|
77
|
-
flex: 1;
|
|
78
|
-
}
|
|
79
|
-
</style>
|
|
80
|
-
|
|
81
|
-
<div style="background-color: black; color: white;">
|
|
82
|
-
Type 'count' or 'average' for series dataKey, type 'timestamp' for axis's dataKey
|
|
83
|
-
</div>
|
|
84
|
-
|
|
85
|
-
<div class="container light">
|
|
86
|
-
<ox-input-chart-mixed
|
|
87
|
-
chart-type="line"
|
|
88
|
-
id="editor"
|
|
89
|
-
.value=${value}
|
|
90
|
-
@change=${(e: CustomEvent) => {
|
|
91
|
-
const target = e.currentTarget as any
|
|
92
|
-
const config = target.value
|
|
93
|
-
const chartjs = document.querySelector('#chartjs') as HTMLElement
|
|
94
|
-
if (chartjs) {
|
|
95
|
-
;(chartjs as any).config = { ...config }
|
|
96
|
-
}
|
|
97
|
-
const scichart = document.querySelector('#scichart') as HTMLElement
|
|
98
|
-
if (scichart) {
|
|
99
|
-
;(scichart as any).config = config
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const container = document.querySelector('.container') as HTMLElement
|
|
103
|
-
if (container) {
|
|
104
|
-
const theme = config.options.theme
|
|
105
|
-
if (theme == 'dark') {
|
|
106
|
-
container.classList.remove('light')
|
|
107
|
-
container.classList.add('dark')
|
|
108
|
-
} else {
|
|
109
|
-
container.classList.remove('dark')
|
|
110
|
-
container.classList.add('light')
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}}
|
|
114
|
-
></ox-input-chart-mixed>
|
|
115
|
-
<div id="charts">
|
|
116
|
-
<ox-chart-js id="chartjs" .data=${data}></ox-chart-js>
|
|
117
|
-
<ox-scichart id="scichart"></ox-scichart>
|
|
118
|
-
</div>
|
|
119
|
-
</div>
|
|
120
|
-
`
|
|
121
|
-
|
|
122
|
-
export const Default = Template.bind({})
|
|
123
|
-
Default.args = {}
|
|
124
|
-
|
|
125
|
-
export const WithData = Template.bind({})
|
|
126
|
-
WithData.args = {
|
|
127
|
-
value: {
|
|
128
|
-
...getDefaultChartConfig('line'),
|
|
129
|
-
data: {
|
|
130
|
-
datasets: [
|
|
131
|
-
{
|
|
132
|
-
label: 'Bar Series',
|
|
133
|
-
type: 'bar',
|
|
134
|
-
data: [10, 20, 30],
|
|
135
|
-
backgroundColor: 'rgba(255, 99, 132, 0.2)',
|
|
136
|
-
borderColor: 'rgba(255, 99, 132, 1)',
|
|
137
|
-
borderWidth: 1
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
label: 'Line Series',
|
|
141
|
-
type: 'line',
|
|
142
|
-
data: [15, 25, 35],
|
|
143
|
-
borderColor: 'rgba(54, 162, 235, 1)',
|
|
144
|
-
borderWidth: 1,
|
|
145
|
-
fill: false,
|
|
146
|
-
lineTension: 0.4,
|
|
147
|
-
pointStyle: 'circle',
|
|
148
|
-
pointRadius: 3
|
|
149
|
-
}
|
|
150
|
-
],
|
|
151
|
-
labelDataKey: 'labels'
|
|
152
|
-
},
|
|
153
|
-
options: {
|
|
154
|
-
scales: {
|
|
155
|
-
xAxes: [{ ticks: { beginAtZero: true } }],
|
|
156
|
-
yAxes: [{ ticks: { beginAtZero: true } }]
|
|
157
|
-
},
|
|
158
|
-
legend: { display: true }
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export const MultiAxis = Template.bind({})
|
|
164
|
-
MultiAxis.args = {
|
|
165
|
-
value: {
|
|
166
|
-
...getDefaultChartConfig('line'),
|
|
167
|
-
options: {
|
|
168
|
-
...getDefaultChartConfig('line').options,
|
|
169
|
-
multiAxis: true
|
|
170
|
-
},
|
|
171
|
-
data: {
|
|
172
|
-
datasets: [
|
|
173
|
-
{
|
|
174
|
-
label: 'Bar Series',
|
|
175
|
-
type: 'bar',
|
|
176
|
-
data: [10, 20, 30],
|
|
177
|
-
backgroundColor: 'rgba(255, 99, 132, 0.2)',
|
|
178
|
-
borderColor: 'rgba(255, 99, 132, 1)',
|
|
179
|
-
borderWidth: 1,
|
|
180
|
-
yAxisID: 'left'
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
label: 'Line Series',
|
|
184
|
-
type: 'line',
|
|
185
|
-
data: [15, 25, 35],
|
|
186
|
-
borderColor: 'rgba(54, 162, 235, 1)',
|
|
187
|
-
borderWidth: 1,
|
|
188
|
-
fill: false,
|
|
189
|
-
lineTension: 0.4,
|
|
190
|
-
pointStyle: 'circle',
|
|
191
|
-
pointRadius: 3,
|
|
192
|
-
yAxisID: 'right'
|
|
193
|
-
}
|
|
194
|
-
],
|
|
195
|
-
labelDataKey: 'labels'
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|