@visactor/vseed 0.1.44 → 0.1.45

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 (351) hide show
  1. package/dist/cjs/index.cjs +1 -1
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/esm/builder/builder/buildSpec.js.map +1 -1
  4. package/dist/esm/builder/builder/builder.d.ts +240 -0
  5. package/dist/esm/pipeline/spec/chart/pipeline/area.js.map +1 -1
  6. package/dist/esm/pipeline/spec/chart/pipeline/areaPercent.js.map +1 -1
  7. package/dist/esm/pipeline/spec/chart/pipeline/bar.d.ts +1 -2
  8. package/dist/esm/pipeline/spec/chart/pipeline/bar.js.map +1 -1
  9. package/dist/esm/pipeline/spec/chart/pipeline/barParallel.d.ts +1 -2
  10. package/dist/esm/pipeline/spec/chart/pipeline/barParallel.js.map +1 -1
  11. package/dist/esm/pipeline/spec/chart/pipeline/barPercent.d.ts +1 -2
  12. package/dist/esm/pipeline/spec/chart/pipeline/barPercent.js.map +1 -1
  13. package/dist/esm/pipeline/spec/chart/pipeline/boxplot.d.ts +1 -2
  14. package/dist/esm/pipeline/spec/chart/pipeline/boxplot.js.map +1 -1
  15. package/dist/esm/pipeline/spec/chart/pipeline/column.js.map +1 -1
  16. package/dist/esm/pipeline/spec/chart/pipeline/columnParallel.d.ts +1 -2
  17. package/dist/esm/pipeline/spec/chart/pipeline/columnParallel.js.map +1 -1
  18. package/dist/esm/pipeline/spec/chart/pipeline/columnPercent.d.ts +1 -2
  19. package/dist/esm/pipeline/spec/chart/pipeline/columnPercent.js.map +1 -1
  20. package/dist/esm/pipeline/spec/chart/pipeline/donut.d.ts +1 -2
  21. package/dist/esm/pipeline/spec/chart/pipeline/donut.js.map +1 -1
  22. package/dist/esm/pipeline/spec/chart/pipeline/dualAxis.d.ts +1 -2
  23. package/dist/esm/pipeline/spec/chart/pipeline/dualAxis.js.map +1 -1
  24. package/dist/esm/pipeline/spec/chart/pipeline/funnel.d.ts +1 -2
  25. package/dist/esm/pipeline/spec/chart/pipeline/funnel.js.map +1 -1
  26. package/dist/esm/pipeline/spec/chart/pipeline/heatmap.d.ts +1 -2
  27. package/dist/esm/pipeline/spec/chart/pipeline/heatmap.js.map +1 -1
  28. package/dist/esm/pipeline/spec/chart/pipeline/histogram.d.ts +1 -2
  29. package/dist/esm/pipeline/spec/chart/pipeline/histogram.js.map +1 -1
  30. package/dist/esm/pipeline/spec/chart/pipeline/line.d.ts +1 -2
  31. package/dist/esm/pipeline/spec/chart/pipeline/line.js.map +1 -1
  32. package/dist/esm/pipeline/spec/chart/pipeline/pie.d.ts +1 -2
  33. package/dist/esm/pipeline/spec/chart/pipeline/pie.js.map +1 -1
  34. package/dist/esm/pipeline/spec/chart/pipeline/radar.js.map +1 -1
  35. package/dist/esm/pipeline/spec/chart/pipeline/rose.js.map +1 -1
  36. package/dist/esm/pipeline/spec/chart/pipeline/roseParallel.d.ts +1 -2
  37. package/dist/esm/pipeline/spec/chart/pipeline/roseParallel.js.map +1 -1
  38. package/dist/esm/pipeline/spec/chart/pipeline/scatter.d.ts +1 -2
  39. package/dist/esm/pipeline/spec/chart/pipeline/scatter.js.map +1 -1
  40. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationArea.d.ts +2 -2
  41. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationArea.js +14 -13
  42. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationArea.js.map +1 -1
  43. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationAreaBand.d.ts +2 -2
  44. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationAreaBand.js +12 -19
  45. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationAreaBand.js.map +1 -1
  46. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.d.ts +2 -2
  47. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.js +2 -17
  48. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.js.map +1 -1
  49. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPoint.d.ts +2 -2
  50. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPoint.js.map +1 -1
  51. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.d.ts +2 -2
  52. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js +2 -17
  53. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js.map +1 -1
  54. package/dist/esm/pipeline/spec/chart/pipes/annotation/splitLine.d.ts +2 -2
  55. package/dist/esm/pipeline/spec/chart/pipes/annotation/splitLine.js +3 -3
  56. package/dist/esm/pipeline/spec/chart/pipes/annotation/splitLine.js.map +1 -1
  57. package/dist/esm/pipeline/spec/chart/pipes/annotation/utils.d.ts +34 -0
  58. package/dist/esm/pipeline/spec/chart/pipes/annotation/utils.js +35 -1
  59. package/dist/esm/pipeline/spec/chart/pipes/annotation/utils.js.map +1 -1
  60. package/dist/esm/pipeline/spec/chart/pipes/axes/radarAngle.d.ts +2 -2
  61. package/dist/esm/pipeline/spec/chart/pipes/axes/radarAngle.js.map +1 -1
  62. package/dist/esm/pipeline/spec/chart/pipes/axes/radarRadius.d.ts +2 -2
  63. package/dist/esm/pipeline/spec/chart/pipes/axes/radarRadius.js.map +1 -1
  64. package/dist/esm/pipeline/spec/chart/pipes/axes/radius.d.ts +2 -2
  65. package/dist/esm/pipeline/spec/chart/pipes/axes/radius.js.map +1 -1
  66. package/dist/esm/pipeline/spec/chart/pipes/axes/xBand.d.ts +2 -2
  67. package/dist/esm/pipeline/spec/chart/pipes/axes/xBand.js.map +1 -1
  68. package/dist/esm/pipeline/spec/chart/pipes/axes/xLinear.d.ts +2 -2
  69. package/dist/esm/pipeline/spec/chart/pipes/axes/xLinear.js.map +1 -1
  70. package/dist/esm/pipeline/spec/chart/pipes/axes/yBand.d.ts +2 -2
  71. package/dist/esm/pipeline/spec/chart/pipes/axes/yBand.js.map +1 -1
  72. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinear.d.ts +2 -2
  73. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinear.js.map +1 -1
  74. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearPrimary.d.ts +2 -2
  75. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearPrimary.js.map +1 -1
  76. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearSecondary.d.ts +2 -2
  77. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearSecondary.js.map +1 -1
  78. package/dist/esm/pipeline/spec/chart/pipes/backgroundColor/background.d.ts +2 -2
  79. package/dist/esm/pipeline/spec/chart/pipes/backgroundColor/background.js.map +1 -1
  80. package/dist/esm/pipeline/spec/chart/pipes/barWidth/barGapInGroup.d.ts +2 -2
  81. package/dist/esm/pipeline/spec/chart/pipes/barWidth/barGapInGroup.js.map +1 -1
  82. package/dist/esm/pipeline/spec/chart/pipes/barWidth/barMaxWidth.d.ts +2 -2
  83. package/dist/esm/pipeline/spec/chart/pipes/barWidth/barMaxWidth.js.map +1 -1
  84. package/dist/esm/pipeline/spec/chart/pipes/color/color.d.ts +2 -2
  85. package/dist/esm/pipeline/spec/chart/pipes/color/color.js.map +1 -1
  86. package/dist/esm/pipeline/spec/chart/pipes/color/colorAdapter.d.ts +3 -2
  87. package/dist/esm/pipeline/spec/chart/pipes/color/colorAdapter.js +3 -1
  88. package/dist/esm/pipeline/spec/chart/pipes/color/colorAdapter.js.map +1 -1
  89. package/dist/esm/pipeline/spec/chart/pipes/color/colorAreaStyleFill.d.ts +2 -2
  90. package/dist/esm/pipeline/spec/chart/pipes/color/colorAreaStyleFill.js.map +1 -1
  91. package/dist/esm/pipeline/spec/chart/pipes/color/colorBarStyleFill.d.ts +2 -2
  92. package/dist/esm/pipeline/spec/chart/pipes/color/colorBarStyleFill.js.map +1 -1
  93. package/dist/esm/pipeline/spec/chart/pipes/color/colorCellStyleFill.d.ts +2 -2
  94. package/dist/esm/pipeline/spec/chart/pipes/color/colorCellStyleFill.js.map +1 -1
  95. package/dist/esm/pipeline/spec/chart/pipes/color/colorFunnelStyleFill.d.ts +2 -2
  96. package/dist/esm/pipeline/spec/chart/pipes/color/colorFunnelStyleFill.js.map +1 -1
  97. package/dist/esm/pipeline/spec/chart/pipes/color/colorLineStyleFill.d.ts +2 -2
  98. package/dist/esm/pipeline/spec/chart/pipes/color/colorLineStyleFill.js.map +1 -1
  99. package/dist/esm/pipeline/spec/chart/pipes/color/colorPieStyleFill.d.ts +2 -2
  100. package/dist/esm/pipeline/spec/chart/pipes/color/colorPieStyleFill.js.map +1 -1
  101. package/dist/esm/pipeline/spec/chart/pipes/color/colorPointStyleFill.d.ts +2 -2
  102. package/dist/esm/pipeline/spec/chart/pipes/color/colorPointStyleFill.js.map +1 -1
  103. package/dist/esm/pipeline/spec/chart/pipes/color/colorRoseStyleFill.d.ts +2 -2
  104. package/dist/esm/pipeline/spec/chart/pipes/color/colorRoseStyleFill.js.map +1 -1
  105. package/dist/esm/pipeline/spec/chart/pipes/color/linearColor.d.ts +2 -2
  106. package/dist/esm/pipeline/spec/chart/pipes/color/linearColor.js.map +1 -1
  107. package/dist/esm/pipeline/spec/chart/pipes/color/linearColorForDualAxis.d.ts +2 -2
  108. package/dist/esm/pipeline/spec/chart/pipes/color/linearColorForDualAxis.js.map +1 -1
  109. package/dist/esm/pipeline/spec/chart/pipes/crosshair/horizontalCrosshairLine.d.ts +2 -2
  110. package/dist/esm/pipeline/spec/chart/pipes/crosshair/horizontalCrosshairLine.js.map +1 -1
  111. package/dist/esm/pipeline/spec/chart/pipes/crosshair/horizontalCrosshairRect.d.ts +2 -2
  112. package/dist/esm/pipeline/spec/chart/pipes/crosshair/horizontalCrosshairRect.js.map +1 -1
  113. package/dist/esm/pipeline/spec/chart/pipes/crosshair/verticalCrosshairLine.d.ts +2 -2
  114. package/dist/esm/pipeline/spec/chart/pipes/crosshair/verticalCrosshairLine.js.map +1 -1
  115. package/dist/esm/pipeline/spec/chart/pipes/crosshair/verticalCrosshairRect.d.ts +2 -2
  116. package/dist/esm/pipeline/spec/chart/pipes/crosshair/verticalCrosshairRect.js.map +1 -1
  117. package/dist/esm/pipeline/spec/chart/pipes/dataset/datasetBoxplot.d.ts +2 -2
  118. package/dist/esm/pipeline/spec/chart/pipes/dataset/datasetBoxplot.js.map +1 -1
  119. package/dist/esm/pipeline/spec/chart/pipes/dataset/datasetDualAxis.d.ts +3 -3
  120. package/dist/esm/pipeline/spec/chart/pipes/dataset/datasetDualAxis.js.map +1 -1
  121. package/dist/esm/pipeline/spec/chart/pipes/dataset/datasetHistogram.d.ts +2 -2
  122. package/dist/esm/pipeline/spec/chart/pipes/dataset/datasetHistogram.js.map +1 -1
  123. package/dist/esm/pipeline/spec/chart/pipes/dataset/datasetPivot.d.ts +2 -2
  124. package/dist/esm/pipeline/spec/chart/pipes/dataset/datasetPivot.js.map +1 -1
  125. package/dist/esm/pipeline/spec/chart/pipes/dataset/datasetScatter.d.ts +2 -2
  126. package/dist/esm/pipeline/spec/chart/pipes/dataset/datasetScatter.js.map +1 -1
  127. package/dist/esm/pipeline/spec/chart/pipes/dataset/datasetXY.d.ts +2 -2
  128. package/dist/esm/pipeline/spec/chart/pipes/dataset/datasetXY.js.map +1 -1
  129. package/dist/esm/pipeline/spec/chart/pipes/dataset/datasetYX.d.ts +2 -2
  130. package/dist/esm/pipeline/spec/chart/pipes/dataset/datasetYX.js.map +1 -1
  131. package/dist/esm/pipeline/spec/chart/pipes/dataset/progressive.d.ts +2 -2
  132. package/dist/esm/pipeline/spec/chart/pipes/dataset/progressive.js.map +1 -1
  133. package/dist/esm/pipeline/spec/chart/pipes/dual/dualChartType.d.ts +3 -3
  134. package/dist/esm/pipeline/spec/chart/pipes/dual/dualChartType.js.map +1 -1
  135. package/dist/esm/pipeline/spec/chart/pipes/init/area.d.ts +2 -2
  136. package/dist/esm/pipeline/spec/chart/pipes/init/area.js.map +1 -1
  137. package/dist/esm/pipeline/spec/chart/pipes/init/bar.d.ts +2 -2
  138. package/dist/esm/pipeline/spec/chart/pipes/init/bar.js.map +1 -1
  139. package/dist/esm/pipeline/spec/chart/pipes/init/barParallel.d.ts +2 -2
  140. package/dist/esm/pipeline/spec/chart/pipes/init/barParallel.js.map +1 -1
  141. package/dist/esm/pipeline/spec/chart/pipes/init/boxplot.d.ts +2 -2
  142. package/dist/esm/pipeline/spec/chart/pipes/init/boxplot.js.map +1 -1
  143. package/dist/esm/pipeline/spec/chart/pipes/init/column.d.ts +2 -2
  144. package/dist/esm/pipeline/spec/chart/pipes/init/column.js.map +1 -1
  145. package/dist/esm/pipeline/spec/chart/pipes/init/columnParallel.d.ts +2 -2
  146. package/dist/esm/pipeline/spec/chart/pipes/init/columnParallel.js.map +1 -1
  147. package/dist/esm/pipeline/spec/chart/pipes/init/donut.d.ts +2 -2
  148. package/dist/esm/pipeline/spec/chart/pipes/init/donut.js.map +1 -1
  149. package/dist/esm/pipeline/spec/chart/pipes/init/dualAxis.d.ts +3 -3
  150. package/dist/esm/pipeline/spec/chart/pipes/init/dualAxis.js.map +1 -1
  151. package/dist/esm/pipeline/spec/chart/pipes/init/funnel.d.ts +2 -2
  152. package/dist/esm/pipeline/spec/chart/pipes/init/funnel.js.map +1 -1
  153. package/dist/esm/pipeline/spec/chart/pipes/init/heatmap.d.ts +2 -2
  154. package/dist/esm/pipeline/spec/chart/pipes/init/heatmap.js.map +1 -1
  155. package/dist/esm/pipeline/spec/chart/pipes/init/histogram.d.ts +2 -2
  156. package/dist/esm/pipeline/spec/chart/pipes/init/histogram.js.map +1 -1
  157. package/dist/esm/pipeline/spec/chart/pipes/init/line.d.ts +2 -2
  158. package/dist/esm/pipeline/spec/chart/pipes/init/line.js.map +1 -1
  159. package/dist/esm/pipeline/spec/chart/pipes/init/pie.d.ts +2 -2
  160. package/dist/esm/pipeline/spec/chart/pipes/init/pie.js.map +1 -1
  161. package/dist/esm/pipeline/spec/chart/pipes/init/pivot.d.ts +2 -2
  162. package/dist/esm/pipeline/spec/chart/pipes/init/pivot.js.map +1 -1
  163. package/dist/esm/pipeline/spec/chart/pipes/init/radar.d.ts +2 -2
  164. package/dist/esm/pipeline/spec/chart/pipes/init/radar.js.map +1 -1
  165. package/dist/esm/pipeline/spec/chart/pipes/init/rose.d.ts +2 -2
  166. package/dist/esm/pipeline/spec/chart/pipes/init/rose.js.map +1 -1
  167. package/dist/esm/pipeline/spec/chart/pipes/init/roseParallel.d.ts +2 -2
  168. package/dist/esm/pipeline/spec/chart/pipes/init/roseParallel.js.map +1 -1
  169. package/dist/esm/pipeline/spec/chart/pipes/init/scatter.d.ts +2 -2
  170. package/dist/esm/pipeline/spec/chart/pipes/init/scatter.js.map +1 -1
  171. package/dist/esm/pipeline/spec/chart/pipes/label/label.d.ts +2 -2
  172. package/dist/esm/pipeline/spec/chart/pipes/label/label.js.map +1 -1
  173. package/dist/esm/pipeline/spec/chart/pipes/label/labelDualAxis.d.ts +3 -3
  174. package/dist/esm/pipeline/spec/chart/pipes/label/labelDualAxis.js.map +1 -1
  175. package/dist/esm/pipeline/spec/chart/pipes/label/labelPie.d.ts +2 -2
  176. package/dist/esm/pipeline/spec/chart/pipes/label/labelPie.js.map +1 -1
  177. package/dist/esm/pipeline/spec/chart/pipes/label/labelScatter.d.ts +2 -2
  178. package/dist/esm/pipeline/spec/chart/pipes/label/labelScatter.js.map +1 -1
  179. package/dist/esm/pipeline/spec/chart/pipes/legend/colorLegend.d.ts +2 -2
  180. package/dist/esm/pipeline/spec/chart/pipes/legend/colorLegend.js +7 -0
  181. package/dist/esm/pipeline/spec/chart/pipes/legend/colorLegend.js.map +1 -1
  182. package/dist/esm/pipeline/spec/chart/pipes/legend/discreteLegend.d.ts +2 -2
  183. package/dist/esm/pipeline/spec/chart/pipes/legend/discreteLegend.js +18 -2
  184. package/dist/esm/pipeline/spec/chart/pipes/legend/discreteLegend.js.map +1 -1
  185. package/dist/esm/pipeline/spec/chart/pipes/legend/heatmapColorLegend.d.ts +2 -2
  186. package/dist/esm/pipeline/spec/chart/pipes/legend/heatmapColorLegend.js.map +1 -1
  187. package/dist/esm/pipeline/spec/chart/pipes/legend/pivotColorLegend.d.ts +2 -2
  188. package/dist/esm/pipeline/spec/chart/pipes/legend/pivotColorLegend.js.map +1 -1
  189. package/dist/esm/pipeline/spec/chart/pipes/legend/pivotDiscreteLegend.d.ts +2 -2
  190. package/dist/esm/pipeline/spec/chart/pipes/legend/pivotDiscreteLegend.js.map +1 -1
  191. package/dist/esm/pipeline/spec/chart/pipes/markStyle/areaStyle.d.ts +2 -2
  192. package/dist/esm/pipeline/spec/chart/pipes/markStyle/areaStyle.js.map +1 -1
  193. package/dist/esm/pipeline/spec/chart/pipes/markStyle/barStyle.d.ts +2 -2
  194. package/dist/esm/pipeline/spec/chart/pipes/markStyle/barStyle.js.map +1 -1
  195. package/dist/esm/pipeline/spec/chart/pipes/markStyle/cellStyle.d.ts +2 -2
  196. package/dist/esm/pipeline/spec/chart/pipes/markStyle/cellStyle.js.map +1 -1
  197. package/dist/esm/pipeline/spec/chart/pipes/markStyle/funnelStyle.d.ts +2 -2
  198. package/dist/esm/pipeline/spec/chart/pipes/markStyle/funnelStyle.js.map +1 -1
  199. package/dist/esm/pipeline/spec/chart/pipes/markStyle/funnelTransformStyle.d.ts +2 -2
  200. package/dist/esm/pipeline/spec/chart/pipes/markStyle/funnelTransformStyle.js.map +1 -1
  201. package/dist/esm/pipeline/spec/chart/pipes/markStyle/lineStyle.d.ts +2 -2
  202. package/dist/esm/pipeline/spec/chart/pipes/markStyle/lineStyle.js.map +1 -1
  203. package/dist/esm/pipeline/spec/chart/pipes/markStyle/pieStyle.d.ts +2 -2
  204. package/dist/esm/pipeline/spec/chart/pipes/markStyle/pieStyle.js.map +1 -1
  205. package/dist/esm/pipeline/spec/chart/pipes/markStyle/pointState.d.ts +3 -3
  206. package/dist/esm/pipeline/spec/chart/pipes/markStyle/pointState.js.map +1 -1
  207. package/dist/esm/pipeline/spec/chart/pipes/markStyle/pointStyle.d.ts +2 -2
  208. package/dist/esm/pipeline/spec/chart/pipes/markStyle/pointStyle.js.map +1 -1
  209. package/dist/esm/pipeline/spec/chart/pipes/markStyle/roseStyle.d.ts +2 -2
  210. package/dist/esm/pipeline/spec/chart/pipes/markStyle/roseStyle.js.map +1 -1
  211. package/dist/esm/pipeline/spec/chart/pipes/percent/percent.d.ts +2 -2
  212. package/dist/esm/pipeline/spec/chart/pipes/percent/percent.js.map +1 -1
  213. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotAdapter.d.ts +2 -2
  214. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotAdapter.js +4 -1
  215. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotAdapter.js.map +1 -1
  216. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotAxisStyle.d.ts +2 -2
  217. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotAxisStyle.js.map +1 -1
  218. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotColumnDimensions.d.ts +2 -2
  219. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotColumnDimensions.js.map +1 -1
  220. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotGridStyle.d.ts +2 -2
  221. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotGridStyle.js.map +1 -1
  222. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotHideIndicatorName.d.ts +2 -2
  223. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotHideIndicatorName.js.map +1 -1
  224. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotIndicators.d.ts +4 -4
  225. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotIndicators.js.map +1 -1
  226. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotRowDimensions.d.ts +2 -2
  227. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotRowDimensions.js.map +1 -1
  228. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotTitle.d.ts +2 -2
  229. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotTitle.js.map +1 -1
  230. package/dist/esm/pipeline/spec/chart/pipes/region/addRegionPadding.d.ts +2 -2
  231. package/dist/esm/pipeline/spec/chart/pipes/region/addRegionPadding.js.map +1 -1
  232. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/columnRegressionLine.d.ts +2 -2
  233. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/columnRegressionLine.js.map +1 -1
  234. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/ecdfRegressionLine.d.ts +2 -2
  235. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/ecdfRegressionLine.js +1 -1
  236. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/ecdfRegressionLine.js.map +1 -1
  237. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/kdeRegressionLine.d.ts +2 -2
  238. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/kdeRegressionLine.js +1 -1
  239. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/kdeRegressionLine.js.map +1 -1
  240. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/linearRegressionLine.d.ts +6 -6
  241. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/linearRegressionLine.js.map +1 -1
  242. package/dist/esm/pipeline/spec/chart/pipes/series/series.d.ts +3 -3
  243. package/dist/esm/pipeline/spec/chart/pipes/series/series.js.map +1 -1
  244. package/dist/esm/pipeline/spec/chart/pipes/size/scatterSize.d.ts +2 -2
  245. package/dist/esm/pipeline/spec/chart/pipes/size/scatterSize.js.map +1 -1
  246. package/dist/esm/pipeline/spec/chart/pipes/stack/stack.d.ts +2 -2
  247. package/dist/esm/pipeline/spec/chart/pipes/stack/stack.js.map +1 -1
  248. package/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadius.d.ts +2 -2
  249. package/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadius.js.map +1 -1
  250. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.d.ts +2 -2
  251. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.js.map +1 -1
  252. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipBoxplot.d.ts +2 -2
  253. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipBoxplot.js.map +1 -1
  254. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.d.ts +3 -3
  255. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js.map +1 -1
  256. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHeatmap.d.ts +2 -2
  257. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHeatmap.js.map +1 -1
  258. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHistogram.d.ts +2 -2
  259. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHistogram.js.map +1 -1
  260. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipScatter.d.ts +2 -2
  261. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipScatter.js.map +1 -1
  262. package/dist/esm/pipeline/spec/table/pipes/cellStyle/pivot.d.ts +2 -2
  263. package/dist/esm/pipeline/spec/table/pipes/cellStyle/pivot.js.map +1 -1
  264. package/dist/esm/pipeline/spec/table/pipes/cellStyle/table.d.ts +2 -2
  265. package/dist/esm/pipeline/spec/table/pipes/cellStyle/table.js.map +1 -1
  266. package/dist/esm/pipeline/spec/table/pipes/columns/dimensionsToColumns.d.ts +2 -2
  267. package/dist/esm/pipeline/spec/table/pipes/columns/dimensionsToColumns.js.map +1 -1
  268. package/dist/esm/pipeline/spec/table/pipes/columns/measuresToColumns.d.ts +2 -2
  269. package/dist/esm/pipeline/spec/table/pipes/columns/measuresToColumns.js.map +1 -1
  270. package/dist/esm/pipeline/spec/table/pipes/columns/pivotColumns.d.ts +2 -2
  271. package/dist/esm/pipeline/spec/table/pipes/columns/pivotColumns.js.map +1 -1
  272. package/dist/esm/pipeline/spec/table/pipes/corner/titleOnDimension.d.ts +2 -2
  273. package/dist/esm/pipeline/spec/table/pipes/corner/titleOnDimension.js.map +1 -1
  274. package/dist/esm/pipeline/spec/table/pipes/indicators/pivotDataConfig.d.ts +2 -2
  275. package/dist/esm/pipeline/spec/table/pipes/indicators/pivotDataConfig.js.map +1 -1
  276. package/dist/esm/pipeline/spec/table/pipes/indicators/pivotIndicators.d.ts +2 -2
  277. package/dist/esm/pipeline/spec/table/pipes/indicators/pivotIndicators.js.map +1 -1
  278. package/dist/esm/pipeline/spec/table/pipes/init/pivotTable.d.ts +2 -2
  279. package/dist/esm/pipeline/spec/table/pipes/init/pivotTable.js.map +1 -1
  280. package/dist/esm/pipeline/spec/table/pipes/init/table.d.ts +2 -2
  281. package/dist/esm/pipeline/spec/table/pipes/init/table.js.map +1 -1
  282. package/dist/esm/pipeline/spec/table/pipes/rows/pivotRows.d.ts +2 -2
  283. package/dist/esm/pipeline/spec/table/pipes/rows/pivotRows.js.map +1 -1
  284. package/dist/esm/pipeline/spec/table/pipes/theme/bodyStyle.d.ts +2 -2
  285. package/dist/esm/pipeline/spec/table/pipes/theme/bodyStyle.js.map +1 -1
  286. package/dist/esm/pipeline/spec/table/pipes/theme/cornerHeaderStyle.d.ts +2 -2
  287. package/dist/esm/pipeline/spec/table/pipes/theme/cornerHeaderStyle.js.map +1 -1
  288. package/dist/esm/pipeline/spec/table/pipes/theme/frameStyle.d.ts +2 -2
  289. package/dist/esm/pipeline/spec/table/pipes/theme/frameStyle.js.map +1 -1
  290. package/dist/esm/pipeline/spec/table/pipes/theme/headerStyle.d.ts +2 -2
  291. package/dist/esm/pipeline/spec/table/pipes/theme/headerStyle.js.map +1 -1
  292. package/dist/esm/pipeline/spec/table/pipes/theme/rowHeaderStyle.d.ts +2 -2
  293. package/dist/esm/pipeline/spec/table/pipes/theme/rowHeaderStyle.js.map +1 -1
  294. package/dist/esm/pipeline/spec/table/pipes/theme/scrollStyle.d.ts +2 -2
  295. package/dist/esm/pipeline/spec/table/pipes/theme/scrollStyle.js.map +1 -1
  296. package/dist/esm/pipeline/spec/table/pipes/theme/selectionStyle.d.ts +2 -2
  297. package/dist/esm/pipeline/spec/table/pipes/theme/selectionStyle.js.map +1 -1
  298. package/dist/esm/theme/common/annotaion.js +7 -7
  299. package/dist/esm/theme/common/annotaion.js.map +1 -1
  300. package/dist/esm/theme/common/axes.js +16 -16
  301. package/dist/esm/theme/common/axes.js.map +1 -1
  302. package/dist/esm/theme/common/legend.d.ts +2 -0
  303. package/dist/esm/theme/common/legend.js +13 -2
  304. package/dist/esm/theme/common/legend.js.map +1 -1
  305. package/dist/esm/theme/common/table.js +0 -2
  306. package/dist/esm/theme/common/table.js.map +1 -1
  307. package/dist/esm/theme/dark/dark.js +2 -2
  308. package/dist/esm/theme/dark/dark.js.map +1 -1
  309. package/dist/esm/theme/light/light.js +2 -2
  310. package/dist/esm/theme/light/light.js.map +1 -1
  311. package/dist/esm/types/advancedVSeed.d.ts +80 -0
  312. package/dist/esm/types/chartType/area/zArea.d.ts +2 -0
  313. package/dist/esm/types/chartType/areaPercent/zAreaPercent.d.ts +2 -0
  314. package/dist/esm/types/chartType/bar/zBar.d.ts +2 -0
  315. package/dist/esm/types/chartType/barParallel/zBarParallel.d.ts +2 -0
  316. package/dist/esm/types/chartType/barPercent/zBarPercent.d.ts +2 -0
  317. package/dist/esm/types/chartType/boxplot/zBoxplot.d.ts +2 -0
  318. package/dist/esm/types/chartType/column/zColumn.d.ts +2 -0
  319. package/dist/esm/types/chartType/columnParallel/zColumnParallel.d.ts +2 -0
  320. package/dist/esm/types/chartType/columnPercent/zColumnPercent.d.ts +2 -0
  321. package/dist/esm/types/chartType/donut/zDonut.d.ts +2 -0
  322. package/dist/esm/types/chartType/dualAxis/zDualAxis.d.ts +2 -0
  323. package/dist/esm/types/chartType/histogram/zHistogram.d.ts +2 -0
  324. package/dist/esm/types/chartType/line/zLine.d.ts +2 -0
  325. package/dist/esm/types/chartType/pie/zPie.d.ts +2 -0
  326. package/dist/esm/types/chartType/radar/zRadar.d.ts +2 -0
  327. package/dist/esm/types/chartType/rose/zRose.d.ts +2 -0
  328. package/dist/esm/types/chartType/roseParallel/zRoseParallel.d.ts +2 -0
  329. package/dist/esm/types/chartType/scatter/zScatter.d.ts +2 -0
  330. package/dist/esm/types/pipeline/spec/spec.d.ts +11 -2
  331. package/dist/esm/types/properties/config/area.d.ts +4 -0
  332. package/dist/esm/types/properties/config/bar.d.ts +6 -0
  333. package/dist/esm/types/properties/config/boxplot.d.ts +2 -0
  334. package/dist/esm/types/properties/config/column.d.ts +6 -0
  335. package/dist/esm/types/properties/config/config.d.ts +40 -0
  336. package/dist/esm/types/properties/config/dualAxis.d.ts +2 -0
  337. package/dist/esm/types/properties/config/funnel.d.ts +2 -0
  338. package/dist/esm/types/properties/config/heatmap.d.ts +2 -0
  339. package/dist/esm/types/properties/config/histogram.d.ts +2 -0
  340. package/dist/esm/types/properties/config/legend/legend.d.ts +10 -0
  341. package/dist/esm/types/properties/config/legend/legend.js +2 -0
  342. package/dist/esm/types/properties/config/legend/legend.js.map +1 -1
  343. package/dist/esm/types/properties/config/line.d.ts +2 -0
  344. package/dist/esm/types/properties/config/pie.d.ts +6 -0
  345. package/dist/esm/types/properties/config/rose.d.ts +4 -0
  346. package/dist/esm/types/properties/config/scatter.d.ts +2 -0
  347. package/dist/esm/types/properties/theme/customTheme.d.ts +80 -0
  348. package/dist/esm/types/zVseed.d.ts +36 -0
  349. package/dist/umd/index.js +207 -139
  350. package/dist/umd/index.js.map +1 -1
  351. package/package.json +5 -5
@@ -1,6 +1,7 @@
1
1
  import { selector } from "../../../../../dataSelector/index.js";
2
- import { isSubset } from "./utils.js";
2
+ import { ANNOTATION_AREA_TEXT_STYLE_BY_POSITION, isSubset } from "./utils.js";
3
3
  import { ANNOTATION_Z_INDEX } from "../../../../utils/constant.js";
4
+ import { isBarLikeChart } from "../../../../utils/chatType.js";
4
5
  const annotationArea_annotationArea = (spec, context)=>{
5
6
  const { advancedVSeed, vseed } = context;
6
7
  const { annotation, config } = advancedVSeed;
@@ -20,12 +21,14 @@ const annotationArea_annotationArea = (spec, context)=>{
20
21
  left: 'insideLeft',
21
22
  right: 'insideRight'
22
23
  };
24
+ const defaultTextPosition = isBarLikeChart(advancedVSeed) ? 'right' : 'top';
23
25
  const markArea = annotationAreaList.flatMap((annotationArea)=>{
24
- const { selector: selectorPoint, text = '', textPosition = 'top', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = 'center', textBaseline = 'top', textBackgroundVisible = theme?.textBackgroundVisible ?? true, textBackgroundColor = theme?.textBackgroundColor ?? '#191d24', textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#191d24', textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundPadding = theme?.textBackgroundPadding ?? 4, areaColor = theme?.areaColor ?? '#888888', areaColorOpacity = theme?.areaColorOpacity ?? 0.15, areaBorderColor = theme?.areaBorderColor ?? '#888888', areaBorderRadius = theme?.areaBorderRadius ?? 4, areaBorderWidth = theme?.areaBorderWidth ?? 1, areaLineDash = theme?.areaLineDash, outerPadding = theme?.outerPadding ?? 4 } = annotationArea;
26
+ const { selector: selectorPoint, text = '', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textBackgroundVisible = theme?.textBackgroundVisible ?? true, textBackgroundColor = theme?.textBackgroundColor ?? '#191d24', textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#191d24', textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundPadding = theme?.textBackgroundPadding ?? 4, areaColor = theme?.areaColor ?? '#888888', areaColorOpacity = theme?.areaColorOpacity ?? 0.15, areaBorderColor = theme?.areaBorderColor ?? '#888888', areaBorderRadius = theme?.areaBorderRadius ?? 4, areaBorderWidth = theme?.areaBorderWidth ?? 1, areaLineDash = theme?.areaLineDash, outerPadding = theme?.outerPadding ?? 4 } = annotationArea;
25
27
  const dataset = advancedVSeed.dataset.flat();
26
28
  const selectedData = selectorPoint ? dataset.filter((datum)=>selector(datum, selectorPoint)) : [];
27
- const labelPosition = positionMap[textPosition || 'top'];
28
- const isBottom = labelPosition.toLocaleLowerCase().includes('bottom');
29
+ const textPosition = annotationArea.textPosition ?? defaultTextPosition;
30
+ const textAlign = annotationArea.textAlign ?? ANNOTATION_AREA_TEXT_STYLE_BY_POSITION[textPosition].textAlign;
31
+ const textBaseline = annotationArea.textBaseline ?? ANNOTATION_AREA_TEXT_STYLE_BY_POSITION[textPosition].textBaseline;
29
32
  return {
30
33
  zIndex: ANNOTATION_Z_INDEX,
31
34
  regionRelative: true,
@@ -35,11 +38,11 @@ const annotationArea_annotationArea = (spec, context)=>{
35
38
  const yAxisHelper = context.getYAxisHelper();
36
39
  const xAxisHelper = context.getXAxisHelper();
37
40
  if ('function' == typeof xAxisHelper?.getBandwidth) {
38
- const yScale = yAxisHelper.getScale();
41
+ const regionRect = context.getRegion().getLayoutRect();
39
42
  const minX = Math.min(...xyList.map((item)=>item.x)) - (outerPadding || 4);
40
43
  const maxX = Math.max(...xyList.map((item)=>item.x)) + (outerPadding || 4);
41
- const minY = Math.min(...yScale.range());
42
- const maxY = Math.max(...yScale.range());
44
+ const minY = 0;
45
+ const maxY = regionRect.height;
43
46
  return [
44
47
  {
45
48
  x: minX,
@@ -60,11 +63,11 @@ const annotationArea_annotationArea = (spec, context)=>{
60
63
  ];
61
64
  }
62
65
  if ('function' == typeof yAxisHelper?.getBandwidth) {
63
- const xScale = xAxisHelper.getScale();
66
+ const regionRect = context.getRegion().getLayoutRect();
64
67
  const minY = Math.min(...xyList.map((item)=>item.y)) - (outerPadding || 4);
65
68
  const maxY = Math.max(...xyList.map((item)=>item.y)) + (outerPadding || 4);
66
- const minX = Math.min(...xScale.range());
67
- const maxX = Math.max(...xScale.range());
69
+ const minX = 0;
70
+ const maxX = regionRect.width;
68
71
  return [
69
72
  {
70
73
  x: minX,
@@ -87,12 +90,11 @@ const annotationArea_annotationArea = (spec, context)=>{
87
90
  return [];
88
91
  },
89
92
  label: {
90
- position: labelPosition,
93
+ position: positionMap[textPosition],
91
94
  visible: true,
92
95
  text: text,
93
96
  style: {
94
97
  opacity: 0.95,
95
- dy: isBottom ? 2 * -(textFontSize || 12) : 0,
96
98
  textAlign: textAlign,
97
99
  textBaseline: textBaseline,
98
100
  fill: textColor,
@@ -106,7 +108,6 @@ const annotationArea_annotationArea = (spec, context)=>{
106
108
  padding: textBackgroundPadding,
107
109
  style: {
108
110
  opacity: 0.95,
109
- dy: isBottom ? 2 * -(textFontSize || 12) : 0,
110
111
  cornerRadius: textBackgroundBorderRadius ?? 4,
111
112
  fill: textBackgroundColor,
112
113
  stroke: textBackgroundBorderColor,
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationArea.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationArea.ts"],"sourcesContent":["import type { ICartesianSeries, ILineChartSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { Datum, SpecPipe } from 'src/types'\nimport { isSubset } from './utils'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\n\nexport const annotationArea: SpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { annotation, config } = advancedVSeed\n\n if (!annotation || !annotation.annotationArea) {\n return spec\n }\n\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationArea\n const { annotationArea } = annotation\n const annotationAreaList = Array.isArray(annotationArea) ? annotationArea : [annotationArea]\n\n const positionMap = {\n top: 'insideTop',\n topRight: 'insideTopRight',\n topLeft: 'insideTopLeft',\n bottom: 'insideBottom',\n bottomLeft: 'insideBottomLeft',\n bottomRight: 'insideBottomRight',\n left: 'insideLeft',\n right: 'insideRight',\n }\n\n const markArea = annotationAreaList.flatMap((annotationArea) => {\n const {\n selector: selectorPoint,\n text = '',\n textPosition = 'top',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n textAlign = 'center',\n textBaseline = 'top',\n\n textBackgroundVisible = theme?.textBackgroundVisible ?? true,\n textBackgroundColor = theme?.textBackgroundColor ?? '#191d24',\n textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#191d24',\n textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1,\n textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4,\n textBackgroundPadding = theme?.textBackgroundPadding ?? 4,\n\n areaColor = theme?.areaColor ?? '#888888',\n areaColorOpacity = theme?.areaColorOpacity ?? 0.15,\n areaBorderColor = theme?.areaBorderColor ?? '#888888',\n areaBorderRadius = theme?.areaBorderRadius ?? 4,\n areaBorderWidth = theme?.areaBorderWidth ?? 1,\n areaLineDash = theme?.areaLineDash,\n\n outerPadding = theme?.outerPadding ?? 4,\n } = annotationArea\n\n const dataset = advancedVSeed.dataset.flat()\n const selectedData = selectorPoint ? dataset.filter((datum) => selector(datum, selectorPoint)) : []\n\n const labelPosition = positionMap[textPosition || 'top']\n const isBottom = labelPosition.toLocaleLowerCase().includes('bottom')\n\n return {\n zIndex: ANNOTATION_Z_INDEX,\n regionRelative: true,\n positions: (data: Datum[], context: ICartesianSeries) => {\n const positionData = data.filter((item) => selectedData.some((datum) => isSubset(datum, item)))\n const xyList = positionData.map((datum) => context.dataToPosition(datum) as { x: number; y: number })\n\n const yAxisHelper = context.getYAxisHelper() as unknown as {\n getBandwidth: (depth?: number) => number\n getScale: () => {\n range: () => number[]\n }\n }\n const xAxisHelper = context.getXAxisHelper() as unknown as {\n getBandwidth: (depth?: number) => number\n getScale: () => {\n range: () => number[]\n }\n }\n\n if (typeof xAxisHelper?.getBandwidth === 'function') {\n const yScale = yAxisHelper.getScale()\n\n const minX = Math.min(...xyList.map((item) => item.x)) - (outerPadding || 4)\n const maxX = Math.max(...xyList.map((item) => item.x)) + (outerPadding || 4)\n const minY = Math.min(...yScale.range())\n const maxY = Math.max(...yScale.range())\n return [\n // 左上\n {\n x: minX,\n y: minY,\n },\n // 右上\n {\n x: maxX,\n y: minY,\n },\n // 右下\n {\n x: maxX,\n y: maxY,\n },\n // 左下\n {\n x: minX,\n y: maxY,\n },\n ]\n }\n\n if (typeof yAxisHelper?.getBandwidth === 'function') {\n const xScale = xAxisHelper.getScale()\n\n const minY = Math.min(...xyList.map((item) => item.y)) - (outerPadding || 4)\n const maxY = Math.max(...xyList.map((item) => item.y)) + (outerPadding || 4)\n const minX = Math.min(...xScale.range())\n const maxX = Math.max(...xScale.range())\n\n return [\n // 左上\n {\n x: minX,\n y: minY,\n },\n // 右上\n {\n x: maxX,\n y: minY,\n },\n // 右下\n {\n x: maxX,\n y: maxY,\n },\n // 左下\n {\n x: minX,\n y: maxY,\n },\n ]\n }\n\n return []\n },\n label: {\n position: labelPosition,\n visible: true,\n text: text,\n style: {\n opacity: 0.95,\n dy: isBottom ? -(textFontSize || 12) * 2 : 0,\n textAlign: textAlign,\n textBaseline: textBaseline,\n fill: textColor,\n stroke: textBackgroundColor,\n lineWidth: 1,\n fontSize: textFontSize,\n fontWeight: textFontWeight,\n },\n\n labelBackground: {\n visible: textBackgroundVisible,\n padding: textBackgroundPadding,\n style: {\n opacity: 0.95,\n dy: isBottom ? -(textFontSize || 12) * 2 : 0,\n cornerRadius: textBackgroundBorderRadius ?? 4,\n fill: textBackgroundColor,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n fillOpacity: 1,\n },\n },\n },\n area: {\n style: {\n visible: true,\n fill: areaColor,\n fillOpacity: areaColorOpacity,\n stroke: areaBorderColor,\n lineWidth: areaBorderWidth,\n cornerRadius: areaBorderRadius,\n lineDash: areaLineDash,\n },\n },\n }\n }) as ILineChartSpec['markArea']\n\n return {\n ...spec,\n markArea: markArea,\n }\n}\n"],"names":["annotationArea","spec","context","advancedVSeed","vseed","annotation","config","theme","annotationAreaList","Array","positionMap","markArea","selectorPoint","text","textPosition","textColor","textFontSize","textFontWeight","textAlign","textBaseline","textBackgroundVisible","textBackgroundColor","textBackgroundBorderColor","textBackgroundBorderWidth","textBackgroundBorderRadius","textBackgroundPadding","areaColor","areaColorOpacity","areaBorderColor","areaBorderRadius","areaBorderWidth","areaLineDash","outerPadding","dataset","selectedData","datum","selector","labelPosition","isBottom","ANNOTATION_Z_INDEX","data","positionData","item","isSubset","xyList","yAxisHelper","xAxisHelper","yScale","minX","Math","maxX","minY","maxY","xScale"],"mappings":";;;AAMO,MAAMA,gCAA2B,CAACC,MAAMC;IAC7C,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IACjC,MAAM,EAAEG,UAAU,EAAEC,MAAM,EAAE,GAAGH;IAE/B,IAAI,CAACE,cAAc,CAACA,WAAW,cAAc,EAC3C,OAAOJ;IAGT,MAAMM,QAAQD,QAAQ,CAACF,MAAM,SAAS,CAAa,EAAE,YAAY;IACjE,MAAM,EAAEJ,cAAc,EAAE,GAAGK;IAC3B,MAAMG,qBAAqBC,MAAM,OAAO,CAACT,kBAAkBA,iBAAiB;QAACA;KAAe;IAE5F,MAAMU,cAAc;QAClB,KAAK;QACL,UAAU;QACV,SAAS;QACT,QAAQ;QACR,YAAY;QACZ,aAAa;QACb,MAAM;QACN,OAAO;IACT;IAEA,MAAMC,WAAWH,mBAAmB,OAAO,CAAC,CAACR;QAC3C,MAAM,EACJ,UAAUY,aAAa,EACvBC,OAAO,EAAE,EACTC,eAAe,KAAK,EACpBC,YAAYR,OAAO,aAAa,SAAS,EACzCS,eAAeT,OAAO,gBAAgB,EAAE,EACxCU,iBAAiBV,OAAO,kBAAkB,GAAG,EAC7CW,YAAY,QAAQ,EACpBC,eAAe,KAAK,EA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ACN,QAAQM;oBACR,WAAW;oBACX,UAAUL;oBACV,YAAYC;gBACd;gBAEA,iBAAiB;oBACf,SAASG;oBACT,SAASK;oBACT,OAAO;wBACL,SAAS;wBACT,IAAIa,WAAW,AAAwB,IAAxB,CAAEtB,CAAAA,gBAAgB,EAAC,IAAS;wBAC3C,cAAcQ,8BAA8B;wBAC5C,MAAMH;wBACN,QAAQC;wBACR,WAAWC;wBACX,aAAa;oBACf;gBACF;YACF;YACA,MAAM;gBACJ,OAAO;oBACL,SAAS;oBACT,MAAMG;oBACN,aAAaC;oBACb,QAAQC;oBACR,WAAWE;oBACX,cAAcD;oBACd,UAAUE;gBACZ;YACF;QACF;IACF;IAEA,OAAO;QACL,GAAG9B,IAAI;QACP,UAAUU;IACZ;AACF"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationArea.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationArea.ts"],"sourcesContent":["/**\n * @description 适用于线图、面积图等的区块标注,计算标注区块的时候,只考虑点的大小\n */\nimport type { ICartesianSeries, ILineChartSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { Datum, VChartSpecPipe, VSeed } from 'src/types'\nimport { ANNOTATION_AREA_TEXT_STYLE_BY_POSITION, isSubset } from './utils'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\nimport { isBarLikeChart } from 'src/pipeline/utils/chatType'\n\nexport const annotationArea: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { annotation, config } = advancedVSeed\n\n if (!annotation || !annotation.annotationArea) {\n return spec\n }\n\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationArea\n const { annotationArea } = annotation\n const annotationAreaList = Array.isArray(annotationArea) ? annotationArea : [annotationArea]\n\n const positionMap = {\n top: 'insideTop',\n topRight: 'insideTopRight',\n topLeft: 'insideTopLeft',\n bottom: 'insideBottom',\n bottomLeft: 'insideBottomLeft',\n bottomRight: 'insideBottomRight',\n left: 'insideLeft',\n right: 'insideRight',\n }\n const defaultTextPosition = isBarLikeChart(advancedVSeed as VSeed) ? 'right' : 'top'\n\n const markArea = annotationAreaList.flatMap((annotationArea) => {\n const {\n selector: selectorPoint,\n text = '',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n\n textBackgroundVisible = theme?.textBackgroundVisible ?? true,\n textBackgroundColor = theme?.textBackgroundColor ?? '#191d24',\n textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#191d24',\n textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1,\n textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4,\n textBackgroundPadding = theme?.textBackgroundPadding ?? 4,\n\n areaColor = theme?.areaColor ?? '#888888',\n areaColorOpacity = theme?.areaColorOpacity ?? 0.15,\n areaBorderColor = theme?.areaBorderColor ?? '#888888',\n areaBorderRadius = theme?.areaBorderRadius ?? 4,\n areaBorderWidth = theme?.areaBorderWidth ?? 1,\n areaLineDash = theme?.areaLineDash,\n\n outerPadding = theme?.outerPadding ?? 4,\n } = annotationArea\n\n const dataset = advancedVSeed.dataset.flat()\n const selectedData = selectorPoint ? dataset.filter((datum) => selector(datum, selectorPoint)) : []\n const textPosition: string = annotationArea.textPosition ?? defaultTextPosition\n const textAlign =\n annotationArea.textAlign ??\n ANNOTATION_AREA_TEXT_STYLE_BY_POSITION[textPosition as keyof typeof ANNOTATION_AREA_TEXT_STYLE_BY_POSITION]\n .textAlign\n const textBaseline =\n annotationArea.textBaseline ??\n ANNOTATION_AREA_TEXT_STYLE_BY_POSITION[textPosition as keyof typeof ANNOTATION_AREA_TEXT_STYLE_BY_POSITION]\n .textBaseline\n\n return {\n zIndex: ANNOTATION_Z_INDEX,\n regionRelative: true,\n positions: (data: Datum[], context: ICartesianSeries) => {\n const positionData = data.filter((item) => selectedData.some((datum) => isSubset(datum, item)))\n const xyList = positionData.map((datum) => context.dataToPosition(datum) as { x: number; y: number })\n\n const yAxisHelper = context.getYAxisHelper() as unknown as {\n getBandwidth: (depth?: number) => number\n getScale: () => {\n range: () => number[]\n }\n }\n const xAxisHelper = context.getXAxisHelper() as unknown as {\n getBandwidth: (depth?: number) => number\n getScale: () => {\n range: () => number[]\n }\n }\n\n if (typeof xAxisHelper?.getBandwidth === 'function') {\n const regionRect = context.getRegion().getLayoutRect()\n\n const minX = Math.min(...xyList.map((item) => item.x)) - (outerPadding || 4)\n const maxX = Math.max(...xyList.map((item) => item.x)) + (outerPadding || 4)\n const minY = 0\n const maxY = regionRect.height\n return [\n // 左上\n {\n x: minX,\n y: minY,\n },\n // 右上\n {\n x: maxX,\n y: minY,\n },\n // 右下\n {\n x: maxX,\n y: maxY,\n },\n // 左下\n {\n x: minX,\n y: maxY,\n },\n ]\n }\n\n if (typeof yAxisHelper?.getBandwidth === 'function') {\n const regionRect = context.getRegion().getLayoutRect()\n\n const minY = Math.min(...xyList.map((item) => item.y)) - (outerPadding || 4)\n const maxY = Math.max(...xyList.map((item) => item.y)) + (outerPadding || 4)\n const minX = 0\n const maxX = regionRect.width\n\n return [\n // 左上\n {\n x: minX,\n y: minY,\n },\n // 右上\n {\n x: maxX,\n y: minY,\n },\n // 右下\n {\n x: maxX,\n y: maxY,\n },\n // 左下\n {\n x: minX,\n y: maxY,\n },\n ]\n }\n\n return []\n },\n label: {\n position: (positionMap as any)[textPosition],\n visible: true,\n text: text,\n style: {\n opacity: 0.95,\n textAlign: textAlign,\n textBaseline: textBaseline,\n fill: textColor,\n stroke: textBackgroundColor,\n lineWidth: 1,\n fontSize: textFontSize,\n fontWeight: textFontWeight,\n },\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 fillOpacity: 1,\n },\n },\n },\n area: {\n style: {\n visible: true,\n fill: areaColor,\n fillOpacity: areaColorOpacity,\n stroke: areaBorderColor,\n lineWidth: areaBorderWidth,\n cornerRadius: areaBorderRadius,\n lineDash: areaLineDash,\n },\n },\n }\n }) as ILineChartSpec['markArea']\n\n return {\n ...spec,\n markArea: markArea,\n }\n}\n"],"names":["annotationArea","spec","context","advancedVSeed","vseed","annotation","config","theme","annotationAreaList","Array","positionMap","defaultTextPosition","isBarLikeChart","markArea","selectorPoint","text","textColor","textFontSize","textFontWeight","textBackgroundVisible","textBackgroundColor","textBackgroundBorderColor","textBackgroundBorderWidth","textBackgroundBorderRadius","textBackgroundPadding","areaColor","areaColorOpacity","areaBorderColor","areaBorderRadius","areaBorderWidth","areaLineDash","outerPadding","dataset","selectedData","datum","selector","textPosition","textAlign","ANNOTATION_AREA_TEXT_STYLE_BY_POSITION","textBaseline","ANNOTATION_Z_INDEX","data","positionData","item","isSubset","xyList","yAxisHelper","xAxisHelper","regionRect","minX","Math","maxX","minY","maxY"],"mappings":";;;;AAUO,MAAMA,gCAAiC,CAACC,MAAMC;IACnD,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IACjC,MAAM,EAAEG,UAAU,EAAEC,MAAM,EAAE,GAAGH;IAE/B,IAAI,CAACE,cAAc,CAACA,WAAW,cAAc,EAC3C,OAAOJ;IAGT,MAAMM,QAAQD,QAAQ,CAACF,MAAM,SAAS,CAAa,EAAE,YAAY;IACjE,MAAM,EAAEJ,cAAc,EAAE,GAAGK;IAC3B,MAAMG,qBAAqBC,MAAM,OAAO,CAACT,kBAAkBA,iBAAiB;QAACA;KAAe;IAE5F,MAAMU,cAAc;QAClB,KAAK;QACL,UAAU;QACV,SAAS;QACT,QAAQ;QACR,YAAY;QACZ,aAAa;QACb,MAAM;QACN,OAAO;IACT;IACA,MAAMC,sBAAsBC,eAAeT,iBAA0B,UAAU;IAE/E,MAAMU,WAAWL,mBAAmB,OAAO,CAAC,CAACR;QAC3C,MAAM,EAC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,CAAC0B,aAAa;gBAC5C,SAAS;gBACT,MAAMrB;gBACN,OAAO;oBACL,SAAS;oBACT,WAAWsB;oBACX,cAAcE;oBACd,MAAMvB;oBACN,QAAQI;oBACR,WAAW;oBACX,UAAUH;oBACV,YAAYC;gBACd;gBAEA,iBAAiB;oBACf,SAASC;oBACT,SAASK;oBACT,OAAO;wBACL,SAAS;wBACT,cAAcD,8BAA8B;wBAC5C,MAAMH;wBACN,QAAQC;wBACR,WAAWC;wBACX,aAAa;oBACf;gBACF;YACF;YACA,MAAM;gBACJ,OAAO;oBACL,SAAS;oBACT,MAAMG;oBACN,aAAaC;oBACb,QAAQC;oBACR,WAAWE;oBACX,cAAcD;oBACd,UAAUE;gBACZ;YACF;QACF;IACF;IAEA,OAAO;QACL,GAAG7B,IAAI;QACP,UAAUY;IACZ;AACF"}
@@ -1,2 +1,2 @@
1
- import type { SpecPipe } from '../../../../../types';
2
- export declare const annotationAreaBand: SpecPipe;
1
+ import type { VChartSpecPipe } from '../../../../../types';
2
+ export declare const annotationAreaBand: VChartSpecPipe;
@@ -1,5 +1,5 @@
1
1
  import { selector } from "../../../../../dataSelector/index.js";
2
- import { isSubset } from "./utils.js";
2
+ import { ANNOTATION_AREA_TEXT_STYLE_BY_POSITION, isSubset } from "./utils.js";
3
3
  import { ANNOTATION_Z_INDEX } from "../../../../utils/constant.js";
4
4
  import { isBarLikeChart } from "../../../../utils/chatType.js";
5
5
  const annotationAreaBand = (spec, context)=>{
@@ -21,17 +21,12 @@ const annotationAreaBand = (spec, context)=>{
21
21
  left: 'insideLeft',
22
22
  right: 'insideRight'
23
23
  };
24
- const defaultOptions = isBarLikeChart(advancedVSeed) ? {
25
- textPosition: 'right',
26
- textAlign: 'right'
27
- } : {
28
- textPosition: 'top',
29
- textAlign: 'center'
30
- };
24
+ const defaultTextPosition = isBarLikeChart(advancedVSeed) ? 'right' : 'top';
31
25
  const markArea = annotationAreaList.flatMap((annotationArea)=>{
32
- const { selector: selectorPoint, text = '', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = defaultOptions.textAlign, textBaseline = 'middle', textBackgroundVisible = theme?.textBackgroundVisible ?? true, textBackgroundColor = theme?.textBackgroundColor ?? '#191d24', textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#191d24', textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundPadding = theme?.textBackgroundPadding ?? 4, areaColor = theme?.areaColor ?? '#888888', areaColorOpacity = theme?.areaColorOpacity ?? 0.15, areaBorderColor = theme?.areaBorderColor ?? '#888888', areaBorderRadius = theme?.areaBorderRadius ?? 4, areaBorderWidth = theme?.areaBorderWidth ?? 1, areaLineDash = theme?.areaLineDash, outerPadding = theme?.outerPadding ?? 4 } = annotationArea;
33
- const textPosition = annotationArea.textPosition ?? defaultOptions.textPosition;
34
- const dy = textPosition.includes('bottom') ? -1 * textFontSize : 0;
26
+ const { selector: selectorPoint, text = '', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textBackgroundVisible = theme?.textBackgroundVisible ?? true, textBackgroundColor = theme?.textBackgroundColor ?? '#191d24', textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#191d24', textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundPadding = theme?.textBackgroundPadding ?? 4, areaColor = theme?.areaColor ?? '#888888', areaColorOpacity = theme?.areaColorOpacity ?? 0.15, areaBorderColor = theme?.areaBorderColor ?? '#888888', areaBorderRadius = theme?.areaBorderRadius ?? 4, areaBorderWidth = theme?.areaBorderWidth ?? 1, areaLineDash = theme?.areaLineDash, outerPadding = theme?.outerPadding ?? 4 } = annotationArea;
27
+ const textPosition = annotationArea.textPosition ?? defaultTextPosition;
28
+ const textAlign = annotationArea.textAlign ?? ANNOTATION_AREA_TEXT_STYLE_BY_POSITION[textPosition].textAlign;
29
+ const textBaseline = annotationArea.textBaseline ?? ANNOTATION_AREA_TEXT_STYLE_BY_POSITION[textPosition].textBaseline;
35
30
  const dataset = advancedVSeed.dataset.flat();
36
31
  const selectedData = selectorPoint ? dataset.filter((datum)=>selector(datum, selectorPoint)) : [];
37
32
  return {
@@ -46,15 +41,15 @@ const annotationAreaBand = (spec, context)=>{
46
41
  if ('function' == typeof xAxisHelper?.getBandwidth) {
47
42
  const depth = context.fieldX.length ?? 0;
48
43
  const xBandWidth = xAxisHelper?.getBandwidth?.(depth - 1);
49
- const yScale = yAxisHelper.getScale();
44
+ const regionRect = context.getRegion().getLayoutRect();
50
45
  const startX = Math.min(...xyList.map((item)=>item.x)) - (outerPadding || 4);
51
46
  const endX = Math.max(...xyList.map((item)=>item.x)) + (outerPadding || 4);
52
47
  const width = endX - startX + xBandWidth;
53
48
  const middleX = (endX + startX) / 2 + xBandWidth * (0.5 - bandPosition);
54
49
  const minX = middleX - width / 2;
55
50
  const maxX = middleX + width / 2;
56
- const minY = Math.min(...yScale.range());
57
- const maxY = Math.max(...yScale.range());
51
+ const minY = 0;
52
+ const maxY = regionRect.height;
58
53
  return [
59
54
  {
60
55
  x: minX,
@@ -77,15 +72,15 @@ const annotationAreaBand = (spec, context)=>{
77
72
  if ('function' == typeof yAxisHelper?.getBandwidth) {
78
73
  const depth = context.fieldY.length ?? 0;
79
74
  const yBandWidth = yAxisHelper?.getBandwidth?.(depth - 1);
80
- const xScale = xAxisHelper.getScale();
75
+ const regionRect = context.getRegion().getLayoutRect();
81
76
  const startY = Math.min(...xyList.map((item)=>item.y)) - (outerPadding || 4);
82
77
  const endY = Math.max(...xyList.map((item)=>item.y)) + (outerPadding || 4);
83
78
  const width = endY - startY + yBandWidth;
84
79
  const middleY = (endY + startY) / 2 + yBandWidth * (0.5 - bandPosition);
85
80
  const minY = middleY - width / 2;
86
81
  const maxY = middleY + width / 2;
87
- const minX = Math.min(...xScale.range());
88
- const maxX = Math.max(...xScale.range());
82
+ const minX = 0;
83
+ const maxX = regionRect.width;
89
84
  return [
90
85
  {
91
86
  x: minX,
@@ -113,7 +108,6 @@ const annotationAreaBand = (spec, context)=>{
113
108
  text: text,
114
109
  style: {
115
110
  opacity: 0.95,
116
- dy: dy,
117
111
  textAlign: textAlign,
118
112
  textBaseline: textBaseline,
119
113
  stroke: textBackgroundColor,
@@ -127,7 +121,6 @@ const annotationAreaBand = (spec, context)=>{
127
121
  padding: textBackgroundPadding,
128
122
  style: {
129
123
  opacity: 0.95,
130
- dy: dy,
131
124
  cornerRadius: textBackgroundBorderRadius ?? 4,
132
125
  fill: textBackgroundColor,
133
126
  stroke: textBackgroundBorderColor,
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationAreaBand.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationAreaBand.ts"],"sourcesContent":["import { type ICartesianSeries, type ILineChartSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { Datum, SpecPipe, 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 annotationAreaBand: SpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { annotation, config } = advancedVSeed\n\n if (!annotation || !annotation.annotationArea) {\n return spec\n }\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationArea\n const { annotationArea } = annotation\n const annotationAreaList = Array.isArray(annotationArea) ? annotationArea : [annotationArea]\n\n const positionMap = {\n top: 'insideTop',\n topRight: 'insideTopRight',\n topLeft: 'insideTopLeft',\n bottom: 'insideBottom',\n bottomLeft: 'insideBottomLeft',\n bottomRight: 'insideBottomRight',\n left: 'insideLeft',\n right: 'insideRight',\n }\n const defaultOptions = isBarLikeChart(advancedVSeed as VSeed)\n ? {\n textPosition: 'right',\n textAlign: 'right',\n }\n : {\n textPosition: 'top',\n textAlign: 'center',\n }\n\n const markArea = annotationAreaList.flatMap((annotationArea) => {\n const {\n selector: selectorPoint,\n text = '',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n textAlign = defaultOptions.textAlign,\n textBaseline = 'middle',\n\n textBackgroundVisible = theme?.textBackgroundVisible ?? true,\n textBackgroundColor = theme?.textBackgroundColor ?? '#191d24',\n textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#191d24',\n textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1,\n textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4,\n textBackgroundPadding = theme?.textBackgroundPadding ?? 4,\n\n areaColor = theme?.areaColor ?? '#888888',\n areaColorOpacity = theme?.areaColorOpacity ?? 0.15,\n areaBorderColor = theme?.areaBorderColor ?? '#888888',\n areaBorderRadius = theme?.areaBorderRadius ?? 4,\n areaBorderWidth = theme?.areaBorderWidth ?? 1,\n areaLineDash = theme?.areaLineDash,\n\n outerPadding = theme?.outerPadding ?? 4,\n } = annotationArea\n const textPosition: string = annotationArea.textPosition ?? defaultOptions.textPosition\n\n const dy = textPosition.includes('bottom') ? -1 * textFontSize! : 0\n\n const dataset = advancedVSeed.dataset.flat()\n const selectedData = selectorPoint ? dataset.filter((datum) => selector(datum, selectorPoint)) : []\n\n return {\n zIndex: ANNOTATION_Z_INDEX,\n regionRelative: true,\n positions: (data: Datum[], context: ICartesianSeries & { _scaleConfig?: { bandPosition?: number } }) => {\n const positionData = data.filter((item) => selectedData.some((datum) => isSubset(datum, item)))\n const xyList = positionData.map((datum) => context.dataToPosition(datum) as { x: number; y: number })\n\n const bandPosition = context?._scaleConfig?.bandPosition || 0\n\n const yAxisHelper = context.getYAxisHelper() as unknown as {\n getBandwidth: (depth?: number) => number\n getScale: () => {\n range: () => number[]\n }\n }\n const xAxisHelper = context.getXAxisHelper() as unknown as {\n getBandwidth: (depth?: number) => number\n getScale: () => {\n range: () => number[]\n }\n }\n\n if (typeof xAxisHelper?.getBandwidth === 'function') {\n const depth = context.fieldX.length ?? 0\n const xBandWidth = xAxisHelper?.getBandwidth?.(depth - 1)\n const yScale = yAxisHelper.getScale()\n const startX = Math.min(...xyList.map((item) => item.x)) - (outerPadding || 4)\n const endX = Math.max(...xyList.map((item) => item.x)) + (outerPadding || 4)\n\n const width = endX - startX + xBandWidth\n const middleX = (endX + startX) / 2 + xBandWidth * (0.5 - bandPosition)\n\n const minX = middleX - width / 2\n const maxX = middleX + width / 2\n\n const minY = Math.min(...yScale.range())\n const maxY = Math.max(...yScale.range())\n\n return [\n // 左上\n {\n x: minX,\n y: minY,\n },\n // 右上\n {\n x: maxX,\n y: minY,\n },\n // 右下\n {\n x: maxX,\n y: maxY,\n },\n // 左下\n {\n x: minX,\n y: maxY,\n },\n ]\n }\n\n if (typeof yAxisHelper?.getBandwidth === 'function') {\n const depth = context.fieldY.length ?? 0\n const yBandWidth = yAxisHelper?.getBandwidth?.(depth - 1)\n const xScale = xAxisHelper.getScale()\n\n const startY = Math.min(...xyList.map((item) => item.y)) - (outerPadding || 4)\n const endY = Math.max(...xyList.map((item) => item.y)) + (outerPadding || 4)\n const width = endY - startY + yBandWidth\n const middleY = (endY + startY) / 2 + yBandWidth * (0.5 - bandPosition)\n\n const minY = middleY - width / 2\n const maxY = middleY + width / 2\n\n const minX = Math.min(...xScale.range())\n const maxX = Math.max(...xScale.range())\n\n return [\n // 左上\n {\n x: minX,\n y: minY,\n },\n // 右上\n {\n x: maxX,\n y: minY,\n },\n // 右下\n {\n x: maxX,\n y: maxY,\n },\n // 左下\n {\n x: minX,\n y: maxY,\n },\n ]\n }\n\n return []\n },\n label: {\n position: positionMap[textPosition as 'bottom'],\n visible: true,\n text: text,\n style: {\n opacity: 0.95,\n dy: dy,\n textAlign: textAlign,\n textBaseline: textBaseline,\n stroke: textBackgroundColor,\n lineWidth: 1,\n fill: textColor,\n fontSize: textFontSize,\n fontWeight: textFontWeight,\n },\n\n labelBackground: {\n visible: textBackgroundVisible,\n padding: textBackgroundPadding,\n style: {\n opacity: 0.95,\n dy: dy,\n cornerRadius: textBackgroundBorderRadius ?? 4,\n fill: textBackgroundColor,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n fillOpacity: 1,\n },\n },\n },\n area: {\n style: {\n visible: true,\n fill: areaColor,\n fillOpacity: areaColorOpacity,\n stroke: areaBorderColor,\n lineWidth: areaBorderWidth,\n cornerRadius: areaBorderRadius,\n lineDash: areaLineDash,\n },\n },\n }\n }) as ILineChartSpec['markArea']\n\n return {\n ...spec,\n markArea: markArea,\n }\n}\n"],"names":["annotationAreaBand","spec","context","advancedVSeed","vseed","annotation","config","theme","annotationArea","annotationAreaList","Array","positionMap","defaultOptions","isBarLikeChart","markArea","selectorPoint","text","textColor","textFontSize","textFontWeight","textAlign","textBaseline","textBackgroundVisible","textBackgroundColor","textBackgroundBorderColor","textBackgroundBorderWidth","textBackgroundBorderRadius","textBackgroundPadding","areaColor","areaColorOpacity","areaBorderColor","areaBorderRadius","areaBorderWidth","areaLineDash","outerPadding","textPosition","dy","dataset","selectedData","datum","selector","ANNOTATION_Z_INDEX","data","positionData","item","isSubset","xyList","bandPosition","yAxisHelper","xAxisHelper","depth","xBandWidth","yScale","startX","Math","endX","width","middleX","minX","maxX","minY","maxY","yBandWidth","xScale","startY","endY","middleY"],"mappings":";;;;AAOO,MAAMA,qBAA+B,CAACC,MAAMC;IACjD,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IACjC,MAAM,EAAEG,UAAU,EAAEC,MAAM,EAAE,GAAGH;IAE/B,IAAI,CAACE,cAAc,CAACA,WAAW,cAAc,EAC3C,OAAOJ;IAET,MAAMM,QAAQD,QAAQ,CAACF,MAAM,SAAS,CAAa,EAAE,YAAY;IACjE,MAAM,EAAEI,cAAc,EAAE,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oBACT,SAASK;oBACT,OAAO;wBACL,SAAS;wBACT,IAAIS;wBACJ,cAAcV,8BAA8B;wBAC5C,MAAMH;wBACN,QAAQC;wBACR,WAAWC;wBACX,aAAa;oBACf;gBACF;YACF;YACA,MAAM;gBACJ,OAAO;oBACL,SAAS;oBACT,MAAMG;oBACN,aAAaC;oBACb,QAAQC;oBACR,WAAWE;oBACX,cAAcD;oBACd,UAAUE;gBACZ;YACF;QACF;IACF;IAEA,OAAO;QACL,GAAGhC,IAAI;QACP,UAAUa;IACZ;AACF"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationAreaBand.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationAreaBand.ts"],"sourcesContent":["import { type ICartesianSeries, type ILineChartSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { Datum, VChartSpecPipe, VSeed } from 'src/types'\nimport { ANNOTATION_AREA_TEXT_STYLE_BY_POSITION, isSubset } from './utils'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\nimport { isBarLikeChart } from 'src/pipeline/utils/chatType'\n\nexport const annotationAreaBand: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { annotation, config } = advancedVSeed\n\n if (!annotation || !annotation.annotationArea) {\n return spec\n }\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationArea\n const { annotationArea } = annotation\n const annotationAreaList = Array.isArray(annotationArea) ? annotationArea : [annotationArea]\n\n const positionMap = {\n top: 'insideTop',\n topRight: 'insideTopRight',\n topLeft: 'insideTopLeft',\n bottom: 'insideBottom',\n bottomLeft: 'insideBottomLeft',\n bottomRight: 'insideBottomRight',\n left: 'insideLeft',\n right: 'insideRight',\n }\n const defaultTextPosition = isBarLikeChart(advancedVSeed as VSeed) ? 'right' : 'top'\n\n const markArea = annotationAreaList.flatMap((annotationArea) => {\n const {\n selector: selectorPoint,\n text = '',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n\n textBackgroundVisible = theme?.textBackgroundVisible ?? true,\n textBackgroundColor = theme?.textBackgroundColor ?? '#191d24',\n textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#191d24',\n textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1,\n textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4,\n textBackgroundPadding = theme?.textBackgroundPadding ?? 4,\n\n areaColor = theme?.areaColor ?? '#888888',\n areaColorOpacity = theme?.areaColorOpacity ?? 0.15,\n areaBorderColor = theme?.areaBorderColor ?? '#888888',\n areaBorderRadius = theme?.areaBorderRadius ?? 4,\n areaBorderWidth = theme?.areaBorderWidth ?? 1,\n areaLineDash = theme?.areaLineDash,\n\n outerPadding = theme?.outerPadding ?? 4,\n } = annotationArea\n const textPosition: string = annotationArea.textPosition ?? defaultTextPosition\n const textAlign =\n annotationArea.textAlign ??\n ANNOTATION_AREA_TEXT_STYLE_BY_POSITION[textPosition as keyof typeof ANNOTATION_AREA_TEXT_STYLE_BY_POSITION]\n .textAlign\n const textBaseline =\n annotationArea.textBaseline ??\n ANNOTATION_AREA_TEXT_STYLE_BY_POSITION[textPosition as keyof typeof ANNOTATION_AREA_TEXT_STYLE_BY_POSITION]\n .textBaseline\n\n const dataset = advancedVSeed.dataset.flat()\n const selectedData = selectorPoint ? dataset.filter((datum) => selector(datum, selectorPoint)) : []\n\n return {\n zIndex: ANNOTATION_Z_INDEX,\n regionRelative: true,\n // coordinates: selectedData,\n positions: (data: Datum[], context: ICartesianSeries & { _scaleConfig?: { bandPosition?: number } }) => {\n const positionData = data.filter((item) => selectedData.some((datum) => isSubset(datum, item)))\n const xyList = positionData.map((datum) => context.dataToPosition(datum) as { x: number; y: number })\n\n const bandPosition = context?._scaleConfig?.bandPosition || 0\n\n const yAxisHelper = context.getYAxisHelper() as unknown as {\n getBandwidth: (depth?: number) => number\n getScale: () => {\n range: () => number[]\n }\n }\n const xAxisHelper = context.getXAxisHelper() as unknown as {\n getBandwidth: (depth?: number) => number\n getScale: () => {\n range: () => number[]\n }\n }\n\n if (typeof xAxisHelper?.getBandwidth === 'function') {\n const depth = context.fieldX.length ?? 0\n const xBandWidth = xAxisHelper?.getBandwidth?.(depth - 1)\n const regionRect = context.getRegion().getLayoutRect()\n const startX = Math.min(...xyList.map((item) => item.x)) - (outerPadding || 4)\n const endX = Math.max(...xyList.map((item) => item.x)) + (outerPadding || 4)\n\n const width = endX - startX + xBandWidth\n const middleX = (endX + startX) / 2 + xBandWidth * (0.5 - bandPosition)\n\n const minX = middleX - width / 2\n const maxX = middleX + width / 2\n\n const minY = 0\n const maxY = regionRect.height\n\n return [\n // 左上\n {\n x: minX,\n y: minY,\n },\n // 右上\n {\n x: maxX,\n y: minY,\n },\n // 右下\n {\n x: maxX,\n y: maxY,\n },\n // 左下\n {\n x: minX,\n y: maxY,\n },\n ]\n }\n\n if (typeof yAxisHelper?.getBandwidth === 'function') {\n const depth = context.fieldY.length ?? 0\n const yBandWidth = yAxisHelper?.getBandwidth?.(depth - 1)\n const regionRect = context.getRegion().getLayoutRect()\n\n const startY = Math.min(...xyList.map((item) => item.y)) - (outerPadding || 4)\n const endY = Math.max(...xyList.map((item) => item.y)) + (outerPadding || 4)\n const width = endY - startY + yBandWidth\n const middleY = (endY + startY) / 2 + yBandWidth * (0.5 - bandPosition)\n\n const minY = middleY - width / 2\n const maxY = middleY + width / 2\n const minX = 0\n const maxX = regionRect.width\n\n return [\n // 左上\n {\n x: minX,\n y: minY,\n },\n // 右上\n {\n x: maxX,\n y: minY,\n },\n // 右下\n {\n x: maxX,\n y: maxY,\n },\n // 左下\n {\n x: minX,\n y: maxY,\n },\n ]\n }\n\n return []\n },\n label: {\n position: positionMap[textPosition as 'bottom'],\n visible: true,\n text: text,\n style: {\n opacity: 0.95,\n textAlign: textAlign,\n textBaseline: textBaseline,\n stroke: textBackgroundColor,\n lineWidth: 1,\n fill: textColor,\n fontSize: textFontSize,\n fontWeight: textFontWeight,\n },\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 fillOpacity: 1,\n },\n },\n },\n area: {\n style: {\n visible: true,\n fill: areaColor,\n fillOpacity: areaColorOpacity,\n stroke: areaBorderColor,\n lineWidth: areaBorderWidth,\n cornerRadius: areaBorderRadius,\n lineDash: areaLineDash,\n },\n },\n }\n }) as ILineChartSpec['markArea']\n\n return {\n ...spec,\n markArea: markArea,\n }\n}\n"],"names":["annotationAreaBand","spec","context","advancedVSeed","vseed","annotation","config","theme","annotationArea","annotationAreaList","Array","positionMap","defaultTextPosition","isBarLikeChart","markArea","selectorPoint","text","textColor","textFontSize","textFontWeight","textBackgroundVisible","textBackgroundColor","textBackgroundBorderColor","textBackgroundBorderWidth","textBackgroundBorderRadius","textBackgroundPadding","areaColor","areaColorOpacity","areaBorderColor","areaBorderRadius","areaBorderWidth","areaLineDash","outerPadding","textPosition","textAlign","ANNOTATION_AREA_TEXT_STYLE_BY_POSITION","textBaseline","dataset","selectedData","datum","selector","ANNOTATION_Z_INDEX","data","positionData","item","isSubset","xyList","bandPosition","yAxisHelper","xAxisHelper","depth","xBandWidth","regionRect","startX","Math","endX","width","middleX","minX","maxX","minY","maxY","yBandWidth","startY","endY","middleY"],"mappings":";;;;AAOO,MAAMA,qBAAqC,CAACC,MAAMC;IACvD,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IACjC,MAAM,EAAEG,UAAU,EAAEC,MAAM,EAAE,GAAGH;IAE/B,IAAI,CAACE,cAAc,CAACA,WAAW,cAAc,EAC3C,OAAOJ;IAET,MAAMM,QAAQD,QAAQ,CAACF,MAAM,SAAS,CAAa,EAAE,YAAY;IACjE,MAAM,EAAEI,cAAc,EAAE,GAAGH;IAC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YACF;YACA,MAAM;gBACJ,OAAO;oBACL,SAAS;oBACT,MAAMG;oBACN,aAAaC;oBACb,QAAQC;oBACR,WAAWE;oBACX,cAAcD;oBACd,UAAUE;gBACZ;YACF;QACF;IACF;IAEA,OAAO;QACL,GAAG9B,IAAI;QACP,UAAUa;IACZ;AACF"}
@@ -1,2 +1,2 @@
1
- import type { SpecPipe } from '../../../../../types';
2
- export declare const annotationHorizontalLine: SpecPipe;
1
+ import type { VChartSpecPipe } from '../../../../../types';
2
+ export declare const annotationHorizontalLine: VChartSpecPipe;
@@ -23,23 +23,8 @@ const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
23
23
  const { selector: selectorPoint, yValue, text = '', textPosition = 'insideEnd', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = 'right', textBaseline = 'bottom', 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 } = annotationHorizontalLine;
24
24
  const dataset = advancedVSeed.dataset.flat();
25
25
  const generateOneMarkLine = (y)=>({
26
- positions: (datum, series)=>{
27
- const regionStart = series.getRegion()?.getLayoutStartPoint();
28
- const xAxisHelper = series.getXAxisHelper();
29
- const yAxisHelper = series.getYAxisHelper();
30
- const yPos = yAxisHelper.getScale(0).scale(y) + regionStart.y;
31
- const xRange = xAxisHelper.getScale(0).range();
32
- return [
33
- {
34
- x: xRange ? xRange[0] + regionStart.x : 0,
35
- y: yPos
36
- },
37
- {
38
- x: xRange ? xRange[1] + regionStart.x : 0,
39
- y: yPos
40
- }
41
- ];
42
- },
26
+ y,
27
+ autoRange: true,
43
28
  zIndex: ANNOTATION_Z_INDEX,
44
29
  line: {
45
30
  style: {
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.ts"],"sourcesContent":["import type { Datum, ICartesianSeries, ILineChartSpec, IMarkLineSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { SpecPipe } from 'src/types'\nimport { isArray, isNumber, isString } from 'remeda'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\n\nexport const annotationHorizontalLine: SpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { annotation, datasetReshapeInfo, config } = advancedVSeed\n const { foldInfo, unfoldInfo } = datasetReshapeInfo[0]\n\n if (!annotation || !annotation.annotationHorizontalLine) {\n return spec\n }\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationHorizontalLine\n const { annotationHorizontalLine } = annotation\n const annotationHorizontalLineList = Array.isArray(annotationHorizontalLine)\n ? annotationHorizontalLine\n : [annotationHorizontalLine]\n\n const positionMap = {\n outsideStart: 'start',\n outsideEnd: 'end',\n outsideMiddle: 'middle',\n insideStart: 'insideStartTop',\n insideMiddle: 'insideMiddleTop',\n insideEnd: 'insideEndTop',\n }\n\n const markLine = annotationHorizontalLineList.flatMap((annotationHorizontalLine) => {\n const {\n selector: selectorPoint,\n yValue,\n text = '',\n textPosition = 'insideEnd',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n textAlign = 'right',\n textBaseline = 'bottom',\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 } = annotationHorizontalLine\n\n const dataset = advancedVSeed.dataset.flat()\n\n const generateOneMarkLine = (y: string | number) => {\n return {\n positions: (datum: Datum[], series: ICartesianSeries) => {\n const regionStart = series.getRegion()?.getLayoutStartPoint()\n const xAxisHelper = series.getXAxisHelper()\n const yAxisHelper = series.getYAxisHelper()\n const yPos = yAxisHelper.getScale!(0).scale(y) + regionStart.y\n const xRange = xAxisHelper.getScale!(0).range()\n\n return [\n { x: xRange ? xRange[0] + regionStart.x : 0, y: yPos },\n {\n x: xRange ? xRange[1] + regionStart.x : 0,\n y: yPos,\n },\n ]\n },\n zIndex: ANNOTATION_Z_INDEX,\n line: {\n style: {\n visible: lineVisible,\n stroke: lineColor,\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[textPosition || 'insideEnd'],\n style: {\n opacity: 0.95,\n visible: true,\n dy: 4,\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 dy: 4,\n cornerRadius: textBackgroundBorderRadius,\n fill: textBackgroundColor,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n fillOpacity: 1,\n },\n },\n },\n startSymbol: {\n visible: theme?.startSymbolVisible ?? true,\n symbolType: theme?.startSymbolType ?? 'triangleDown',\n size: 5 + (lineWidth || 1),\n style: {\n dx: 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 dx: -4,\n fill: lineColor,\n },\n },\n }\n }\n if ((!selectorPoint && isArray(yValue)) || isString(yValue) || isNumber(yValue)) {\n const yValueArr = Array.isArray(yValue) ? yValue : [yValue]\n return yValueArr.map(generateOneMarkLine)\n }\n\n const selectedData = selectorPoint ? dataset.filter((datum) => selector(datum, selectorPoint)) : []\n\n return selectedData.map((datum) => {\n if (datum[unfoldInfo.encodingY]) {\n return generateOneMarkLine(datum[unfoldInfo.encodingY] as string)\n }\n if (datum[foldInfo.measureValue]) {\n return generateOneMarkLine(datum[foldInfo.measureValue] as string)\n }\n return {}\n })\n }) as IMarkLineSpec[]\n const specMarkLine = ((spec as ILineChartSpec).markLine as IMarkLineSpec[]) || []\n const newMarkLine = [...specMarkLine, ...(markLine || [])]\n return {\n ...spec,\n markLine: newMarkLine,\n }\n}\n"],"names":["annotationHorizontalLine","spec","context","advancedVSeed","vseed","annotation","datasetReshapeInfo","config","foldInfo","unfoldInfo","theme","annotationHorizontalLineList","Array","positionMap","markLine","selectorPoint","yValue","text","textPosition","textColor","textFontSize","textFontWeight","textAlign","textBaseline","lineColor","lineStyle","lineVisible","lineWidth","textBackgroundVisible","textBackgroundColor","textBackgroundBorderColor","textBackgroundBorderRadius","textBackgroundBorderWidth","textBackgroundPadding","dataset","generateOneMarkLine","y","datum","series","regionStart","xAxisHelper","yAxisHelper","yPos","xRange","ANNOTATION_Z_INDEX","isArray","isString","isNumber","yValueArr","selectedData","selector","specMarkLine","newMarkLine"],"mappings":";;;AAMO,MAAMA,oDAAqC,CAACC,MAAMC;IACvD,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IACjC,MAAM,EAAEG,UAAU,EAAEC,kBAAkB,EAAEC,MAAM,EAAE,GAAGJ;IACnD,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MiB,CAAAA,aAAa;oBACzB,OAAO;wBACL,IAAI;wBACJ,MAAMH;oBACR;gBACF;YACF;QAEF,IAAK,CAACT,iBAAiB8B,QAAQ7B,WAAY8B,SAAS9B,WAAW+B,SAAS/B,SAAS;YAC/E,MAAMgC,YAAYpC,MAAM,OAAO,CAACI,UAAUA,SAAS;gBAACA;aAAO;YAC3D,OAAOgC,UAAU,GAAG,CAACb;QACvB;QAEA,MAAMc,eAAelC,gBAAgBmB,QAAQ,MAAM,CAAC,CAACG,QAAUa,SAASb,OAAOtB,kBAAkB,EAAE;QAEnG,OAAOkC,aAAa,GAAG,CAAC,CAACZ;YACvB,IAAIA,KAAK,CAAC5B,WAAW,SAAS,CAAC,EAC7B,OAAO0B,oBAAoBE,KAAK,CAAC5B,WAAW,SAAS,CAAC;YAExD,IAAI4B,KAAK,CAAC7B,SAAS,YAAY,CAAC,EAC9B,OAAO2B,oBAAoBE,KAAK,CAAC7B,SAAS,YAAY,CAAC;YAEzD,OAAO,CAAC;QACV;IACF;IACA,MAAM2C,eAAiBlD,KAAwB,QAAQ,IAAwB,EAAE;IACjF,MAAMmD,cAAc;WAAID;WAAkBrC,YAAY,EAAE;KAAE;IAC1D,OAAO;QACL,GAAGb,IAAI;QACP,UAAUmD;IACZ;AACF"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.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 annotationHorizontalLine: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { annotation, datasetReshapeInfo, config } = advancedVSeed\n const { foldInfo, unfoldInfo } = datasetReshapeInfo[0]\n\n if (!annotation || !annotation.annotationHorizontalLine) {\n return spec\n }\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationHorizontalLine\n const { annotationHorizontalLine } = annotation\n const annotationHorizontalLineList = Array.isArray(annotationHorizontalLine)\n ? annotationHorizontalLine\n : [annotationHorizontalLine]\n\n const positionMap = {\n outsideStart: 'start',\n outsideEnd: 'end',\n outsideMiddle: 'middle',\n insideStart: 'insideStartTop',\n insideMiddle: 'insideMiddleTop',\n insideEnd: 'insideEndTop',\n }\n\n const markLine = annotationHorizontalLineList.flatMap((annotationHorizontalLine) => {\n const {\n selector: selectorPoint,\n yValue,\n text = '',\n textPosition = 'insideEnd',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n textAlign = 'right',\n textBaseline = 'bottom',\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 } = annotationHorizontalLine\n\n const dataset = advancedVSeed.dataset.flat()\n\n const generateOneMarkLine = (y: string | number) => {\n return {\n y,\n autoRange: true,\n zIndex: ANNOTATION_Z_INDEX,\n line: {\n style: {\n visible: lineVisible,\n stroke: lineColor,\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 visible: true,\n dy: 4,\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 dy: 4,\n cornerRadius: textBackgroundBorderRadius,\n fill: textBackgroundColor,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n fillOpacity: 1,\n },\n },\n },\n startSymbol: {\n visible: theme?.startSymbolVisible ?? true,\n symbolType: theme?.startSymbolType ?? 'triangleDown',\n size: 5 + (lineWidth || 1),\n style: {\n dx: 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 dx: -4,\n fill: lineColor,\n },\n },\n }\n }\n if ((!selectorPoint && isArray(yValue)) || isString(yValue) || isNumber(yValue)) {\n const yValueArr = Array.isArray(yValue) ? yValue : [yValue]\n return yValueArr.map(generateOneMarkLine)\n }\n\n const selectedData = selectorPoint ? dataset.filter((datum) => selector(datum, selectorPoint)) : []\n\n return selectedData.map((datum) => {\n if (datum[unfoldInfo.encodingY]) {\n return generateOneMarkLine(datum[unfoldInfo.encodingY] as string)\n }\n if (datum[foldInfo.measureValue]) {\n return generateOneMarkLine(datum[foldInfo.measureValue] as string)\n }\n return {}\n })\n }) as IMarkLineSpec[]\n const specMarkLine = ((spec as ILineChartSpec).markLine as IMarkLineSpec[]) || []\n const newMarkLine = [...specMarkLine, ...(markLine || [])]\n return {\n ...spec,\n markLine: newMarkLine,\n }\n}\n"],"names":["annotationHorizontalLine","spec","context","advancedVSeed","vseed","annotation","datasetReshapeInfo","config","foldInfo","unfoldInfo","theme","annotationHorizontalLineList","Array","positionMap","markLine","selectorPoint","yValue","text","textPosition","textColor","textFontSize","textFontWeight","textAlign","textBaseline","lineColor","lineStyle","lineVisible","lineWidth","textBackgroundVisible","textBackgroundColor","textBackgroundBorderColor","textBackgroundBorderRadius","textBackgroundBorderWidth","textBackgroundPadding","dataset","generateOneMarkLine","y","ANNOTATION_Z_INDEX","isArray","isString","isNumber","yValueArr","selectedData","datum","selector","specMarkLine","newMarkLine"],"mappings":";;;AAMO,MAAMA,oDAA2C,CAACC,MAAMC;IAC7D,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IACjC,MAAM,EAAEG,UAAU,EAAEC,kBAAkB,EAAEC,MAAM,EAAE,GAAGJ;IACnD,MAAM,EAAEK,QAAQ,EAAEC,UAAU,EAAE,GAAGH,kBAAkB,CAAC,EAAE;IAEtD,IAAI,CAACD,cAAc,CAACA,WAAW,wBAAwB,EACrD,OAAOJ;IAET,MAAMS,QAAQH,QAAQ,CAACH,MAAM,SAAS,CAAa,EAAE,YAAY;IACjE,MAAM,EAAEJ,wBAAwB,EAAE,GAAGK;IACrC,MAAMM,+BAA+BC,MAAM,OAAO,CAACZ,4BAC/CA,2BACA;QAACA;KAAyB;IAE9B,MAAMa,cAAc;QAClB,cAAc;QACd,YAAY;QACZ,eAAe;QACf,aAAa;QACb,cAAc;QACd,WAAW;IACb;IAEA,MAAMC,WAAWH,6BAA6B,OAAO,CAAC,CAACX;QACrD,MAAM,EACJ,UAAUe,aAAa,EACvBC,MAAM,EACNC,OAAO,EAAE,EACTC,eAAe,WAAW,EAC1BC,YAAYT,OAAO,aAAa,SAAS,EACzCU,eAAeV,OAAO,gBAAgB,EAAE,EACxCW,iBAAiBX,OAAO,kBAAkB,GAAG,EAC7CY,YAAY,OAAO,EACnBC,eAAe,QAAQ,EAEvBC,YAAYd,OAAO,aAAa,SAAS,EACzCe,YAAYf,OAAO,aAAa,QAAQ,EACxCgB,cAAchB,OAAO,aAAa,IAAI,EACtCiB,YAAYjB,OAAO,aAAa,CAAC,EAEjCkB,wBAAwBlB,OAAO,yBAAyB,IAAI,EAC5DmB,sBAAsBnB,OAAO,uBAAuB,SAAS,EAC7Do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B,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,CAAClC,WAAW,SAAS,CAAC,EAC7B,OAAO0B,oBAAoBQ,KAAK,CAAClC,WAAW,SAAS,CAAC;YAExD,IAAIkC,KAAK,CAACnC,SAAS,YAAY,CAAC,EAC9B,OAAO2B,oBAAoBQ,KAAK,CAACnC,SAAS,YAAY,CAAC;YAEzD,OAAO,CAAC;QACV;IACF;IACA,MAAMqC,eAAiB5C,KAAwB,QAAQ,IAAwB,EAAE;IACjF,MAAM6C,cAAc;WAAID;WAAkB/B,YAAY,EAAE;KAAE;IAC1D,OAAO;QACL,GAAGb,IAAI;QACP,UAAU6C;IACZ;AACF"}
@@ -1,2 +1,2 @@
1
- import type { SpecPipe } from '../../../../../types';
2
- export declare const annotationPoint: SpecPipe;
1
+ import type { VChartSpecPipe } from '../../../../../types';
2
+ export declare const annotationPoint: VChartSpecPipe;
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationPoint.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationPoint.ts"],"sourcesContent":["import type { ILineChartSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { Datum, SpecPipe, 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 annotationPoint: SpecPipe = (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\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 ? dataset.filter((datum) => selector(datum, selectorPoint)) : []\n const dx = -10 - (isHorizontalBar ? (textFontSize as number) : 0) // 由于vchart tag实现问题,需要设置这个强制偏移量\n const dy = isHorizontalBar ? 0 : (textFontSize as number)\n\n return selectedData.map((datum) => {\n return {\n zIndex: ANNOTATION_Z_INDEX,\n regionRelative: true,\n coordinate: (data: Datum[]) => {\n return data.find((item) => isSubset(datum, item))\n },\n\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 }) as ILineChartSpec['markPoint']\n\n return {\n ...spec,\n markPoint,\n }\n}\n"],"names":["annotationPoint","spec","context","advancedVSeed","vseed","annotation","config","theme","annotationPointList","Array","isHorizontalBar","isBarLikeChart","defaultStyle","markPoint","selectorPoint","text","textColor","textFontSize","textFontWeight","textAlign","textBaseline","textBackgroundBorderColor","textBackgroundBorderRadius","textBackgroundBorderWidth","textBackgroundColor","textBackgroundPadding","textBackgroundVisible","offsetX","offsetY","dataset","selectedData","datum","selector","dx","dy","ANNOTATION_Z_INDEX","data","item","isSubset"],"mappings":";;;;AAOO,MAAMA,kCAA4B,CAACC,MAAMC;IAC9C,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,EAAEJ,eAAe,EAAE,GAAGK;IAC5B,MAAMG,sBAAsBC,MAAM,OAAO,CAACT,mBAAmBA,kBAAkB;QAACA;KAAgB;IAChG,MAAMU,kBAAkBC,eAAeR;IACvC,MAAMS,eAAeF,kBACjB;QACE,WAAW;QACX,cAAc;IAChB,IACA;QACE,WAAW;QACX,cAAc;IAChB;IAEJ,MAAMG,YAAYL,oBAAoB,OAAO,CAAC,CAACR;QAC7C,MAAM,EACJ,UAAUc,aAAa,EACvBC,OAAO,EAAE,EACTC,YAAYT,OAAO,aAAa,SAAS,EACzCU,e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J;IAEA,OAAO;QACL,GAAGjC,IAAI;QACPY;IACF;AACF"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationPoint.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationPoint.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'\n\nexport const annotationPoint: 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\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 ? dataset.filter((datum) => selector(datum, selectorPoint)) : []\n const dx = -10 - (isHorizontalBar ? (textFontSize as number) : 0) // 由于vchart tag实现问题,需要设置这个强制偏移量\n const dy = isHorizontalBar ? 0 : (textFontSize as number)\n\n return selectedData.map((datum) => {\n return {\n zIndex: ANNOTATION_Z_INDEX,\n regionRelative: true,\n coordinate: (data: Datum[]) => {\n return data.find((item) => isSubset(datum, item))\n },\n\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 }) as ILineChartSpec['markPoint']\n\n return {\n ...spec,\n markPoint,\n }\n}\n"],"names":["annotationPoint","spec","context","advancedVSeed","vseed","annotation","config","theme","annotationPointList","Array","isHorizontalBar","isBarLikeChart","defaultStyle","markPoint","selectorPoint","text","textColor","textFontSize","textFontWeight","textAlign","textBaseline","textBackgroundBorderColor","textBackgroundBorderRadius","textBackgroundBorderWidth","textBackgroundColor","textBackgroundPadding","textBackgroundVisible","offsetX","offsetY","dataset","selectedData","datum","selector","dx","dy","ANNOTATION_Z_INDEX","data","item","isSubset"],"mappings":";;;;AAOO,MAAMA,kCAAkC,CAACC,MAAMC;IACpD,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IACjC,MAAM,EAAEG,UAAU,EAAEC,MAAM,EAAE,GAAGH;IAE/B,IAAI,CAACE,cAA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OACJA,KAAK,IAAI,CAAC,CAACC,OAASC,SAASP,OAAOM;gBAG7C,UAAU;oBACR,SAAS;gBACX;gBACA,aAAa;oBACXT;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;4BACZe;4BACAC;wBACF;wBACA,iBAAiB;4BACf,SAASR;4BACT,SAASD;4BACT,OAAO;gCACL,SAAS;gCACT,cAAcH,8BAA8B;gCAC5C,MAAME;gCACN,QAAQH;gCACR,WAAWE;gCACXU;gCACAC;4BACF;wBACF;oBACF;gBACF;YACF;IAEJ;IAEA,OAAO;QACL,GAAGjC,IAAI;QACPY;IACF;AACF"}
@@ -1,2 +1,2 @@
1
- import type { SpecPipe } from '../../../../../types';
2
- export declare const annotationVerticalLine: SpecPipe;
1
+ import type { VChartSpecPipe } from '../../../../../types';
2
+ export declare const annotationVerticalLine: VChartSpecPipe;
@@ -23,23 +23,8 @@ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
23
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
24
  const dataset = advancedVSeed.dataset.flat();
25
25
  const generateOneMarkLine = (x)=>({
26
- positions: (datum, series)=>{
27
- const regionStart = series.getRegion()?.getLayoutStartPoint();
28
- const xAxisHelper = series.getXAxisHelper();
29
- const yAxisHelper = series.getYAxisHelper();
30
- const xPos = xAxisHelper.getScale(0).scale(x) + regionStart.x;
31
- const yRange = yAxisHelper.getScale(0).range();
32
- return [
33
- {
34
- x: xPos,
35
- y: yRange ? yRange[0] + regionStart.y : 0
36
- },
37
- {
38
- x: xPos,
39
- y: yRange ? yRange[1] + regionStart.y : 0
40
- }
41
- ];
42
- },
26
+ x,
27
+ autoRange: true,
43
28
  zIndex: ANNOTATION_Z_INDEX,
44
29
  line: {
45
30
  style: {
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.ts"],"sourcesContent":["import type { Datum, ICartesianSeries, ILineChartSpec, IMarkLineSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { SpecPipe } from 'src/types'\nimport { isArray, isNumber, isString } from 'remeda'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\n\nexport const annotationVerticalLine: SpecPipe = (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 positions: (datum: Datum[], series: ICartesianSeries) => {\n const regionStart = series.getRegion()?.getLayoutStartPoint()\n const xAxisHelper = series.getXAxisHelper()\n const yAxisHelper = series.getYAxisHelper()\n const xPos = xAxisHelper.getScale!(0).scale(x) + regionStart.x\n const yRange = yAxisHelper.getScale!(0).range()\n\n return [\n { x: xPos, y: yRange ? yRange[0] + regionStart.y : 0 },\n {\n x: xPos,\n y: yRange ? yRange[1] + regionStart.y : 0,\n },\n ]\n },\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[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","datum","series","regionStart","xAxisHelper","yAxisHelper","xPos","yRange","ANNOTATION_Z_INDEX","isArray","isString","isNumber","xValueArr","selectedData","selector","specMarkLine","newMarkLine"],"mappings":";;;AAMO,MAAMA,gDAAmC,CAACC,MAAMC;IACrD,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,EACxCW,iBAAiBX,OAAO,kBAAkB,GAAG,EAC7CY,YAAY,QAAQ,EACpBC,eAAe,KAAK,EAEpBC,YAAYd,OAAO,aAAa,SAAS,EACzCe,YAAYf,OAAO,aAAa,QAAQ,EACxCgB,cAAchB,OAAO,aAAa,IAAI,EACtCiB,YAAYjB,OAAO,aAAa,CAAC,EAEjCkB,wBAAwBlB,OAAO,yBAAyB,IAAI,EAC5DmB,sBAAsBnB,OAAO,uBAAuB,SAAS,EAC7DoB,4BAA4BpB,OAAO,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4BACT,IAAI;4BACJ,cAAcF;4BACd,MAAMF;4BACN,aAAa;4BACb,QAAQC;4BACR,WAAWE;wBACb;oBACF;gBACF;gBACA,aAAa;oBACX,SAAStB,OAAO,sBAAsB;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,iBAAiB8B,QAAQ7B,WAAY8B,SAAS9B,WAAW+B,SAAS/B,SAAS;YAC/E,MAAMgC,YAAYpC,MAAM,OAAO,CAACI,UAAUA,SAAS;gBAACA;aAAO;YAC3D,OAAOgC,UAAU,GAAG,CAACb;QACvB;QAEA,MAAMc,eAAelC,gBAAgBmB,QAAQ,MAAM,CAAC,CAACG,QAAUa,SAASb,OAAOtB,kBAAkB,EAAE;QAEnG,OAAOkC,aAAa,GAAG,CAAC,CAACZ;YACvB,IAAIA,KAAK,CAAC7B,WAAW,SAAS,CAAC,EAC7B,OAAO2B,oBAAoBE,KAAK,CAAC7B,WAAW,SAAS,CAAC;YAExD,IAAI6B,KAAK,CAAC5B,SAAS,YAAY,CAAC,EAC9B,OAAO0B,oBAAoBE,KAAK,CAAC5B,SAAS,YAAY,CAAC;YAEzD,OAAO,CAAC;QACV;IACF;IAEA,MAAM0C,eAAiBlD,KAAwB,QAAQ,IAAwB,EAAE;IACjF,MAAMmD,cAAc;WAAID;WAAkBrC,YAAY,EAAE;KAAE;IAE1D,OAAO;QACL,GAAGb,IAAI;QACP,UAAUmD;IACZ;AACF"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js","sources":["webpack://@visactor/vseed/./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,E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,aAAa;oBACX,SAAStB,OAAO,sBAAsB;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,2 +1,2 @@
1
- import type { SpecPipe } from '../../../../../types';
2
- export declare const splitLine: SpecPipe;
1
+ import type { VChartSpecPipe } from '../../../../../types';
2
+ export declare const splitLine: VChartSpecPipe;
@@ -171,11 +171,11 @@ const splitLine = (spec, context)=>{
171
171
  if (!seriesSpec.point.style) seriesSpec.point.style = {};
172
172
  if (!seriesSpec.line.style) seriesSpec.line.style = {};
173
173
  const measureValueKey = datasetReshapeInfo[0].foldInfo.measureValue;
174
- seriesSpec.point.style.fill = (datum)=>datum?.[measureValueKey] >= splitValue ? colorConfig.positiveColor : colorConfig.negativeColor;
175
- seriesSpec.line.style.stroke = (datum)=>datum?.[measureValueKey] >= splitValue ? colorConfig.positiveColor : colorConfig.negativeColor;
174
+ seriesSpec.point.style.fill = (datum)=>datum?.[measureValueKey] < splitValue ? colorConfig.negativeColor : colorConfig.positiveColor;
175
+ seriesSpec.line.style.stroke = (datum)=>datum?.[measureValueKey] < splitValue ? colorConfig.negativeColor : colorConfig.positiveColor;
176
176
  if (seriesSpec.label && seriesSpec.label.visible && isNullish(seriesSpec.label.style?.fill)) seriesSpec.label.style = {
177
177
  ...seriesSpec.label.style,
178
- fill: (datum)=>datum?.[measureValueKey] >= splitValue ? colorConfig.positiveColor : colorConfig.negativeColor
178
+ fill: (datum)=>datum?.[measureValueKey] < splitValue ? colorConfig.negativeColor : colorConfig.positiveColor
179
179
  };
180
180
  }
181
181
  return result;