@operato/chart 8.0.0-alpha.9 → 8.0.0-beta.1
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 +197 -0
- package/dist/src/editors/configurer.d.ts +2 -2
- package/dist/src/editors/ox-input-chart-hbar.js +6 -1
- package/dist/src/editors/ox-input-chart-hbar.js.map +1 -1
- package/dist/src/editors/ox-input-chart-mixed.js +6 -1
- package/dist/src/editors/ox-input-chart-mixed.js.map +1 -1
- package/dist/src/editors/ox-input-chart-radar.js +6 -1
- package/dist/src/editors/ox-input-chart-radar.js.map +1 -1
- package/dist/src/editors/ox-input-chart-timeseries.js +7 -1
- package/dist/src/editors/ox-input-chart-timeseries.js.map +1 -1
- package/dist/src/editors/templates/annotations.d.ts +1 -0
- package/dist/src/editors/templates/annotations.js +5 -0
- package/dist/src/editors/templates/annotations.js.map +1 -1
- package/dist/src/editors/templates/display-value.js +7 -6
- package/dist/src/editors/templates/display-value.js.map +1 -1
- package/dist/src/editors/templates/series.d.ts +1 -0
- package/dist/src/editors/templates/series.js +5 -0
- package/dist/src/editors/templates/series.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -14
- package/.editorconfig +0 -29
- package/.storybook/main.js +0 -3
- package/.storybook/preview.js +0 -52
- package/.storybook/server.mjs +0 -8
- 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/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 -152
- package/src/editors/ox-input-chart-mixed.ts +0 -236
- package/src/editors/ox-input-chart-pie.ts +0 -69
- package/src/editors/ox-input-chart-radar.ts +0 -51
- package/src/editors/ox-input-chart-timeseries.ts +0 -273
- package/src/editors/ox-property-editor-chart.ts +0 -72
- package/src/editors/templates/annotations.ts +0 -287
- package/src/editors/templates/display-value.ts +0 -110
- package/src/editors/templates/series.ts +0 -308
- 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
package/src/types.d.ts
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
declare namespace OperatoChart {
|
|
2
|
-
export type SeriesType = 'bar' | 'horizontalBar' | 'line' | 'radar' | 'pie' | 'doughnut' | 'polarArea' | undefined
|
|
3
|
-
export type ChartType =
|
|
4
|
-
| 'bar'
|
|
5
|
-
| 'horizontalBar'
|
|
6
|
-
| 'line'
|
|
7
|
-
| 'radar'
|
|
8
|
-
| 'pie'
|
|
9
|
-
| 'doughnut'
|
|
10
|
-
| 'polarArea'
|
|
11
|
-
| 'mixed'
|
|
12
|
-
| 'timeseries'
|
|
13
|
-
|
|
14
|
-
export interface ChartConfig {
|
|
15
|
-
data: ChartData
|
|
16
|
-
options?: ChartOptions
|
|
17
|
-
type?: ChartType
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface ChartData {
|
|
21
|
-
labels?: Array<string | string[]>
|
|
22
|
-
datasets: Dataset[]
|
|
23
|
-
labelDataKey?: string
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface Dataset {
|
|
27
|
-
label?: string
|
|
28
|
-
data?: any[]
|
|
29
|
-
borderWidth?: number
|
|
30
|
-
dataKey?: string
|
|
31
|
-
yAxisID?: string
|
|
32
|
-
color?: string | string[]
|
|
33
|
-
type?: ChartType
|
|
34
|
-
backgroundColor?: string | string[]
|
|
35
|
-
stack?: string
|
|
36
|
-
fill?: boolean
|
|
37
|
-
lineTension?: number
|
|
38
|
-
pointStyle?:
|
|
39
|
-
| 'circle'
|
|
40
|
-
| 'triangle'
|
|
41
|
-
| 'rect'
|
|
42
|
-
| 'rectRot'
|
|
43
|
-
| 'cross'
|
|
44
|
-
| 'crossRot'
|
|
45
|
-
| 'star'
|
|
46
|
-
| 'line'
|
|
47
|
-
| 'dash'
|
|
48
|
-
| undefined
|
|
49
|
-
pointRadius?: number
|
|
50
|
-
valuePrefix?: string
|
|
51
|
-
valueSuffix?: string
|
|
52
|
-
valueFormat?: string
|
|
53
|
-
displayValue?: boolean
|
|
54
|
-
dataLabelAnchor?: string
|
|
55
|
-
dataLabelOffset?: number
|
|
56
|
-
dataLabelRotation?: number
|
|
57
|
-
[key: string]: any
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface ChartOptions {
|
|
61
|
-
theme?: 'dark' | 'light' | 'auto'
|
|
62
|
-
tooltip?: boolean
|
|
63
|
-
animation?: boolean
|
|
64
|
-
legend?: LegendOptions
|
|
65
|
-
scales?: ScalesOptions
|
|
66
|
-
stacked?: boolean
|
|
67
|
-
xGridLine?: boolean
|
|
68
|
-
yGridLine?: boolean
|
|
69
|
-
y2ndGridLine?: boolean
|
|
70
|
-
multiAxis?: boolean
|
|
71
|
-
maintainAspectRatio?: boolean
|
|
72
|
-
plugins?: { [plugin: string]: any }
|
|
73
|
-
annotations?: Annotation[]
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface LegendOptions {
|
|
77
|
-
display?: boolean
|
|
78
|
-
position?: 'top' | 'right' | 'bottom' | 'left'
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface ScalesOptions {
|
|
82
|
-
xAxes?: AxisOptions[]
|
|
83
|
-
yAxes?: AxisOptions[]
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export interface AxisOptions {
|
|
87
|
-
axisTitle?: string
|
|
88
|
-
barSpacing?: number
|
|
89
|
-
categorySpacing?: number
|
|
90
|
-
barPercentage?: number
|
|
91
|
-
ticks?: TickOptions
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface TickOptions {
|
|
95
|
-
display?: boolean
|
|
96
|
-
autoMin?: boolean
|
|
97
|
-
autoMax?: boolean
|
|
98
|
-
min?: number
|
|
99
|
-
max?: number
|
|
100
|
-
stepSize?: number
|
|
101
|
-
beginAtZero?: boolean
|
|
102
|
-
color?: string
|
|
103
|
-
textStrokeColor?: string
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export interface Annotation {
|
|
107
|
-
type: AnnotationType
|
|
108
|
-
x1?: number
|
|
109
|
-
y1?: number
|
|
110
|
-
x2?: number
|
|
111
|
-
y2?: number
|
|
112
|
-
stroke?: string
|
|
113
|
-
strokeThickness?: number
|
|
114
|
-
fill?: string
|
|
115
|
-
text?: string
|
|
116
|
-
horizontalAnchorPoint?: 'Left' | 'Center' | 'Right'
|
|
117
|
-
verticalAnchorPoint?: 'Top' | 'Center' | 'Bottom'
|
|
118
|
-
xCoordinateMode?: 'DataValue' | 'Pixel' | 'Relative'
|
|
119
|
-
yCoordinateMode?: 'DataValue' | 'Pixel' | 'Relative'
|
|
120
|
-
[key: string]: any
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export type AnnotationType = 'line' | 'text' | 'box' | 'horizontalLine' | 'verticalLine' | undefined
|
|
124
|
-
}
|
package/stories/common.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
export function getDefaultChartConfig(
|
|
2
|
-
type: OperatoChart.ChartType,
|
|
3
|
-
datasets?: OperatoChart.Dataset[]
|
|
4
|
-
): OperatoChart.ChartConfig {
|
|
5
|
-
return {
|
|
6
|
-
data: {
|
|
7
|
-
datasets: datasets || [],
|
|
8
|
-
labelDataKey: ''
|
|
9
|
-
},
|
|
10
|
-
options: {
|
|
11
|
-
theme: 'light',
|
|
12
|
-
tooltip: true,
|
|
13
|
-
animation: true,
|
|
14
|
-
legend: {
|
|
15
|
-
display: true,
|
|
16
|
-
position: 'top'
|
|
17
|
-
},
|
|
18
|
-
scales: {
|
|
19
|
-
xAxes: [getDefaultAxisOptions()],
|
|
20
|
-
yAxes: [getDefaultAxisOptions(), getDefaultAxisOptions()] // Two y-axes for multi-axis support
|
|
21
|
-
},
|
|
22
|
-
stacked: false,
|
|
23
|
-
xGridLine: true,
|
|
24
|
-
yGridLine: true,
|
|
25
|
-
y2ndGridLine: false,
|
|
26
|
-
multiAxis: false
|
|
27
|
-
},
|
|
28
|
-
type
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function getDefaultAxisOptions(): OperatoChart.AxisOptions {
|
|
33
|
-
return {
|
|
34
|
-
axisTitle: '',
|
|
35
|
-
barSpacing: 0,
|
|
36
|
-
categorySpacing: 0,
|
|
37
|
-
barPercentage: 0.9,
|
|
38
|
-
ticks: {
|
|
39
|
-
display: true,
|
|
40
|
-
autoMin: true,
|
|
41
|
-
autoMax: true,
|
|
42
|
-
min: undefined,
|
|
43
|
-
max: undefined,
|
|
44
|
-
stepSize: undefined
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// export const data = [
|
|
50
|
-
// { timestamp: 2010, count: 10, average: 120 },
|
|
51
|
-
// { timestamp: 2011, count: 20, average: 110 },
|
|
52
|
-
// { timestamp: 2012, count: 15, average: 80 },
|
|
53
|
-
// { timestamp: 2013, count: 25, average: 130 },
|
|
54
|
-
// { timestamp: 2014, count: 22, average: 120 },
|
|
55
|
-
// { timestamp: 2015, count: 30, average: 60 },
|
|
56
|
-
// { timestamp: 2016, count: 28, average: 90 }
|
|
57
|
-
// ]
|
|
58
|
-
// 랜덤한 범위의 숫자를 생성하는 함수
|
|
59
|
-
function getRandomInRange(i: number, min: number, max: number) {
|
|
60
|
-
if (!(i % 11)) {
|
|
61
|
-
return null
|
|
62
|
-
}
|
|
63
|
-
return Math.floor(Math.random() * (max - min + 1)) + min
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// 랜덤 데이터를 생성하는 함수
|
|
67
|
-
function generateRandomData(count: number) {
|
|
68
|
-
const randomData = []
|
|
69
|
-
const startTimestamp = Math.floor(Date.now()) // 현재 시간을 Unix 타임스탬프로 설정
|
|
70
|
-
|
|
71
|
-
for (let i = 0; i < count; i++) {
|
|
72
|
-
const timestamp = startTimestamp + i * 360 * 30 * 1000 // 3초씩 증가하는 타임스탬프 설정
|
|
73
|
-
const randomCount = getRandomInRange(i, 5, 35) // count 값을 5에서 35 사이로 랜덤 생성
|
|
74
|
-
const randomAverage = getRandomInRange(i, 50, 150) // average 값을 50에서 150 사이로 랜덤 생성
|
|
75
|
-
|
|
76
|
-
randomData.push({
|
|
77
|
-
timestamp: timestamp,
|
|
78
|
-
count: randomCount,
|
|
79
|
-
average: randomAverage
|
|
80
|
-
})
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return randomData
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// 100개의 랜덤 데이터를 생성
|
|
87
|
-
export const data = generateRandomData(100)
|
|
@@ -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
|
-
}
|