@visactor/vseed 0.0.9 → 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.
Files changed (38) hide show
  1. package/dist/builder/builder/builder.d.ts +1035 -36
  2. package/dist/index.cjs +923 -66
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.js +905 -63
  5. package/dist/index.js.map +1 -1
  6. package/dist/pipeline/advanced/pipes/annotation/annotation.d.ts +2 -0
  7. package/dist/pipeline/advanced/pipes/annotation/index.d.ts +1 -0
  8. package/dist/pipeline/advanced/pipes/index.d.ts +1 -0
  9. package/dist/pipeline/spec/pipes/annotation/annotationArea.d.ts +2 -0
  10. package/dist/pipeline/spec/pipes/annotation/annotationAreaBand.d.ts +2 -0
  11. package/dist/pipeline/spec/pipes/annotation/annotationHorizontalLine.d.ts +2 -0
  12. package/dist/pipeline/spec/pipes/annotation/annotationPoint.d.ts +2 -0
  13. package/dist/pipeline/spec/pipes/annotation/annotationVerticalLine.d.ts +2 -0
  14. package/dist/pipeline/spec/pipes/annotation/index.d.ts +5 -0
  15. package/dist/pipeline/spec/pipes/annotation/utils.d.ts +2 -0
  16. package/dist/pipeline/spec/pipes/index.d.ts +1 -0
  17. package/dist/types/advancedVSeed.d.ts +886 -12
  18. package/dist/types/builder/builder.d.ts +3 -0
  19. package/dist/types/chartType/area/area.d.ts +21 -1
  20. package/dist/types/chartType/areaPercent/areaPercent.d.ts +21 -1
  21. package/dist/types/chartType/bar/bar.d.ts +21 -1
  22. package/dist/types/chartType/barParallel/barParallel.d.ts +21 -1
  23. package/dist/types/chartType/barPercent/barPercent.d.ts +21 -1
  24. package/dist/types/chartType/column/column.d.ts +21 -1
  25. package/dist/types/chartType/columnParallel/columnParallel.d.ts +21 -1
  26. package/dist/types/chartType/columnPercent/columnPercent.d.ts +21 -1
  27. package/dist/types/chartType/line/line.d.ts +21 -1
  28. package/dist/types/dataSelector/selector.d.ts +60 -6
  29. package/dist/types/properties/annotation/annotation.d.ts +824 -0
  30. package/dist/types/properties/annotation/annotationArea.d.ts +248 -0
  31. package/dist/types/properties/annotation/annotationHorizontalLine.d.ts +253 -0
  32. package/dist/types/properties/annotation/annotationPoint.d.ts +199 -0
  33. package/dist/types/properties/annotation/annotationVerticalLine.d.ts +253 -0
  34. package/dist/types/properties/annotation/index.d.ts +5 -0
  35. package/dist/types/properties/index.d.ts +1 -0
  36. package/dist/types/properties/markStyle/barStyle.d.ts +65 -13
  37. package/dist/types/properties/markStyle/markStyle.d.ts +64 -12
  38. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -26,7 +26,7 @@ __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
27
  registerBar: ()=>registerBar,
28
28
  isVChart: ()=>isVChart,
29
- columnPercentSpecPipeline: ()=>columnPercentSpecPipeline,
29
+ zBaseConfig: ()=>zBaseConfig,
30
30
  pieAdvancedPipeline: ()=>pieAdvancedPipeline,
31
31
  execPipeline: ()=>execPipeline,
32
32
  areaSpecPipeline: ()=>areaSpecPipeline,
@@ -41,22 +41,26 @@ __webpack_require__.d(__webpack_exports__, {
41
41
  columnPercentAdvancedPipeline: ()=>columnPercentAdvancedPipeline,
42
42
  zAxis: ()=>zAxis,
43
43
  isVTable: ()=>isVTable,
44
+ zAnnotation: ()=>zAnnotation,
44
45
  columnSpecPipeline: ()=>columnSpecPipeline,
45
46
  UnfoldDimensionGroup: ()=>UnfoldDimensionGroup,
46
47
  zDatasetReshapeInfo: ()=>zDatasetReshapeInfo,
47
48
  zFoldInfo: ()=>zFoldInfo,
48
49
  zYBandAxis: ()=>zYBandAxis,
49
50
  ORIGINAL_DATA: ()=>ORIGINAL_DATA,
50
- zYLinearAxis: ()=>zYLinearAxis,
51
+ zAnnotationHorizontalLine: ()=>zAnnotationHorizontalLine,
52
+ zAnnotationArea: ()=>zAnnotationArea,
51
53
  zMarkStyle: ()=>zMarkStyle,
54
+ zYLinearAxis: ()=>zYLinearAxis,
52
55
  Separator: ()=>Separator,
53
56
  columnAdvancedPipeline: ()=>columnAdvancedPipeline,
54
57
  columnParallelSpecPipeline: ()=>columnParallelSpecPipeline,
55
58
  zLabel: ()=>zLabel,
56
59
  registerColumn: ()=>registerColumn,
57
- zDimension: ()=>zDimension,
60
+ zAnnotationPoint: ()=>zAnnotationPoint,
58
61
  lightTheme: ()=>lightTheme,
59
62
  registerColumnParallel: ()=>registerColumnParallel,
63
+ zDimension: ()=>zDimension,
60
64
  isPivotChart: ()=>isPivotChart,
61
65
  zCustomTheme: ()=>zCustomTheme,
62
66
  zXBandAxis: ()=>zXBandAxis,
@@ -86,7 +90,7 @@ __webpack_require__.d(__webpack_exports__, {
86
90
  foldMeasures: ()=>foldMeasures,
87
91
  dataReshapeFor2D1M: ()=>dataReshapeFor2D1M,
88
92
  registerLightTheme: ()=>registerLightTheme,
89
- zChartType: ()=>zChartType,
93
+ zAnnotationVerticalLine: ()=>zAnnotationVerticalLine,
90
94
  registerDarkTheme: ()=>registerDarkTheme,
91
95
  barParallelAdvancedPipeline: ()=>barParallelAdvancedPipeline,
92
96
  FoldMeasureValue: ()=>FoldMeasureValue,
@@ -95,13 +99,14 @@ __webpack_require__.d(__webpack_exports__, {
95
99
  pieSpecPipeline: ()=>pieSpecPipeline,
96
100
  barSpecPipeline: ()=>barSpecPipeline,
97
101
  lineSpecPipeline: ()=>lineSpecPipeline,
102
+ zChartType: ()=>zChartType,
98
103
  zTooltip: ()=>zTooltip,
99
- zBaseConfig: ()=>zBaseConfig,
100
104
  unfoldDimensions: ()=>unfoldDimensions,
101
105
  areaAdvancedPipeline: ()=>areaAdvancedPipeline,
102
106
  areaPercentSpecPipeline: ()=>areaPercentSpecPipeline,
103
107
  Builder: ()=>Builder,
104
108
  barParallelSpecPipeline: ()=>barParallelSpecPipeline,
109
+ columnPercentSpecPipeline: ()=>columnPercentSpecPipeline,
105
110
  registerAll: ()=>all_registerAll
106
111
  });
107
112
  const initAdvancedVSeed = (advancedVSeed, context)=>{
@@ -744,6 +749,19 @@ const markStyle_markStyle = (advancedVSeed, context)=>{
744
749
  markStyle
745
750
  };
746
751
  };
752
+ const annotation_annotation = (advancedVSeed, context)=>{
753
+ const { vseed } = context;
754
+ const annotation = (0, external_remeda_namespaceObject.pick)(vseed, [
755
+ 'annotationPoint',
756
+ 'annotationHorizontalLine',
757
+ 'annotationVerticalLine',
758
+ 'annotationArea'
759
+ ]);
760
+ return {
761
+ ...advancedVSeed,
762
+ annotation
763
+ };
764
+ };
747
765
  const lineAdvancedPipeline = [
748
766
  initAdvancedVSeed,
749
767
  autoMeasures,
@@ -756,7 +774,8 @@ const lineAdvancedPipeline = [
756
774
  encodingXY,
757
775
  vchartBaseConfig,
758
776
  lineConfig,
759
- vchartTheme
777
+ vchartTheme,
778
+ annotation_annotation
760
779
  ];
761
780
  const barAdvancedPipeline = [
762
781
  initAdvancedVSeed,
@@ -771,7 +790,8 @@ const barAdvancedPipeline = [
771
790
  barConfig,
772
791
  vchartBaseConfig,
773
792
  vchartTheme,
774
- markStyle_markStyle
793
+ markStyle_markStyle,
794
+ annotation_annotation
775
795
  ];
776
796
  const barParallelAdvancedPipeline = [
777
797
  initAdvancedVSeed,
@@ -786,7 +806,8 @@ const barParallelAdvancedPipeline = [
786
806
  barParallelConfig,
787
807
  vchartBaseConfig,
788
808
  vchartTheme,
789
- markStyle_markStyle
809
+ markStyle_markStyle,
810
+ annotation_annotation
790
811
  ];
791
812
  const barPercentAdvancedPipeline = [
792
813
  initAdvancedVSeed,
@@ -801,7 +822,8 @@ const barPercentAdvancedPipeline = [
801
822
  barPercentConfig,
802
823
  vchartBaseConfig,
803
824
  vchartTheme,
804
- markStyle_markStyle
825
+ markStyle_markStyle,
826
+ annotation_annotation
805
827
  ];
806
828
  const columnAdvancedPipeline = [
807
829
  initAdvancedVSeed,
@@ -816,7 +838,8 @@ const columnAdvancedPipeline = [
816
838
  columnConfig,
817
839
  vchartBaseConfig,
818
840
  vchartTheme,
819
- markStyle_markStyle
841
+ markStyle_markStyle,
842
+ annotation_annotation
820
843
  ];
821
844
  const columnParallelAdvancedPipeline = [
822
845
  initAdvancedVSeed,
@@ -831,7 +854,8 @@ const columnParallelAdvancedPipeline = [
831
854
  columnParallelConfig,
832
855
  vchartBaseConfig,
833
856
  vchartTheme,
834
- markStyle_markStyle
857
+ markStyle_markStyle,
858
+ annotation_annotation
835
859
  ];
836
860
  const columnPercentAdvancedPipeline = [
837
861
  initAdvancedVSeed,
@@ -846,7 +870,8 @@ const columnPercentAdvancedPipeline = [
846
870
  columnPercentConfig,
847
871
  vchartBaseConfig,
848
872
  vchartTheme,
849
- markStyle_markStyle
873
+ markStyle_markStyle,
874
+ annotation_annotation
850
875
  ];
851
876
  const areaAdvancedPipeline = [
852
877
  initAdvancedVSeed,
@@ -860,7 +885,8 @@ const areaAdvancedPipeline = [
860
885
  encodingXY,
861
886
  areaConfig,
862
887
  vchartBaseConfig,
863
- vchartTheme
888
+ vchartTheme,
889
+ annotation_annotation
864
890
  ];
865
891
  const areaPercentAdvancedPipeline = [
866
892
  initAdvancedVSeed,
@@ -874,7 +900,8 @@ const areaPercentAdvancedPipeline = [
874
900
  encodingXY,
875
901
  areaPercentConfig,
876
902
  vchartBaseConfig,
877
- vchartTheme
903
+ vchartTheme,
904
+ annotation_annotation
878
905
  ];
879
906
  const pieAdvancedPipeline = [
880
907
  initAdvancedVSeed,
@@ -888,7 +915,8 @@ const pieAdvancedPipeline = [
888
915
  encodingPolar,
889
916
  pieConfig,
890
917
  vchartBaseConfig,
891
- vchartTheme
918
+ vchartTheme,
919
+ annotation_annotation
892
920
  ];
893
921
  const dataset_dataset = (spec, context)=>{
894
922
  const { advancedVSeed } = context;
@@ -1917,11 +1945,13 @@ const selector_selector = (datum, selector)=>{
1917
1945
  for (const selector of selectors)if (isValueSelector(selector)) {
1918
1946
  if (Object.values(datum).find((v)=>v === selector)) return true;
1919
1947
  } else if (isMeasureSelector(selector)) {
1948
+ const op = selector.operator || selector.op;
1920
1949
  const selectorValueArr = Array.isArray(selector.value) ? selector.value : [
1921
1950
  selector.value
1922
1951
  ];
1923
- switch(selector.operator){
1952
+ switch(op){
1924
1953
  case '=':
1954
+ case '==':
1925
1955
  if (datum[selector.field] === selectorValueArr[0]) return true;
1926
1956
  break;
1927
1957
  case '!=':
@@ -1946,11 +1976,20 @@ const selector_selector = (datum, selector)=>{
1946
1976
  break;
1947
1977
  }
1948
1978
  } else if (isDimensionSelector(selector)) {
1979
+ const op = selector.operator || selector.op;
1949
1980
  const selectorValueArr = Array.isArray(selector.value) ? selector.value : [
1950
1981
  selector.value
1951
1982
  ];
1952
- if ('in' === selector.operator && selectorValueArr.includes(datum[selector.field])) return true;
1953
- if ('not in' === selector.operator && !selectorValueArr.includes(datum[selector.field])) return true;
1983
+ switch(op){
1984
+ case 'in':
1985
+ if (selectorValueArr.includes(datum[selector.field])) return true;
1986
+ break;
1987
+ case 'not in':
1988
+ if (!selectorValueArr.includes(datum[selector.field])) return true;
1989
+ break;
1990
+ default:
1991
+ break;
1992
+ }
1954
1993
  } else if (isPartialDatumSelector(selector)) {
1955
1994
  if (Object.keys(selector).every((key)=>datum[key] === selector[key])) return true;
1956
1995
  }
@@ -1958,19 +1997,32 @@ const selector_selector = (datum, selector)=>{
1958
1997
  };
1959
1998
  const isValueSelector = (selector)=>'string' == typeof selector || 'number' == typeof selector;
1960
1999
  const isPartialDatumSelector = (selector)=>'object' == typeof selector && null !== selector;
1961
- const isMeasureSelector = (selector)=>'object' == typeof selector && null !== selector && 'field' in selector && 'operator' in selector && 'value' in selector && [
2000
+ const isMeasureSelector = (selector)=>'object' == typeof selector && null !== selector && 'field' in selector && ('operator' in selector || 'op' in selector) && 'value' in selector && ([
2001
+ '=',
2002
+ '==',
2003
+ '!=',
2004
+ '>',
2005
+ '<',
2006
+ '>=',
2007
+ '<=',
2008
+ 'between'
2009
+ ].includes(selector.operator) || [
1962
2010
  '=',
2011
+ '==',
1963
2012
  '!=',
1964
2013
  '>',
1965
2014
  '<',
1966
2015
  '>=',
1967
2016
  '<=',
1968
2017
  'between'
1969
- ].includes(selector.operator);
1970
- const isDimensionSelector = (selector)=>'object' == typeof selector && null !== selector && 'field' in selector && 'operator' in selector && 'value' in selector && [
2018
+ ].includes(selector.op));
2019
+ const isDimensionSelector = (selector)=>'object' == typeof selector && null !== selector && 'field' in selector && ('operator' in selector || 'op' in selector) && 'value' in selector && ([
1971
2020
  'in',
1972
2021
  'not in'
1973
- ].includes(selector.operator);
2022
+ ].includes(selector.operator) || [
2023
+ 'in',
2024
+ 'not in'
2025
+ ].includes(selector.op));
1974
2026
  const barStyle_barStyle = (spec, context)=>{
1975
2027
  const { advancedVSeed } = context;
1976
2028
  const { markStyle, encoding } = advancedVSeed;
@@ -1984,23 +2036,23 @@ const barStyle_barStyle = (spec, context)=>{
1984
2036
  ...result,
1985
2037
  bar: {
1986
2038
  style: {
1987
- fill: (datum, context)=>{
2039
+ fill: barColor ? (datum, context)=>{
1988
2040
  if (selector_selector(datum, barSelector)) return barColor;
1989
2041
  return context.seriesColor(datum[encoding[0]?.group?.[0]]);
1990
- },
1991
- fillOpacity: (datum)=>{
2042
+ } : void 0,
2043
+ fillOpacity: barColorOpacity ? (datum)=>{
1992
2044
  if (selector_selector(datum, barSelector)) return barColorOpacity;
1993
2045
  return 1;
1994
- },
1995
- stroke: (datum, context)=>{
2046
+ } : void 0,
2047
+ stroke: barBorderColor ? (datum, context)=>{
1996
2048
  if (selector_selector(datum, barSelector)) return barBorderColor;
1997
2049
  return context.seriesColor(datum[encoding[0]?.group?.[0]]);
1998
- },
1999
- lineWidth: (datum)=>{
2050
+ } : void 0,
2051
+ lineWidth: barBorderWidth ? (datum)=>{
2000
2052
  if (selector_selector(datum, barSelector)) return barBorderWidth;
2001
2053
  return 0;
2002
- },
2003
- lineDash: (datum)=>{
2054
+ } : void 0,
2055
+ lineDash: barBorderStyle ? (datum)=>{
2004
2056
  if (selector_selector(datum, barSelector)) {
2005
2057
  if ('solid' === barBorderStyle) ;
2006
2058
  else if ('dashed' === barBorderStyle) return [
@@ -2016,15 +2068,518 @@ const barStyle_barStyle = (spec, context)=>{
2016
2068
  0,
2017
2069
  0
2018
2070
  ];
2019
- },
2020
- cornerRadius: (datum)=>{
2071
+ } : void 0,
2072
+ cornerRadius: barRadius ? (datum)=>{
2021
2073
  if (selector_selector(datum, barSelector)) return barRadius;
2022
2074
  return 0;
2023
- }
2075
+ } : void 0
2024
2076
  }
2025
2077
  }
2026
2078
  };
2027
2079
  };
2080
+ const isSubset = (sub, obj)=>Object.entries(sub).every(([key, value])=>{
2081
+ if ('string' == typeof value) return obj[key] === value;
2082
+ if ('number' == typeof value) return obj[key] === value;
2083
+ return true;
2084
+ });
2085
+ const annotationPoint_annotationPoint = (spec, context)=>{
2086
+ const { advancedVSeed } = context;
2087
+ const { annotation } = advancedVSeed;
2088
+ if (!annotation || !annotation.annotationPoint) return spec;
2089
+ const { annotationPoint } = annotation;
2090
+ const annotationPointList = Array.isArray(annotationPoint) ? annotationPoint : [
2091
+ annotationPoint
2092
+ ];
2093
+ const markPoint = annotationPointList.flatMap((annotationPoint)=>{
2094
+ 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;
2095
+ const dataset = advancedVSeed.dataset.flat();
2096
+ const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
2097
+ return selectedData.map((datum)=>({
2098
+ regionRelative: true,
2099
+ position: (data, context)=>{
2100
+ const targetDatum = data.find((item)=>isSubset(datum, item));
2101
+ if (targetDatum) {
2102
+ const { x, y } = context.dataToPosition(targetDatum);
2103
+ const xBandWidth = context.scaleX?.bandwidth?.();
2104
+ const yBandWidth = context.scaleY?.bandwidth?.();
2105
+ if (xBandWidth) return {
2106
+ x: x,
2107
+ y: y
2108
+ };
2109
+ if (yBandWidth) return {
2110
+ x,
2111
+ y: y
2112
+ };
2113
+ }
2114
+ },
2115
+ itemLine: {
2116
+ visible: false
2117
+ },
2118
+ itemContent: {
2119
+ offsetY,
2120
+ offsetX,
2121
+ text: {
2122
+ visible: true,
2123
+ text: text,
2124
+ style: {
2125
+ textAlign: textAlign,
2126
+ textBaseline: textBaseline,
2127
+ fill: textColor,
2128
+ fontSize: textFontSize,
2129
+ fontWeight: textFontWeight
2130
+ },
2131
+ labelBackground: {
2132
+ visible: backgroundVisible,
2133
+ padding: backgroundPadding,
2134
+ style: {
2135
+ cornerRadius: backgroundBorderRadius ?? 4,
2136
+ fill: backgroundColor,
2137
+ stroke: backgroundBorderColor,
2138
+ strokeWidth: backgroundBorderWidth
2139
+ }
2140
+ }
2141
+ }
2142
+ }
2143
+ }));
2144
+ });
2145
+ return {
2146
+ ...spec,
2147
+ markPoint
2148
+ };
2149
+ };
2150
+ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
2151
+ const { advancedVSeed } = context;
2152
+ const { annotation, encoding } = advancedVSeed;
2153
+ if (!annotation || !annotation.annotationVerticalLine) return spec;
2154
+ const { annotationVerticalLine } = annotation;
2155
+ const annotationVerticalLineList = Array.isArray(annotationVerticalLine) ? annotationVerticalLine : [
2156
+ annotationVerticalLine
2157
+ ];
2158
+ const positionMap = {
2159
+ outsideStart: 'start',
2160
+ outsideEnd: 'end',
2161
+ outsideMiddle: 'middle',
2162
+ insideStart: 'insideStartTop',
2163
+ insideMiddle: 'insideMiddleTop',
2164
+ insideEnd: 'insideEndTop'
2165
+ };
2166
+ const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
2167
+ 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;
2168
+ const dataset = advancedVSeed.dataset.flat();
2169
+ const generateOneMarkLine = (x)=>({
2170
+ x: x,
2171
+ line: {
2172
+ visible: lineVisible,
2173
+ style: {
2174
+ offsetX,
2175
+ offsetY,
2176
+ stroke: lineColor,
2177
+ lineStyle: lineStyle,
2178
+ lineWidth: lineWidth,
2179
+ lineDash: 'dashed' === lineStyle ? [
2180
+ 5,
2181
+ 2
2182
+ ] : 'dotted' === lineStyle ? [
2183
+ 2,
2184
+ 5
2185
+ ] : [
2186
+ 0
2187
+ ]
2188
+ }
2189
+ },
2190
+ label: {
2191
+ text: text,
2192
+ position: positionMap[textPosition],
2193
+ style: {
2194
+ offsetX,
2195
+ offsetY,
2196
+ visible: true,
2197
+ textAlign: textAlign,
2198
+ textBaseline: textBaseline,
2199
+ fill: textColor,
2200
+ fontSize: textFontSize,
2201
+ fontWeight: textFontWeight
2202
+ },
2203
+ labelBackground: {
2204
+ visible: backgroundVisible,
2205
+ padding: backgroundPadding,
2206
+ style: {
2207
+ offsetX,
2208
+ offsetY,
2209
+ cornerRadius: backgroundBorderRadius ?? 4,
2210
+ fill: backgroundColor,
2211
+ stroke: backgroundBorderColor,
2212
+ strokeWidth: backgroundBorderWidth
2213
+ }
2214
+ }
2215
+ },
2216
+ endSymbol: {
2217
+ visible: true,
2218
+ style: {
2219
+ fill: lineColor
2220
+ }
2221
+ }
2222
+ });
2223
+ if (!selectorPoint && (0, external_remeda_namespaceObject.isArray)(xValue) || (0, external_remeda_namespaceObject.isString)(xValue) || (0, external_remeda_namespaceObject.isNumber)(xValue)) {
2224
+ const xValueArr = Array.isArray(xValue) ? xValue : [
2225
+ xValue
2226
+ ];
2227
+ return xValueArr.map(generateOneMarkLine);
2228
+ }
2229
+ const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
2230
+ return selectedData.map((datum)=>{
2231
+ const x = encoding[0]?.x?.[0];
2232
+ if (!x) return {};
2233
+ return generateOneMarkLine(datum[x]);
2234
+ });
2235
+ });
2236
+ const specMarkLine = spec.markLine || [];
2237
+ const newMarkLine = [
2238
+ ...specMarkLine,
2239
+ ...markLine || []
2240
+ ];
2241
+ return {
2242
+ ...spec,
2243
+ markLine: newMarkLine
2244
+ };
2245
+ };
2246
+ const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
2247
+ const { advancedVSeed } = context;
2248
+ const { annotation, encoding } = advancedVSeed;
2249
+ if (!annotation || !annotation.annotationHorizontalLine) return spec;
2250
+ const { annotationHorizontalLine } = annotation;
2251
+ const annotationVerticalLineList = Array.isArray(annotationHorizontalLine) ? annotationHorizontalLine : [
2252
+ annotationHorizontalLine
2253
+ ];
2254
+ const positionMap = {
2255
+ outsideStart: 'start',
2256
+ outsideEnd: 'end',
2257
+ outsideMiddle: 'middle',
2258
+ insideStart: 'insideStartTop',
2259
+ insideMiddle: 'insideMiddleTop',
2260
+ insideEnd: 'insideEndTop'
2261
+ };
2262
+ const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
2263
+ 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;
2264
+ const dataset = advancedVSeed.dataset.flat();
2265
+ const generateOneMarkLine = (y)=>({
2266
+ y,
2267
+ line: {
2268
+ visible: lineVisible,
2269
+ style: {
2270
+ offsetX,
2271
+ offsetY,
2272
+ stroke: lineColor,
2273
+ lineStyle: lineStyle,
2274
+ lineWidth: lineWidth,
2275
+ lineDash: 'dashed' === lineStyle ? [
2276
+ 5,
2277
+ 2
2278
+ ] : 'dotted' === lineStyle ? [
2279
+ 2,
2280
+ 5
2281
+ ] : [
2282
+ 0
2283
+ ]
2284
+ }
2285
+ },
2286
+ label: {
2287
+ text: text,
2288
+ position: positionMap[textPosition],
2289
+ style: {
2290
+ offsetX,
2291
+ offsetY,
2292
+ visible: true,
2293
+ textAlign: textAlign,
2294
+ textBaseline: textBaseline,
2295
+ fill: textColor,
2296
+ fontSize: textFontSize,
2297
+ fontWeight: textFontWeight
2298
+ },
2299
+ labelBackground: {
2300
+ visible: backgroundVisible,
2301
+ padding: backgroundPadding,
2302
+ style: {
2303
+ offsetX,
2304
+ offsetY,
2305
+ cornerRadius: backgroundBorderRadius ?? 4,
2306
+ fill: backgroundColor,
2307
+ stroke: backgroundBorderColor,
2308
+ strokeWidth: backgroundBorderWidth
2309
+ }
2310
+ }
2311
+ },
2312
+ endSymbol: {
2313
+ visible: true,
2314
+ style: {
2315
+ fill: lineColor
2316
+ }
2317
+ }
2318
+ });
2319
+ if (!selectorPoint && (0, external_remeda_namespaceObject.isArray)(yValue) || (0, external_remeda_namespaceObject.isString)(yValue) || (0, external_remeda_namespaceObject.isNumber)(yValue)) {
2320
+ const yValueArr = Array.isArray(yValue) ? yValue : [
2321
+ yValue
2322
+ ];
2323
+ return yValueArr.map(generateOneMarkLine);
2324
+ }
2325
+ const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
2326
+ return selectedData.map((datum)=>{
2327
+ const y = encoding[0]?.y?.[0];
2328
+ if (!y) return {};
2329
+ return generateOneMarkLine(datum[y]);
2330
+ });
2331
+ });
2332
+ const specMarkLine = spec.markLine || [];
2333
+ const newMarkLine = [
2334
+ ...specMarkLine,
2335
+ ...markLine || []
2336
+ ];
2337
+ return {
2338
+ ...spec,
2339
+ markLine: newMarkLine
2340
+ };
2341
+ };
2342
+ const annotationArea_annotationArea = (spec, context)=>{
2343
+ const { advancedVSeed } = context;
2344
+ const { annotation } = advancedVSeed;
2345
+ if (!annotation || !annotation.annotationArea) return spec;
2346
+ const { annotationArea } = annotation;
2347
+ const annotationAreaList = Array.isArray(annotationArea) ? annotationArea : [
2348
+ annotationArea
2349
+ ];
2350
+ const positionMap = {
2351
+ top: 'insideTop',
2352
+ topRight: 'insideTopRight',
2353
+ topLeft: 'insideTopLeft',
2354
+ bottom: 'insideBottom',
2355
+ bottomLeft: 'insideBottomLeft',
2356
+ bottomRight: 'insideBottomRight',
2357
+ left: 'insideLeft',
2358
+ right: 'insideRight'
2359
+ };
2360
+ const markArea = annotationAreaList.flatMap((annotationArea)=>{
2361
+ 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;
2362
+ const dataset = advancedVSeed.dataset.flat();
2363
+ const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
2364
+ return {
2365
+ regionRelative: true,
2366
+ positions: (data, context)=>{
2367
+ console.log('debug selectedData', selectedData);
2368
+ const positionData = data.filter((item)=>selectedData.some((datum)=>isSubset(datum, item)));
2369
+ const xyList = positionData.map((datum)=>context.dataToPosition(datum));
2370
+ const xScale = context.scaleX;
2371
+ const yScale = context.scaleY;
2372
+ const xBandWidth = xScale?.bandwidth?.();
2373
+ const yBandWidth = yScale?.bandwidth?.();
2374
+ if (xBandWidth) {
2375
+ const minX = Math.min(...xyList.map((item)=>item.x)) - outerPadding;
2376
+ const maxX = Math.max(...xyList.map((item)=>item.x)) + outerPadding;
2377
+ const minY = Math.min(...yScale.range());
2378
+ const maxY = Math.max(...yScale.range());
2379
+ return [
2380
+ {
2381
+ x: minX,
2382
+ y: minY
2383
+ },
2384
+ {
2385
+ x: maxX,
2386
+ y: minY
2387
+ },
2388
+ {
2389
+ x: maxX,
2390
+ y: maxY
2391
+ },
2392
+ {
2393
+ x: minX,
2394
+ y: maxY
2395
+ }
2396
+ ];
2397
+ }
2398
+ if (yBandWidth) {
2399
+ const minY = Math.min(...xyList.map((item)=>item.y)) - outerPadding;
2400
+ const maxY = Math.max(...xyList.map((item)=>item.y)) + outerPadding;
2401
+ const minX = Math.min(...xScale.range());
2402
+ const maxX = Math.max(...xScale.range());
2403
+ return [
2404
+ {
2405
+ x: minX,
2406
+ y: minY
2407
+ },
2408
+ {
2409
+ x: maxX,
2410
+ y: minY
2411
+ },
2412
+ {
2413
+ x: maxX,
2414
+ y: maxY
2415
+ },
2416
+ {
2417
+ x: minX,
2418
+ y: maxY
2419
+ }
2420
+ ];
2421
+ }
2422
+ return [];
2423
+ },
2424
+ label: {
2425
+ position: positionMap[textPosition],
2426
+ visible: true,
2427
+ text: text,
2428
+ style: {
2429
+ textAlign: textAlign,
2430
+ textBaseline: textBaseline,
2431
+ fill: textColor,
2432
+ fontSize: textFontSize,
2433
+ fontWeight: textFontWeight
2434
+ },
2435
+ labelBackground: {
2436
+ visible: backgroundVisible,
2437
+ padding: backgroundPadding,
2438
+ style: {
2439
+ cornerRadius: backgroundBorderRadius ?? 4,
2440
+ fill: backgroundColor,
2441
+ stroke: backgroundBorderColor,
2442
+ strokeWidth: backgroundBorderWidth
2443
+ }
2444
+ }
2445
+ },
2446
+ area: {
2447
+ style: {
2448
+ visible: true,
2449
+ fill: areaColor,
2450
+ fillOpacity: areaColorOpacity,
2451
+ stroke: areaBorderColor,
2452
+ strokeWidth: areaBorderWidth,
2453
+ cornerRadius: areaBorderRadius
2454
+ }
2455
+ }
2456
+ };
2457
+ });
2458
+ return {
2459
+ ...spec,
2460
+ markArea: markArea
2461
+ };
2462
+ };
2463
+ const annotationAreaBand = (spec, context)=>{
2464
+ const { advancedVSeed } = context;
2465
+ const { annotation } = advancedVSeed;
2466
+ if (!annotation || !annotation.annotationArea) return spec;
2467
+ const { annotationArea } = annotation;
2468
+ const annotationAreaList = Array.isArray(annotationArea) ? annotationArea : [
2469
+ annotationArea
2470
+ ];
2471
+ const positionMap = {
2472
+ top: 'insideTop',
2473
+ topRight: 'insideTopRight',
2474
+ topLeft: 'insideTopLeft',
2475
+ bottom: 'insideBottom',
2476
+ bottomLeft: 'insideBottomLeft',
2477
+ bottomRight: 'insideBottomRight',
2478
+ left: 'insideLeft',
2479
+ right: 'insideRight'
2480
+ };
2481
+ const markArea = annotationAreaList.flatMap((annotationArea)=>{
2482
+ 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;
2483
+ const dataset = advancedVSeed.dataset.flat();
2484
+ const selectedData = dataset.filter((datum)=>selector_selector(datum, selectorPoint));
2485
+ return {
2486
+ regionRelative: true,
2487
+ positions: (data, context)=>{
2488
+ const positionData = data.filter((item)=>selectedData.some((datum)=>isSubset(datum, item)));
2489
+ const xyList = positionData.map((datum)=>context.dataToPosition(datum));
2490
+ const xScale = context.scaleX;
2491
+ const yScale = context.scaleY;
2492
+ const xBandWidth = xScale?.bandwidth?.();
2493
+ const yBandWidth = yScale?.bandwidth?.();
2494
+ if (xBandWidth) {
2495
+ const minX = Math.min(...xyList.map((item)=>item.x)) - outerPadding;
2496
+ const maxX = Math.max(...xyList.map((item)=>item.x)) + xBandWidth + outerPadding;
2497
+ const minY = Math.min(...yScale.range());
2498
+ const maxY = Math.max(...yScale.range());
2499
+ return [
2500
+ {
2501
+ x: minX,
2502
+ y: minY
2503
+ },
2504
+ {
2505
+ x: maxX,
2506
+ y: minY
2507
+ },
2508
+ {
2509
+ x: maxX,
2510
+ y: maxY
2511
+ },
2512
+ {
2513
+ x: minX,
2514
+ y: maxY
2515
+ }
2516
+ ];
2517
+ }
2518
+ if (yBandWidth) {
2519
+ const minY = Math.min(...xyList.map((item)=>item.y)) - outerPadding;
2520
+ const maxY = Math.max(...xyList.map((item)=>item.y)) + yBandWidth + outerPadding;
2521
+ const minX = Math.min(...xScale.range());
2522
+ const maxX = Math.max(...xScale.range());
2523
+ return [
2524
+ {
2525
+ x: minX,
2526
+ y: minY
2527
+ },
2528
+ {
2529
+ x: maxX,
2530
+ y: minY
2531
+ },
2532
+ {
2533
+ x: maxX,
2534
+ y: maxY
2535
+ },
2536
+ {
2537
+ x: minX,
2538
+ y: maxY
2539
+ }
2540
+ ];
2541
+ }
2542
+ return [];
2543
+ },
2544
+ label: {
2545
+ position: positionMap[textPosition],
2546
+ visible: true,
2547
+ text: text,
2548
+ style: {
2549
+ textAlign: textAlign,
2550
+ textBaseline: textBaseline,
2551
+ fill: textColor,
2552
+ fontSize: textFontSize,
2553
+ fontWeight: textFontWeight
2554
+ },
2555
+ labelBackground: {
2556
+ visible: backgroundVisible,
2557
+ padding: backgroundPadding,
2558
+ style: {
2559
+ cornerRadius: backgroundBorderRadius ?? 4,
2560
+ fill: backgroundColor,
2561
+ stroke: backgroundBorderColor,
2562
+ strokeWidth: backgroundBorderWidth
2563
+ }
2564
+ }
2565
+ },
2566
+ area: {
2567
+ style: {
2568
+ visible: true,
2569
+ fill: areaColor,
2570
+ fillOpacity: areaColorOpacity,
2571
+ stroke: areaBorderColor,
2572
+ strokeWidth: areaBorderWidth,
2573
+ cornerRadius: areaBorderRadius
2574
+ }
2575
+ }
2576
+ };
2577
+ });
2578
+ return {
2579
+ ...spec,
2580
+ markArea: markArea
2581
+ };
2582
+ };
2028
2583
  const line_line = [
2029
2584
  initLine,
2030
2585
  color_color,
@@ -2034,7 +2589,11 @@ const line_line = [
2034
2589
  yLinear,
2035
2590
  label_label,
2036
2591
  tooltip_tooltip,
2037
- discreteLegend
2592
+ discreteLegend,
2593
+ annotationPoint_annotationPoint,
2594
+ annotationVerticalLine_annotationVerticalLine,
2595
+ annotationHorizontalLine_annotationHorizontalLine,
2596
+ annotationArea_annotationArea
2038
2597
  ];
2039
2598
  const pivotLine = [
2040
2599
  initPivot,
@@ -2049,7 +2608,11 @@ const pivotLine = [
2049
2608
  xBand,
2050
2609
  yLinear,
2051
2610
  label_label,
2052
- tooltip_tooltip
2611
+ tooltip_tooltip,
2612
+ annotationPoint_annotationPoint,
2613
+ annotationVerticalLine_annotationVerticalLine,
2614
+ annotationHorizontalLine_annotationHorizontalLine,
2615
+ annotationArea_annotationArea
2053
2616
  ]),
2054
2617
  pivotRowDimensions,
2055
2618
  pivotColumnDimensions,
@@ -2069,7 +2632,11 @@ const column = [
2069
2632
  label_label,
2070
2633
  tooltip_tooltip,
2071
2634
  discreteLegend,
2072
- barStyle_barStyle
2635
+ barStyle_barStyle,
2636
+ annotationPoint_annotationPoint,
2637
+ annotationVerticalLine_annotationVerticalLine,
2638
+ annotationHorizontalLine_annotationHorizontalLine,
2639
+ annotationAreaBand
2073
2640
  ];
2074
2641
  const pivotColumn = [
2075
2642
  initPivot,
@@ -2086,7 +2653,11 @@ const pivotColumn = [
2086
2653
  yLinear,
2087
2654
  label_label,
2088
2655
  tooltip_tooltip,
2089
- barStyle_barStyle
2656
+ barStyle_barStyle,
2657
+ annotationPoint_annotationPoint,
2658
+ annotationVerticalLine_annotationVerticalLine,
2659
+ annotationHorizontalLine_annotationHorizontalLine,
2660
+ annotationAreaBand
2090
2661
  ]),
2091
2662
  pivotRowDimensions,
2092
2663
  pivotColumnDimensions,
@@ -2105,7 +2676,11 @@ const columnParallel = [
2105
2676
  label_label,
2106
2677
  tooltip_tooltip,
2107
2678
  discreteLegend,
2108
- barStyle_barStyle
2679
+ barStyle_barStyle,
2680
+ annotationPoint_annotationPoint,
2681
+ annotationVerticalLine_annotationVerticalLine,
2682
+ annotationHorizontalLine_annotationHorizontalLine,
2683
+ annotationAreaBand
2109
2684
  ];
2110
2685
  const pivotColumnParallel = [
2111
2686
  initPivot,
@@ -2121,7 +2696,11 @@ const pivotColumnParallel = [
2121
2696
  yLinear,
2122
2697
  label_label,
2123
2698
  tooltip_tooltip,
2124
- barStyle_barStyle
2699
+ barStyle_barStyle,
2700
+ annotationPoint_annotationPoint,
2701
+ annotationVerticalLine_annotationVerticalLine,
2702
+ annotationHorizontalLine_annotationHorizontalLine,
2703
+ annotationAreaBand
2125
2704
  ]),
2126
2705
  pivotRowDimensions,
2127
2706
  pivotColumnDimensions,
@@ -2142,7 +2721,11 @@ const columnPercent = [
2142
2721
  label_label,
2143
2722
  tooltip_tooltip,
2144
2723
  discreteLegend,
2145
- barStyle_barStyle
2724
+ barStyle_barStyle,
2725
+ annotationPoint_annotationPoint,
2726
+ annotationVerticalLine_annotationVerticalLine,
2727
+ annotationHorizontalLine_annotationHorizontalLine,
2728
+ annotationAreaBand
2146
2729
  ];
2147
2730
  const pivotColumnPercent = [
2148
2731
  initPivot,
@@ -2160,7 +2743,11 @@ const pivotColumnPercent = [
2160
2743
  yLinear,
2161
2744
  label_label,
2162
2745
  tooltip_tooltip,
2163
- barStyle_barStyle
2746
+ barStyle_barStyle,
2747
+ annotationPoint_annotationPoint,
2748
+ annotationVerticalLine_annotationVerticalLine,
2749
+ annotationHorizontalLine_annotationHorizontalLine,
2750
+ annotationAreaBand
2164
2751
  ]),
2165
2752
  pivotRowDimensions,
2166
2753
  pivotColumnDimensions,
@@ -2179,7 +2766,11 @@ const bar = [
2179
2766
  label_label,
2180
2767
  tooltip_tooltip,
2181
2768
  discreteLegend,
2182
- barStyle_barStyle
2769
+ barStyle_barStyle,
2770
+ annotationPoint_annotationPoint,
2771
+ annotationVerticalLine_annotationVerticalLine,
2772
+ annotationHorizontalLine_annotationHorizontalLine,
2773
+ annotationAreaBand
2183
2774
  ];
2184
2775
  const pivotBar = [
2185
2776
  initPivot,
@@ -2195,7 +2786,11 @@ const pivotBar = [
2195
2786
  label_label,
2196
2787
  label_label,
2197
2788
  tooltip_tooltip,
2198
- barStyle_barStyle
2789
+ barStyle_barStyle,
2790
+ annotationPoint_annotationPoint,
2791
+ annotationVerticalLine_annotationVerticalLine,
2792
+ annotationHorizontalLine_annotationHorizontalLine,
2793
+ annotationAreaBand
2199
2794
  ]),
2200
2795
  pivotRowDimensions,
2201
2796
  pivotColumnDimensions,
@@ -2214,7 +2809,11 @@ const barParallel = [
2214
2809
  label_label,
2215
2810
  tooltip_tooltip,
2216
2811
  discreteLegend,
2217
- barStyle_barStyle
2812
+ barStyle_barStyle,
2813
+ annotationPoint_annotationPoint,
2814
+ annotationVerticalLine_annotationVerticalLine,
2815
+ annotationHorizontalLine_annotationHorizontalLine,
2816
+ annotationAreaBand
2218
2817
  ];
2219
2818
  const pivotBarParallel = [
2220
2819
  initPivot,
@@ -2230,7 +2829,11 @@ const pivotBarParallel = [
2230
2829
  xLinear,
2231
2830
  label_label,
2232
2831
  tooltip_tooltip,
2233
- barStyle_barStyle
2832
+ barStyle_barStyle,
2833
+ annotationPoint_annotationPoint,
2834
+ annotationVerticalLine_annotationVerticalLine,
2835
+ annotationHorizontalLine_annotationHorizontalLine,
2836
+ annotationAreaBand
2234
2837
  ]),
2235
2838
  pivotRowDimensions,
2236
2839
  pivotColumnDimensions,
@@ -2250,7 +2853,11 @@ const barPercent = [
2250
2853
  label_label,
2251
2854
  tooltip_tooltip,
2252
2855
  discreteLegend,
2253
- barStyle_barStyle
2856
+ barStyle_barStyle,
2857
+ annotationPoint_annotationPoint,
2858
+ annotationVerticalLine_annotationVerticalLine,
2859
+ annotationHorizontalLine_annotationHorizontalLine,
2860
+ annotationAreaBand
2254
2861
  ];
2255
2862
  const pivotBarPercent = [
2256
2863
  initPivot,
@@ -2267,7 +2874,11 @@ const pivotBarPercent = [
2267
2874
  xLinear,
2268
2875
  label_label,
2269
2876
  tooltip_tooltip,
2270
- barStyle_barStyle
2877
+ barStyle_barStyle,
2878
+ annotationPoint_annotationPoint,
2879
+ annotationVerticalLine_annotationVerticalLine,
2880
+ annotationHorizontalLine_annotationHorizontalLine,
2881
+ annotationAreaBand
2271
2882
  ]),
2272
2883
  pivotRowDimensions,
2273
2884
  pivotColumnDimensions,
@@ -2286,7 +2897,11 @@ const area_area = [
2286
2897
  yLinear,
2287
2898
  label_label,
2288
2899
  tooltip_tooltip,
2289
- discreteLegend
2900
+ discreteLegend,
2901
+ annotationPoint_annotationPoint,
2902
+ annotationVerticalLine_annotationVerticalLine,
2903
+ annotationHorizontalLine_annotationHorizontalLine,
2904
+ annotationArea_annotationArea
2290
2905
  ];
2291
2906
  const pivotArea = [
2292
2907
  initPivot,
@@ -2302,7 +2917,11 @@ const pivotArea = [
2302
2917
  xBand,
2303
2918
  yLinear,
2304
2919
  label_label,
2305
- tooltip_tooltip
2920
+ tooltip_tooltip,
2921
+ annotationPoint_annotationPoint,
2922
+ annotationVerticalLine_annotationVerticalLine,
2923
+ annotationHorizontalLine_annotationHorizontalLine,
2924
+ annotationArea_annotationArea
2306
2925
  ]),
2307
2926
  pivotRowDimensions,
2308
2927
  pivotColumnDimensions,
@@ -2322,7 +2941,11 @@ const areaPercent = [
2322
2941
  yLinear,
2323
2942
  label_label,
2324
2943
  tooltip_tooltip,
2325
- discreteLegend
2944
+ discreteLegend,
2945
+ annotationPoint_annotationPoint,
2946
+ annotationVerticalLine_annotationVerticalLine,
2947
+ annotationHorizontalLine_annotationHorizontalLine,
2948
+ annotationArea_annotationArea
2326
2949
  ];
2327
2950
  const pivotAreaPercent = [
2328
2951
  initPivot,
@@ -2339,7 +2962,11 @@ const pivotAreaPercent = [
2339
2962
  xBand,
2340
2963
  yLinear,
2341
2964
  label_label,
2342
- tooltip_tooltip
2965
+ tooltip_tooltip,
2966
+ annotationPoint_annotationPoint,
2967
+ annotationVerticalLine_annotationVerticalLine,
2968
+ annotationHorizontalLine_annotationHorizontalLine,
2969
+ annotationArea_annotationArea
2343
2970
  ]),
2344
2971
  pivotRowDimensions,
2345
2972
  pivotColumnDimensions,
@@ -2355,7 +2982,11 @@ const pie = [
2355
2982
  dataset_dataset,
2356
2983
  label_label,
2357
2984
  tooltip_tooltip,
2358
- discreteLegend
2985
+ discreteLegend,
2986
+ annotationPoint_annotationPoint,
2987
+ annotationVerticalLine_annotationVerticalLine,
2988
+ annotationHorizontalLine_annotationHorizontalLine,
2989
+ annotationArea_annotationArea
2359
2990
  ];
2360
2991
  const pivotPie = [
2361
2992
  initPivot,
@@ -2368,7 +2999,11 @@ const pivotPie = [
2368
2999
  background_backgroundColor,
2369
3000
  datasetPivotPlaceholder,
2370
3001
  label_label,
2371
- tooltip_tooltip
3002
+ tooltip_tooltip,
3003
+ annotationPoint_annotationPoint,
3004
+ annotationVerticalLine_annotationVerticalLine,
3005
+ annotationHorizontalLine_annotationHorizontalLine,
3006
+ annotationArea_annotationArea
2372
3007
  ]),
2373
3008
  pivotRowDimensions,
2374
3009
  pivotColumnDimensions,
@@ -2410,17 +3045,17 @@ const buildSpec = (builder, advancedVSeed)=>{
2410
3045
  }
2411
3046
  };
2412
3047
  const build = (builder)=>{
2413
- console.log('debug vseed', builder.vseed);
2414
3048
  const advancedVSeed = builder.buildAdvanced();
2415
- console.log('debug advancedVSeed', advancedVSeed);
3049
+ builder.advancedVSeed = advancedVSeed;
2416
3050
  if (!advancedVSeed) throw new Error('advancedVSeed is null');
2417
3051
  const spec = builder.buildSpec(advancedVSeed);
2418
- console.log('debug spec', spec);
3052
+ builder.spec = spec;
2419
3053
  return spec;
2420
3054
  };
2421
3055
  class Builder {
2422
3056
  _vseed;
2423
3057
  _advancedVSeed = null;
3058
+ _spec = null;
2424
3059
  constructor(vseed){
2425
3060
  this._vseed = vseed;
2426
3061
  }
@@ -2443,6 +3078,12 @@ class Builder {
2443
3078
  set advancedVSeed(value) {
2444
3079
  this._advancedVSeed = value;
2445
3080
  }
3081
+ get spec() {
3082
+ return this._spec;
3083
+ }
3084
+ set spec(value) {
3085
+ this._spec = value;
3086
+ }
2446
3087
  static _advancedPipelineMap = {};
2447
3088
  static _specPipelineMap = {};
2448
3089
  static _themeMap = {};
@@ -3190,7 +3831,26 @@ const zSelector = external_zod_namespaceObject.z.union([
3190
3831
  external_zod_namespaceObject.z.number(),
3191
3832
  external_zod_namespaceObject.z.object({
3192
3833
  field: external_zod_namespaceObject.z.string(),
3193
- operator: external_zod_namespaceObject.z.string(),
3834
+ operator: external_zod_namespaceObject.z["enum"]([
3835
+ '=',
3836
+ '==',
3837
+ '!=',
3838
+ '>',
3839
+ '<',
3840
+ '>=',
3841
+ '<=',
3842
+ 'between'
3843
+ ]).optional(),
3844
+ op: external_zod_namespaceObject.z["enum"]([
3845
+ '=',
3846
+ '==',
3847
+ '!=',
3848
+ '>',
3849
+ '<',
3850
+ '>=',
3851
+ '<=',
3852
+ 'between'
3853
+ ]).optional(),
3194
3854
  value: external_zod_namespaceObject.z.union([
3195
3855
  external_zod_namespaceObject.z.string(),
3196
3856
  external_zod_namespaceObject.z.number(),
@@ -3202,7 +3862,14 @@ const zSelector = external_zod_namespaceObject.z.union([
3202
3862
  }),
3203
3863
  external_zod_namespaceObject.z.object({
3204
3864
  field: external_zod_namespaceObject.z.string(),
3205
- operator: external_zod_namespaceObject.z.string(),
3865
+ operator: external_zod_namespaceObject.z["enum"]([
3866
+ 'in',
3867
+ 'not in'
3868
+ ]).optional(),
3869
+ op: external_zod_namespaceObject.z["enum"]([
3870
+ 'in',
3871
+ 'not in'
3872
+ ]).optional(),
3206
3873
  value: external_zod_namespaceObject.z.union([
3207
3874
  external_zod_namespaceObject.z.string(),
3208
3875
  external_zod_namespaceObject.z.number(),
@@ -3218,24 +3885,204 @@ const zBarStyle = external_zod_namespaceObject.z.object({
3218
3885
  selector: external_zod_namespaceObject.z.union([
3219
3886
  zSelector,
3220
3887
  zSelectors
3221
- ]),
3222
- barColor: external_zod_namespaceObject.z.string(),
3223
- barColorOpacity: external_zod_namespaceObject.z.number(),
3224
- barBorderColor: external_zod_namespaceObject.z.string(),
3225
- barBorderWidth: external_zod_namespaceObject.z.number(),
3888
+ ]).optional(),
3889
+ barColor: external_zod_namespaceObject.z.string().optional(),
3890
+ barColorOpacity: external_zod_namespaceObject.z.number().optional(),
3891
+ barBorderColor: external_zod_namespaceObject.z.string().optional(),
3892
+ barBorderWidth: external_zod_namespaceObject.z.number().optional(),
3226
3893
  barBorderStyle: external_zod_namespaceObject.z.union([
3227
3894
  external_zod_namespaceObject.z.literal('solid'),
3228
3895
  external_zod_namespaceObject.z.literal('dashed'),
3229
3896
  external_zod_namespaceObject.z.literal('dotted')
3230
- ]),
3897
+ ]).optional(),
3231
3898
  barRadius: external_zod_namespaceObject.z.union([
3232
3899
  external_zod_namespaceObject.z.number(),
3233
3900
  external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.number())
3234
- ])
3901
+ ]).optional()
3235
3902
  });
3236
3903
  const zMarkStyle = external_zod_namespaceObject.z.object({
3237
3904
  barStyle: zBarStyle.optional()
3238
3905
  });
3906
+ const zAnnotationPoint = external_zod_namespaceObject.z.object({
3907
+ selector: external_zod_namespaceObject.z.union([
3908
+ zSelector,
3909
+ zSelectors
3910
+ ]),
3911
+ text: external_zod_namespaceObject.z.string().or(external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.string())).optional(),
3912
+ textColor: external_zod_namespaceObject.z.string().default('#ffffff').optional(),
3913
+ textFontSize: external_zod_namespaceObject.z.number().default(12).optional(),
3914
+ textFontWeight: external_zod_namespaceObject.z.number().default(400).optional(),
3915
+ textAlign: external_zod_namespaceObject.z["enum"]([
3916
+ 'left',
3917
+ 'right',
3918
+ 'center'
3919
+ ]).default('center').optional(),
3920
+ textBaseline: external_zod_namespaceObject.z["enum"]([
3921
+ 'top',
3922
+ 'middle',
3923
+ 'bottom'
3924
+ ]).default('middle').optional(),
3925
+ backgroundVisible: external_zod_namespaceObject.z.boolean().default(true).optional(),
3926
+ backgroundColor: external_zod_namespaceObject.z.string().default('#212121').optional(),
3927
+ backgroundBorderColor: external_zod_namespaceObject.z.string().optional(),
3928
+ backgroundBorderWidth: external_zod_namespaceObject.z.number().default(1).optional(),
3929
+ backgroundBorderRadius: external_zod_namespaceObject.z.number().default(4).optional(),
3930
+ backgroundPadding: external_zod_namespaceObject.z.number().optional(),
3931
+ offsetY: external_zod_namespaceObject.z.number().default(0).optional(),
3932
+ offsetX: external_zod_namespaceObject.z.number().default(0).optional()
3933
+ });
3934
+ const zAnnotationVerticalLine = external_zod_namespaceObject.z.object({
3935
+ selector: external_zod_namespaceObject.z.union([
3936
+ zSelector,
3937
+ zSelectors
3938
+ ]).optional(),
3939
+ xValue: external_zod_namespaceObject.z.union([
3940
+ external_zod_namespaceObject.z.number(),
3941
+ external_zod_namespaceObject.z.string(),
3942
+ external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.union([
3943
+ external_zod_namespaceObject.z.number(),
3944
+ external_zod_namespaceObject.z.string()
3945
+ ]))
3946
+ ]).optional(),
3947
+ text: external_zod_namespaceObject.z.string().or(external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.string())).optional(),
3948
+ textPosition: external_zod_namespaceObject.z["enum"]([
3949
+ 'outsideStart',
3950
+ 'outsideEnd',
3951
+ 'outsideMiddle',
3952
+ 'insideStart',
3953
+ 'insideMiddle',
3954
+ 'insideEnd'
3955
+ ]).default('insideEnd').optional(),
3956
+ textColor: external_zod_namespaceObject.z.string().default('#ffffff').optional(),
3957
+ textFontSize: external_zod_namespaceObject.z.number().default(12).optional(),
3958
+ textFontWeight: external_zod_namespaceObject.z.number().default(400).optional(),
3959
+ textAlign: external_zod_namespaceObject.z["enum"]([
3960
+ 'left',
3961
+ 'right',
3962
+ 'center'
3963
+ ]).default('right').optional(),
3964
+ textBaseline: external_zod_namespaceObject.z["enum"]([
3965
+ 'top',
3966
+ 'middle',
3967
+ 'bottom'
3968
+ ]).default('top').optional(),
3969
+ lineVisible: external_zod_namespaceObject.z.boolean().optional(),
3970
+ lineColor: external_zod_namespaceObject.z.string().optional(),
3971
+ lineWidth: external_zod_namespaceObject.z.number().optional(),
3972
+ lineStyle: external_zod_namespaceObject.z.union([
3973
+ external_zod_namespaceObject.z.literal('solid'),
3974
+ external_zod_namespaceObject.z.literal('dashed'),
3975
+ external_zod_namespaceObject.z.literal('dotted')
3976
+ ]).optional(),
3977
+ backgroundVisible: external_zod_namespaceObject.z.boolean().default(true).optional(),
3978
+ backgroundColor: external_zod_namespaceObject.z.string().default('#212121').optional(),
3979
+ backgroundBorderColor: external_zod_namespaceObject.z.string().optional(),
3980
+ backgroundBorderWidth: external_zod_namespaceObject.z.number().default(1).optional(),
3981
+ backgroundBorderRadius: external_zod_namespaceObject.z.number().default(4).optional(),
3982
+ backgroundPadding: external_zod_namespaceObject.z.number().optional(),
3983
+ offsetY: external_zod_namespaceObject.z.number().default(0).optional(),
3984
+ offsetX: external_zod_namespaceObject.z.number().default(0).optional()
3985
+ });
3986
+ const zAnnotationHorizontalLine = external_zod_namespaceObject.z.object({
3987
+ selector: external_zod_namespaceObject.z.union([
3988
+ zSelector,
3989
+ zSelectors
3990
+ ]).optional(),
3991
+ yValue: external_zod_namespaceObject.z.union([
3992
+ external_zod_namespaceObject.z.number(),
3993
+ external_zod_namespaceObject.z.string(),
3994
+ external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.union([
3995
+ external_zod_namespaceObject.z.number(),
3996
+ external_zod_namespaceObject.z.string()
3997
+ ]))
3998
+ ]).optional(),
3999
+ text: external_zod_namespaceObject.z.string().or(external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.string())).optional(),
4000
+ textPosition: external_zod_namespaceObject.z["enum"]([
4001
+ 'outsideStart',
4002
+ 'outsideEnd',
4003
+ 'outsideMiddle',
4004
+ 'insideStart',
4005
+ 'insideMiddle',
4006
+ 'insideEnd'
4007
+ ]).default('insideMiddle').optional(),
4008
+ textColor: external_zod_namespaceObject.z.string().default('#ffffff').optional(),
4009
+ textFontSize: external_zod_namespaceObject.z.number().default(12).optional(),
4010
+ textFontWeight: external_zod_namespaceObject.z.number().default(400).optional(),
4011
+ textAlign: external_zod_namespaceObject.z["enum"]([
4012
+ 'left',
4013
+ 'right',
4014
+ 'center'
4015
+ ]).default('center').optional(),
4016
+ textBaseline: external_zod_namespaceObject.z["enum"]([
4017
+ 'top',
4018
+ 'middle',
4019
+ 'bottom'
4020
+ ]).default('bottom').optional(),
4021
+ lineVisible: external_zod_namespaceObject.z.boolean().optional(),
4022
+ lineColor: external_zod_namespaceObject.z.string().optional(),
4023
+ lineWidth: external_zod_namespaceObject.z.number().optional(),
4024
+ lineStyle: external_zod_namespaceObject.z.union([
4025
+ external_zod_namespaceObject.z.literal('solid'),
4026
+ external_zod_namespaceObject.z.literal('dashed'),
4027
+ external_zod_namespaceObject.z.literal('dotted')
4028
+ ]).optional(),
4029
+ backgroundVisible: external_zod_namespaceObject.z.boolean().default(true).optional(),
4030
+ backgroundColor: external_zod_namespaceObject.z.string().default('#212121').optional(),
4031
+ backgroundBorderColor: external_zod_namespaceObject.z.string().optional(),
4032
+ backgroundBorderWidth: external_zod_namespaceObject.z.number().default(1).optional(),
4033
+ backgroundBorderRadius: external_zod_namespaceObject.z.number().default(4).optional(),
4034
+ backgroundPadding: external_zod_namespaceObject.z.number().optional(),
4035
+ offsetY: external_zod_namespaceObject.z.number().default(0).optional(),
4036
+ offsetX: external_zod_namespaceObject.z.number().default(0).optional()
4037
+ });
4038
+ const zAnnotationArea = external_zod_namespaceObject.z.object({
4039
+ selector: external_zod_namespaceObject.z.union([
4040
+ zSelector,
4041
+ zSelectors
4042
+ ]),
4043
+ textPosition: external_zod_namespaceObject.z["enum"]([
4044
+ 'top',
4045
+ 'topRight',
4046
+ 'topLeft',
4047
+ 'bottom',
4048
+ 'bottomLeft',
4049
+ 'bottomRight',
4050
+ 'left',
4051
+ 'right'
4052
+ ]).default('top').optional(),
4053
+ text: external_zod_namespaceObject.z.string().or(external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.string())).optional(),
4054
+ textColor: external_zod_namespaceObject.z.string().default('#ffffff').optional(),
4055
+ textFontSize: external_zod_namespaceObject.z.number().default(12).optional(),
4056
+ textFontWeight: external_zod_namespaceObject.z.number().default(400).optional(),
4057
+ textAlign: external_zod_namespaceObject.z["enum"]([
4058
+ 'left',
4059
+ 'right',
4060
+ 'center'
4061
+ ]).default('center').optional(),
4062
+ textBaseline: external_zod_namespaceObject.z["enum"]([
4063
+ 'top',
4064
+ 'middle',
4065
+ 'bottom'
4066
+ ]).default('middle').optional(),
4067
+ backgroundVisible: external_zod_namespaceObject.z.boolean().default(true).optional(),
4068
+ backgroundColor: external_zod_namespaceObject.z.string().default('#212121').optional(),
4069
+ backgroundBorderColor: external_zod_namespaceObject.z.string().optional(),
4070
+ backgroundBorderWidth: external_zod_namespaceObject.z.number().default(1).optional(),
4071
+ backgroundBorderRadius: external_zod_namespaceObject.z.number().default(4).optional(),
4072
+ backgroundPadding: external_zod_namespaceObject.z.number().optional(),
4073
+ areaColor: external_zod_namespaceObject.z.string().default('red').optional(),
4074
+ areaColorOpacity: external_zod_namespaceObject.z.number().default(0.5).optional(),
4075
+ areaBorderColor: external_zod_namespaceObject.z.number().optional(),
4076
+ areaBorderWidth: external_zod_namespaceObject.z.number().default(2).optional(),
4077
+ areaBorderRadius: external_zod_namespaceObject.z.number().default(4).optional(),
4078
+ outerPadding: external_zod_namespaceObject.z.number().optional()
4079
+ });
4080
+ const zAnnotation = external_zod_namespaceObject.z.object({
4081
+ annotationPoint: zAnnotationPoint.or(external_zod_namespaceObject.z.array(zAnnotationPoint)).optional(),
4082
+ annotationVerticalLine: zAnnotationVerticalLine.or(external_zod_namespaceObject.z.array(zAnnotationVerticalLine)).optional(),
4083
+ annotationHorizontalLine: zAnnotationHorizontalLine.or(external_zod_namespaceObject.z.array(zAnnotationHorizontalLine)).optional(),
4084
+ annotationArea: zAnnotationArea.or(external_zod_namespaceObject.z.array(zAnnotationArea)).optional()
4085
+ });
3239
4086
  exports.Builder = __webpack_exports__.Builder;
3240
4087
  exports.FoldMeasureId = __webpack_exports__.FoldMeasureId;
3241
4088
  exports.FoldMeasureName = __webpack_exports__.FoldMeasureName;
@@ -3286,6 +4133,11 @@ exports.registerDarkTheme = __webpack_exports__.registerDarkTheme;
3286
4133
  exports.registerLightTheme = __webpack_exports__.registerLightTheme;
3287
4134
  exports.registerLine = __webpack_exports__.registerLine;
3288
4135
  exports.unfoldDimensions = __webpack_exports__.unfoldDimensions;
4136
+ exports.zAnnotation = __webpack_exports__.zAnnotation;
4137
+ exports.zAnnotationArea = __webpack_exports__.zAnnotationArea;
4138
+ exports.zAnnotationHorizontalLine = __webpack_exports__.zAnnotationHorizontalLine;
4139
+ exports.zAnnotationPoint = __webpack_exports__.zAnnotationPoint;
4140
+ exports.zAnnotationVerticalLine = __webpack_exports__.zAnnotationVerticalLine;
3289
4141
  exports.zAxis = __webpack_exports__.zAxis;
3290
4142
  exports.zBackgroundColor = __webpack_exports__.zBackgroundColor;
3291
4143
  exports.zBarStyle = __webpack_exports__.zBarStyle;
@@ -3366,6 +4218,11 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
3366
4218
  "registerLightTheme",
3367
4219
  "registerLine",
3368
4220
  "unfoldDimensions",
4221
+ "zAnnotation",
4222
+ "zAnnotationArea",
4223
+ "zAnnotationHorizontalLine",
4224
+ "zAnnotationPoint",
4225
+ "zAnnotationVerticalLine",
3369
4226
  "zAxis",
3370
4227
  "zBackgroundColor",
3371
4228
  "zBarStyle",