@graphenedata/cli 0.0.13 → 0.0.14
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/dist/cli/cli.js +8591 -1214
- package/dist/docs/base.md +98 -0
- package/dist/docs/cli.md +22 -0
- package/dist/docs/graphene.md +10 -10
- package/dist/ui/component-utilities/echarts.js +2 -3
- package/dist/ui/component-utilities/formatting.js +3 -11
- package/dist/ui/component-utilities/getSeriesConfig.js +2 -1
- package/dist/ui/components/Area.svelte +188 -151
- package/dist/ui/components/AreaChart.svelte +43 -79
- package/dist/ui/components/Bar.svelte +273 -255
- package/dist/ui/components/BarChart.svelte +58 -112
- package/dist/ui/components/BigValue.svelte +13 -7
- package/dist/ui/components/Chart.svelte +280 -317
- package/dist/ui/components/Column.svelte +102 -113
- package/dist/ui/components/DateRange.svelte +37 -27
- package/dist/ui/components/Dropdown.svelte +77 -57
- package/dist/ui/components/DropdownOption.svelte +10 -7
- package/dist/ui/components/ECharts.svelte +23 -16
- package/dist/ui/components/ErrorChart.svelte +85 -21
- package/dist/ui/components/GrapheneQuery.svelte +7 -3
- package/dist/ui/components/InlineDelta.svelte +53 -34
- package/dist/ui/components/Line.svelte +192 -178
- package/dist/ui/components/LineChart.svelte +53 -96
- package/dist/ui/components/PieChart.svelte +26 -15
- package/dist/ui/components/QueryLoad.svelte +15 -10
- package/dist/ui/components/SortIcon.svelte +5 -1
- package/dist/ui/components/Table.svelte +15 -9
- package/dist/ui/components/TableCell.svelte +30 -17
- package/dist/ui/components/TableGroupRow.svelte +26 -19
- package/dist/ui/components/TableGroupToggle.svelte +9 -6
- package/dist/ui/components/TableHeader.svelte +37 -27
- package/dist/ui/components/TableRow.svelte +30 -20
- package/dist/ui/components/TableSubtotalRow.svelte +16 -9
- package/dist/ui/components/TableTotalRow.svelte +18 -11
- package/dist/ui/components/TextInput.svelte +23 -20
- package/dist/ui/components/_Table.svelte +303 -260
- package/dist/ui/internal/LocalApp.svelte +40 -0
- package/dist/ui/internal/NavSidebar.svelte +27 -30
- package/dist/ui/internal/PageError.svelte +23 -0
- package/dist/ui/internal/checkSocket.ts +48 -0
- package/dist/ui/internal/queryEngine.ts +9 -2
- package/dist/ui/internal/telemetry.ts +1 -0
- package/dist/ui/web.js +5 -55
- package/package.json +8 -9
- package/dist/ui/internal/NavSidebarHMR.svelte +0 -8
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import {
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {getContext} from 'svelte'
|
|
3
|
+
import type {Writable} from 'svelte/store'
|
|
3
4
|
import {propKey, configKey} from '../component-utilities/chartContext.js'
|
|
4
5
|
import getSeriesConfig from '../component-utilities/getSeriesConfig.js'
|
|
5
6
|
import formatTitle from '../component-utilities/formatTitle.js'
|
|
@@ -10,204 +11,217 @@
|
|
|
10
11
|
import {toBoolean} from '../component-utilities/convert'
|
|
11
12
|
import {parseCommaList} from '../component-utilities/inputUtils.ts'
|
|
12
13
|
|
|
14
|
+
interface Props {
|
|
15
|
+
y?: any, y2?: any, series?: any, options?: any, name?: any, lineColor?: any, lineWidth?: number
|
|
16
|
+
lineType?: string, lineOpacity?: any, markers?: boolean | string, markerShape?: string
|
|
17
|
+
markerSize?: number, labels?: boolean | string, labelSize?: number, labelPosition?: string
|
|
18
|
+
labelColor?: any, labelFmt?: any, yLabelFmt?: any, y2LabelFmt?: any, showAllLabels?: boolean | string
|
|
19
|
+
y2SeriesType?: any, handleMissing?: string, step?: boolean | string, stepPosition?: string
|
|
20
|
+
seriesOrder?: any, seriesLabelFmt?: any
|
|
21
|
+
}
|
|
22
|
+
|
|
13
23
|
const {resolveColor} = getThemeStores()
|
|
14
|
-
const
|
|
15
|
-
const config = getContext(configKey)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
let
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
let
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (labelFmt) labelFormat = getFormatObjectFromString(labelFmt)
|
|
80
|
-
if (yLabelFmt) yLabelFormat = getFormatObjectFromString(yLabelFmt)
|
|
81
|
-
if (y2LabelFmt) y2LabelFormat = getFormatObjectFromString(y2LabelFmt)
|
|
82
|
-
|
|
83
|
-
$: data = $props.data
|
|
84
|
-
$: x = $props.x
|
|
85
|
-
$: swapXY = $props.swapXY
|
|
86
|
-
$: yFormat = $props.yFormat
|
|
87
|
-
$: y2Format = $props.y2Format
|
|
88
|
-
$: yCount = $props.yCount
|
|
89
|
-
$: y2Count = $props.y2Count
|
|
90
|
-
$: xType = $props.xType
|
|
91
|
-
$: xMismatch = $props.xMismatch
|
|
92
|
-
$: columnSummary = $props.columnSummary
|
|
93
|
-
$: series = seriesSet ? series : $props.series
|
|
94
|
-
$: resolvedY = ySet ? parseCommaList(y) : $props.y
|
|
95
|
-
$: resolvedY2 = y2Set ? parseCommaList(y2) : $props.y2
|
|
96
|
-
$: seriesOrder = parseCommaList(seriesOrder)
|
|
97
|
-
|
|
98
|
-
$: {
|
|
99
|
-
if (!series && (!Array.isArray(resolvedY) || resolvedY.length === 1)) {
|
|
24
|
+
const chartProps: Writable<any> = getContext(propKey)
|
|
25
|
+
const config: Writable<any> = getContext(configKey)
|
|
26
|
+
|
|
27
|
+
let {
|
|
28
|
+
y = undefined, y2 = undefined, series = undefined, options = undefined, name = undefined,
|
|
29
|
+
lineColor = undefined, lineWidth = 2, lineType = 'solid', lineOpacity = undefined, markers = false,
|
|
30
|
+
markerShape = 'circle', markerSize = 8, labels = false, labelSize = 11, labelPosition = 'top',
|
|
31
|
+
labelColor = undefined, labelFmt = undefined, yLabelFmt = undefined, y2LabelFmt = undefined,
|
|
32
|
+
showAllLabels = false, y2SeriesType = undefined, handleMissing = 'gap', step = false,
|
|
33
|
+
stepPosition = 'end', seriesOrder = undefined, seriesLabelFmt = undefined,
|
|
34
|
+
}: Props = $props()
|
|
35
|
+
|
|
36
|
+
// Use $derived for values that depend on props
|
|
37
|
+
let ySet = $derived(y ? true : false)
|
|
38
|
+
let y2Set = $derived(y2 ? true : false)
|
|
39
|
+
let seriesSet = $derived(series ? true : false)
|
|
40
|
+
|
|
41
|
+
let lineColorStore = $derived(resolveColor(lineColor))
|
|
42
|
+
let labelColorStore = $derived(resolveColor(labelColor))
|
|
43
|
+
let markersBool = $derived(toBoolean(markers))
|
|
44
|
+
let labelsBool = $derived(toBoolean(labels))
|
|
45
|
+
let showAllLabelsBool = $derived(toBoolean(showAllLabels))
|
|
46
|
+
let stepBool = $derived(toBoolean(step))
|
|
47
|
+
|
|
48
|
+
// Format objects derived from props
|
|
49
|
+
let labelFormat = $derived(labelFmt ? getFormatObjectFromString(labelFmt) : undefined)
|
|
50
|
+
let yLabelFormat = $derived(yLabelFmt ? getFormatObjectFromString(yLabelFmt) : undefined)
|
|
51
|
+
let y2LabelFormat = $derived(y2LabelFmt ? getFormatObjectFromString(y2LabelFmt) : undefined)
|
|
52
|
+
|
|
53
|
+
const labelPositions = {above: 'top', below: 'bottom', middle: 'inside'}
|
|
54
|
+
const swapXYLabelPositions = {above: 'right', below: 'left', middle: 'inside'}
|
|
55
|
+
|
|
56
|
+
// Derive values from chartProps store instead of using $effect to assign
|
|
57
|
+
let data = $derived($chartProps.data)
|
|
58
|
+
let x = $derived($chartProps.x)
|
|
59
|
+
let swapXY = $derived($chartProps.swapXY)
|
|
60
|
+
let yFormat = $derived($chartProps.yFormat)
|
|
61
|
+
let y2Format = $derived($chartProps.y2Format)
|
|
62
|
+
let yCount = $derived($chartProps.yCount)
|
|
63
|
+
let y2Count = $derived($chartProps.y2Count)
|
|
64
|
+
let xType = $derived($chartProps.xType)
|
|
65
|
+
let xMismatch = $derived($chartProps.xMismatch)
|
|
66
|
+
let columnSummary = $derived($chartProps.columnSummary)
|
|
67
|
+
let resolvedSeries = $derived(seriesSet ? series : $chartProps.series)
|
|
68
|
+
let resolvedY = $derived(ySet ? parseCommaList(y) : $chartProps.y)
|
|
69
|
+
let resolvedY2 = $derived(y2Set ? parseCommaList(y2) : $chartProps.y2)
|
|
70
|
+
let resolvedSeriesOrder = $derived(parseCommaList(seriesOrder))
|
|
71
|
+
|
|
72
|
+
// Compute all the derived state in one $derived.by block to avoid read/write conflicts
|
|
73
|
+
let computedState = $derived.by(() => {
|
|
74
|
+
let isSingleSeries = !resolvedSeries && (!Array.isArray(resolvedY) || resolvedY.length === 1)
|
|
75
|
+
let computedData = data
|
|
76
|
+
let computedName = name
|
|
77
|
+
let computedDefaultLabelPosition = swapXY ? 'right' : 'top'
|
|
78
|
+
|
|
79
|
+
if (!data || !columnSummary) {
|
|
80
|
+
return {
|
|
81
|
+
data: computedData,
|
|
82
|
+
name: computedName,
|
|
83
|
+
defaultLabelPosition: computedDefaultLabelPosition,
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (isSingleSeries) {
|
|
88
|
+
// Single Series
|
|
100
89
|
let col = Array.isArray(resolvedY) ? resolvedY[0] : resolvedY
|
|
101
|
-
if (
|
|
90
|
+
if (col && columnSummary[col]) {
|
|
91
|
+
computedName = computedName ?? formatTitle(col, columnSummary[col].title)
|
|
92
|
+
}
|
|
102
93
|
} else {
|
|
94
|
+
// Multi Series
|
|
103
95
|
try {
|
|
104
|
-
|
|
96
|
+
computedData = getCompletedData(computedData, x, resolvedY, resolvedSeries)
|
|
105
97
|
} catch (error) {
|
|
106
98
|
globalThis.console?.warn('Failed to complete data', {error})
|
|
107
|
-
|
|
99
|
+
computedData = []
|
|
108
100
|
}
|
|
109
101
|
}
|
|
110
|
-
}
|
|
111
102
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
103
|
+
// Handle missing values
|
|
104
|
+
if (handleMissing === 'zero') {
|
|
105
|
+
try {
|
|
106
|
+
computedData = getCompletedData(computedData, x, resolvedY, resolvedSeries, true)
|
|
107
|
+
} catch (error) {
|
|
108
|
+
globalThis.console?.warn('Failed to complete data', {error})
|
|
109
|
+
computedData = []
|
|
110
|
+
}
|
|
118
111
|
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const labelPositions = {above: 'top', below: 'bottom', middle: 'inside'}
|
|
122
|
-
const swapXYLabelPositions = {above: 'right', below: 'left', middle: 'inside'}
|
|
123
112
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
113
|
+
return {
|
|
114
|
+
data: computedData,
|
|
115
|
+
name: computedName,
|
|
116
|
+
defaultLabelPosition: computedDefaultLabelPosition,
|
|
117
|
+
}
|
|
118
|
+
})
|
|
128
119
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
formatter: (params) =>
|
|
134
|
-
params.value[swapXY ? 0 : 1] === 0
|
|
135
|
-
? ''
|
|
136
|
-
: formatValue(
|
|
137
|
-
params.value[swapXY ? 0 : 1],
|
|
138
|
-
[yLabelFormat ?? labelFormat ?? yFormat, y2LabelFormat ?? labelFormat ?? y2Format][
|
|
139
|
-
getYAxisIndex(params.componentIndex, yCount, y2Count)
|
|
140
|
-
],
|
|
141
|
-
),
|
|
142
|
-
fontSize: labelSize,
|
|
143
|
-
color: $labelColorStore,
|
|
144
|
-
position: labelPosition,
|
|
145
|
-
padding: 3,
|
|
146
|
-
},
|
|
147
|
-
labelLayout: {hideOverlap: showAllLabels ? false : true},
|
|
148
|
-
connectNulls: handleMissing === 'connect',
|
|
149
|
-
emphasis: {
|
|
150
|
-
focus: 'series',
|
|
151
|
-
endLabel: {show: false},
|
|
152
|
-
lineStyle: {opacity: 1, width: 3},
|
|
153
|
-
},
|
|
154
|
-
lineStyle: {width: parseInt(lineWidth), type: lineType, opacity: lineOpacity},
|
|
155
|
-
itemStyle: {color: $lineColorStore, opacity: lineOpacity},
|
|
156
|
-
showSymbol: labels || markers,
|
|
157
|
-
symbol: markerShape,
|
|
158
|
-
symbolSize: labels && !markers ? 0 : markerSize,
|
|
159
|
-
step: step ? stepPosition : false,
|
|
160
|
-
}
|
|
120
|
+
// Extract computed values for use in template and other derived values
|
|
121
|
+
let processedData = $derived(computedState.data)
|
|
122
|
+
let resolvedName = $derived(computedState.name)
|
|
123
|
+
let defaultLabelPosition = $derived(computedState.defaultLabelPosition)
|
|
161
124
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
x,
|
|
165
|
-
resolvedY,
|
|
166
|
-
series,
|
|
167
|
-
swapXY,
|
|
168
|
-
baseConfig,
|
|
169
|
-
name,
|
|
170
|
-
xMismatch,
|
|
171
|
-
columnSummary,
|
|
172
|
-
seriesOrder,
|
|
173
|
-
undefined,
|
|
174
|
-
undefined,
|
|
175
|
-
resolvedY2,
|
|
176
|
-
seriesLabelFmt,
|
|
125
|
+
let resolvedLabelPosition = $derived(
|
|
126
|
+
(swapXY ? swapXYLabelPositions[labelPosition] : labelPositions[labelPosition]) ?? defaultLabelPosition,
|
|
177
127
|
)
|
|
178
128
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
return value
|
|
129
|
+
let chartOverrides = $derived({
|
|
130
|
+
yAxis: {boundaryGap: ['0%', '1%']},
|
|
131
|
+
xAxis: {boundaryGap: [xType === 'time' ? '2%' : '0%', '2%']},
|
|
183
132
|
})
|
|
184
133
|
|
|
185
|
-
|
|
134
|
+
$effect(() => {
|
|
135
|
+
// Don't run until we have data
|
|
136
|
+
if (!processedData || !columnSummary) return
|
|
137
|
+
|
|
138
|
+
let baseConfig = {
|
|
139
|
+
type: 'line',
|
|
140
|
+
label: {
|
|
141
|
+
show: labelsBool,
|
|
142
|
+
formatter: (params: any) =>
|
|
143
|
+
params.value[swapXY ? 0 : 1] === 0
|
|
144
|
+
? ''
|
|
145
|
+
: formatValue(
|
|
146
|
+
params.value[swapXY ? 0 : 1],
|
|
147
|
+
[yLabelFormat ?? labelFormat ?? yFormat, y2LabelFormat ?? labelFormat ?? y2Format][
|
|
148
|
+
getYAxisIndex(params.componentIndex, yCount, y2Count)
|
|
149
|
+
],
|
|
150
|
+
),
|
|
151
|
+
fontSize: labelSize,
|
|
152
|
+
color: $labelColorStore,
|
|
153
|
+
position: resolvedLabelPosition,
|
|
154
|
+
padding: 3,
|
|
155
|
+
},
|
|
156
|
+
labelLayout: {hideOverlap: showAllLabelsBool ? false : true},
|
|
157
|
+
connectNulls: handleMissing === 'connect',
|
|
158
|
+
emphasis: {
|
|
159
|
+
focus: 'series',
|
|
160
|
+
endLabel: {show: false},
|
|
161
|
+
lineStyle: {opacity: 1, width: 3},
|
|
162
|
+
},
|
|
163
|
+
lineStyle: {width: parseInt(lineWidth as string), type: lineType, opacity: lineOpacity},
|
|
164
|
+
itemStyle: {color: $lineColorStore, opacity: lineOpacity},
|
|
165
|
+
showSymbol: labelsBool || markersBool,
|
|
166
|
+
symbol: markerShape,
|
|
167
|
+
symbolSize: labelsBool && !markersBool ? 0 : markerSize,
|
|
168
|
+
step: stepBool ? stepPosition : false,
|
|
169
|
+
}
|
|
186
170
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
171
|
+
let seriesConfig = getSeriesConfig(
|
|
172
|
+
processedData,
|
|
173
|
+
x,
|
|
174
|
+
resolvedY,
|
|
175
|
+
resolvedSeries,
|
|
176
|
+
swapXY,
|
|
177
|
+
baseConfig,
|
|
178
|
+
resolvedName,
|
|
179
|
+
xMismatch,
|
|
180
|
+
columnSummary,
|
|
181
|
+
resolvedSeriesOrder,
|
|
182
|
+
undefined,
|
|
183
|
+
undefined,
|
|
184
|
+
resolvedY2,
|
|
185
|
+
seriesLabelFmt,
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
config.update((d: any) => {
|
|
189
|
+
// Guard against incomplete config state
|
|
190
|
+
if (!d.series) d.series = []
|
|
191
|
+
if (!d.legend) d.legend = {data: []}
|
|
192
|
+
if (!d.legend.data) d.legend.data = []
|
|
193
|
+
|
|
194
|
+
d.series.push(...seriesConfig)
|
|
195
|
+
d.legend.data.push(...seriesConfig.map((entry: any) => entry.name.toString()))
|
|
196
|
+
return d
|
|
197
|
+
})
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
// Use $effect.pre() instead of beforeUpdate for runes mode
|
|
201
|
+
$effect.pre(() => {
|
|
202
|
+
if (options) {
|
|
203
|
+
config.update((d: any) => ({...d, ...options}))
|
|
204
|
+
}
|
|
191
205
|
|
|
192
|
-
|
|
193
|
-
config.update((
|
|
206
|
+
if (!chartOverrides) return
|
|
207
|
+
config.update((d: any) => {
|
|
208
|
+
if (!d.yAxis || !Array.isArray(d.yAxis)) return d
|
|
194
209
|
if (swapXY) {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
210
|
+
d.yAxis = {...d.yAxis, ...chartOverrides.xAxis}
|
|
211
|
+
d.xAxis = {...d.xAxis, ...chartOverrides.yAxis}
|
|
212
|
+
if (labelsBool) d.axisPointer = {triggerEmphasis: false}
|
|
213
|
+
return d
|
|
214
|
+
}
|
|
215
|
+
if (d.yAxis[0]) d.yAxis[0] = {...d.yAxis[0], ...chartOverrides.yAxis}
|
|
216
|
+
d.xAxis = {...d.xAxis, ...chartOverrides.xAxis}
|
|
217
|
+
if (y2Count > 0 && d.yAxis[1]) {
|
|
218
|
+
let shouldSetY2Type = y2SeriesType && ['line', 'bar', 'scatter'].includes(y2SeriesType) && d.series
|
|
219
|
+
for (let i = 0; shouldSetY2Type && i < y2Count; i++) {
|
|
220
|
+
if (d.series[yCount + i]) d.series[yCount + i].type = y2SeriesType
|
|
207
221
|
}
|
|
208
222
|
}
|
|
209
|
-
if (
|
|
210
|
-
return
|
|
223
|
+
if (labelsBool) d.axisPointer = {triggerEmphasis: false}
|
|
224
|
+
return d
|
|
211
225
|
})
|
|
212
226
|
})
|
|
213
227
|
</script>
|
|
@@ -1,105 +1,60 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type {Snippet} from 'svelte'
|
|
2
3
|
import Chart from './Chart.svelte'
|
|
3
4
|
import Line from './Line.svelte'
|
|
4
5
|
import QueryLoad from './QueryLoad.svelte'
|
|
5
6
|
import {getThemeStores} from '../component-utilities/themeStores'
|
|
6
7
|
import {parseCommaList} from '../component-utilities/inputUtils.ts'
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export let y2Fmt = undefined
|
|
24
|
-
|
|
25
|
-
export let title = undefined
|
|
26
|
-
export let subtitle = undefined
|
|
27
|
-
export let legend = undefined
|
|
28
|
-
export let xAxisTitle = undefined
|
|
29
|
-
export let yAxisTitle = y2 ? 'true' : undefined
|
|
30
|
-
export let y2AxisTitle = y2 ? 'true' : undefined
|
|
31
|
-
export let xGridlines = undefined
|
|
32
|
-
export let yGridlines = undefined
|
|
33
|
-
export let y2Gridlines = undefined
|
|
34
|
-
export let xAxisLabels = undefined
|
|
35
|
-
export let yAxisLabels = undefined
|
|
36
|
-
export let y2AxisLabels = undefined
|
|
37
|
-
export let xBaseline = undefined
|
|
38
|
-
export let yBaseline = undefined
|
|
39
|
-
export let y2Baseline = undefined
|
|
40
|
-
export let xTickMarks = undefined
|
|
41
|
-
export let yTickMarks = undefined
|
|
42
|
-
export let y2TickMarks = undefined
|
|
43
|
-
export let yMin = undefined
|
|
44
|
-
export let yMax = undefined
|
|
45
|
-
export let yScale = undefined
|
|
46
|
-
export let y2Min = undefined
|
|
47
|
-
export let y2Max = undefined
|
|
48
|
-
export let y2Scale = undefined
|
|
49
|
-
export let sort = undefined
|
|
50
|
-
|
|
51
|
-
export let lineColor = undefined
|
|
52
|
-
$: lineColorStore = resolveColor(lineColor)
|
|
53
|
-
|
|
54
|
-
export let lineType = undefined
|
|
55
|
-
export let lineWidth = undefined
|
|
56
|
-
export let lineOpacity = undefined
|
|
57
|
-
export let chartAreaHeight = undefined
|
|
58
|
-
|
|
59
|
-
export let markers = undefined
|
|
60
|
-
export let markerShape = undefined
|
|
61
|
-
export let markerSize = undefined
|
|
62
|
-
export let handleMissing = undefined
|
|
63
|
-
export let step = undefined
|
|
64
|
-
export let stepPosition = undefined
|
|
65
|
-
|
|
66
|
-
export let colorPalette = 'default'
|
|
67
|
-
$: colorPaletteStore = resolveColorPalette(colorPalette)
|
|
9
|
+
interface Props {
|
|
10
|
+
data?: any, x?: any, y?: any, y2?: any, series?: any, xType?: any, yLog?: any, yLogBase?: any
|
|
11
|
+
y2SeriesType?: any, yFmt?: any, xFmt?: any, y2Fmt?: any, title?: any, subtitle?: any, legend?: any
|
|
12
|
+
xAxisTitle?: any, yAxisTitle?: any, y2AxisTitle?: any, xGridlines?: any, yGridlines?: any
|
|
13
|
+
y2Gridlines?: any, xAxisLabels?: any, yAxisLabels?: any, y2AxisLabels?: any, xBaseline?: any
|
|
14
|
+
yBaseline?: any, y2Baseline?: any, xTickMarks?: any, yTickMarks?: any, y2TickMarks?: any
|
|
15
|
+
yMin?: any, yMax?: any, yScale?: any, y2Min?: any, y2Max?: any, y2Scale?: any, sort?: any
|
|
16
|
+
lineColor?: any, lineType?: any, lineWidth?: any, lineOpacity?: any, chartAreaHeight?: any
|
|
17
|
+
markers?: any, markerShape?: any, markerSize?: any, handleMissing?: any, step?: any
|
|
18
|
+
stepPosition?: any, colorPalette?: string, labels?: any, labelSize?: any, labelPosition?: any
|
|
19
|
+
labelColor?: any, labelFmt?: any, yLabelFmt?: any, y2LabelFmt?: any, showAllLabels?: any
|
|
20
|
+
yAxisColor?: any, y2AxisColor?: any, echartsOptions?: any, seriesOptions?: any, seriesColors?: any
|
|
21
|
+
seriesOrder?: any, connectGroup?: any, seriesLabelFmt?: any, leftPadding?: any, rightPadding?: any
|
|
22
|
+
xLabelWrap?: any, children?: Snippet
|
|
23
|
+
}
|
|
68
24
|
|
|
69
|
-
|
|
70
|
-
export let labelSize = undefined
|
|
71
|
-
export let labelPosition = undefined
|
|
72
|
-
|
|
73
|
-
export let labelColor = undefined
|
|
74
|
-
$: labelColorStore = resolveColor(labelColor)
|
|
75
|
-
|
|
76
|
-
export let labelFmt = undefined
|
|
77
|
-
export let yLabelFmt = undefined
|
|
78
|
-
export let y2LabelFmt = undefined
|
|
79
|
-
export let showAllLabels = undefined
|
|
80
|
-
|
|
81
|
-
export let yAxisColor = undefined
|
|
82
|
-
$: yAxisColorStore = resolveColor(yAxisColor)
|
|
83
|
-
|
|
84
|
-
export let y2AxisColor = undefined
|
|
85
|
-
$: y2AxisColorStore = resolveColor(y2AxisColor)
|
|
86
|
-
|
|
87
|
-
export let echartsOptions = undefined
|
|
88
|
-
export let seriesOptions = undefined
|
|
89
|
-
|
|
90
|
-
export let seriesColors = undefined
|
|
91
|
-
$: seriesColorsStore = resolveColorsObject(seriesColors)
|
|
92
|
-
|
|
93
|
-
export let seriesOrder = undefined
|
|
94
|
-
export let connectGroup = undefined
|
|
95
|
-
export let seriesLabelFmt = undefined
|
|
25
|
+
const {resolveColor, resolveColorsObject, resolveColorPalette} = getThemeStores()
|
|
96
26
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
27
|
+
let {
|
|
28
|
+
data = undefined, x = undefined, y = undefined, y2 = undefined, series = undefined, xType = undefined,
|
|
29
|
+
yLog = undefined, yLogBase = undefined, y2SeriesType = undefined, yFmt = undefined, xFmt = undefined,
|
|
30
|
+
y2Fmt = undefined, title = undefined, subtitle = undefined, legend = undefined, xAxisTitle = undefined,
|
|
31
|
+
yAxisTitle = undefined, y2AxisTitle = undefined, xGridlines = undefined, yGridlines = undefined,
|
|
32
|
+
y2Gridlines = undefined, xAxisLabels = undefined, yAxisLabels = undefined, y2AxisLabels = undefined,
|
|
33
|
+
xBaseline = undefined, yBaseline = undefined, y2Baseline = undefined, xTickMarks = undefined,
|
|
34
|
+
yTickMarks = undefined, y2TickMarks = undefined, yMin = undefined, yMax = undefined, yScale = undefined,
|
|
35
|
+
y2Min = undefined, y2Max = undefined, y2Scale = undefined, sort = undefined, lineColor = undefined,
|
|
36
|
+
lineType = undefined, lineWidth = undefined, lineOpacity = undefined, chartAreaHeight = undefined,
|
|
37
|
+
markers = undefined, markerShape = undefined, markerSize = undefined, handleMissing = undefined,
|
|
38
|
+
step = undefined, stepPosition = undefined, colorPalette = 'default', labels = undefined,
|
|
39
|
+
labelSize = undefined, labelPosition = undefined, labelColor = undefined, labelFmt = undefined,
|
|
40
|
+
yLabelFmt = undefined, y2LabelFmt = undefined, showAllLabels = undefined, yAxisColor = undefined,
|
|
41
|
+
y2AxisColor = undefined, echartsOptions = undefined, seriesOptions = undefined, seriesColors = undefined,
|
|
42
|
+
seriesOrder = undefined, connectGroup = undefined, seriesLabelFmt = undefined, leftPadding = undefined,
|
|
43
|
+
rightPadding = undefined, xLabelWrap = undefined, children,
|
|
44
|
+
}: Props = $props()
|
|
45
|
+
|
|
46
|
+
let lineColorStore = $derived(resolveColor(lineColor))
|
|
47
|
+
let colorPaletteStore = $derived(resolveColorPalette(colorPalette))
|
|
48
|
+
let labelColorStore = $derived(resolveColor(labelColor))
|
|
49
|
+
let yAxisColorStore = $derived(resolveColor(yAxisColor))
|
|
50
|
+
let y2AxisColorStore = $derived(resolveColor(y2AxisColor))
|
|
51
|
+
let seriesColorsStore = $derived(resolveColorsObject(seriesColors))
|
|
52
|
+
|
|
53
|
+
let derivedYAxisTitle = $derived(yAxisTitle ?? (y2 ? 'true' : undefined))
|
|
54
|
+
let derivedY2AxisTitle = $derived(y2AxisTitle ?? (y2 ? 'true' : undefined))
|
|
100
55
|
</script>
|
|
101
56
|
|
|
102
|
-
|
|
57
|
+
{#snippet lineChartContent(loaded: any[])}
|
|
103
58
|
<Chart
|
|
104
59
|
data={loaded}
|
|
105
60
|
chartContext={{data, x, y, series}}
|
|
@@ -115,8 +70,8 @@
|
|
|
115
70
|
{yLogBase}
|
|
116
71
|
{legend}
|
|
117
72
|
{xAxisTitle}
|
|
118
|
-
{
|
|
119
|
-
{
|
|
73
|
+
yAxisTitle={derivedYAxisTitle}
|
|
74
|
+
y2AxisTitle={derivedY2AxisTitle}
|
|
120
75
|
{xGridlines}
|
|
121
76
|
{yGridlines}
|
|
122
77
|
{y2Gridlines}
|
|
@@ -174,6 +129,8 @@
|
|
|
174
129
|
{seriesOrder}
|
|
175
130
|
{seriesLabelFmt}
|
|
176
131
|
/>
|
|
177
|
-
|
|
132
|
+
{@render children?.()}
|
|
178
133
|
</Chart>
|
|
179
|
-
|
|
134
|
+
{/snippet}
|
|
135
|
+
|
|
136
|
+
<QueryLoad data={data} fields={{x, y: parseCommaList(y), y2: parseCommaList(y2), series}} children={lineChartContent} />
|
|
@@ -1,22 +1,31 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script lang="ts">
|
|
2
2
|
import ECharts from './ECharts.svelte'
|
|
3
3
|
import QueryLoad from './QueryLoad.svelte'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
interface Props {
|
|
6
|
+
data: any
|
|
7
|
+
category: any
|
|
8
|
+
value: any
|
|
9
|
+
title?: any
|
|
10
|
+
subtitle?: any
|
|
11
|
+
printEchartsConfig?: any
|
|
12
|
+
echartsOptions?: any
|
|
13
|
+
seriesOptions?: any
|
|
14
|
+
seriesColors?: any
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let {
|
|
18
|
+
data, category, value, title = undefined, subtitle = undefined, printEchartsConfig = undefined,
|
|
19
|
+
echartsOptions = undefined, seriesOptions = undefined, seriesColors = undefined,
|
|
20
|
+
}: Props = $props()
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
// printEchartsConfig is intentionally unused - it's a debug prop that
|
|
23
|
+
// users can pass but we don't implement it yet. Using $derived to read
|
|
24
|
+
// it reactively and suppress state_referenced_locally warning.
|
|
25
|
+
$effect(() => { void printEchartsConfig })
|
|
26
|
+
</script>
|
|
18
27
|
|
|
19
|
-
|
|
28
|
+
{#snippet pieChartContent(loaded: any[])}
|
|
20
29
|
<ECharts data={loaded} {echartsOptions} {seriesOptions} {seriesColors} config={{
|
|
21
30
|
title: {
|
|
22
31
|
text: title,
|
|
@@ -33,4 +42,6 @@
|
|
|
33
42
|
},
|
|
34
43
|
],
|
|
35
44
|
}} />
|
|
36
|
-
|
|
45
|
+
{/snippet}
|
|
46
|
+
|
|
47
|
+
<QueryLoad data={data} fields={{category, value}} children={pieChartContent} />
|