@visactor/vseed 0.0.10 → 0.0.11
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/builder/builder/builder.d.ts +837 -39
- package/dist/index.cjs +753 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +742 -41
- package/dist/index.js.map +1 -1
- package/dist/pipeline/spec/pipes/annotation/annotationArea.d.ts +2 -0
- package/dist/pipeline/spec/pipes/annotation/annotationAreaBand.d.ts +2 -0
- package/dist/pipeline/spec/pipes/annotation/annotationHorizontalLine.d.ts +2 -0
- package/dist/pipeline/spec/pipes/annotation/annotationVerticalLine.d.ts +2 -0
- package/dist/pipeline/spec/pipes/annotation/index.d.ts +4 -0
- package/dist/pipeline/spec/pipes/annotation/utils.d.ts +2 -0
- package/dist/types/advancedVSeed.d.ts +803 -12
- package/dist/types/builder/builder.d.ts +3 -0
- package/dist/types/chartType/area/area.d.ts +16 -1
- package/dist/types/chartType/areaPercent/areaPercent.d.ts +16 -1
- package/dist/types/chartType/bar/bar.d.ts +16 -1
- package/dist/types/chartType/barParallel/barParallel.d.ts +16 -1
- package/dist/types/chartType/barPercent/barPercent.d.ts +16 -1
- package/dist/types/chartType/column/column.d.ts +16 -1
- package/dist/types/chartType/columnParallel/columnParallel.d.ts +16 -1
- package/dist/types/chartType/columnPercent/columnPercent.d.ts +16 -1
- package/dist/types/chartType/line/line.d.ts +16 -1
- package/dist/types/dataSelector/selector.d.ts +60 -6
- package/dist/types/properties/annotation/annotation.d.ts +747 -8
- package/dist/types/properties/annotation/annotationArea.d.ts +248 -0
- package/dist/types/properties/annotation/annotationHorizontalLine.d.ts +253 -0
- package/dist/types/properties/annotation/annotationPoint.d.ts +56 -4
- package/dist/types/properties/annotation/annotationVerticalLine.d.ts +253 -0
- package/dist/types/properties/annotation/index.d.ts +3 -0
- package/dist/types/properties/markStyle/barStyle.d.ts +56 -4
- package/dist/types/properties/markStyle/markStyle.d.ts +56 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { clone as external_remeda_clone, mergeDeep as external_remeda_mergeDeep, omit, pick as external_remeda_pick, unique } from "remeda";
|
1
|
+
import { clone as external_remeda_clone, isArray, isNumber, isString, mergeDeep as external_remeda_mergeDeep, omit, pick as external_remeda_pick, unique } from "remeda";
|
2
2
|
import { z } from "zod";
|
3
3
|
const initAdvancedVSeed = (advancedVSeed, context)=>{
|
4
4
|
const { vseed } = context;
|
@@ -642,7 +642,10 @@ const markStyle_markStyle = (advancedVSeed, context)=>{
|
|
642
642
|
const annotation_annotation = (advancedVSeed, context)=>{
|
643
643
|
const { vseed } = context;
|
644
644
|
const annotation = external_remeda_pick(vseed, [
|
645
|
-
'annotationPoint'
|
645
|
+
'annotationPoint',
|
646
|
+
'annotationHorizontalLine',
|
647
|
+
'annotationVerticalLine',
|
648
|
+
'annotationArea'
|
646
649
|
]);
|
647
650
|
return {
|
648
651
|
...advancedVSeed,
|
@@ -1832,11 +1835,13 @@ const selector_selector = (datum, selector)=>{
|
|
1832
1835
|
for (const selector of selectors)if (isValueSelector(selector)) {
|
1833
1836
|
if (Object.values(datum).find((v)=>v === selector)) return true;
|
1834
1837
|
} else if (isMeasureSelector(selector)) {
|
1838
|
+
const op = selector.operator || selector.op;
|
1835
1839
|
const selectorValueArr = Array.isArray(selector.value) ? selector.value : [
|
1836
1840
|
selector.value
|
1837
1841
|
];
|
1838
|
-
switch(
|
1842
|
+
switch(op){
|
1839
1843
|
case '=':
|
1844
|
+
case '==':
|
1840
1845
|
if (datum[selector.field] === selectorValueArr[0]) return true;
|
1841
1846
|
break;
|
1842
1847
|
case '!=':
|
@@ -1861,11 +1866,20 @@ const selector_selector = (datum, selector)=>{
|
|
1861
1866
|
break;
|
1862
1867
|
}
|
1863
1868
|
} else if (isDimensionSelector(selector)) {
|
1869
|
+
const op = selector.operator || selector.op;
|
1864
1870
|
const selectorValueArr = Array.isArray(selector.value) ? selector.value : [
|
1865
1871
|
selector.value
|
1866
1872
|
];
|
1867
|
-
|
1868
|
-
|
1873
|
+
switch(op){
|
1874
|
+
case 'in':
|
1875
|
+
if (selectorValueArr.includes(datum[selector.field])) return true;
|
1876
|
+
break;
|
1877
|
+
case 'not in':
|
1878
|
+
if (!selectorValueArr.includes(datum[selector.field])) return true;
|
1879
|
+
break;
|
1880
|
+
default:
|
1881
|
+
break;
|
1882
|
+
}
|
1869
1883
|
} else if (isPartialDatumSelector(selector)) {
|
1870
1884
|
if (Object.keys(selector).every((key)=>datum[key] === selector[key])) return true;
|
1871
1885
|
}
|
@@ -1873,19 +1887,32 @@ const selector_selector = (datum, selector)=>{
|
|
1873
1887
|
};
|
1874
1888
|
const isValueSelector = (selector)=>'string' == typeof selector || 'number' == typeof selector;
|
1875
1889
|
const isPartialDatumSelector = (selector)=>'object' == typeof selector && null !== selector;
|
1876
|
-
const isMeasureSelector = (selector)=>'object' == typeof selector && null !== selector && 'field' in selector && 'operator' in selector && 'value' in selector && [
|
1890
|
+
const isMeasureSelector = (selector)=>'object' == typeof selector && null !== selector && 'field' in selector && ('operator' in selector || 'op' in selector) && 'value' in selector && ([
|
1891
|
+
'=',
|
1892
|
+
'==',
|
1893
|
+
'!=',
|
1894
|
+
'>',
|
1895
|
+
'<',
|
1896
|
+
'>=',
|
1897
|
+
'<=',
|
1898
|
+
'between'
|
1899
|
+
].includes(selector.operator) || [
|
1877
1900
|
'=',
|
1901
|
+
'==',
|
1878
1902
|
'!=',
|
1879
1903
|
'>',
|
1880
1904
|
'<',
|
1881
1905
|
'>=',
|
1882
1906
|
'<=',
|
1883
1907
|
'between'
|
1884
|
-
].includes(selector.
|
1885
|
-
const isDimensionSelector = (selector)=>'object' == typeof selector && null !== selector && 'field' in selector && 'operator' in selector && 'value' in selector && [
|
1908
|
+
].includes(selector.op));
|
1909
|
+
const isDimensionSelector = (selector)=>'object' == typeof selector && null !== selector && 'field' in selector && ('operator' in selector || 'op' in selector) && 'value' in selector && ([
|
1886
1910
|
'in',
|
1887
1911
|
'not in'
|
1888
|
-
].includes(selector.operator)
|
1912
|
+
].includes(selector.operator) || [
|
1913
|
+
'in',
|
1914
|
+
'not in'
|
1915
|
+
].includes(selector.op));
|
1889
1916
|
const barStyle_barStyle = (spec, context)=>{
|
1890
1917
|
const { advancedVSeed } = context;
|
1891
1918
|
const { markStyle, encoding } = advancedVSeed;
|
@@ -1940,6 +1967,11 @@ const barStyle_barStyle = (spec, context)=>{
|
|
1940
1967
|
}
|
1941
1968
|
};
|
1942
1969
|
};
|
1970
|
+
const isSubset = (sub, obj)=>Object.entries(sub).every(([key, value])=>{
|
1971
|
+
if ('string' == typeof value) return obj[key] === value;
|
1972
|
+
if ('number' == typeof value) return obj[key] === value;
|
1973
|
+
return true;
|
1974
|
+
});
|
1943
1975
|
const annotationPoint_annotationPoint = (spec, context)=>{
|
1944
1976
|
const { advancedVSeed } = context;
|
1945
1977
|
const { annotation } = advancedVSeed;
|
@@ -1949,7 +1981,7 @@ const annotationPoint_annotationPoint = (spec, context)=>{
|
|
1949
1981
|
annotationPoint
|
1950
1982
|
];
|
1951
1983
|
const markPoint = annotationPointList.flatMap((annotationPoint)=>{
|
1952
|
-
const { selector: selectorPoint, text = '', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'middle', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding =
|
1984
|
+
const { selector: selectorPoint, text = '', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'middle', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, offsetX = 0, offsetY = 0 } = annotationPoint;
|
1953
1985
|
const dataset = advancedVSeed.dataset.flat();
|
1954
1986
|
const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
|
1955
1987
|
return selectedData.map((datum)=>({
|
@@ -2005,11 +2037,439 @@ const annotationPoint_annotationPoint = (spec, context)=>{
|
|
2005
2037
|
markPoint
|
2006
2038
|
};
|
2007
2039
|
};
|
2008
|
-
const
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
2040
|
+
const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
|
2041
|
+
const { advancedVSeed } = context;
|
2042
|
+
const { annotation, encoding } = advancedVSeed;
|
2043
|
+
if (!annotation || !annotation.annotationVerticalLine) return spec;
|
2044
|
+
const { annotationVerticalLine } = annotation;
|
2045
|
+
const annotationVerticalLineList = Array.isArray(annotationVerticalLine) ? annotationVerticalLine : [
|
2046
|
+
annotationVerticalLine
|
2047
|
+
];
|
2048
|
+
const positionMap = {
|
2049
|
+
outsideStart: 'start',
|
2050
|
+
outsideEnd: 'end',
|
2051
|
+
outsideMiddle: 'middle',
|
2052
|
+
insideStart: 'insideStartTop',
|
2053
|
+
insideMiddle: 'insideMiddleTop',
|
2054
|
+
insideEnd: 'insideEndTop'
|
2055
|
+
};
|
2056
|
+
const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
|
2057
|
+
const { selector: selectorPoint, xValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'right', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, offsetX = 0, offsetY = 0, lineColor = '#212121', lineStyle = 'dashed', lineVisible = true, lineWidth = 1 } = annotationVerticalLine;
|
2058
|
+
const dataset = advancedVSeed.dataset.flat();
|
2059
|
+
const generateOneMarkLine = (x)=>({
|
2060
|
+
x: x,
|
2061
|
+
line: {
|
2062
|
+
visible: lineVisible,
|
2063
|
+
style: {
|
2064
|
+
offsetX,
|
2065
|
+
offsetY,
|
2066
|
+
stroke: lineColor,
|
2067
|
+
lineStyle: lineStyle,
|
2068
|
+
lineWidth: lineWidth,
|
2069
|
+
lineDash: 'dashed' === lineStyle ? [
|
2070
|
+
5,
|
2071
|
+
2
|
2072
|
+
] : 'dotted' === lineStyle ? [
|
2073
|
+
2,
|
2074
|
+
5
|
2075
|
+
] : [
|
2076
|
+
0
|
2077
|
+
]
|
2078
|
+
}
|
2079
|
+
},
|
2080
|
+
label: {
|
2081
|
+
text: text,
|
2082
|
+
position: positionMap[textPosition],
|
2083
|
+
style: {
|
2084
|
+
offsetX,
|
2085
|
+
offsetY,
|
2086
|
+
visible: true,
|
2087
|
+
textAlign: textAlign,
|
2088
|
+
textBaseline: textBaseline,
|
2089
|
+
fill: textColor,
|
2090
|
+
fontSize: textFontSize,
|
2091
|
+
fontWeight: textFontWeight
|
2092
|
+
},
|
2093
|
+
labelBackground: {
|
2094
|
+
visible: backgroundVisible,
|
2095
|
+
padding: backgroundPadding,
|
2096
|
+
style: {
|
2097
|
+
offsetX,
|
2098
|
+
offsetY,
|
2099
|
+
cornerRadius: backgroundBorderRadius ?? 4,
|
2100
|
+
fill: backgroundColor,
|
2101
|
+
stroke: backgroundBorderColor,
|
2102
|
+
strokeWidth: backgroundBorderWidth
|
2103
|
+
}
|
2104
|
+
}
|
2105
|
+
},
|
2106
|
+
endSymbol: {
|
2107
|
+
visible: true,
|
2108
|
+
style: {
|
2109
|
+
fill: lineColor
|
2110
|
+
}
|
2111
|
+
}
|
2112
|
+
});
|
2113
|
+
if (!selectorPoint && isArray(xValue) || isString(xValue) || isNumber(xValue)) {
|
2114
|
+
const xValueArr = Array.isArray(xValue) ? xValue : [
|
2115
|
+
xValue
|
2116
|
+
];
|
2117
|
+
return xValueArr.map(generateOneMarkLine);
|
2118
|
+
}
|
2119
|
+
const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
|
2120
|
+
return selectedData.map((datum)=>{
|
2121
|
+
const x = encoding[0]?.x?.[0];
|
2122
|
+
if (!x) return {};
|
2123
|
+
return generateOneMarkLine(datum[x]);
|
2124
|
+
});
|
2012
2125
|
});
|
2126
|
+
const specMarkLine = spec.markLine || [];
|
2127
|
+
const newMarkLine = [
|
2128
|
+
...specMarkLine,
|
2129
|
+
...markLine || []
|
2130
|
+
];
|
2131
|
+
return {
|
2132
|
+
...spec,
|
2133
|
+
markLine: newMarkLine
|
2134
|
+
};
|
2135
|
+
};
|
2136
|
+
const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
|
2137
|
+
const { advancedVSeed } = context;
|
2138
|
+
const { annotation, encoding } = advancedVSeed;
|
2139
|
+
if (!annotation || !annotation.annotationHorizontalLine) return spec;
|
2140
|
+
const { annotationHorizontalLine } = annotation;
|
2141
|
+
const annotationVerticalLineList = Array.isArray(annotationHorizontalLine) ? annotationHorizontalLine : [
|
2142
|
+
annotationHorizontalLine
|
2143
|
+
];
|
2144
|
+
const positionMap = {
|
2145
|
+
outsideStart: 'start',
|
2146
|
+
outsideEnd: 'end',
|
2147
|
+
outsideMiddle: 'middle',
|
2148
|
+
insideStart: 'insideStartTop',
|
2149
|
+
insideMiddle: 'insideMiddleTop',
|
2150
|
+
insideEnd: 'insideEndTop'
|
2151
|
+
};
|
2152
|
+
const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
|
2153
|
+
const { selector: selectorPoint, yValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'bottom', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, offsetX = 0, offsetY = 0, lineColor = '#212121', lineStyle = 'dashed', lineVisible = true, lineWidth = 1 } = annotationVerticalLine;
|
2154
|
+
const dataset = advancedVSeed.dataset.flat();
|
2155
|
+
const generateOneMarkLine = (y)=>({
|
2156
|
+
y,
|
2157
|
+
line: {
|
2158
|
+
visible: lineVisible,
|
2159
|
+
style: {
|
2160
|
+
offsetX,
|
2161
|
+
offsetY,
|
2162
|
+
stroke: lineColor,
|
2163
|
+
lineStyle: lineStyle,
|
2164
|
+
lineWidth: lineWidth,
|
2165
|
+
lineDash: 'dashed' === lineStyle ? [
|
2166
|
+
5,
|
2167
|
+
2
|
2168
|
+
] : 'dotted' === lineStyle ? [
|
2169
|
+
2,
|
2170
|
+
5
|
2171
|
+
] : [
|
2172
|
+
0
|
2173
|
+
]
|
2174
|
+
}
|
2175
|
+
},
|
2176
|
+
label: {
|
2177
|
+
text: text,
|
2178
|
+
position: positionMap[textPosition],
|
2179
|
+
style: {
|
2180
|
+
offsetX,
|
2181
|
+
offsetY,
|
2182
|
+
visible: true,
|
2183
|
+
textAlign: textAlign,
|
2184
|
+
textBaseline: textBaseline,
|
2185
|
+
fill: textColor,
|
2186
|
+
fontSize: textFontSize,
|
2187
|
+
fontWeight: textFontWeight
|
2188
|
+
},
|
2189
|
+
labelBackground: {
|
2190
|
+
visible: backgroundVisible,
|
2191
|
+
padding: backgroundPadding,
|
2192
|
+
style: {
|
2193
|
+
offsetX,
|
2194
|
+
offsetY,
|
2195
|
+
cornerRadius: backgroundBorderRadius ?? 4,
|
2196
|
+
fill: backgroundColor,
|
2197
|
+
stroke: backgroundBorderColor,
|
2198
|
+
strokeWidth: backgroundBorderWidth
|
2199
|
+
}
|
2200
|
+
}
|
2201
|
+
},
|
2202
|
+
endSymbol: {
|
2203
|
+
visible: true,
|
2204
|
+
style: {
|
2205
|
+
fill: lineColor
|
2206
|
+
}
|
2207
|
+
}
|
2208
|
+
});
|
2209
|
+
if (!selectorPoint && isArray(yValue) || isString(yValue) || isNumber(yValue)) {
|
2210
|
+
const yValueArr = Array.isArray(yValue) ? yValue : [
|
2211
|
+
yValue
|
2212
|
+
];
|
2213
|
+
return yValueArr.map(generateOneMarkLine);
|
2214
|
+
}
|
2215
|
+
const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
|
2216
|
+
return selectedData.map((datum)=>{
|
2217
|
+
const y = encoding[0]?.y?.[0];
|
2218
|
+
if (!y) return {};
|
2219
|
+
return generateOneMarkLine(datum[y]);
|
2220
|
+
});
|
2221
|
+
});
|
2222
|
+
const specMarkLine = spec.markLine || [];
|
2223
|
+
const newMarkLine = [
|
2224
|
+
...specMarkLine,
|
2225
|
+
...markLine || []
|
2226
|
+
];
|
2227
|
+
return {
|
2228
|
+
...spec,
|
2229
|
+
markLine: newMarkLine
|
2230
|
+
};
|
2231
|
+
};
|
2232
|
+
const annotationArea_annotationArea = (spec, context)=>{
|
2233
|
+
const { advancedVSeed } = context;
|
2234
|
+
const { annotation } = advancedVSeed;
|
2235
|
+
if (!annotation || !annotation.annotationArea) return spec;
|
2236
|
+
const { annotationArea } = annotation;
|
2237
|
+
const annotationAreaList = Array.isArray(annotationArea) ? annotationArea : [
|
2238
|
+
annotationArea
|
2239
|
+
];
|
2240
|
+
const positionMap = {
|
2241
|
+
top: 'insideTop',
|
2242
|
+
topRight: 'insideTopRight',
|
2243
|
+
topLeft: 'insideTopLeft',
|
2244
|
+
bottom: 'insideBottom',
|
2245
|
+
bottomLeft: 'insideBottomLeft',
|
2246
|
+
bottomRight: 'insideBottomRight',
|
2247
|
+
left: 'insideLeft',
|
2248
|
+
right: 'insideRight'
|
2249
|
+
};
|
2250
|
+
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
2251
|
+
const { selector: selectorPoint, text = '', textPosition = 'top', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#191d24', backgroundPadding = 4, backgroundVisible = true, outerPadding = 8, areaColor = '#888888', areaColorOpacity = 0.15, areaBorderColor, areaBorderRadius, areaBorderWidth } = annotationArea;
|
2252
|
+
const dataset = advancedVSeed.dataset.flat();
|
2253
|
+
const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
|
2254
|
+
return {
|
2255
|
+
regionRelative: true,
|
2256
|
+
positions: (data, context)=>{
|
2257
|
+
console.log('debug selectedData', selectedData);
|
2258
|
+
const positionData = data.filter((item)=>selectedData.some((datum)=>isSubset(datum, item)));
|
2259
|
+
const xyList = positionData.map((datum)=>context.dataToPosition(datum));
|
2260
|
+
const xScale = context.scaleX;
|
2261
|
+
const yScale = context.scaleY;
|
2262
|
+
const xBandWidth = xScale?.bandwidth?.();
|
2263
|
+
const yBandWidth = yScale?.bandwidth?.();
|
2264
|
+
if (xBandWidth) {
|
2265
|
+
const minX = Math.min(...xyList.map((item)=>item.x)) - outerPadding;
|
2266
|
+
const maxX = Math.max(...xyList.map((item)=>item.x)) + outerPadding;
|
2267
|
+
const minY = Math.min(...yScale.range());
|
2268
|
+
const maxY = Math.max(...yScale.range());
|
2269
|
+
return [
|
2270
|
+
{
|
2271
|
+
x: minX,
|
2272
|
+
y: minY
|
2273
|
+
},
|
2274
|
+
{
|
2275
|
+
x: maxX,
|
2276
|
+
y: minY
|
2277
|
+
},
|
2278
|
+
{
|
2279
|
+
x: maxX,
|
2280
|
+
y: maxY
|
2281
|
+
},
|
2282
|
+
{
|
2283
|
+
x: minX,
|
2284
|
+
y: maxY
|
2285
|
+
}
|
2286
|
+
];
|
2287
|
+
}
|
2288
|
+
if (yBandWidth) {
|
2289
|
+
const minY = Math.min(...xyList.map((item)=>item.y)) - outerPadding;
|
2290
|
+
const maxY = Math.max(...xyList.map((item)=>item.y)) + outerPadding;
|
2291
|
+
const minX = Math.min(...xScale.range());
|
2292
|
+
const maxX = Math.max(...xScale.range());
|
2293
|
+
return [
|
2294
|
+
{
|
2295
|
+
x: minX,
|
2296
|
+
y: minY
|
2297
|
+
},
|
2298
|
+
{
|
2299
|
+
x: maxX,
|
2300
|
+
y: minY
|
2301
|
+
},
|
2302
|
+
{
|
2303
|
+
x: maxX,
|
2304
|
+
y: maxY
|
2305
|
+
},
|
2306
|
+
{
|
2307
|
+
x: minX,
|
2308
|
+
y: maxY
|
2309
|
+
}
|
2310
|
+
];
|
2311
|
+
}
|
2312
|
+
return [];
|
2313
|
+
},
|
2314
|
+
label: {
|
2315
|
+
position: positionMap[textPosition],
|
2316
|
+
visible: true,
|
2317
|
+
text: text,
|
2318
|
+
style: {
|
2319
|
+
textAlign: textAlign,
|
2320
|
+
textBaseline: textBaseline,
|
2321
|
+
fill: textColor,
|
2322
|
+
fontSize: textFontSize,
|
2323
|
+
fontWeight: textFontWeight
|
2324
|
+
},
|
2325
|
+
labelBackground: {
|
2326
|
+
visible: backgroundVisible,
|
2327
|
+
padding: backgroundPadding,
|
2328
|
+
style: {
|
2329
|
+
cornerRadius: backgroundBorderRadius ?? 4,
|
2330
|
+
fill: backgroundColor,
|
2331
|
+
stroke: backgroundBorderColor,
|
2332
|
+
strokeWidth: backgroundBorderWidth
|
2333
|
+
}
|
2334
|
+
}
|
2335
|
+
},
|
2336
|
+
area: {
|
2337
|
+
style: {
|
2338
|
+
visible: true,
|
2339
|
+
fill: areaColor,
|
2340
|
+
fillOpacity: areaColorOpacity,
|
2341
|
+
stroke: areaBorderColor,
|
2342
|
+
strokeWidth: areaBorderWidth,
|
2343
|
+
cornerRadius: areaBorderRadius
|
2344
|
+
}
|
2345
|
+
}
|
2346
|
+
};
|
2347
|
+
});
|
2348
|
+
return {
|
2349
|
+
...spec,
|
2350
|
+
markArea: markArea
|
2351
|
+
};
|
2352
|
+
};
|
2353
|
+
const annotationAreaBand = (spec, context)=>{
|
2354
|
+
const { advancedVSeed } = context;
|
2355
|
+
const { annotation } = advancedVSeed;
|
2356
|
+
if (!annotation || !annotation.annotationArea) return spec;
|
2357
|
+
const { annotationArea } = annotation;
|
2358
|
+
const annotationAreaList = Array.isArray(annotationArea) ? annotationArea : [
|
2359
|
+
annotationArea
|
2360
|
+
];
|
2361
|
+
const positionMap = {
|
2362
|
+
top: 'insideTop',
|
2363
|
+
topRight: 'insideTopRight',
|
2364
|
+
topLeft: 'insideTopLeft',
|
2365
|
+
bottom: 'insideBottom',
|
2366
|
+
bottomLeft: 'insideBottomLeft',
|
2367
|
+
bottomRight: 'insideBottomRight',
|
2368
|
+
left: 'insideLeft',
|
2369
|
+
right: 'insideRight'
|
2370
|
+
};
|
2371
|
+
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
2372
|
+
const { selector: selectorPoint, text = '', textPosition = 'top', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#191d24', backgroundPadding = 4, backgroundVisible = true, outerPadding = 8, areaColor = '#888888', areaColorOpacity = 0.15, areaBorderColor, areaBorderRadius, areaBorderWidth } = annotationArea;
|
2373
|
+
const dataset = advancedVSeed.dataset.flat();
|
2374
|
+
const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
|
2375
|
+
return {
|
2376
|
+
regionRelative: true,
|
2377
|
+
positions: (data, context)=>{
|
2378
|
+
const positionData = data.filter((item)=>selectedData.some((datum)=>isSubset(datum, item)));
|
2379
|
+
const xyList = positionData.map((datum)=>context.dataToPosition(datum));
|
2380
|
+
const xScale = context.scaleX;
|
2381
|
+
const yScale = context.scaleY;
|
2382
|
+
const xBandWidth = xScale?.bandwidth?.();
|
2383
|
+
const yBandWidth = yScale?.bandwidth?.();
|
2384
|
+
if (xBandWidth) {
|
2385
|
+
const minX = Math.min(...xyList.map((item)=>item.x)) - outerPadding;
|
2386
|
+
const maxX = Math.max(...xyList.map((item)=>item.x)) + xBandWidth + outerPadding;
|
2387
|
+
const minY = Math.min(...yScale.range());
|
2388
|
+
const maxY = Math.max(...yScale.range());
|
2389
|
+
return [
|
2390
|
+
{
|
2391
|
+
x: minX,
|
2392
|
+
y: minY
|
2393
|
+
},
|
2394
|
+
{
|
2395
|
+
x: maxX,
|
2396
|
+
y: minY
|
2397
|
+
},
|
2398
|
+
{
|
2399
|
+
x: maxX,
|
2400
|
+
y: maxY
|
2401
|
+
},
|
2402
|
+
{
|
2403
|
+
x: minX,
|
2404
|
+
y: maxY
|
2405
|
+
}
|
2406
|
+
];
|
2407
|
+
}
|
2408
|
+
if (yBandWidth) {
|
2409
|
+
const minY = Math.min(...xyList.map((item)=>item.y)) - outerPadding;
|
2410
|
+
const maxY = Math.max(...xyList.map((item)=>item.y)) + yBandWidth + outerPadding;
|
2411
|
+
const minX = Math.min(...xScale.range());
|
2412
|
+
const maxX = Math.max(...xScale.range());
|
2413
|
+
return [
|
2414
|
+
{
|
2415
|
+
x: minX,
|
2416
|
+
y: minY
|
2417
|
+
},
|
2418
|
+
{
|
2419
|
+
x: maxX,
|
2420
|
+
y: minY
|
2421
|
+
},
|
2422
|
+
{
|
2423
|
+
x: maxX,
|
2424
|
+
y: maxY
|
2425
|
+
},
|
2426
|
+
{
|
2427
|
+
x: minX,
|
2428
|
+
y: maxY
|
2429
|
+
}
|
2430
|
+
];
|
2431
|
+
}
|
2432
|
+
return [];
|
2433
|
+
},
|
2434
|
+
label: {
|
2435
|
+
position: positionMap[textPosition],
|
2436
|
+
visible: true,
|
2437
|
+
text: text,
|
2438
|
+
style: {
|
2439
|
+
textAlign: textAlign,
|
2440
|
+
textBaseline: textBaseline,
|
2441
|
+
fill: textColor,
|
2442
|
+
fontSize: textFontSize,
|
2443
|
+
fontWeight: textFontWeight
|
2444
|
+
},
|
2445
|
+
labelBackground: {
|
2446
|
+
visible: backgroundVisible,
|
2447
|
+
padding: backgroundPadding,
|
2448
|
+
style: {
|
2449
|
+
cornerRadius: backgroundBorderRadius ?? 4,
|
2450
|
+
fill: backgroundColor,
|
2451
|
+
stroke: backgroundBorderColor,
|
2452
|
+
strokeWidth: backgroundBorderWidth
|
2453
|
+
}
|
2454
|
+
}
|
2455
|
+
},
|
2456
|
+
area: {
|
2457
|
+
style: {
|
2458
|
+
visible: true,
|
2459
|
+
fill: areaColor,
|
2460
|
+
fillOpacity: areaColorOpacity,
|
2461
|
+
stroke: areaBorderColor,
|
2462
|
+
strokeWidth: areaBorderWidth,
|
2463
|
+
cornerRadius: areaBorderRadius
|
2464
|
+
}
|
2465
|
+
}
|
2466
|
+
};
|
2467
|
+
});
|
2468
|
+
return {
|
2469
|
+
...spec,
|
2470
|
+
markArea: markArea
|
2471
|
+
};
|
2472
|
+
};
|
2013
2473
|
const line_line = [
|
2014
2474
|
initLine,
|
2015
2475
|
color_color,
|
@@ -2020,7 +2480,10 @@ const line_line = [
|
|
2020
2480
|
label_label,
|
2021
2481
|
tooltip_tooltip,
|
2022
2482
|
discreteLegend,
|
2023
|
-
annotationPoint_annotationPoint
|
2483
|
+
annotationPoint_annotationPoint,
|
2484
|
+
annotationVerticalLine_annotationVerticalLine,
|
2485
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2486
|
+
annotationArea_annotationArea
|
2024
2487
|
];
|
2025
2488
|
const pivotLine = [
|
2026
2489
|
initPivot,
|
@@ -2036,7 +2499,10 @@ const pivotLine = [
|
|
2036
2499
|
yLinear,
|
2037
2500
|
label_label,
|
2038
2501
|
tooltip_tooltip,
|
2039
|
-
annotationPoint_annotationPoint
|
2502
|
+
annotationPoint_annotationPoint,
|
2503
|
+
annotationVerticalLine_annotationVerticalLine,
|
2504
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2505
|
+
annotationArea_annotationArea
|
2040
2506
|
]),
|
2041
2507
|
pivotRowDimensions,
|
2042
2508
|
pivotColumnDimensions,
|
@@ -2057,7 +2523,10 @@ const column = [
|
|
2057
2523
|
tooltip_tooltip,
|
2058
2524
|
discreteLegend,
|
2059
2525
|
barStyle_barStyle,
|
2060
|
-
annotationPoint_annotationPoint
|
2526
|
+
annotationPoint_annotationPoint,
|
2527
|
+
annotationVerticalLine_annotationVerticalLine,
|
2528
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2529
|
+
annotationAreaBand
|
2061
2530
|
];
|
2062
2531
|
const pivotColumn = [
|
2063
2532
|
initPivot,
|
@@ -2075,7 +2544,10 @@ const pivotColumn = [
|
|
2075
2544
|
label_label,
|
2076
2545
|
tooltip_tooltip,
|
2077
2546
|
barStyle_barStyle,
|
2078
|
-
annotationPoint_annotationPoint
|
2547
|
+
annotationPoint_annotationPoint,
|
2548
|
+
annotationVerticalLine_annotationVerticalLine,
|
2549
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2550
|
+
annotationAreaBand
|
2079
2551
|
]),
|
2080
2552
|
pivotRowDimensions,
|
2081
2553
|
pivotColumnDimensions,
|
@@ -2095,7 +2567,10 @@ const columnParallel = [
|
|
2095
2567
|
tooltip_tooltip,
|
2096
2568
|
discreteLegend,
|
2097
2569
|
barStyle_barStyle,
|
2098
|
-
annotationPoint_annotationPoint
|
2570
|
+
annotationPoint_annotationPoint,
|
2571
|
+
annotationVerticalLine_annotationVerticalLine,
|
2572
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2573
|
+
annotationAreaBand
|
2099
2574
|
];
|
2100
2575
|
const pivotColumnParallel = [
|
2101
2576
|
initPivot,
|
@@ -2112,7 +2587,10 @@ const pivotColumnParallel = [
|
|
2112
2587
|
label_label,
|
2113
2588
|
tooltip_tooltip,
|
2114
2589
|
barStyle_barStyle,
|
2115
|
-
annotationPoint_annotationPoint
|
2590
|
+
annotationPoint_annotationPoint,
|
2591
|
+
annotationVerticalLine_annotationVerticalLine,
|
2592
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2593
|
+
annotationAreaBand
|
2116
2594
|
]),
|
2117
2595
|
pivotRowDimensions,
|
2118
2596
|
pivotColumnDimensions,
|
@@ -2134,7 +2612,10 @@ const columnPercent = [
|
|
2134
2612
|
tooltip_tooltip,
|
2135
2613
|
discreteLegend,
|
2136
2614
|
barStyle_barStyle,
|
2137
|
-
annotationPoint_annotationPoint
|
2615
|
+
annotationPoint_annotationPoint,
|
2616
|
+
annotationVerticalLine_annotationVerticalLine,
|
2617
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2618
|
+
annotationAreaBand
|
2138
2619
|
];
|
2139
2620
|
const pivotColumnPercent = [
|
2140
2621
|
initPivot,
|
@@ -2153,7 +2634,10 @@ const pivotColumnPercent = [
|
|
2153
2634
|
label_label,
|
2154
2635
|
tooltip_tooltip,
|
2155
2636
|
barStyle_barStyle,
|
2156
|
-
annotationPoint_annotationPoint
|
2637
|
+
annotationPoint_annotationPoint,
|
2638
|
+
annotationVerticalLine_annotationVerticalLine,
|
2639
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2640
|
+
annotationAreaBand
|
2157
2641
|
]),
|
2158
2642
|
pivotRowDimensions,
|
2159
2643
|
pivotColumnDimensions,
|
@@ -2173,7 +2657,10 @@ const bar = [
|
|
2173
2657
|
tooltip_tooltip,
|
2174
2658
|
discreteLegend,
|
2175
2659
|
barStyle_barStyle,
|
2176
|
-
annotationPoint_annotationPoint
|
2660
|
+
annotationPoint_annotationPoint,
|
2661
|
+
annotationVerticalLine_annotationVerticalLine,
|
2662
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2663
|
+
annotationAreaBand
|
2177
2664
|
];
|
2178
2665
|
const pivotBar = [
|
2179
2666
|
initPivot,
|
@@ -2190,7 +2677,10 @@ const pivotBar = [
|
|
2190
2677
|
label_label,
|
2191
2678
|
tooltip_tooltip,
|
2192
2679
|
barStyle_barStyle,
|
2193
|
-
annotationPoint_annotationPoint
|
2680
|
+
annotationPoint_annotationPoint,
|
2681
|
+
annotationVerticalLine_annotationVerticalLine,
|
2682
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2683
|
+
annotationAreaBand
|
2194
2684
|
]),
|
2195
2685
|
pivotRowDimensions,
|
2196
2686
|
pivotColumnDimensions,
|
@@ -2210,7 +2700,10 @@ const barParallel = [
|
|
2210
2700
|
tooltip_tooltip,
|
2211
2701
|
discreteLegend,
|
2212
2702
|
barStyle_barStyle,
|
2213
|
-
annotationPoint_annotationPoint
|
2703
|
+
annotationPoint_annotationPoint,
|
2704
|
+
annotationVerticalLine_annotationVerticalLine,
|
2705
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2706
|
+
annotationAreaBand
|
2214
2707
|
];
|
2215
2708
|
const pivotBarParallel = [
|
2216
2709
|
initPivot,
|
@@ -2227,7 +2720,10 @@ const pivotBarParallel = [
|
|
2227
2720
|
label_label,
|
2228
2721
|
tooltip_tooltip,
|
2229
2722
|
barStyle_barStyle,
|
2230
|
-
annotationPoint_annotationPoint
|
2723
|
+
annotationPoint_annotationPoint,
|
2724
|
+
annotationVerticalLine_annotationVerticalLine,
|
2725
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2726
|
+
annotationAreaBand
|
2231
2727
|
]),
|
2232
2728
|
pivotRowDimensions,
|
2233
2729
|
pivotColumnDimensions,
|
@@ -2248,7 +2744,10 @@ const barPercent = [
|
|
2248
2744
|
tooltip_tooltip,
|
2249
2745
|
discreteLegend,
|
2250
2746
|
barStyle_barStyle,
|
2251
|
-
annotationPoint_annotationPoint
|
2747
|
+
annotationPoint_annotationPoint,
|
2748
|
+
annotationVerticalLine_annotationVerticalLine,
|
2749
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2750
|
+
annotationAreaBand
|
2252
2751
|
];
|
2253
2752
|
const pivotBarPercent = [
|
2254
2753
|
initPivot,
|
@@ -2266,7 +2765,10 @@ const pivotBarPercent = [
|
|
2266
2765
|
label_label,
|
2267
2766
|
tooltip_tooltip,
|
2268
2767
|
barStyle_barStyle,
|
2269
|
-
annotationPoint_annotationPoint
|
2768
|
+
annotationPoint_annotationPoint,
|
2769
|
+
annotationVerticalLine_annotationVerticalLine,
|
2770
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2771
|
+
annotationAreaBand
|
2270
2772
|
]),
|
2271
2773
|
pivotRowDimensions,
|
2272
2774
|
pivotColumnDimensions,
|
@@ -2286,7 +2788,10 @@ const area_area = [
|
|
2286
2788
|
label_label,
|
2287
2789
|
tooltip_tooltip,
|
2288
2790
|
discreteLegend,
|
2289
|
-
annotationPoint_annotationPoint
|
2791
|
+
annotationPoint_annotationPoint,
|
2792
|
+
annotationVerticalLine_annotationVerticalLine,
|
2793
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2794
|
+
annotationArea_annotationArea
|
2290
2795
|
];
|
2291
2796
|
const pivotArea = [
|
2292
2797
|
initPivot,
|
@@ -2303,7 +2808,10 @@ const pivotArea = [
|
|
2303
2808
|
yLinear,
|
2304
2809
|
label_label,
|
2305
2810
|
tooltip_tooltip,
|
2306
|
-
annotationPoint_annotationPoint
|
2811
|
+
annotationPoint_annotationPoint,
|
2812
|
+
annotationVerticalLine_annotationVerticalLine,
|
2813
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2814
|
+
annotationArea_annotationArea
|
2307
2815
|
]),
|
2308
2816
|
pivotRowDimensions,
|
2309
2817
|
pivotColumnDimensions,
|
@@ -2324,7 +2832,10 @@ const areaPercent = [
|
|
2324
2832
|
label_label,
|
2325
2833
|
tooltip_tooltip,
|
2326
2834
|
discreteLegend,
|
2327
|
-
annotationPoint_annotationPoint
|
2835
|
+
annotationPoint_annotationPoint,
|
2836
|
+
annotationVerticalLine_annotationVerticalLine,
|
2837
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2838
|
+
annotationArea_annotationArea
|
2328
2839
|
];
|
2329
2840
|
const pivotAreaPercent = [
|
2330
2841
|
initPivot,
|
@@ -2342,7 +2853,10 @@ const pivotAreaPercent = [
|
|
2342
2853
|
yLinear,
|
2343
2854
|
label_label,
|
2344
2855
|
tooltip_tooltip,
|
2345
|
-
annotationPoint_annotationPoint
|
2856
|
+
annotationPoint_annotationPoint,
|
2857
|
+
annotationVerticalLine_annotationVerticalLine,
|
2858
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2859
|
+
annotationArea_annotationArea
|
2346
2860
|
]),
|
2347
2861
|
pivotRowDimensions,
|
2348
2862
|
pivotColumnDimensions,
|
@@ -2359,7 +2873,10 @@ const pie = [
|
|
2359
2873
|
label_label,
|
2360
2874
|
tooltip_tooltip,
|
2361
2875
|
discreteLegend,
|
2362
|
-
annotationPoint_annotationPoint
|
2876
|
+
annotationPoint_annotationPoint,
|
2877
|
+
annotationVerticalLine_annotationVerticalLine,
|
2878
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2879
|
+
annotationArea_annotationArea
|
2363
2880
|
];
|
2364
2881
|
const pivotPie = [
|
2365
2882
|
initPivot,
|
@@ -2373,7 +2890,10 @@ const pivotPie = [
|
|
2373
2890
|
datasetPivotPlaceholder,
|
2374
2891
|
label_label,
|
2375
2892
|
tooltip_tooltip,
|
2376
|
-
annotationPoint_annotationPoint
|
2893
|
+
annotationPoint_annotationPoint,
|
2894
|
+
annotationVerticalLine_annotationVerticalLine,
|
2895
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
2896
|
+
annotationArea_annotationArea
|
2377
2897
|
]),
|
2378
2898
|
pivotRowDimensions,
|
2379
2899
|
pivotColumnDimensions,
|
@@ -2415,17 +2935,17 @@ const buildSpec = (builder, advancedVSeed)=>{
|
|
2415
2935
|
}
|
2416
2936
|
};
|
2417
2937
|
const build = (builder)=>{
|
2418
|
-
console.log('debug vseed', builder.vseed);
|
2419
2938
|
const advancedVSeed = builder.buildAdvanced();
|
2420
|
-
|
2939
|
+
builder.advancedVSeed = advancedVSeed;
|
2421
2940
|
if (!advancedVSeed) throw new Error('advancedVSeed is null');
|
2422
2941
|
const spec = builder.buildSpec(advancedVSeed);
|
2423
|
-
|
2942
|
+
builder.spec = spec;
|
2424
2943
|
return spec;
|
2425
2944
|
};
|
2426
2945
|
class Builder {
|
2427
2946
|
_vseed;
|
2428
2947
|
_advancedVSeed = null;
|
2948
|
+
_spec = null;
|
2429
2949
|
constructor(vseed){
|
2430
2950
|
this._vseed = vseed;
|
2431
2951
|
}
|
@@ -2448,6 +2968,12 @@ class Builder {
|
|
2448
2968
|
set advancedVSeed(value) {
|
2449
2969
|
this._advancedVSeed = value;
|
2450
2970
|
}
|
2971
|
+
get spec() {
|
2972
|
+
return this._spec;
|
2973
|
+
}
|
2974
|
+
set spec(value) {
|
2975
|
+
this._spec = value;
|
2976
|
+
}
|
2451
2977
|
static _advancedPipelineMap = {};
|
2452
2978
|
static _specPipelineMap = {};
|
2453
2979
|
static _themeMap = {};
|
@@ -3194,7 +3720,26 @@ const zSelector = z.union([
|
|
3194
3720
|
z.number(),
|
3195
3721
|
z.object({
|
3196
3722
|
field: z.string(),
|
3197
|
-
operator: z
|
3723
|
+
operator: z["enum"]([
|
3724
|
+
'=',
|
3725
|
+
'==',
|
3726
|
+
'!=',
|
3727
|
+
'>',
|
3728
|
+
'<',
|
3729
|
+
'>=',
|
3730
|
+
'<=',
|
3731
|
+
'between'
|
3732
|
+
]).optional(),
|
3733
|
+
op: z["enum"]([
|
3734
|
+
'=',
|
3735
|
+
'==',
|
3736
|
+
'!=',
|
3737
|
+
'>',
|
3738
|
+
'<',
|
3739
|
+
'>=',
|
3740
|
+
'<=',
|
3741
|
+
'between'
|
3742
|
+
]).optional(),
|
3198
3743
|
value: z.union([
|
3199
3744
|
z.string(),
|
3200
3745
|
z.number(),
|
@@ -3206,7 +3751,14 @@ const zSelector = z.union([
|
|
3206
3751
|
}),
|
3207
3752
|
z.object({
|
3208
3753
|
field: z.string(),
|
3209
|
-
operator: z
|
3754
|
+
operator: z["enum"]([
|
3755
|
+
'in',
|
3756
|
+
'not in'
|
3757
|
+
]).optional(),
|
3758
|
+
op: z["enum"]([
|
3759
|
+
'in',
|
3760
|
+
'not in'
|
3761
|
+
]).optional(),
|
3210
3762
|
value: z.union([
|
3211
3763
|
z.string(),
|
3212
3764
|
z.number(),
|
@@ -3268,9 +3820,158 @@ const zAnnotationPoint = z.object({
|
|
3268
3820
|
offsetY: z.number().default(0).optional(),
|
3269
3821
|
offsetX: z.number().default(0).optional()
|
3270
3822
|
});
|
3823
|
+
const zAnnotationVerticalLine = z.object({
|
3824
|
+
selector: z.union([
|
3825
|
+
zSelector,
|
3826
|
+
zSelectors
|
3827
|
+
]).optional(),
|
3828
|
+
xValue: z.union([
|
3829
|
+
z.number(),
|
3830
|
+
z.string(),
|
3831
|
+
z.array(z.union([
|
3832
|
+
z.number(),
|
3833
|
+
z.string()
|
3834
|
+
]))
|
3835
|
+
]).optional(),
|
3836
|
+
text: z.string().or(z.array(z.string())).optional(),
|
3837
|
+
textPosition: z["enum"]([
|
3838
|
+
'outsideStart',
|
3839
|
+
'outsideEnd',
|
3840
|
+
'outsideMiddle',
|
3841
|
+
'insideStart',
|
3842
|
+
'insideMiddle',
|
3843
|
+
'insideEnd'
|
3844
|
+
]).default('insideEnd').optional(),
|
3845
|
+
textColor: z.string().default('#ffffff').optional(),
|
3846
|
+
textFontSize: z.number().default(12).optional(),
|
3847
|
+
textFontWeight: z.number().default(400).optional(),
|
3848
|
+
textAlign: z["enum"]([
|
3849
|
+
'left',
|
3850
|
+
'right',
|
3851
|
+
'center'
|
3852
|
+
]).default('right').optional(),
|
3853
|
+
textBaseline: z["enum"]([
|
3854
|
+
'top',
|
3855
|
+
'middle',
|
3856
|
+
'bottom'
|
3857
|
+
]).default('top').optional(),
|
3858
|
+
lineVisible: z.boolean().optional(),
|
3859
|
+
lineColor: z.string().optional(),
|
3860
|
+
lineWidth: z.number().optional(),
|
3861
|
+
lineStyle: z.union([
|
3862
|
+
z.literal('solid'),
|
3863
|
+
z.literal('dashed'),
|
3864
|
+
z.literal('dotted')
|
3865
|
+
]).optional(),
|
3866
|
+
backgroundVisible: z.boolean().default(true).optional(),
|
3867
|
+
backgroundColor: z.string().default('#212121').optional(),
|
3868
|
+
backgroundBorderColor: z.string().optional(),
|
3869
|
+
backgroundBorderWidth: z.number().default(1).optional(),
|
3870
|
+
backgroundBorderRadius: z.number().default(4).optional(),
|
3871
|
+
backgroundPadding: z.number().optional(),
|
3872
|
+
offsetY: z.number().default(0).optional(),
|
3873
|
+
offsetX: z.number().default(0).optional()
|
3874
|
+
});
|
3875
|
+
const zAnnotationHorizontalLine = z.object({
|
3876
|
+
selector: z.union([
|
3877
|
+
zSelector,
|
3878
|
+
zSelectors
|
3879
|
+
]).optional(),
|
3880
|
+
yValue: z.union([
|
3881
|
+
z.number(),
|
3882
|
+
z.string(),
|
3883
|
+
z.array(z.union([
|
3884
|
+
z.number(),
|
3885
|
+
z.string()
|
3886
|
+
]))
|
3887
|
+
]).optional(),
|
3888
|
+
text: z.string().or(z.array(z.string())).optional(),
|
3889
|
+
textPosition: z["enum"]([
|
3890
|
+
'outsideStart',
|
3891
|
+
'outsideEnd',
|
3892
|
+
'outsideMiddle',
|
3893
|
+
'insideStart',
|
3894
|
+
'insideMiddle',
|
3895
|
+
'insideEnd'
|
3896
|
+
]).default('insideMiddle').optional(),
|
3897
|
+
textColor: z.string().default('#ffffff').optional(),
|
3898
|
+
textFontSize: z.number().default(12).optional(),
|
3899
|
+
textFontWeight: z.number().default(400).optional(),
|
3900
|
+
textAlign: z["enum"]([
|
3901
|
+
'left',
|
3902
|
+
'right',
|
3903
|
+
'center'
|
3904
|
+
]).default('center').optional(),
|
3905
|
+
textBaseline: z["enum"]([
|
3906
|
+
'top',
|
3907
|
+
'middle',
|
3908
|
+
'bottom'
|
3909
|
+
]).default('bottom').optional(),
|
3910
|
+
lineVisible: z.boolean().optional(),
|
3911
|
+
lineColor: z.string().optional(),
|
3912
|
+
lineWidth: z.number().optional(),
|
3913
|
+
lineStyle: z.union([
|
3914
|
+
z.literal('solid'),
|
3915
|
+
z.literal('dashed'),
|
3916
|
+
z.literal('dotted')
|
3917
|
+
]).optional(),
|
3918
|
+
backgroundVisible: z.boolean().default(true).optional(),
|
3919
|
+
backgroundColor: z.string().default('#212121').optional(),
|
3920
|
+
backgroundBorderColor: z.string().optional(),
|
3921
|
+
backgroundBorderWidth: z.number().default(1).optional(),
|
3922
|
+
backgroundBorderRadius: z.number().default(4).optional(),
|
3923
|
+
backgroundPadding: z.number().optional(),
|
3924
|
+
offsetY: z.number().default(0).optional(),
|
3925
|
+
offsetX: z.number().default(0).optional()
|
3926
|
+
});
|
3927
|
+
const zAnnotationArea = z.object({
|
3928
|
+
selector: z.union([
|
3929
|
+
zSelector,
|
3930
|
+
zSelectors
|
3931
|
+
]),
|
3932
|
+
textPosition: z["enum"]([
|
3933
|
+
'top',
|
3934
|
+
'topRight',
|
3935
|
+
'topLeft',
|
3936
|
+
'bottom',
|
3937
|
+
'bottomLeft',
|
3938
|
+
'bottomRight',
|
3939
|
+
'left',
|
3940
|
+
'right'
|
3941
|
+
]).default('top').optional(),
|
3942
|
+
text: z.string().or(z.array(z.string())).optional(),
|
3943
|
+
textColor: z.string().default('#ffffff').optional(),
|
3944
|
+
textFontSize: z.number().default(12).optional(),
|
3945
|
+
textFontWeight: z.number().default(400).optional(),
|
3946
|
+
textAlign: z["enum"]([
|
3947
|
+
'left',
|
3948
|
+
'right',
|
3949
|
+
'center'
|
3950
|
+
]).default('center').optional(),
|
3951
|
+
textBaseline: z["enum"]([
|
3952
|
+
'top',
|
3953
|
+
'middle',
|
3954
|
+
'bottom'
|
3955
|
+
]).default('middle').optional(),
|
3956
|
+
backgroundVisible: z.boolean().default(true).optional(),
|
3957
|
+
backgroundColor: z.string().default('#212121').optional(),
|
3958
|
+
backgroundBorderColor: z.string().optional(),
|
3959
|
+
backgroundBorderWidth: z.number().default(1).optional(),
|
3960
|
+
backgroundBorderRadius: z.number().default(4).optional(),
|
3961
|
+
backgroundPadding: z.number().optional(),
|
3962
|
+
areaColor: z.string().default('red').optional(),
|
3963
|
+
areaColorOpacity: z.number().default(0.5).optional(),
|
3964
|
+
areaBorderColor: z.number().optional(),
|
3965
|
+
areaBorderWidth: z.number().default(2).optional(),
|
3966
|
+
areaBorderRadius: z.number().default(4).optional(),
|
3967
|
+
outerPadding: z.number().optional()
|
3968
|
+
});
|
3271
3969
|
const zAnnotation = z.object({
|
3272
|
-
annotationPoint: zAnnotationPoint.or(z.array(zAnnotationPoint)).optional()
|
3970
|
+
annotationPoint: zAnnotationPoint.or(z.array(zAnnotationPoint)).optional(),
|
3971
|
+
annotationVerticalLine: zAnnotationVerticalLine.or(z.array(zAnnotationVerticalLine)).optional(),
|
3972
|
+
annotationHorizontalLine: zAnnotationHorizontalLine.or(z.array(zAnnotationHorizontalLine)).optional(),
|
3973
|
+
annotationArea: zAnnotationArea.or(z.array(zAnnotationArea)).optional()
|
3273
3974
|
});
|
3274
|
-
export { Builder, FoldMeasureId, FoldMeasureName, FoldMeasureValue, ORIGINAL_DATA, Separator, UnfoldDimensionGroup, areaAdvancedPipeline, areaPercentAdvancedPipeline, areaPercentSpecPipeline, areaSpecPipeline, barAdvancedPipeline, barParallelAdvancedPipeline, barParallelSpecPipeline, barPercentAdvancedPipeline, barPercentSpecPipeline, barSpecPipeline, columnAdvancedPipeline, columnParallelAdvancedPipeline, columnParallelSpecPipeline, columnPercentAdvancedPipeline, columnPercentSpecPipeline, columnSpecPipeline, darkTheme, dataReshapeFor1D1M, dataReshapeFor2D1M, execPipeline, foldMeasures, isPivotChart, isVChart, isVTable, lightTheme, lineAdvancedPipeline, lineSpecPipeline, pieAdvancedPipeline, pieSpecPipeline, all_registerAll as registerAll, registerArea, registerAreaPercent, registerBar, registerBarParallel, registerBarPercent, registerColumn, registerColumnParallel, registerColumnPercent, registerCustomTheme, registerDarkTheme, registerLightTheme, registerLine, unfoldDimensions, zAnnotation, zAnnotationPoint, zAxis, zBackgroundColor, zBarStyle, zBaseConfig, zChartType, zColor, zConfig, zCustomTheme, zCustomThemeConfig, zDataset, zDatasetReshapeInfo, zDatum, zDimension, zDimensions, zEncoding, zFoldInfo, zLabel, zLegend, zMarkStyle, zMeasure, zMeasureGroup, zMeasures, zTheme, zTooltip, zUnfoldInfo, zXBandAxis, zXLinearAxis, zYBandAxis, zYLinearAxis };
|
3975
|
+
export { Builder, FoldMeasureId, FoldMeasureName, FoldMeasureValue, ORIGINAL_DATA, Separator, UnfoldDimensionGroup, areaAdvancedPipeline, areaPercentAdvancedPipeline, areaPercentSpecPipeline, areaSpecPipeline, barAdvancedPipeline, barParallelAdvancedPipeline, barParallelSpecPipeline, barPercentAdvancedPipeline, barPercentSpecPipeline, barSpecPipeline, columnAdvancedPipeline, columnParallelAdvancedPipeline, columnParallelSpecPipeline, columnPercentAdvancedPipeline, columnPercentSpecPipeline, columnSpecPipeline, darkTheme, dataReshapeFor1D1M, dataReshapeFor2D1M, execPipeline, foldMeasures, isPivotChart, isVChart, isVTable, lightTheme, lineAdvancedPipeline, lineSpecPipeline, pieAdvancedPipeline, pieSpecPipeline, all_registerAll as registerAll, registerArea, registerAreaPercent, registerBar, registerBarParallel, registerBarPercent, registerColumn, registerColumnParallel, registerColumnPercent, registerCustomTheme, registerDarkTheme, registerLightTheme, registerLine, unfoldDimensions, zAnnotation, zAnnotationArea, zAnnotationHorizontalLine, zAnnotationPoint, zAnnotationVerticalLine, zAxis, zBackgroundColor, zBarStyle, zBaseConfig, zChartType, zColor, zConfig, zCustomTheme, zCustomThemeConfig, zDataset, zDatasetReshapeInfo, zDatum, zDimension, zDimensions, zEncoding, zFoldInfo, zLabel, zLegend, zMarkStyle, zMeasure, zMeasureGroup, zMeasures, zTheme, zTooltip, zUnfoldInfo, zXBandAxis, zXLinearAxis, zYBandAxis, zYLinearAxis };
|
3275
3976
|
|
3276
3977
|
//# sourceMappingURL=index.js.map
|