@visactor/vseed 0.2.1 → 0.2.3

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 (196) hide show
  1. package/dist/cjs/index.cjs +1 -3
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/esm/builder/builder/buildAdvanced.js +1 -2
  4. package/dist/esm/builder/builder/buildAdvanced.js.map +1 -1
  5. package/dist/esm/builder/builder/buildSpec.js +1 -2
  6. package/dist/esm/builder/builder/buildSpec.js.map +1 -1
  7. package/dist/esm/builder/builder/builder.d.ts +628 -334
  8. package/dist/esm/builder/register/all.js +2 -2
  9. package/dist/esm/builder/register/all.js.map +1 -1
  10. package/dist/esm/builder/register/chartType/boxplot.d.ts +1 -1
  11. package/dist/esm/builder/register/chartType/boxplot.js +2 -2
  12. package/dist/esm/builder/register/chartType/boxplot.js.map +1 -1
  13. package/dist/esm/builder/register/chartType/index.d.ts +1 -1
  14. package/dist/esm/builder/register/chartType/index.js +2 -2
  15. package/dist/esm/dataReshape/constant.d.ts +1 -0
  16. package/dist/esm/dataReshape/constant.js +2 -1
  17. package/dist/esm/dataReshape/constant.js.map +1 -1
  18. package/dist/esm/i18n/i18n.js +1 -4
  19. package/dist/esm/i18n/i18n.js.map +1 -1
  20. package/dist/esm/index.d.ts +1 -1
  21. package/dist/esm/index.js +2 -2
  22. package/dist/esm/pipeline/advanced/chart/pipes/config/histogram.js +17 -0
  23. package/dist/esm/pipeline/advanced/chart/pipes/config/histogram.js.map +1 -1
  24. package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithBoxplotEncoding.js +12 -0
  25. package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithBoxplotEncoding.js.map +1 -1
  26. package/dist/esm/pipeline/spec/chart/pipeline/heatmap.js +3 -1
  27. package/dist/esm/pipeline/spec/chart/pipeline/heatmap.js.map +1 -1
  28. package/dist/esm/pipeline/spec/chart/pipeline/histogram.js +3 -3
  29. package/dist/esm/pipeline/spec/chart/pipeline/histogram.js.map +1 -1
  30. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.js +4 -12
  31. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.js.map +1 -1
  32. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPoint.js +3 -76
  33. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPoint.js.map +1 -1
  34. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointCommon.d.ts +6 -0
  35. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointCommon.js +95 -0
  36. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointCommon.js.map +1 -0
  37. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.js +16 -84
  38. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.js.map +1 -1
  39. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointOfHistogram.d.ts +2 -0
  40. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointOfHistogram.js +23 -0
  41. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointOfHistogram.js.map +1 -0
  42. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js +4 -12
  43. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js.map +1 -1
  44. package/dist/esm/pipeline/spec/chart/pipes/annotation/index.d.ts +1 -0
  45. package/dist/esm/pipeline/spec/chart/pipes/annotation/index.js +2 -1
  46. package/dist/esm/pipeline/spec/chart/pipes/axes/axisStyle.d.ts +3 -0
  47. package/dist/esm/pipeline/spec/chart/pipes/axes/axisStyle.js +65 -0
  48. package/dist/esm/pipeline/spec/chart/pipes/axes/axisStyle.js.map +1 -0
  49. package/dist/esm/pipeline/spec/chart/pipes/axes/heatmapBandAxis.d.ts +2 -0
  50. package/dist/esm/pipeline/spec/chart/pipes/axes/heatmapBandAxis.js +24 -0
  51. package/dist/esm/pipeline/spec/chart/pipes/axes/heatmapBandAxis.js.map +1 -0
  52. package/dist/esm/pipeline/spec/chart/pipes/axes/index.d.ts +1 -0
  53. package/dist/esm/pipeline/spec/chart/pipes/axes/index.js +2 -1
  54. package/dist/esm/pipeline/spec/chart/pipes/axes/xBand.js +15 -72
  55. package/dist/esm/pipeline/spec/chart/pipes/axes/xBand.js.map +1 -1
  56. package/dist/esm/pipeline/spec/chart/pipes/axes/yBand.js +17 -73
  57. package/dist/esm/pipeline/spec/chart/pipes/axes/yBand.js.map +1 -1
  58. package/dist/esm/pipeline/spec/chart/pipes/dual/dualChartType.js +11 -13
  59. package/dist/esm/pipeline/spec/chart/pipes/dual/dualChartType.js.map +1 -1
  60. package/dist/esm/pipeline/spec/chart/pipes/init/boxplot.js +10 -8
  61. package/dist/esm/pipeline/spec/chart/pipes/init/boxplot.js.map +1 -1
  62. package/dist/esm/pipeline/spec/chart/pipes/init/heatmap.js +0 -12
  63. package/dist/esm/pipeline/spec/chart/pipes/init/heatmap.js.map +1 -1
  64. package/dist/esm/pipeline/spec/chart/pipes/label/label.js +1 -1
  65. package/dist/esm/pipeline/spec/chart/pipes/label/label.js.map +1 -1
  66. package/dist/esm/pipeline/spec/chart/pipes/legend/colorLegend.js +13 -1
  67. package/dist/esm/pipeline/spec/chart/pipes/legend/colorLegend.js.map +1 -1
  68. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/dimensionLinkage.js +2 -2
  69. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/dimensionLinkage.js.map +1 -1
  70. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.js +3 -1
  71. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.js.map +1 -1
  72. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipBoxplot.js +3 -1
  73. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipBoxplot.js.map +1 -1
  74. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js +3 -1
  75. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js.map +1 -1
  76. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipElement.d.ts +2 -0
  77. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipElement.js +58 -0
  78. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipElement.js.map +1 -0
  79. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHeatmap.js +3 -1
  80. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHeatmap.js.map +1 -1
  81. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHistogram.js +11 -8
  82. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHistogram.js.map +1 -1
  83. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipScatter.js +3 -1
  84. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipScatter.js.map +1 -1
  85. package/dist/esm/pipeline/spec/chart/utils/histogram.d.ts +1 -0
  86. package/dist/esm/pipeline/spec/chart/utils/histogram.js +6 -2
  87. package/dist/esm/pipeline/spec/chart/utils/histogram.js.map +1 -1
  88. package/dist/esm/pipeline/utils/boxplot.d.ts +1 -0
  89. package/dist/esm/pipeline/utils/boxplot.js +8 -0
  90. package/dist/esm/pipeline/utils/boxplot.js.map +1 -0
  91. package/dist/esm/pipeline/utils/index.d.ts +1 -0
  92. package/dist/esm/pipeline/utils/index.js +1 -0
  93. package/dist/esm/theme/common/legend.d.ts +3 -1
  94. package/dist/esm/theme/common/legend.js +13 -1
  95. package/dist/esm/theme/common/legend.js.map +1 -1
  96. package/dist/esm/theme/common/tooltip.js +1 -1
  97. package/dist/esm/theme/common/tooltip.js.map +1 -1
  98. package/dist/esm/theme/dark/dark.js +4 -1
  99. package/dist/esm/theme/dark/dark.js.map +1 -1
  100. package/dist/esm/theme/light/light.js +4 -1
  101. package/dist/esm/theme/light/light.js.map +1 -1
  102. package/dist/esm/types/advancedVSeed.d.ts +252 -420
  103. package/dist/esm/types/chartType/area/area.d.ts +2 -2
  104. package/dist/esm/types/chartType/area/zArea.d.ts +5 -281
  105. package/dist/esm/types/chartType/areaPercent/areaPercent.d.ts +3 -5
  106. package/dist/esm/types/chartType/areaPercent/zAreaPercent.d.ts +5 -281
  107. package/dist/esm/types/chartType/bar/bar.d.ts +3 -3
  108. package/dist/esm/types/chartType/bar/zBar.d.ts +5 -281
  109. package/dist/esm/types/chartType/barParallel/barParallel.d.ts +3 -3
  110. package/dist/esm/types/chartType/barParallel/zBarParallel.d.ts +5 -281
  111. package/dist/esm/types/chartType/barPercent/barPercent.d.ts +3 -3
  112. package/dist/esm/types/chartType/barPercent/zBarPercent.d.ts +5 -281
  113. package/dist/esm/types/chartType/{boxplot/boxplot.d.ts → boxPlot/boxPlot.d.ts} +6 -6
  114. package/dist/esm/types/chartType/boxPlot/index.d.ts +2 -0
  115. package/dist/esm/types/chartType/boxPlot/index.js +1 -0
  116. package/dist/esm/types/chartType/{boxplot/zBoxplot.d.ts → boxPlot/zBoxPlot.d.ts} +6 -282
  117. package/dist/esm/types/chartType/{boxplot/zBoxplot.js → boxPlot/zBoxPlot.js} +3 -3
  118. package/dist/esm/types/chartType/{boxplot/zBoxplot.js.map → boxPlot/zBoxPlot.js.map} +1 -1
  119. package/dist/esm/types/chartType/column/column.d.ts +4 -4
  120. package/dist/esm/types/chartType/column/zColumn.d.ts +7 -283
  121. package/dist/esm/types/chartType/column/zColumn.js +1 -1
  122. package/dist/esm/types/chartType/column/zColumn.js.map +1 -1
  123. package/dist/esm/types/chartType/columnParallel/columnParallel.d.ts +3 -5
  124. package/dist/esm/types/chartType/columnParallel/zColumnParallel.d.ts +5 -281
  125. package/dist/esm/types/chartType/columnPercent/columnPercent.d.ts +3 -3
  126. package/dist/esm/types/chartType/columnPercent/zColumnPercent.d.ts +5 -281
  127. package/dist/esm/types/chartType/donut/zDonut.d.ts +1 -1
  128. package/dist/esm/types/chartType/dualAxis/dualAxis.d.ts +3 -3
  129. package/dist/esm/types/chartType/dualAxis/zDualAxis.d.ts +5 -281
  130. package/dist/esm/types/chartType/funnel/zFunnel.d.ts +5 -0
  131. package/dist/esm/types/chartType/heatmap/zHeatmap.d.ts +5 -0
  132. package/dist/esm/types/chartType/histogram/histogram.d.ts +6 -6
  133. package/dist/esm/types/chartType/histogram/zHistogram.d.ts +5 -281
  134. package/dist/esm/types/chartType/index.d.ts +1 -1
  135. package/dist/esm/types/chartType/index.js +1 -1
  136. package/dist/esm/types/chartType/line/line.d.ts +3 -5
  137. package/dist/esm/types/chartType/line/zLine.d.ts +5 -281
  138. package/dist/esm/types/chartType/pie/zPie.d.ts +1 -1
  139. package/dist/esm/types/chartType/pivotTable/pivotTable.d.ts +1 -1
  140. package/dist/esm/types/chartType/radar/zRadar.d.ts +1 -1
  141. package/dist/esm/types/chartType/rose/zRose.d.ts +1 -1
  142. package/dist/esm/types/chartType/roseParallel/zRoseParallel.d.ts +1 -1
  143. package/dist/esm/types/chartType/scatter/scatter.d.ts +7 -7
  144. package/dist/esm/types/chartType/scatter/zScatter.d.ts +13 -289
  145. package/dist/esm/types/chartType/scatter/zScatter.js +4 -4
  146. package/dist/esm/types/chartType/scatter/zScatter.js.map +1 -1
  147. package/dist/esm/types/chartType/table/table.d.ts +1 -1
  148. package/dist/esm/types/dataSelector/selector.d.ts +108 -0
  149. package/dist/esm/types/dataSelector/selector.js +58 -51
  150. package/dist/esm/types/dataSelector/selector.js.map +1 -1
  151. package/dist/esm/types/properties/annotation/annotation.d.ts +4 -280
  152. package/dist/esm/types/properties/annotation/annotationArea.d.ts +2 -2
  153. package/dist/esm/types/properties/annotation/annotationHorizontalLine.d.ts +1 -6
  154. package/dist/esm/types/properties/annotation/annotationVerticalLine.d.ts +0 -5
  155. package/dist/esm/types/properties/annotation/zAnnotationArea.d.ts +2 -2
  156. package/dist/esm/types/properties/annotation/zAnnotationArea.js +3 -3
  157. package/dist/esm/types/properties/annotation/zAnnotationArea.js.map +1 -1
  158. package/dist/esm/types/properties/annotation/zAnnotationHorizontalLine.d.ts +0 -69
  159. package/dist/esm/types/properties/annotation/zAnnotationHorizontalLine.js +0 -5
  160. package/dist/esm/types/properties/annotation/zAnnotationHorizontalLine.js.map +1 -1
  161. package/dist/esm/types/properties/annotation/zAnnotationVerticalLine.d.ts +0 -69
  162. package/dist/esm/types/properties/annotation/zAnnotationVerticalLine.js +0 -5
  163. package/dist/esm/types/properties/annotation/zAnnotationVerticalLine.js.map +1 -1
  164. package/dist/esm/types/properties/config/area.d.ts +2 -2
  165. package/dist/esm/types/properties/config/bar.d.ts +3 -3
  166. package/dist/esm/types/properties/config/boxplot.d.ts +1 -1
  167. package/dist/esm/types/properties/config/column.d.ts +3 -3
  168. package/dist/esm/types/properties/config/config.d.ts +102 -48
  169. package/dist/esm/types/properties/config/dualAxis.d.ts +1 -1
  170. package/dist/esm/types/properties/config/funnel.d.ts +1 -1
  171. package/dist/esm/types/properties/config/heatmap.d.ts +83 -29
  172. package/dist/esm/types/properties/config/heatmap.js +6 -3
  173. package/dist/esm/types/properties/config/heatmap.js.map +1 -1
  174. package/dist/esm/types/properties/config/histogram.d.ts +1 -1
  175. package/dist/esm/types/properties/config/legend/legend.d.ts +10 -2
  176. package/dist/esm/types/properties/config/legend/legend.js +7 -2
  177. package/dist/esm/types/properties/config/legend/legend.js.map +1 -1
  178. package/dist/esm/types/properties/config/line.d.ts +1 -1
  179. package/dist/esm/types/properties/config/pie.d.ts +3 -3
  180. package/dist/esm/types/properties/config/rose.d.ts +2 -2
  181. package/dist/esm/types/properties/config/scatter.d.ts +1 -1
  182. package/dist/esm/types/properties/regressionLine/linearRegressionLine.d.ts +4 -0
  183. package/dist/esm/types/properties/regressionLine/logisticRegressionLine.d.ts +4 -0
  184. package/dist/esm/types/properties/regressionLine/lowessRegressionLine.d.ts +4 -0
  185. package/dist/esm/types/properties/regressionLine/polynomialRegressionLine.d.ts +4 -0
  186. package/dist/esm/types/properties/theme/customTheme.d.ts +204 -96
  187. package/dist/esm/types/vseed.d.ts +2 -2
  188. package/dist/esm/types/zVseed.d.ts +837 -4415
  189. package/dist/esm/types/zVseed.js +2 -2
  190. package/dist/esm/types/zVseed.js.map +1 -1
  191. package/dist/umd/index.js +541 -426
  192. package/dist/umd/index.js.map +1 -1
  193. package/package.json +10 -5
  194. package/dist/esm/types/chartType/boxplot/index.d.ts +0 -2
  195. package/dist/esm/types/chartType/boxplot/index.js +0 -1
  196. /package/dist/esm/types/chartType/{boxplot/boxplot.js → boxPlot/boxPlot.js} +0 -0
@@ -0,0 +1,6 @@
1
+ import type { ISpec, IMarkPointSpec } from '@visactor/vchart';
2
+ import type { Datum, Selector, Selectors, SpecPipelineContext, VChartSpecPipe } from '../../../../../types';
3
+ export declare const generateAnnotationPointPipe: (options: {
4
+ findSelectedDatas?: (dataset: Datum[], selector: Selector | Selectors | undefined | null, spec: ISpec, context: SpecPipelineContext) => Datum[];
5
+ generateMarkPoint?: (datum: Datum, spec: ISpec, context: SpecPipelineContext) => IMarkPointSpec[] | undefined;
6
+ }) => VChartSpecPipe;
@@ -0,0 +1,95 @@
1
+ import { selector } from "../../../../../dataSelector/index.js";
2
+ import { isSubset } from "./utils.js";
3
+ import { ANNOTATION_Z_INDEX } from "../../../../utils/constant.js";
4
+ import { isBarLikeChart } from "../../../../utils/chatType.js";
5
+ const generateAnnotationPointPipe = (options)=>{
6
+ const findSelectedDatas = options.findSelectedDatas ?? ((dataset, s)=>dataset.filter((datum)=>selector(datum, s)));
7
+ const generateMarkPoint = options.generateMarkPoint ?? ((datum)=>[
8
+ {
9
+ coordinate: (data)=>data.find((item)=>isSubset(datum, item))
10
+ }
11
+ ]);
12
+ return (spec, context)=>{
13
+ const { advancedVSeed, vseed } = context;
14
+ const { annotation, config } = advancedVSeed;
15
+ if (!annotation || !annotation.annotationPoint) return spec;
16
+ const theme = config?.[vseed.chartType]?.annotation?.annotationPoint;
17
+ const { annotationPoint } = annotation;
18
+ const annotationPointList = Array.isArray(annotationPoint) ? annotationPoint : [
19
+ annotationPoint
20
+ ];
21
+ const isHorizontalBar = isBarLikeChart(advancedVSeed);
22
+ const defaultStyle = isHorizontalBar ? {
23
+ textAlign: 'right',
24
+ textBaseline: 'middle'
25
+ } : {
26
+ textAlign: 'center',
27
+ textBaseline: 'top'
28
+ };
29
+ const markPoint = annotationPointList.flatMap((annotationPoint)=>{
30
+ const { selector: selectorPoint, text = '', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = defaultStyle.textAlign, textBaseline = defaultStyle.textBaseline, textBackgroundBorderColor = theme?.textBackgroundBorderColor, textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundColor = theme?.textBackgroundColor ?? '#212121', textBackgroundPadding = theme?.textBackgroundPadding ?? 2, textBackgroundVisible = theme?.textBackgroundVisible ?? true, offsetX = theme?.offsetX ?? 0, offsetY = theme?.offsetY ?? 0 } = annotationPoint;
31
+ const dataset = advancedVSeed.dataset.flat();
32
+ const selectedData = selectorPoint ? findSelectedDatas(dataset, selectorPoint, spec, context) : [];
33
+ const dx = -10 - (isHorizontalBar ? textFontSize : 0);
34
+ const dy = isHorizontalBar ? 0 : textFontSize;
35
+ const markPointStyle = {
36
+ zIndex: ANNOTATION_Z_INDEX,
37
+ regionRelative: true,
38
+ itemLine: {
39
+ visible: false
40
+ },
41
+ itemContent: {
42
+ offsetY,
43
+ offsetX,
44
+ confine: true,
45
+ text: {
46
+ text: text,
47
+ style: {
48
+ opacity: 0.95,
49
+ visible: true,
50
+ textAlign: textAlign,
51
+ textBaseline: textBaseline,
52
+ fill: textColor,
53
+ stroke: textBackgroundColor,
54
+ lineWidth: 1,
55
+ fontSize: textFontSize,
56
+ fontWeight: textFontWeight,
57
+ dx,
58
+ dy
59
+ },
60
+ labelBackground: {
61
+ visible: textBackgroundVisible,
62
+ padding: textBackgroundPadding,
63
+ style: {
64
+ opacity: 0.95,
65
+ cornerRadius: textBackgroundBorderRadius ?? 4,
66
+ fill: textBackgroundColor,
67
+ stroke: textBackgroundBorderColor,
68
+ lineWidth: textBackgroundBorderWidth,
69
+ dx,
70
+ dy
71
+ }
72
+ }
73
+ }
74
+ }
75
+ };
76
+ return selectedData.reduce((res, datum)=>{
77
+ const marks = generateMarkPoint(datum, spec, context);
78
+ if (marks && marks.length) marks.forEach((mark)=>{
79
+ res.push({
80
+ ...markPointStyle,
81
+ ...mark
82
+ });
83
+ });
84
+ return res;
85
+ }, []);
86
+ });
87
+ return {
88
+ ...spec,
89
+ markPoint
90
+ };
91
+ };
92
+ };
93
+ export { generateAnnotationPointPipe };
94
+
95
+ //# sourceMappingURL=annotationPointCommon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationPointCommon.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/annotation/annotationPointCommon.ts"],"sourcesContent":["import type { ISpec, IMarkPointSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { Datum, Selector, Selectors, SpecPipelineContext, VChartSpecPipe, VSeed } from 'src/types'\nimport { isSubset } from './utils'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\nimport { isBarLikeChart } from 'src/pipeline/utils/chatType'\n\nexport const generateAnnotationPointPipe = (options: {\n findSelectedDatas?: (\n dataset: Datum[],\n selector: Selector | Selectors | undefined | null,\n spec: ISpec,\n context: SpecPipelineContext,\n ) => Datum[]\n generateMarkPoint?: (datum: Datum, spec: ISpec, context: SpecPipelineContext) => IMarkPointSpec[] | undefined\n}) => {\n const findSelectedDatas = options.findSelectedDatas ?? ((dataset, s) => dataset.filter((datum) => selector(datum, s)))\n const generateMarkPoint =\n options.generateMarkPoint ??\n ((datum: Datum) => {\n return [\n {\n coordinate: (data: Datum[]) => {\n return data.find((item) => isSubset(datum, item))\n },\n },\n ]\n })\n\n return ((spec: ISpec, context: SpecPipelineContext) => {\n const { advancedVSeed, vseed } = context\n const { annotation, config } = advancedVSeed\n\n if (!annotation || !annotation.annotationPoint) {\n return spec\n }\n\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationPoint\n const { annotationPoint } = annotation\n const annotationPointList = Array.isArray(annotationPoint) ? annotationPoint : [annotationPoint]\n const isHorizontalBar = isBarLikeChart(advancedVSeed as VSeed)\n const defaultStyle = isHorizontalBar\n ? {\n textAlign: 'right',\n textBaseline: 'middle',\n }\n : {\n textAlign: 'center',\n textBaseline: 'top',\n }\n\n const markPoint = annotationPointList.flatMap((annotationPoint) => {\n const {\n selector: selectorPoint,\n text = '',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n textAlign = defaultStyle.textAlign,\n textBaseline = defaultStyle.textBaseline,\n textBackgroundBorderColor = theme?.textBackgroundBorderColor,\n textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4,\n textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1,\n textBackgroundColor = theme?.textBackgroundColor ?? '#212121',\n textBackgroundPadding = theme?.textBackgroundPadding ?? 2,\n textBackgroundVisible = theme?.textBackgroundVisible ?? true,\n offsetX = theme?.offsetX ?? 0,\n offsetY = theme?.offsetY ?? 0,\n } = annotationPoint\n\n const dataset = advancedVSeed.dataset.flat()\n const selectedData = selectorPoint ? findSelectedDatas(dataset, selectorPoint, spec, context) : []\n const dx = -10 - (isHorizontalBar ? (textFontSize as number) : 0) // 由于vchart tag实现问题,需要设置这个强制偏移量\n const dy = isHorizontalBar ? 0 : (textFontSize as number)\n const markPointStyle = {\n zIndex: ANNOTATION_Z_INDEX,\n regionRelative: true,\n itemLine: {\n visible: false,\n },\n itemContent: {\n offsetY,\n offsetX,\n confine: true,\n text: {\n text: text,\n style: {\n opacity: 0.95,\n visible: true,\n textAlign: textAlign,\n textBaseline: textBaseline,\n fill: textColor,\n stroke: textBackgroundColor,\n lineWidth: 1,\n fontSize: textFontSize,\n fontWeight: textFontWeight,\n dx,\n dy,\n },\n labelBackground: {\n visible: textBackgroundVisible,\n padding: textBackgroundPadding,\n style: {\n opacity: 0.95,\n cornerRadius: textBackgroundBorderRadius ?? 4,\n fill: textBackgroundColor,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n dx,\n dy,\n },\n },\n },\n },\n } as Partial<IMarkPointSpec>\n\n return selectedData.reduce((res: IMarkPointSpec[], datum) => {\n const marks = generateMarkPoint(datum, spec, context)\n\n if (marks && marks.length) {\n marks.forEach((mark) => {\n res.push({\n ...markPointStyle,\n ...mark,\n } as IMarkPointSpec)\n })\n }\n\n return res\n }, [])\n }) as unknown as IMarkPointSpec[]\n\n return {\n ...spec,\n markPoint,\n } as ISpec\n }) as VChartSpecPipe\n}\n"],"names":["generateAnnotationPointPipe","options","findSelectedDatas","dataset","s","datum","selector","generateMarkPoint","data","item","isSubset","spec","context","advancedVSeed","vseed","annotation","config","theme","annotationPoint","annotationPointList","Array","isHorizontalBar","isBarLikeChart","defaultStyle","markPoint","selectorPoint","text","textColor","textFontSize","textFontWeight","textAlign","textBaseline","textBackgroundBorderColor","textBackgroundBorderRadius","textBackgroundBorderWidth","textBackgroundColor","textBackgroundPadding","textBackgroundVisible","offsetX","offsetY","selectedData","dx","dy","markPointStyle","ANNOTATION_Z_INDEX","res","marks","mark"],"mappings":";;;;AAOO,MAAMA,8BAA8B,CAACC;IAS1C,MAAMC,oBAAoBD,QAAQ,iBAAiB,IAAM,EAAAE,SAASC,IAAMD,QAAQ,MAAM,CAAC,CAACE,QAAUC,SAASD,OAAOD,GAAE;IACpH,MAAMG,oBACJN,QAAQ,iBAAiB,IACvB,EAAAI,QACO;YACL;gBACE,YAAY,CAACG,OACJA,KAAK,IAAI,CAAC,CAACC,OAASC,SAASL,OAAOI;YAE/C;SACD,AACH;IAEF,OAAQ,CAACE,MAAaC;QACpB,MAAM,EAAEC,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ClC,MAAMe,iBAAiB;gBACrB,QAAQC;gBACR,gBAAgB;gBAChB,UAAU;oBACR,SAAS;gBACX;gBACA,aAAa;oBACXL;oBACAD;oBACA,SAAS;oBACT,MAAM;wBACJ,MAAMZ;wBACN,OAAO;4BACL,SAAS;4BACT,SAAS;4BACT,WAAWI;4BACX,cAAcC;4BACd,MAAMJ;4BACN,QAAQQ;4BACR,WAAW;4BACX,UAAUP;4BACV,YAAYC;4BACZY;4BACAC;wBACF;wBACA,iBAAiB;4BACf,SAASL;4BACT,SAASD;4BACT,OAAO;gCACL,SAAS;gCACT,cAAcH,8BAA8B;gCAC5C,MAAME;gCACN,QAAQH;gCACR,WAAWE;gCACXO;gCACAC;4BACF;wBACF;oBACF;gBACF;YACF;YAEA,OAAOF,aAAa,MAAM,CAAC,CAACK,KAAuBxC;gBACjD,MAAMyC,QAAQvC,kBAAkBF,OAAOM,MAAMC;gBAE7C,IAAIkC,SAASA,MAAM,MAAM,EACvBA,MAAM,OAAO,CAAC,CAACC;oBACbF,IAAI,IAAI,CAAC;wBACP,GAAGF,cAAc;wBACjB,GAAGI,IAAI;oBACT;gBACF;gBAGF,OAAOF;YACT,GAAG,EAAE;QACP;QAEA,OAAO;YACL,GAAGlC,IAAI;YACPa;QACF;IACF;AACF"}
@@ -1,94 +1,26 @@
1
1
  import { selector } from "../../../../../dataSelector/index.js";
2
2
  import { isSubset } from "./utils.js";
3
- import { ANNOTATION_Z_INDEX } from "../../../../utils/constant.js";
4
- import { isBarLikeChart } from "../../../../utils/chatType.js";
5
3
  import { findAllMeasures } from "../../../../utils/index.js";
6
4
  import { MeasureId } from "../../../../../dataReshape/constant.js";
7
5
  import { pickWithout } from "@visactor/vutils";
8
- const annotationPointOfDualAxis = (spec, context)=>{
9
- const { advancedVSeed, vseed } = context;
10
- const { annotation, config } = advancedVSeed;
11
- if (!annotation || !annotation.annotationPoint) return spec;
12
- const theme = config?.[vseed.chartType]?.annotation?.annotationPoint;
13
- const { annotationPoint } = annotation;
14
- const annotationPointList = Array.isArray(annotationPoint) ? annotationPoint : [
15
- annotationPoint
16
- ];
17
- const isHorizontalBar = isBarLikeChart(advancedVSeed);
18
- const defaultStyle = isHorizontalBar ? {
19
- textAlign: 'right',
20
- textBaseline: 'middle'
21
- } : {
22
- textAlign: 'center',
23
- textBaseline: 'top'
24
- };
25
- const allMeasureIds = findAllMeasures(advancedVSeed.reshapeMeasures ?? advancedVSeed.measures).map((m)=>m.id);
26
- const markPoint = annotationPointList.flatMap((annotationPoint)=>{
27
- const { selector: selectorPoint, text = '', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = defaultStyle.textAlign, textBaseline = defaultStyle.textBaseline, textBackgroundBorderColor = theme?.textBackgroundBorderColor, textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundColor = theme?.textBackgroundColor ?? '#212121', textBackgroundPadding = theme?.textBackgroundPadding ?? 2, textBackgroundVisible = theme?.textBackgroundVisible ?? true, offsetX = theme?.offsetX ?? 0, offsetY = theme?.offsetY ?? 0 } = annotationPoint;
28
- const dataset = advancedVSeed.dataset.flat();
29
- const selectedData = selectorPoint ? dataset.reduce((res, d)=>{
6
+ import { generateAnnotationPointPipe } from "./annotationPointCommon.js";
7
+ const annotationPointOfDualAxis = generateAnnotationPointPipe({
8
+ findSelectedDatas: (dataset, s, spec, context)=>dataset.reduce((res, d)=>{
9
+ const { advancedVSeed } = context;
10
+ const allMeasureIds = findAllMeasures(advancedVSeed.reshapeMeasures ?? advancedVSeed.measures).map((m)=>m.id);
30
11
  const pickedDatum = pickWithout(d, allMeasureIds.filter((id)=>id !== d[MeasureId]));
31
- if (selector(pickedDatum, selectorPoint)) res.push(pickedDatum);
12
+ if (selector(pickedDatum, s)) res.push(pickedDatum);
32
13
  return res;
33
- }, []) : [];
34
- const dx = -10 - (isHorizontalBar ? textFontSize : 0);
35
- const dy = isHorizontalBar ? 0 : textFontSize;
36
- const baseConfig = {
37
- zIndex: ANNOTATION_Z_INDEX,
38
- itemLine: {
39
- visible: false
40
- },
41
- itemContent: {
42
- offsetY,
43
- offsetX,
44
- confine: true,
45
- text: {
46
- text: text,
47
- style: {
48
- opacity: 0.95,
49
- visible: true,
50
- textAlign: textAlign,
51
- textBaseline: textBaseline,
52
- fill: textColor,
53
- stroke: textBackgroundColor,
54
- lineWidth: 1,
55
- fontSize: textFontSize,
56
- fontWeight: textFontWeight,
57
- dx,
58
- dy
59
- },
60
- labelBackground: {
61
- visible: textBackgroundVisible,
62
- padding: textBackgroundPadding,
63
- style: {
64
- opacity: 0.95,
65
- cornerRadius: textBackgroundBorderRadius ?? 4,
66
- fill: textBackgroundColor,
67
- stroke: textBackgroundBorderColor,
68
- lineWidth: textBackgroundBorderWidth,
69
- dx,
70
- dy
71
- }
72
- }
73
- }
74
- }
75
- };
76
- return spec.series?.reduce((res, s, index)=>{
77
- selectedData.forEach((datum)=>{
78
- res.push({
79
- ...baseConfig,
80
- relativeSeriesIndex: index,
81
- coordinate: (data)=>data.find((item)=>isSubset(datum, item, allMeasureIds.filter((id)=>id !== item[MeasureId])))
82
- });
83
- });
84
- return res;
85
- }, []);
86
- });
87
- return {
88
- ...spec,
89
- markPoint
90
- };
91
- };
14
+ }, []),
15
+ generateMarkPoint: (datum, spec, context)=>{
16
+ const { advancedVSeed } = context;
17
+ const allMeasureIds = findAllMeasures(advancedVSeed.reshapeMeasures ?? advancedVSeed.measures).map((m)=>m.id);
18
+ return spec.series?.map((s, index)=>({
19
+ relativeSeriesIndex: index,
20
+ coordinate: (data)=>data.find((item)=>isSubset(datum, item, allMeasureIds.filter((id)=>id !== item[MeasureId])))
21
+ }));
22
+ }
23
+ });
92
24
  export { annotationPointOfDualAxis };
93
25
 
94
26
  //# sourceMappingURL=annotationPointOfDualAxis.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.ts"],"sourcesContent":["import type { ILineChartSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { Datum, VChartSpecPipe, VSeed } from 'src/types'\nimport { isSubset } from './utils'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\nimport { isBarLikeChart } from 'src/pipeline/utils/chatType'\nimport { findAllMeasures } from 'src/pipeline/utils'\nimport { MeasureId } from 'src/dataReshape/constant'\nimport { pickWithout } from '@visactor/vutils'\n\nexport const annotationPointOfDualAxis: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { annotation, config } = advancedVSeed\n\n if (!annotation || !annotation.annotationPoint) {\n return spec\n }\n\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationPoint\n const { annotationPoint } = annotation\n const annotationPointList = Array.isArray(annotationPoint) ? annotationPoint : [annotationPoint]\n const isHorizontalBar = isBarLikeChart(advancedVSeed as VSeed)\n const defaultStyle = isHorizontalBar\n ? {\n textAlign: 'right',\n textBaseline: 'middle',\n }\n : {\n textAlign: 'center',\n textBaseline: 'top',\n }\n const allMeasureIds = findAllMeasures(advancedVSeed.reshapeMeasures ?? advancedVSeed.measures).map((m) => m.id)\n\n const markPoint = annotationPointList.flatMap((annotationPoint) => {\n const {\n selector: selectorPoint,\n text = '',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n textAlign = defaultStyle.textAlign,\n textBaseline = defaultStyle.textBaseline,\n textBackgroundBorderColor = theme?.textBackgroundBorderColor,\n textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4,\n textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1,\n textBackgroundColor = theme?.textBackgroundColor ?? '#212121',\n textBackgroundPadding = theme?.textBackgroundPadding ?? 2,\n textBackgroundVisible = theme?.textBackgroundVisible ?? true,\n offsetX = theme?.offsetX ?? 0,\n offsetY = theme?.offsetY ?? 0,\n } = annotationPoint\n\n const dataset = advancedVSeed.dataset.flat()\n const selectedData = selectorPoint\n ? dataset.reduce((res: Datum[], d: Datum) => {\n const pickedDatum = pickWithout(\n d,\n allMeasureIds.filter((id) => id !== d[MeasureId]),\n )\n\n if (selector(pickedDatum, selectorPoint)) {\n res.push(pickedDatum)\n }\n\n return res\n }, [])\n : []\n\n const dx = -10 - (isHorizontalBar ? (textFontSize as number) : 0) // 由于vchart tag实现问题,需要设置这个强制偏移量\n const dy = isHorizontalBar ? 0 : (textFontSize as number)\n const baseConfig = {\n zIndex: ANNOTATION_Z_INDEX,\n itemLine: {\n visible: false,\n },\n itemContent: {\n offsetY,\n offsetX,\n confine: true,\n text: {\n text: text,\n style: {\n opacity: 0.95,\n visible: true,\n textAlign: textAlign,\n textBaseline: textBaseline,\n fill: textColor,\n stroke: textBackgroundColor,\n lineWidth: 1,\n fontSize: textFontSize,\n fontWeight: textFontWeight,\n dx,\n dy,\n },\n labelBackground: {\n visible: textBackgroundVisible,\n padding: textBackgroundPadding,\n style: {\n opacity: 0.95,\n cornerRadius: textBackgroundBorderRadius ?? 4,\n fill: textBackgroundColor,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n dx,\n dy,\n },\n },\n },\n },\n }\n\n return spec.series?.reduce((res: any[], s: any, index: number) => {\n selectedData.forEach((datum: Datum) => {\n res.push({\n ...baseConfig,\n relativeSeriesIndex: index,\n coordinate: (data: Datum[]) => {\n return data.find((item) => {\n return isSubset(\n datum,\n item,\n allMeasureIds.filter((id) => id !== item[MeasureId]),\n )\n })\n },\n })\n })\n\n return res\n }, [] as any[])\n }) as ILineChartSpec['markPoint']\n\n return {\n ...spec,\n markPoint,\n }\n}\n"],"names":["annotationPointOfDualAxis","spec","context","advancedVSeed","vseed","annotation","config","theme","annotationPoint","annotationPointList","Array","isHorizontalBar","isBarLikeChart","defaultStyle","allMeasureIds","findAllMeasures","m","markPoint","selectorPoint","text","textColor","textFontSize","textFontWeight","textAlign","textBaseline","textBackgroundBorderColor","textBackgroundBorderRadius","textBackgroundBorderWidth","textBackgroundColor","textBackgroundPadding","textBackgroundVisible","offsetX","offsetY","dataset","selectedData","res","d","pickedDatum","pickWithout","id","MeasureId","selector","dx","dy","baseConfig","ANNOTATION_Z_INDEX","s","index","datum","data","item","isSubset"],"mappings":";;;;;;;AAUO,MAAMA,4BAA4C,CAACC,MAAMC;IAC9D,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IACjC,MAAM,EAAEG,UAAU,EAAEC,MAAM,EAAE,GAAGH;IAE/B,IAAI,CAACE,cAAc,CAACA,WAAW,eAAe,EAC5C,OAAOJ;IAGT,MAAMM,QAAQD,QAAQ,CAACF,MAAM,SAAS,CAAa,EAAE,YAAY;IACjE,MAAM,EAAEI,eAAe,EAAE,GAAGH;IAC5B,MAAMI,sBAAsBC,MAAM,OAAO,CAACF,mBAAmBA,kBAAkB;QAACA;KAAgB;IAChG,MAAMG,kBAAkBC,eAAeT;IACvC,MAAMU,eAAeF,kBACjB;QACE,WAAW;QACX,cAAc;IAChB,IACA;QACE,WAAW;QACX,cAAc;IAChB;IACJ,MAAMG,gBAAgBC,gBAAgBZ,cAAc,eAAe,IAAIA,cAAc,QAAQ,EAAE,GAAG,CAAC,CAACa,IAAMA,EAAE,EAAE;IAE9G,MAAMC,YAAYR,oBAAoB,OAAO,CAAC,CAACD;QAC7C,MAAM,EACJ,UAAUU,aAAa,EACvBC,OAAO,EAAE,EACTC,YAAYb,OAAO,aAAa,SAAS,EACzCc,eAAed,OAAO,gBAAgB,EAAE,EACxCe,iBAAiBf,OAAO,kBAAkB,GAAG,EAC7CgB,YAAYV,aAAa,SAAS,EAClCW,eAAeX,aAAa,YAAY,EACxCY,4BAA4BlB,OAAO,yBAAyB,EAC5DmB,6BAA6BnB,OAAO,8BAA8B,CAAC,EACnEoB,4BAA4BpB,OAA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CAACE,OACJA,KAAK,IAAI,CAAC,CAACC,OACTC,SACLH,OACAE,MACApC,cAAc,MAAM,CAAC,CAACyB,KAAOA,OAAOW,IAAI,CAACV,UAAU;gBAI3D;YACF;YAEA,OAAOL;QACT,GAAG,EAAE;IACP;IAEA,OAAO;QACL,GAAGlC,IAAI;QACPgB;IACF;AACF"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.ts"],"sourcesContent":["import type { IMarkPointSpec, ISpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { Datum, SpecPipelineContext, VChartSpecPipe } from 'src/types'\nimport { isSubset } from './utils'\nimport { findAllMeasures } from 'src/pipeline/utils'\nimport { MeasureId } from 'src/dataReshape/constant'\nimport { pickWithout } from '@visactor/vutils'\nimport { generateAnnotationPointPipe } from './annotationPointCommon'\n\nexport const annotationPointOfDualAxis: VChartSpecPipe = generateAnnotationPointPipe({\n findSelectedDatas: (dataset, s, spec: ISpec, context: SpecPipelineContext) => {\n return dataset.reduce((res: Datum[], d: Datum) => {\n const { advancedVSeed } = context\n const allMeasureIds = findAllMeasures(advancedVSeed.reshapeMeasures ?? advancedVSeed.measures).map((m) => m.id)\n const pickedDatum = pickWithout(\n d,\n allMeasureIds.filter((id) => id !== d[MeasureId]),\n )\n\n if (selector(pickedDatum, s)) {\n res.push(pickedDatum)\n }\n\n return res\n }, [])\n },\n generateMarkPoint: (datum: Datum, spec: ISpec, context: SpecPipelineContext) => {\n const { advancedVSeed } = context\n const allMeasureIds = findAllMeasures(advancedVSeed.reshapeMeasures ?? advancedVSeed.measures).map((m) => m.id)\n return spec.series?.map((s: any, index: number) => {\n return {\n relativeSeriesIndex: index,\n coordinate: (data: Datum[]) => {\n return data.find((item) => {\n return isSubset(\n datum,\n item,\n allMeasureIds.filter((id) => id !== item[MeasureId]),\n )\n })\n },\n } as IMarkPointSpec\n })\n },\n})\n"],"names":["annotationPointOfDualAxis","generateAnnotationPointPipe","dataset","s","spec","context","res","d","advancedVSeed","allMeasureIds","findAllMeasures","m","pickedDatum","pickWithout","id","MeasureId","selector","datum","index","data","item","isSubset"],"mappings":";;;;;;AASO,MAAMA,4BAA4CC,4BAA4B;IACnF,mBAAmB,CAACC,SAASC,GAAGC,MAAaC,UACpCH,QAAQ,MAAM,CAAC,CAACI,KAAcC;YACnC,MAAM,EAAEC,aAAa,EAAE,GAAGH;YAC1B,MAAMI,gBAAgBC,gBAAgBF,cAAc,eAAe,IAAIA,cAAc,QAAQ,EAAE,GAAG,CAAC,CAACG,IAAMA,EAAE,EAAE;YAC9G,MAAMC,cAAcC,YAClBN,GACAE,cAAc,MAAM,CAAC,CAACK,KAAOA,OAAOP,CAAC,CAACQ,UAAU;YAGlD,IAAIC,SAASJ,aAAaT,IACxBG,IAAI,IAAI,CAACM;YAGX,OAAON;QACT,GAAG,EAAE;IAEP,mBAAmB,CAACW,OAAcb,MAAaC;QAC7C,MAAM,EAAEG,aAAa,EAAE,GAAGH;QAC1B,MAAMI,gBAAgBC,gBAAgBF,cAAc,eAAe,IAAIA,cAAc,QAAQ,EAAE,GAAG,CAAC,CAACG,IAAMA,EAAE,EAAE;QAC9G,OAAOP,KAAK,MAAM,EAAE,IAAI,CAACD,GAAQe,QACxB;gBACL,qBAAqBA;gBACrB,YAAY,CAACC,OACJA,KAAK,IAAI,CAAC,CAACC,OACTC,SACLJ,OACAG,MACAX,cAAc,MAAM,CAAC,CAACK,KAAOA,OAAOM,IAAI,CAACL,UAAU;YAI3D;IAEJ;AACF"}
@@ -0,0 +1,2 @@
1
+ import type { VChartSpecPipe } from '../../../../../types';
2
+ export declare const annotationPointOfHistogram: VChartSpecPipe;
@@ -0,0 +1,23 @@
1
+ import { isSubset } from "./utils.js";
2
+ import { generateAnnotationPointPipe } from "./annotationPointCommon.js";
3
+ const annotationPointOfHistogram = generateAnnotationPointPipe({
4
+ generateMarkPoint: (datum, spec)=>{
5
+ const histogramSpec = spec;
6
+ const xField = histogramSpec.xField;
7
+ const x2Field = histogramSpec.x2Field;
8
+ return [
9
+ {
10
+ coordinate: (data)=>{
11
+ const d = data.find((item)=>isSubset(datum, item));
12
+ return d ? {
13
+ ...d,
14
+ [xField]: (d[xField] + d[x2Field]) / 2
15
+ } : void 0;
16
+ }
17
+ }
18
+ ];
19
+ }
20
+ });
21
+ export { annotationPointOfHistogram };
22
+
23
+ //# sourceMappingURL=annotationPointOfHistogram.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationPointOfHistogram.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/annotation/annotationPointOfHistogram.ts"],"sourcesContent":["import type { IHistogramChartSpec, IMarkPointSpec } from '@visactor/vchart'\nimport type { Datum, VChartSpecPipe } from 'src/types'\nimport { isSubset } from './utils'\nimport { generateAnnotationPointPipe } from './annotationPointCommon'\n\nexport const annotationPointOfHistogram: VChartSpecPipe = generateAnnotationPointPipe({\n generateMarkPoint: (datum: Datum, spec) => {\n const histogramSpec = spec as IHistogramChartSpec\n const xField = histogramSpec.xField as string\n const x2Field = histogramSpec.x2Field as string\n\n return [\n {\n coordinate: (data: Datum[]) => {\n const d = data.find((item) => isSubset(datum, item))\n\n return d\n ? {\n ...d,\n [xField]: (d[xField] + d[x2Field]) / 2,\n }\n : undefined\n },\n } as IMarkPointSpec,\n ]\n },\n})\n"],"names":["annotationPointOfHistogram","generateAnnotationPointPipe","datum","spec","histogramSpec","xField","x2Field","data","d","item","isSubset","undefined"],"mappings":";;AAKO,MAAMA,6BAA6CC,4BAA4B;IACpF,mBAAmB,CAACC,OAAcC;QAChC,MAAMC,gBAAgBD;QACtB,MAAME,SAASD,cAAc,MAAM;QACnC,MAAME,UAAUF,cAAc,OAAO;QAErC,OAAO;YACL;gBACE,YAAY,CAACG;oBACX,MAAMC,IAAID,KAAK,IAAI,CAAC,CAACE,OAASC,SAASR,OAAOO;oBAE9C,OAAOD,IACH;wBACE,GAAGA,CAAC;wBACJ,CAACH,OAAO,EAAGG,AAAAA,CAAAA,CAAC,CAACH,OAAO,GAAGG,CAAC,CAACF,QAAO,IAAK;oBACvC,IACAK;gBACN;YACF;SACD;IACH;AACF"}
@@ -1,10 +1,8 @@
1
- import { selector } from "../../../../../dataSelector/index.js";
2
1
  import { isArray, isNumber, isString } from "remeda";
3
2
  import { ANNOTATION_Z_INDEX } from "../../../../utils/constant.js";
4
3
  const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
5
4
  const { advancedVSeed, vseed } = context;
6
- const { annotation, datasetReshapeInfo, config } = advancedVSeed;
7
- const { unfoldInfo, foldInfo } = datasetReshapeInfo[0];
5
+ const { annotation, config } = advancedVSeed;
8
6
  if (!annotation || !annotation.annotationVerticalLine) return spec;
9
7
  const theme = config?.[vseed.chartType]?.annotation?.annotationVerticalLine;
10
8
  const { annotationVerticalLine } = annotation;
@@ -20,8 +18,7 @@ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
20
18
  insideEnd: 'insideEndTop'
21
19
  };
22
20
  const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
23
- const { selector: selectorPoint, xValue, text = '', textPosition = 'insideEnd', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = 'center', textBaseline = 'top', lineColor = theme?.lineColor ?? '#212121', lineStyle = theme?.lineStyle ?? 'dashed', lineVisible = theme?.lineStyle ?? true, lineWidth = theme?.lineWidth ?? 1, textBackgroundVisible = theme?.textBackgroundVisible ?? true, textBackgroundColor = theme?.textBackgroundColor ?? '#212121', textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#212121', textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundPadding = theme?.textBackgroundPadding ?? 2 } = annotationVerticalLine;
24
- const dataset = advancedVSeed.dataset.flat();
21
+ const { xValue, text = '', textPosition = 'insideEnd', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = 'center', textBaseline = 'top', lineColor = theme?.lineColor ?? '#212121', lineStyle = theme?.lineStyle ?? 'dashed', lineVisible = theme?.lineStyle ?? true, lineWidth = theme?.lineWidth ?? 1, textBackgroundVisible = theme?.textBackgroundVisible ?? true, textBackgroundColor = theme?.textBackgroundColor ?? '#212121', textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#212121', textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundPadding = theme?.textBackgroundPadding ?? 2 } = annotationVerticalLine;
25
22
  const generateOneMarkLine = (x)=>({
26
23
  x,
27
24
  autoRange: true,
@@ -92,18 +89,13 @@ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
92
89
  }
93
90
  }
94
91
  });
95
- if (!selectorPoint && isArray(xValue) || isString(xValue) || isNumber(xValue)) {
92
+ if (isArray(xValue) || isString(xValue) || isNumber(xValue)) {
96
93
  const xValueArr = Array.isArray(xValue) ? xValue : [
97
94
  xValue
98
95
  ];
99
96
  return xValueArr.map(generateOneMarkLine);
100
97
  }
101
- const selectedData = selectorPoint ? dataset.filter((datum)=>selector(datum, selectorPoint)) : [];
102
- return selectedData.map((datum)=>{
103
- if (datum[unfoldInfo.encodingX]) return generateOneMarkLine(datum[unfoldInfo.encodingX]);
104
- if (datum[foldInfo.measureValue]) return generateOneMarkLine(datum[foldInfo.measureValue]);
105
- return {};
106
- });
98
+ return [];
107
99
  });
108
100
  const specMarkLine = spec.markLine || [];
109
101
  const newMarkLine = [
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.ts"],"sourcesContent":["import type { ILineChartSpec, IMarkLineSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { VChartSpecPipe } from 'src/types'\nimport { isArray, isNumber, isString } from 'remeda'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\n\nexport const annotationVerticalLine: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { annotation, datasetReshapeInfo, config } = advancedVSeed\n\n const { unfoldInfo, foldInfo } = datasetReshapeInfo[0]\n\n if (!annotation || !annotation.annotationVerticalLine) {\n return spec\n }\n\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationVerticalLine\n const { annotationVerticalLine } = annotation\n const annotationVerticalLineList = Array.isArray(annotationVerticalLine)\n ? annotationVerticalLine\n : [annotationVerticalLine]\n\n const positionMap = {\n outsideStart: 'start',\n outsideEnd: 'end',\n outsideMiddle: 'middle',\n insideStart: 'insideStartTop',\n insideMiddle: 'insideMiddleTop',\n insideEnd: 'insideEndTop',\n }\n const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine) => {\n const {\n selector: selectorPoint,\n xValue,\n text = '',\n textPosition = 'insideEnd',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n textAlign = 'center',\n textBaseline = 'top',\n\n lineColor = theme?.lineColor ?? '#212121',\n lineStyle = theme?.lineStyle ?? 'dashed',\n lineVisible = theme?.lineStyle ?? true,\n lineWidth = theme?.lineWidth ?? 1,\n\n textBackgroundVisible = theme?.textBackgroundVisible ?? true,\n textBackgroundColor = theme?.textBackgroundColor ?? '#212121',\n textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#212121',\n textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4,\n textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1,\n textBackgroundPadding = theme?.textBackgroundPadding ?? 2,\n } = annotationVerticalLine\n\n const dataset = advancedVSeed.dataset.flat()\n\n const generateOneMarkLine = (x: number | string) => ({\n x,\n autoRange: true,\n zIndex: ANNOTATION_Z_INDEX,\n line: {\n style: {\n visible: lineVisible,\n stroke: lineColor,\n lineStyle: lineStyle,\n lineWidth: lineWidth,\n lineDash: lineStyle === 'dashed' ? [5, 2] : lineStyle === 'dotted' ? [2, 5] : [0],\n },\n },\n label: {\n confine: true,\n text: text,\n position: (positionMap as any)[textPosition || 'insideEnd'],\n style: {\n opacity: 0.95,\n dx: 5,\n visible: true,\n stroke: textBackgroundColor,\n lineWidth: 1,\n textAlign: textAlign,\n textBaseline: textBaseline,\n fill: textColor,\n fontSize: textFontSize,\n fontWeight: textFontWeight,\n },\n labelBackground: {\n visible: textBackgroundVisible,\n padding: textBackgroundPadding,\n style: {\n opacity: 0.95,\n dx: 5,\n cornerRadius: textBackgroundBorderRadius,\n fill: textBackgroundColor,\n fillOpacity: 1,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n },\n },\n },\n startSymbol: {\n visible: theme?.startSymbolVisible ?? true,\n symbolType: theme?.startSymbolType ?? 'triangleDown',\n size: 5 + (lineWidth || 1),\n style: {\n dy: -3,\n fill: lineColor,\n },\n },\n endSymbol: {\n visible: theme?.endSymbolVisible ?? false,\n symbolType: theme?.endSymbolType ?? 'arrow',\n size: 10 + (lineWidth || 1),\n style: {\n dy: 4,\n fill: lineColor,\n },\n },\n })\n\n if ((!selectorPoint && isArray(xValue)) || isString(xValue) || isNumber(xValue)) {\n const xValueArr = Array.isArray(xValue) ? xValue : [xValue]\n return xValueArr.map(generateOneMarkLine)\n }\n\n const selectedData = selectorPoint ? dataset.filter((datum) => selector(datum, selectorPoint)) : []\n\n return selectedData.map((datum) => {\n if (datum[unfoldInfo.encodingX]) {\n return generateOneMarkLine(datum[unfoldInfo.encodingX] as string)\n }\n if (datum[foldInfo.measureValue]) {\n return generateOneMarkLine(datum[foldInfo.measureValue] as string)\n }\n return {}\n })\n }) as IMarkLineSpec[]\n\n const specMarkLine = ((spec as ILineChartSpec).markLine as IMarkLineSpec[]) || []\n const newMarkLine = [...specMarkLine, ...(markLine || [])]\n\n return {\n ...spec,\n markLine: newMarkLine,\n }\n}\n"],"names":["annotationVerticalLine","spec","context","advancedVSeed","vseed","annotation","datasetReshapeInfo","config","unfoldInfo","foldInfo","theme","annotationVerticalLineList","Array","positionMap","markLine","selectorPoint","xValue","text","textPosition","textColor","textFontSize","textFontWeight","textAlign","textBaseline","lineColor","lineStyle","lineVisible","lineWidth","textBackgroundVisible","textBackgroundColor","textBackgroundBorderColor","textBackgroundBorderRadius","textBackgroundBorderWidth","textBackgroundPadding","dataset","generateOneMarkLine","x","ANNOTATION_Z_INDEX","isArray","isString","isNumber","xValueArr","selectedData","datum","selector","specMarkLine","newMarkLine"],"mappings":";;;AAMO,MAAMA,gDAAyC,CAACC,MAAMC;IAC3D,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IACjC,MAAM,EAAEG,UAAU,EAAEC,kBAAkB,EAAEC,MAAM,EAAE,GAAGJ;IAEnD,MAAM,EAAEK,UAAU,EAAEC,QAAQ,EAAE,GAAGH,kBAAkB,CAAC,EAAE;IAEtD,IAAI,CAACD,cAAc,CAACA,WAAW,sBAAsB,EACnD,OAAOJ;IAGT,MAAMS,QAAQH,QAAQ,CAACH,MAAM,SAAS,CAAa,EAAE,YAAY;IACjE,MAAM,EAAEJ,sBAAsB,EAAE,GAAGK;IACnC,MAAMM,6BAA6BC,MAAM,OAAO,CAACZ,0BAC7CA,yBACA;QAACA;KAAuB;IAE5B,MAAMa,cAAc;QAClB,cAAc;QACd,YAAY;QACZ,eAAe;QACf,aAAa;QACb,cAAc;QACd,WAAW;IACb;IACA,MAAMC,WAAWH,2BAA2B,OAAO,CAAC,CAACX;QACnD,MAAM,EACJ,UAAUe,aAAa,EACvBC,MAAM,EACNC,OAAO,EAAE,EACTC,eAAe,WAAW,EAC1BC,YAAYT,OAAO,aAAa,SAAS,EACzCU,eAAeV,OAAO,gBAAgB,EAAE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B;oBACtC,YAAYA,OAAO,mBAAmB;oBACtC,MAAM,IAAKiB,CAAAA,aAAa;oBACxB,OAAO;wBACL,IAAI;wBACJ,MAAMH;oBACR;gBACF;gBACA,WAAW;oBACT,SAASd,OAAO,oBAAoB;oBACpC,YAAYA,OAAO,iBAAiB;oBACpC,MAAM,KAAMiB,CAAAA,aAAa;oBACzB,OAAO;wBACL,IAAI;wBACJ,MAAMH;oBACR;gBACF;YACF;QAEA,IAAK,CAACT,iBAAiBuB,QAAQtB,WAAYuB,SAASvB,WAAWwB,SAASxB,SAAS;YAC/E,MAAMyB,YAAY7B,MAAM,OAAO,CAACI,UAAUA,SAAS;gBAACA;aAAO;YAC3D,OAAOyB,UAAU,GAAG,CAACN;QACvB;QAEA,MAAMO,eAAe3B,gBAAgBmB,QAAQ,MAAM,CAAC,CAACS,QAAUC,SAASD,OAAO5B,kBAAkB,EAAE;QAEnG,OAAO2B,aAAa,GAAG,CAAC,CAACC;YACvB,IAAIA,KAAK,CAACnC,WAAW,SAAS,CAAC,EAC7B,OAAO2B,oBAAoBQ,KAAK,CAACnC,WAAW,SAAS,CAAC;YAExD,IAAImC,KAAK,CAAClC,SAAS,YAAY,CAAC,EAC9B,OAAO0B,oBAAoBQ,KAAK,CAAClC,SAAS,YAAY,CAAC;YAEzD,OAAO,CAAC;QACV;IACF;IAEA,MAAMoC,eAAiB5C,KAAwB,QAAQ,IAAwB,EAAE;IACjF,MAAM6C,cAAc;WAAID;WAAkB/B,YAAY,EAAE;KAAE;IAE1D,OAAO;QACL,GAAGb,IAAI;QACP,UAAU6C;IACZ;AACF"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.ts"],"sourcesContent":["import type { ILineChartSpec, IMarkLineSpec } from '@visactor/vchart'\nimport type { VChartSpecPipe } from 'src/types'\nimport { isArray, isNumber, isString } from 'remeda'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\n\nexport const annotationVerticalLine: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { annotation, config } = advancedVSeed\n\n if (!annotation || !annotation.annotationVerticalLine) {\n return spec\n }\n\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationVerticalLine\n const { annotationVerticalLine } = annotation\n const annotationVerticalLineList = Array.isArray(annotationVerticalLine)\n ? annotationVerticalLine\n : [annotationVerticalLine]\n\n const positionMap = {\n outsideStart: 'start',\n outsideEnd: 'end',\n outsideMiddle: 'middle',\n insideStart: 'insideStartTop',\n insideMiddle: 'insideMiddleTop',\n insideEnd: 'insideEndTop',\n }\n const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine) => {\n const {\n xValue,\n text = '',\n textPosition = 'insideEnd',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n textAlign = 'center',\n textBaseline = 'top',\n\n lineColor = theme?.lineColor ?? '#212121',\n lineStyle = theme?.lineStyle ?? 'dashed',\n lineVisible = theme?.lineStyle ?? true,\n lineWidth = theme?.lineWidth ?? 1,\n\n textBackgroundVisible = theme?.textBackgroundVisible ?? true,\n textBackgroundColor = theme?.textBackgroundColor ?? '#212121',\n textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#212121',\n textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4,\n textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1,\n textBackgroundPadding = theme?.textBackgroundPadding ?? 2,\n } = annotationVerticalLine\n\n const generateOneMarkLine = (x: number | string) => ({\n x,\n autoRange: true,\n zIndex: ANNOTATION_Z_INDEX,\n line: {\n style: {\n visible: lineVisible,\n stroke: lineColor,\n lineStyle: lineStyle,\n lineWidth: lineWidth,\n lineDash: lineStyle === 'dashed' ? [5, 2] : lineStyle === 'dotted' ? [2, 5] : [0],\n },\n },\n label: {\n confine: true,\n text: text,\n position: (positionMap as any)[textPosition || 'insideEnd'],\n style: {\n opacity: 0.95,\n dx: 5,\n visible: true,\n stroke: textBackgroundColor,\n lineWidth: 1,\n textAlign: textAlign,\n textBaseline: textBaseline,\n fill: textColor,\n fontSize: textFontSize,\n fontWeight: textFontWeight,\n },\n labelBackground: {\n visible: textBackgroundVisible,\n padding: textBackgroundPadding,\n style: {\n opacity: 0.95,\n dx: 5,\n cornerRadius: textBackgroundBorderRadius,\n fill: textBackgroundColor,\n fillOpacity: 1,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n },\n },\n },\n startSymbol: {\n visible: theme?.startSymbolVisible ?? true,\n symbolType: theme?.startSymbolType ?? 'triangleDown',\n size: 5 + (lineWidth || 1),\n style: {\n dy: -3,\n fill: lineColor,\n },\n },\n endSymbol: {\n visible: theme?.endSymbolVisible ?? false,\n symbolType: theme?.endSymbolType ?? 'arrow',\n size: 10 + (lineWidth || 1),\n style: {\n dy: 4,\n fill: lineColor,\n },\n },\n })\n\n if (isArray(xValue) || isString(xValue) || isNumber(xValue)) {\n const xValueArr = Array.isArray(xValue) ? xValue : [xValue]\n return xValueArr.map(generateOneMarkLine)\n }\n\n return []\n }) as IMarkLineSpec[]\n\n const specMarkLine = ((spec as ILineChartSpec).markLine as IMarkLineSpec[]) || []\n const newMarkLine = [...specMarkLine, ...(markLine || [])]\n\n return {\n ...spec,\n markLine: newMarkLine,\n }\n}\n"],"names":["annotationVerticalLine","spec","context","advancedVSeed","vseed","annotation","config","theme","annotationVerticalLineList","Array","positionMap","markLine","xValue","text","textPosition","textColor","textFontSize","textFontWeight","textAlign","textBaseline","lineColor","lineStyle","lineVisible","lineWidth","textBackgroundVisible","textBackgroundColor","textBackgroundBorderColor","textBackgroundBorderRadius","textBackgroundBorderWidth","textBackgroundPadding","generateOneMarkLine","x","ANNOTATION_Z_INDEX","isArray","isString","isNumber","xValueArr","specMarkLine","newMarkLine"],"mappings":";;AAKO,MAAMA,gDAAyC,CAACC,MAAMC;IAC3D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AAAc,aAAdA,YAAyB;4BAAC;4BAAG;yBAAE,GAAGA,AAAc,aAAdA,YAAyB;4BAAC;4BAAG;yBAAE,GAAG;4BAAC;yBAAE;oBACnF;gBACF;gBACA,OAAO;oBACL,SAAS;oBACT,MAAMR;oBACN,UAAWH,WAAmB,CAACI,gBAAgB,YAAY;oBAC3D,OAAO;wBACL,SAAS;wBACT,IAAI;wBACJ,SAAS;wBACT,QAAQW;wBACR,WAAW;wBACX,WAAWP;wBACX,cAAcC;wBACd,MAAMJ;wBACN,UAAUC;wBACV,YAAYC;oBACd;oBACA,iBAAiB;wBACf,SAASO;wBACT,SAASK;wBACT,OAAO;4BACL,SAAS;4BACT,IAAI;4BACJ,cAAcF;4BACd,MAAMF;4BACN,aAAa;4BACb,QAAQC;4BACR,WAAWE;wBACb;oBACF;gBACF;gBACA,aAAa;oBACX,SAASrB,OAAO,sBAAsB;oBACtC,YAAYA,OAAO,mBAAmB;oBACtC,MAAM,IAAKgB,CAAAA,aAAa;oBACxB,OAAO;wBACL,IAAI;wBACJ,MAAMH;oBACR;gBACF;gBACA,WAAW;oBACT,SAASb,OAAO,oBAAoB;oBACpC,YAAYA,OAAO,iBAAiB;oBACpC,MAAM,KAAMgB,CAAAA,aAAa;oBACzB,OAAO;wBACL,IAAI;wBACJ,MAAMH;oBACR;gBACF;YACF;QAEA,IAAIa,QAAQrB,WAAWsB,SAAStB,WAAWuB,SAASvB,SAAS;YAC3D,MAAMwB,YAAY3B,MAAM,OAAO,CAACG,UAAUA,SAAS;gBAACA;aAAO;YAC3D,OAAOwB,UAAU,GAAG,CAACN;QACvB;QAEA,OAAO,EAAE;IACX;IAEA,MAAMO,eAAiBpC,KAAwB,QAAQ,IAAwB,EAAE;IACjF,MAAMqC,cAAc;WAAID;WAAkB1B,YAAY,EAAE;KAAE;IAE1D,OAAO;QACL,GAAGV,IAAI;QACP,UAAUqC;IACZ;AACF"}
@@ -5,3 +5,4 @@ export { annotationHorizontalLine } from './annotationHorizontalLine';
5
5
  export { annotationArea } from './annotationArea';
6
6
  export { annotationAreaBand } from './annotationAreaBand';
7
7
  export { splitLine } from './splitLine';
8
+ export { annotationPointOfHistogram } from './annotationPointOfHistogram';
@@ -5,4 +5,5 @@ import { annotationHorizontalLine } from "./annotationHorizontalLine.js";
5
5
  import { annotationArea } from "./annotationArea.js";
6
6
  import { annotationAreaBand } from "./annotationAreaBand.js";
7
7
  import { splitLine } from "./splitLine.js";
8
- export { annotationArea, annotationAreaBand, annotationHorizontalLine, annotationPoint, annotationPointOfDualAxis, annotationVerticalLine, splitLine };
8
+ import { annotationPointOfHistogram } from "./annotationPointOfHistogram.js";
9
+ export { annotationArea, annotationAreaBand, annotationHorizontalLine, annotationPoint, annotationPointOfDualAxis, annotationPointOfHistogram, annotationVerticalLine, splitLine };
@@ -0,0 +1,3 @@
1
+ import type { ICartesianBandAxisSpec } from '@visactor/vchart';
2
+ import type { XBandAxis } from '../../../../../types';
3
+ export declare const bandAxisStyle: (config: XBandAxis) => Partial<ICartesianBandAxisSpec>;
@@ -0,0 +1,65 @@
1
+ import { AXIS_LABEL_SPACE } from "../../../../utils/index.js";
2
+ const bandAxisStyle = (config)=>{
3
+ const { visible = true, label, tick, title, grid, line, labelAutoHide, labelAutoHideGap, labelAutoLimit, labelAutoLimitLength = 80, labelAutoRotate, labelAutoRotateAngleRange } = config;
4
+ return {
5
+ type: 'band',
6
+ sampling: !(labelAutoHide || labelAutoRotate || labelAutoLimit),
7
+ visible,
8
+ hover: true,
9
+ label: {
10
+ visible: label?.visible,
11
+ flush: true,
12
+ space: AXIS_LABEL_SPACE,
13
+ style: {
14
+ maxLineWidth: labelAutoLimitLength,
15
+ fill: label?.labelColor,
16
+ angle: label?.labelAngle,
17
+ fontSize: label?.labelFontSize,
18
+ fontWeight: label?.labelFontWeight
19
+ },
20
+ minGap: labelAutoHideGap,
21
+ autoHide: labelAutoHide,
22
+ autoHideMethod: 'greedy',
23
+ autoHideSeparation: labelAutoHideGap,
24
+ autoLimit: labelAutoLimit,
25
+ autoRotate: labelAutoRotate,
26
+ autoRotateAngle: labelAutoRotateAngleRange,
27
+ lastVisible: true
28
+ },
29
+ title: {
30
+ visible: title?.visible,
31
+ text: title?.titleText,
32
+ style: {
33
+ fill: title?.titleColor,
34
+ fontSize: title?.titleFontSize,
35
+ fontWeight: title?.titleFontWeight
36
+ }
37
+ },
38
+ tick: {
39
+ visible: tick?.visible,
40
+ tickSize: tick?.tickSize,
41
+ inside: tick?.tickInside,
42
+ style: {
43
+ stroke: tick?.tickColor
44
+ }
45
+ },
46
+ grid: {
47
+ visible: grid?.visible,
48
+ style: {
49
+ lineWidth: grid?.gridWidth,
50
+ stroke: grid?.gridColor,
51
+ lineDash: grid?.gridLineDash
52
+ }
53
+ },
54
+ domainLine: {
55
+ visible: line?.visible,
56
+ style: {
57
+ lineWidth: line?.lineWidth,
58
+ stroke: line?.lineColor
59
+ }
60
+ }
61
+ };
62
+ };
63
+ export { bandAxisStyle };
64
+
65
+ //# sourceMappingURL=axisStyle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/axes/axisStyle.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/axes/axisStyle.ts"],"sourcesContent":["import type { ICartesianBandAxisSpec } from '@visactor/vchart'\nimport type { XBandAxis } from 'src/types'\nimport { AXIS_LABEL_SPACE } from 'src/pipeline/utils'\n\nexport const bandAxisStyle = (config: XBandAxis) => {\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n labelAutoHide,\n labelAutoHideGap,\n labelAutoLimit,\n labelAutoLimitLength = 80,\n labelAutoRotate,\n labelAutoRotateAngleRange,\n } = config\n\n return {\n type: 'band',\n sampling: !(labelAutoHide || labelAutoRotate || labelAutoLimit),\n visible,\n hover: true,\n label: {\n visible: label?.visible,\n flush: true,\n space: AXIS_LABEL_SPACE,\n style: {\n maxLineWidth: labelAutoLimitLength,\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n\n // 防重叠相关\n minGap: labelAutoHideGap,\n autoHide: labelAutoHide,\n autoHideMethod: 'greedy',\n autoHideSeparation: labelAutoHideGap,\n autoLimit: labelAutoLimit,\n autoRotate: labelAutoRotate,\n autoRotateAngle: labelAutoRotateAngleRange,\n lastVisible: true,\n },\n title: {\n visible: title?.visible,\n text: title?.titleText,\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n lineDash: grid?.gridLineDash,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n } as Partial<ICartesianBandAxisSpec>\n}\n"],"names":["bandAxisStyle","config","visible","label","tick","title","grid","line","labelAutoHide","labelAutoHideGap","labelAutoLimit","labelAutoLimitLength","labelAutoRotate","labelAutoRotateAngleRange","AXIS_LABEL_SPACE"],"mappings":";AAIO,MAAMA,gBAAgB,CAACC;IAC5B,MAAM,EACJC,UAAU,IAAI,EACdC,KAAK,EACLC,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,IAAI,EACJC,aAAa,EACbC,gBAAgB,EAChBC,cAAc,EACdC,uBAAuB,EAAE,EACzBC,eAAe,EACfC,yBAAyB,EAC1B,GAAGZ;IAEJ,OAAO;QACL,MAAM;QACN,UAAU,CAAEO,CAAAA,iBAAiBI,mBAAmBF,cAAa;QAC7DR;QACA,OAAO;QACP,OAAO;YACL,SAASC,OAAO;YAChB,OAAO;YACP,OAAOW;YACP,OAAO;gBACL,cAAcH;gBACd,MAAMR,OAAO;gBACb,OAAOA,OAAO;gBACd,UAAUA,OAAO;gBACjB,YAAYA,OAAO;YACrB;YAGA,QAAQM;YACR,UAAUD;YACV,gBAAgB;YAChB,oBAAoBC;YACpB,WAAWC;YACX,YAAYE;YACZ,iBAAiBC;YACjB,aAAa;QACf;QACA,OAAO;YACL,SAASR,OAAO;YAChB,MAAMA,OAAO;YACb,OAAO;gBACL,MAAMA,OAAO;gBACb,UAAUA,OAAO;gBACjB,YAAYA,OAAO;YACrB;QACF;QACA,MAAM;YACJ,SAASD,MAAM;YACf,UAAUA,MAAM;YAChB,QAAQA,MAAM;YACd,OAAO;gBACL,QAAQA,MAAM;YAChB;QACF;QACA,MAAM;YACJ,SAASE,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;gBACd,UAAUA,MAAM;YAClB;QACF;QACA,YAAY;YACV,SAASC,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;IACF;AACF"}
@@ -0,0 +1,2 @@
1
+ import type { VChartSpecPipe } from '../../../../../types';
2
+ export declare const heatmapBandAxis: VChartSpecPipe;
@@ -0,0 +1,24 @@
1
+ import { bandAxisStyle } from "./axisStyle.js";
2
+ const heatmapBandAxis = (spec, context)=>{
3
+ const result = {
4
+ ...spec
5
+ };
6
+ const { advancedVSeed, vseed } = context;
7
+ const { chartType } = vseed;
8
+ const xAxisConfig = advancedVSeed.config?.[chartType]?.xAxis ?? {};
9
+ const yAxisConfig = advancedVSeed.config?.[chartType]?.yAxis ?? {};
10
+ const xBandAxis = bandAxisStyle(xAxisConfig);
11
+ const yBandAxis = bandAxisStyle(yAxisConfig);
12
+ xBandAxis.orient = 'bottom';
13
+ xBandAxis.bandPadding = 0;
14
+ yBandAxis.orient = 'left';
15
+ yBandAxis.bandPadding = 0;
16
+ result.axes = [
17
+ xBandAxis,
18
+ yBandAxis
19
+ ];
20
+ return result;
21
+ };
22
+ export { heatmapBandAxis };
23
+
24
+ //# sourceMappingURL=heatmapBandAxis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/axes/heatmapBandAxis.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/axes/heatmapBandAxis.ts"],"sourcesContent":["import type { ISpec } from '@visactor/vchart'\nimport type { VChartSpecPipe, XBandAxis, YBandAxis } from 'src/types'\nimport { bandAxisStyle } from './axisStyle'\n\nexport const heatmapBandAxis: VChartSpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const xAxisConfig = (advancedVSeed.config?.[chartType as 'heatmap']?.xAxis ?? {}) as XBandAxis\n const yAxisConfig = (advancedVSeed.config?.[chartType as 'heatmap']?.yAxis ?? {}) as YBandAxis\n const xBandAxis = bandAxisStyle(xAxisConfig)\n const yBandAxis = bandAxisStyle(yAxisConfig)\n\n xBandAxis.orient = 'bottom'\n xBandAxis.bandPadding = 0\n yBandAxis.orient = 'left'\n yBandAxis.bandPadding = 0\n\n result.axes = [xBandAxis, yBandAxis]\n\n return result\n}\n"],"names":["heatmapBandAxis","spec","context","result","advancedVSeed","vseed","chartType","xAxisConfig","yAxisConfig","xBandAxis","bandAxisStyle","yBandAxis"],"mappings":";AAIO,MAAMA,kBAAkC,CAACC,MAAMC;IACpD,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IACtB,MAAME,cAAeH,cAAc,MAAM,EAAE,CAACE,UAAuB,EAAE,SAAS,CAAC;IAC/E,MAAME,cAAeJ,cAAc,MAAM,EAAE,CAACE,UAAuB,EAAE,SAAS,CAAC;IAC/E,MAAMG,YAAYC,cAAcH;IAChC,MAAMI,YAAYD,cAAcF;IAEhCC,UAAU,MAAM,GAAG;IACnBA,UAAU,WAAW,GAAG;IACxBE,UAAU,MAAM,GAAG;IACnBA,UAAU,WAAW,GAAG;IAExBR,OAAO,IAAI,GAAG;QAACM;QAAWE;KAAU;IAEpC,OAAOR;AACT"}
@@ -7,3 +7,4 @@ export { yLinearSecondary } from './yLinearSecondary';
7
7
  export { radiusAxis } from './radius';
8
8
  export { radarAngleAxis } from './radarAngle';
9
9
  export { radarRadiusAxis } from './radarRadius';
10
+ export { heatmapBandAxis } from './heatmapBandAxis';
@@ -7,4 +7,5 @@ import { yLinearSecondary } from "./yLinearSecondary.js";
7
7
  import { radiusAxis } from "./radius.js";
8
8
  import { radarAngleAxis } from "./radarAngle.js";
9
9
  import { radarRadiusAxis } from "./radarRadius.js";
10
- export { radarAngleAxis, radarRadiusAxis, radiusAxis, xBand, xLinear, yBand, yLinear, yLinearPrimary, yLinearSecondary };
10
+ import { heatmapBandAxis } from "./heatmapBandAxis.js";
11
+ export { heatmapBandAxis, radarAngleAxis, radarRadiusAxis, radiusAxis, xBand, xLinear, yBand, yLinear, yLinearPrimary, yLinearSecondary };