@visactor/vseed 0.1.43 → 0.1.44

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 (213) hide show
  1. package/dist/cjs/index.cjs +3 -3
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/esm/builder/builder/builder.d.ts +4380 -0
  4. package/dist/esm/dataSelector/selector.d.ts +1 -1
  5. package/dist/esm/dataSelector/selector.js +1 -2
  6. package/dist/esm/dataSelector/selector.js.map +1 -1
  7. package/dist/esm/pipeline/advanced/chart/pipeline/histogram.js +2 -0
  8. package/dist/esm/pipeline/advanced/chart/pipeline/histogram.js.map +1 -1
  9. package/dist/esm/pipeline/advanced/chart/pipes/config/histogram.d.ts +1 -0
  10. package/dist/esm/pipeline/advanced/chart/pipes/config/histogram.js +35 -2
  11. package/dist/esm/pipeline/advanced/chart/pipes/config/histogram.js.map +1 -1
  12. package/dist/esm/pipeline/advanced/chart/pipes/regressionLine/regressionLine.js +1 -1
  13. package/dist/esm/pipeline/advanced/chart/pipes/regressionLine/regressionLine.js.map +1 -1
  14. package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithHistogramEncoding.js +22 -2
  15. package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithHistogramEncoding.js.map +1 -1
  16. package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithHistogramEncoding.js +22 -3
  17. package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithHistogramEncoding.js.map +1 -1
  18. package/dist/esm/pipeline/advanced/table/pipeline/pivotTable.js +3 -2
  19. package/dist/esm/pipeline/advanced/table/pipeline/pivotTable.js.map +1 -1
  20. package/dist/esm/pipeline/advanced/table/pipeline/table.js +2 -1
  21. package/dist/esm/pipeline/advanced/table/pipeline/table.js.map +1 -1
  22. package/dist/esm/pipeline/advanced/table/pipes/{default/defaultMeasureName.d.ts → cellStyle/cellStyle.d.ts} +1 -1
  23. package/dist/esm/pipeline/advanced/table/pipes/cellStyle/cellStyle.js +16 -0
  24. package/dist/esm/pipeline/advanced/table/pipes/cellStyle/cellStyle.js.map +1 -0
  25. package/dist/esm/pipeline/advanced/table/pipes/cellStyle/index.d.ts +1 -0
  26. package/dist/esm/pipeline/advanced/table/pipes/cellStyle/index.js +2 -0
  27. package/dist/esm/pipeline/advanced/table/pipes/default/defaultMeasureId.d.ts +2 -0
  28. package/dist/esm/pipeline/advanced/table/pipes/default/{defaultMeasureName.js → defaultMeasureId.js} +5 -5
  29. package/dist/esm/pipeline/advanced/table/pipes/default/defaultMeasureId.js.map +1 -0
  30. package/dist/esm/pipeline/advanced/table/pipes/default/index.d.ts +1 -1
  31. package/dist/esm/pipeline/advanced/table/pipes/default/index.js +2 -2
  32. package/dist/esm/pipeline/advanced/table/pipes/index.d.ts +1 -0
  33. package/dist/esm/pipeline/advanced/table/pipes/index.js +1 -0
  34. package/dist/esm/pipeline/spec/chart/pipeline/histogram.js.map +1 -1
  35. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationArea.js +2 -0
  36. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationArea.js.map +1 -1
  37. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationAreaBand.js +2 -0
  38. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationAreaBand.js.map +1 -1
  39. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.js +22 -3
  40. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.js.map +1 -1
  41. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPoint.js +2 -0
  42. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPoint.js.map +1 -1
  43. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js +20 -1
  44. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js.map +1 -1
  45. package/dist/esm/pipeline/spec/chart/pipes/annotation/splitLine.js +23 -7
  46. package/dist/esm/pipeline/spec/chart/pipes/annotation/splitLine.js.map +1 -1
  47. package/dist/esm/pipeline/spec/chart/pipes/axes/xBand.js +2 -1
  48. package/dist/esm/pipeline/spec/chart/pipes/axes/xBand.js.map +1 -1
  49. package/dist/esm/pipeline/spec/chart/pipes/axes/xLinear.js +2 -1
  50. package/dist/esm/pipeline/spec/chart/pipes/axes/xLinear.js.map +1 -1
  51. package/dist/esm/pipeline/spec/chart/pipes/axes/yBand.js +2 -1
  52. package/dist/esm/pipeline/spec/chart/pipes/axes/yBand.js.map +1 -1
  53. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinear.js +2 -1
  54. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinear.js.map +1 -1
  55. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearPrimary.js +2 -1
  56. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearPrimary.js.map +1 -1
  57. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearSecondary.js +2 -1
  58. package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearSecondary.js.map +1 -1
  59. package/dist/esm/pipeline/spec/chart/pipes/init/histogram.js +4 -0
  60. package/dist/esm/pipeline/spec/chart/pipes/init/histogram.js.map +1 -1
  61. package/dist/esm/pipeline/spec/chart/pipes/label/label.js +2 -1
  62. package/dist/esm/pipeline/spec/chart/pipes/label/label.js.map +1 -1
  63. package/dist/esm/pipeline/spec/chart/pipes/legend/discreteLegend.js +1 -1
  64. package/dist/esm/pipeline/spec/chart/pipes/legend/discreteLegend.js.map +1 -1
  65. package/dist/esm/pipeline/spec/chart/pipes/legend/pivotDiscreteLegend.js +1 -0
  66. package/dist/esm/pipeline/spec/chart/pipes/legend/pivotDiscreteLegend.js.map +1 -1
  67. package/dist/esm/pipeline/spec/chart/pipes/markStyle/barStyle.js +5 -7
  68. package/dist/esm/pipeline/spec/chart/pipes/markStyle/barStyle.js.map +1 -1
  69. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotAxisStyle.js +23 -6
  70. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotAxisStyle.js.map +1 -1
  71. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotGridStyle.js +39 -34
  72. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotGridStyle.js.map +1 -1
  73. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotIndicators.js +10 -3
  74. package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotIndicators.js.map +1 -1
  75. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/ecdfRegressionLine.js +1 -1
  76. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/ecdfRegressionLine.js.map +1 -1
  77. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/kdeRegressionLine.js +1 -1
  78. package/dist/esm/pipeline/spec/chart/pipes/regressionLine/kdeRegressionLine.js.map +1 -1
  79. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.js +4 -2
  80. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.js.map +1 -1
  81. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipBoxplot.js +2 -0
  82. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipBoxplot.js.map +1 -1
  83. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js +2 -0
  84. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js.map +1 -1
  85. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHeatmap.js +2 -0
  86. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHeatmap.js.map +1 -1
  87. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHistogram.js +2 -0
  88. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHistogram.js.map +1 -1
  89. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipScatter.js +2 -0
  90. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipScatter.js.map +1 -1
  91. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipStyle.d.ts +3 -0
  92. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipStyle.js +31 -0
  93. package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipStyle.js.map +1 -0
  94. package/dist/esm/pipeline/spec/table/pipeline/pivotTable.js +3 -2
  95. package/dist/esm/pipeline/spec/table/pipeline/pivotTable.js.map +1 -1
  96. package/dist/esm/pipeline/spec/table/pipeline/table.js +3 -2
  97. package/dist/esm/pipeline/spec/table/pipeline/table.js.map +1 -1
  98. package/dist/esm/pipeline/spec/table/pipes/cellStyle/common.d.ts +2 -0
  99. package/dist/esm/pipeline/spec/table/pipes/cellStyle/common.js +14 -0
  100. package/dist/esm/pipeline/spec/table/pipes/cellStyle/common.js.map +1 -0
  101. package/dist/esm/pipeline/spec/table/pipes/cellStyle/index.d.ts +2 -0
  102. package/dist/esm/pipeline/spec/table/pipes/cellStyle/index.js +2 -0
  103. package/dist/esm/pipeline/spec/table/pipes/cellStyle/pivot.d.ts +2 -0
  104. package/dist/esm/pipeline/spec/table/pipes/cellStyle/pivot.js +49 -0
  105. package/dist/esm/pipeline/spec/table/pipes/cellStyle/pivot.js.map +1 -0
  106. package/dist/esm/pipeline/spec/table/pipes/cellStyle/table.d.ts +2 -0
  107. package/dist/esm/pipeline/spec/table/pipes/cellStyle/table.js +41 -0
  108. package/dist/esm/pipeline/spec/table/pipes/cellStyle/table.js.map +1 -0
  109. package/dist/esm/pipeline/spec/table/pipes/index.d.ts +1 -0
  110. package/dist/esm/pipeline/spec/table/pipes/index.js +1 -0
  111. package/dist/esm/pipeline/spec/table/pipes/rows/pivotRows.js +13 -3
  112. package/dist/esm/pipeline/spec/table/pipes/rows/pivotRows.js.map +1 -1
  113. package/dist/esm/pipeline/utils/constant.d.ts +3 -1
  114. package/dist/esm/pipeline/utils/constant.js +4 -2
  115. package/dist/esm/pipeline/utils/constant.js.map +1 -1
  116. package/dist/esm/pipeline/utils/measures/depth.js.map +1 -1
  117. package/dist/esm/pipeline/utils/measures/find.js.map +1 -1
  118. package/dist/esm/pipeline/utils/tree/traverse.d.ts +1 -11
  119. package/dist/esm/pipeline/utils/tree/traverse.js +3 -4
  120. package/dist/esm/pipeline/utils/tree/traverse.js.map +1 -1
  121. package/dist/esm/theme/common/axes.js +2 -2
  122. package/dist/esm/theme/common/axes.js.map +1 -1
  123. package/dist/esm/theme/common/table.d.ts +30 -22
  124. package/dist/esm/theme/common/table.js +12 -2
  125. package/dist/esm/theme/common/table.js.map +1 -1
  126. package/dist/esm/theme/common/tooltip.d.ts +3 -2
  127. package/dist/esm/theme/common/tooltip.js +24 -2
  128. package/dist/esm/theme/common/tooltip.js.map +1 -1
  129. package/dist/esm/theme/dark/dark.js +2 -2
  130. package/dist/esm/theme/dark/dark.js.map +1 -1
  131. package/dist/esm/theme/light/light.js +2 -2
  132. package/dist/esm/theme/light/light.js.map +1 -1
  133. package/dist/esm/types/advancedVSeed.d.ts +3442 -0
  134. package/dist/esm/types/advancedVSeed.js +2 -0
  135. package/dist/esm/types/advancedVSeed.js.map +1 -1
  136. package/dist/esm/types/chartType/area/zArea.d.ts +80 -0
  137. package/dist/esm/types/chartType/areaPercent/zAreaPercent.d.ts +80 -0
  138. package/dist/esm/types/chartType/bar/zBar.d.ts +80 -0
  139. package/dist/esm/types/chartType/barParallel/zBarParallel.d.ts +80 -0
  140. package/dist/esm/types/chartType/barPercent/zBarPercent.d.ts +80 -0
  141. package/dist/esm/types/chartType/boxplot/zBoxplot.d.ts +80 -0
  142. package/dist/esm/types/chartType/column/zColumn.d.ts +82 -0
  143. package/dist/esm/types/chartType/columnParallel/zColumnParallel.d.ts +80 -0
  144. package/dist/esm/types/chartType/columnPercent/zColumnPercent.d.ts +80 -0
  145. package/dist/esm/types/chartType/donut/zDonut.d.ts +80 -0
  146. package/dist/esm/types/chartType/dualAxis/zDualAxis.d.ts +80 -0
  147. package/dist/esm/types/chartType/funnel/zFunnel.d.ts +80 -0
  148. package/dist/esm/types/chartType/heatmap/zHeatmap.d.ts +80 -0
  149. package/dist/esm/types/chartType/histogram/histogram.d.ts +2 -2
  150. package/dist/esm/types/chartType/histogram/zHistogram.d.ts +88 -4
  151. package/dist/esm/types/chartType/histogram/zHistogram.js +2 -2
  152. package/dist/esm/types/chartType/histogram/zHistogram.js.map +1 -1
  153. package/dist/esm/types/chartType/line/zLine.d.ts +80 -0
  154. package/dist/esm/types/chartType/pie/zPie.d.ts +80 -0
  155. package/dist/esm/types/chartType/pivotTable/pivotTable.d.ts +5 -1
  156. package/dist/esm/types/chartType/pivotTable/zPivotTable.d.ts +76 -0
  157. package/dist/esm/types/chartType/pivotTable/zPivotTable.js +2 -1
  158. package/dist/esm/types/chartType/pivotTable/zPivotTable.js.map +1 -1
  159. package/dist/esm/types/chartType/radar/zRadar.d.ts +80 -0
  160. package/dist/esm/types/chartType/rose/zRose.d.ts +80 -0
  161. package/dist/esm/types/chartType/roseParallel/zRoseParallel.d.ts +80 -0
  162. package/dist/esm/types/chartType/scatter/zScatter.d.ts +88 -0
  163. package/dist/esm/types/chartType/table/table.d.ts +5 -1
  164. package/dist/esm/types/chartType/table/zTable.d.ts +76 -0
  165. package/dist/esm/types/chartType/table/zTable.js +2 -1
  166. package/dist/esm/types/chartType/table/zTable.js.map +1 -1
  167. package/dist/esm/types/properties/cellStyle/bodyCellStyle.d.ts +138 -0
  168. package/dist/esm/types/properties/cellStyle/bodyCellStyle.js +16 -0
  169. package/dist/esm/types/properties/cellStyle/bodyCellStyle.js.map +1 -0
  170. package/dist/esm/types/properties/cellStyle/cellStyle.d.ts +80 -0
  171. package/dist/esm/types/properties/cellStyle/cellStyle.js +8 -0
  172. package/dist/esm/types/properties/cellStyle/cellStyle.js.map +1 -0
  173. package/dist/esm/types/properties/cellStyle/index.d.ts +1 -0
  174. package/dist/esm/types/properties/cellStyle/index.js +1 -0
  175. package/dist/esm/types/properties/config/area.d.ts +164 -0
  176. package/dist/esm/types/properties/config/bar.d.ts +246 -0
  177. package/dist/esm/types/properties/config/boxplot.d.ts +82 -0
  178. package/dist/esm/types/properties/config/column.d.ts +258 -0
  179. package/dist/esm/types/properties/config/config.d.ts +1676 -0
  180. package/dist/esm/types/properties/config/dualAxis.d.ts +82 -0
  181. package/dist/esm/types/properties/config/funnel.d.ts +82 -0
  182. package/dist/esm/types/properties/config/heatmap.d.ts +82 -0
  183. package/dist/esm/types/properties/config/histogram.d.ts +94 -0
  184. package/dist/esm/types/properties/config/label/label.d.ts +5 -0
  185. package/dist/esm/types/properties/config/label/zLabel.d.ts +69 -0
  186. package/dist/esm/types/properties/config/label/zLabel.js +6 -1
  187. package/dist/esm/types/properties/config/label/zLabel.js.map +1 -1
  188. package/dist/esm/types/properties/config/label/zPieLabel.d.ts +69 -0
  189. package/dist/esm/types/properties/config/line.d.ts +82 -0
  190. package/dist/esm/types/properties/config/pie.d.ts +246 -0
  191. package/dist/esm/types/properties/config/pivotGrid/pivotGrid.d.ts +2 -0
  192. package/dist/esm/types/properties/config/pivotGrid/pivotGrid.js +3 -1
  193. package/dist/esm/types/properties/config/pivotGrid/pivotGrid.js.map +1 -1
  194. package/dist/esm/types/properties/config/rose.d.ts +164 -0
  195. package/dist/esm/types/properties/config/scatter.d.ts +94 -0
  196. package/dist/esm/types/properties/config/tooltip/tooltip.d.ts +12 -0
  197. package/dist/esm/types/properties/config/tooltip/tooltip.js +12 -1
  198. package/dist/esm/types/properties/config/tooltip/tooltip.js.map +1 -1
  199. package/dist/esm/types/properties/index.d.ts +1 -0
  200. package/dist/esm/types/properties/index.js +1 -0
  201. package/dist/esm/types/properties/markStyle/barStyle.d.ts +5 -0
  202. package/dist/esm/types/properties/markStyle/barStyle.js.map +1 -1
  203. package/dist/esm/types/properties/regressionLine/ecdfRegressionLine.d.ts +4 -0
  204. package/dist/esm/types/properties/regressionLine/kdeRegressionLine.d.ts +4 -0
  205. package/dist/esm/types/properties/regressionLine/zRegressionLine.d.ts +18 -0
  206. package/dist/esm/types/properties/regressionLine/zRegressionLine.js +1 -0
  207. package/dist/esm/types/properties/regressionLine/zRegressionLine.js.map +1 -1
  208. package/dist/esm/types/properties/theme/customTheme.d.ts +3352 -0
  209. package/dist/esm/types/zVseed.d.ts +1890 -124
  210. package/dist/umd/index.js +726 -349
  211. package/dist/umd/index.js.map +1 -1
  212. package/package.json +3 -3
  213. package/dist/esm/pipeline/advanced/table/pipes/default/defaultMeasureName.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/axes/xLinear.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/xLinear.ts"],"sourcesContent":["import type { ISpec } from '@visactor/vchart'\nimport type { SpecPipe, XLinearAxis } from 'src/types'\nimport {\n createNumFormatter,\n isAreaPercent,\n isBarPercent,\n isColumnPercent,\n LINEAR_AXIS_INNER_OFFSET_TOP,\n} from 'src/pipeline/utils'\nimport { createLinearFormat, createLinearPercentFormat } from './format/linearFormat'\nimport { defaultTitleText } from './title/defaultTitleText'\n\nexport const xLinear: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { encoding, dimensions, measures } = advancedVSeed\n const { chartType } = vseed\n const config = advancedVSeed.config?.[chartType as 'bar']?.xAxis as XLinearAxis\n\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n\n zero,\n nice,\n inverse,\n max,\n min,\n log,\n logBase = 10,\n autoFormat,\n numFormat = {},\n } = config\n\n const formatter = createNumFormatter(numFormat)\n const percentFormatter = createNumFormatter({\n type: 'percent',\n })\n\n const linearAxis = {\n visible,\n type: log ? 'log' : 'linear',\n base: logBase,\n orient: 'bottom',\n nice,\n zero: log ? false : zero,\n inverse,\n max,\n min,\n label: {\n visible: label?.visible,\n formatMethod: (value: string) => {\n if (isBarPercent(vseed) || isColumnPercent(vseed) || isAreaPercent(vseed)) {\n return createLinearPercentFormat(value, autoFormat, numFormat, formatter, percentFormatter)\n }\n return createLinearFormat(value, autoFormat, numFormat, formatter)\n },\n style: {\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.x as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n lineDash: grid?.gridLineDash,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n innerOffset: {\n right: LINEAR_AXIS_INNER_OFFSET_TOP,\n // left: LINEAR_AXIS_INNER_OFFSET_TOP,\n },\n }\n\n result.axes = [...result.axes, linearAxis] as ISpec['axes']\n\n return result\n}\n"],"names":["xLinear","spec","context","result","advancedVSeed","vseed","encoding","dimensions","measures","chartType","config","visible","label","tick","title","grid","line","zero","nice","inverse","max","min","log","logBase","autoFormat","numFormat","formatter","createNumFormatter","percentFormatter","linearAxis","value","isBarPercent","isColumnPercent","isAreaPercent","createLinearPercentFormat","createLinearFormat","defaultTitleText","LINEAR_AXIS_INNER_OFFSET_TOP"],"mappings":";;;AAYO,MAAMA,UAAoB,CAACC,MAAMC;IACtC,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,QAAQ,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGJ;IAC3C,MAAM,EAAEK,SAAS,EAAE,GAAGJ;IACtB,MAAMK,SAASN,cAAc,MAAM,EAAE,CAACK,UAAmB,EAAE;IAE3D,IAAI,CAACN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WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,aAAa;YACX,OAAOqB;QAET;IACF;IAEAlC,OAAO,IAAI,GAAG;WAAIA,OAAO,IAAI;QAAE0B;KAAW;IAE1C,OAAO1B;AACT"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/axes/xLinear.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/xLinear.ts"],"sourcesContent":["import type { ISpec } from '@visactor/vchart'\nimport type { SpecPipe, XLinearAxis } from 'src/types'\nimport {\n AXIS_LABEL_SPACE,\n createNumFormatter,\n isAreaPercent,\n isBarPercent,\n isColumnPercent,\n LINEAR_AXIS_INNER_OFFSET_TOP,\n} from 'src/pipeline/utils'\nimport { createLinearFormat, createLinearPercentFormat } from './format/linearFormat'\nimport { defaultTitleText } from './title/defaultTitleText'\n\nexport const xLinear: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { encoding, dimensions, measures } = advancedVSeed\n const { chartType } = vseed\n const config = advancedVSeed.config?.[chartType as 'bar']?.xAxis as XLinearAxis\n\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n\n zero,\n nice,\n inverse,\n max,\n min,\n log,\n logBase = 10,\n autoFormat,\n numFormat = {},\n } = config\n\n const formatter = createNumFormatter(numFormat)\n const percentFormatter = createNumFormatter({\n type: 'percent',\n })\n\n const linearAxis = {\n visible,\n type: log ? 'log' : 'linear',\n base: logBase,\n orient: 'bottom',\n nice,\n zero: log ? false : zero,\n inverse,\n max,\n min,\n label: {\n space: AXIS_LABEL_SPACE,\n visible: label?.visible,\n formatMethod: (value: string) => {\n if (isBarPercent(vseed) || isColumnPercent(vseed) || isAreaPercent(vseed)) {\n return createLinearPercentFormat(value, autoFormat, numFormat, formatter, percentFormatter)\n }\n return createLinearFormat(value, autoFormat, numFormat, formatter)\n },\n style: {\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.x as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n lineDash: grid?.gridLineDash,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n innerOffset: {\n right: LINEAR_AXIS_INNER_OFFSET_TOP,\n // left: LINEAR_AXIS_INNER_OFFSET_TOP,\n },\n }\n\n result.axes = [...result.axes, linearAxis] as ISpec['axes']\n\n return result\n}\n"],"names":["xLinear","spec","context","result","advancedVSeed","vseed","encoding","dimensions","measures","chartType","config","visible","label","tick","title","grid","line","zero","nice","inverse","max","min","log","logBase","autoFormat","numFormat","formatter","createNumFormatter","percentFormatter","linearAxis","AXIS_LABEL_SPACE","value","isBarPercent","isColumnPercent","isAreaPercent","createLinearPercentFormat","createLinearFormat","defaultTitleText","LINEAR_AXIS_INNER_OFFSET_TOP"],"mappings":";;;AAaO,MAAMA,UAAoB,CAACC,MAAMC;IACtC,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,QAAQ,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGJ;IAC3C,MAAM,EAAEK,SAAS,EAAE,GAAGJ;IACtB,MAAMK,SAASN,cAAc,MAAM,EAAE,CAACK,UAAmB,EAAE;IAE3D,IAAI,CAACN,OAAO,IAAI,EACdA,OAAO,IAAI,GAAG,EAAE;IAGlB,MAAM,EACJQ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QACA,aAAa;YACX,OAAOsB;QAET;IACF;IAEAnC,OAAO,IAAI,GAAG;WAAIA,OAAO,IAAI;QAAE0B;KAAW;IAE1C,OAAO1B;AACT"}
@@ -1,4 +1,5 @@
1
1
  import { defaultTitleText } from "./title/defaultTitleText.js";
2
+ import { AXIS_LABEL_SPACE } from "../../../../utils/index.js";
2
3
  const yBand = (spec, context)=>{
3
4
  const result = {
4
5
  ...spec
@@ -21,7 +22,7 @@ const yBand = (spec, context)=>{
21
22
  visible: label?.visible,
22
23
  flush: true,
23
24
  containerAlign: 'right',
24
- space: 8,
25
+ space: AXIS_LABEL_SPACE,
25
26
  style: {
26
27
  maxLineWidth: labelAutoLimitLength,
27
28
  fill: label?.labelColor,
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/axes/yBand.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/yBand.ts"],"sourcesContent":["import type { ICartesianBandAxisSpec, ISpec } from '@visactor/vchart'\nimport type { SpecPipe, XBandAxis } from 'src/types'\nimport { defaultTitleText } from './title/defaultTitleText'\n\nexport const yBand: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { measures, dimensions, encoding } = advancedVSeed\n const config = advancedVSeed.config?.[chartType as 'bar']?.yAxis as XBandAxis\n\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n labelAutoHide,\n labelAutoHideGap,\n labelAutoLimit,\n labelAutoLimitLength = 80,\n labelAutoRotate,\n labelAutoRotateAngleRange,\n } = config\n\n const sampling = !(labelAutoHide || labelAutoRotate || labelAutoLimit)\n\n const bandAxis = {\n visible,\n type: 'band',\n orient: 'left',\n maxWidth: labelAutoLimitLength + 60,\n sampling,\n hover: true,\n label: {\n visible: label?.visible,\n flush: true,\n containerAlign: 'right',\n space: 8,\n style: {\n maxLineWidth: labelAutoLimitLength,\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n // 防重叠相关\n minGap: labelAutoHideGap,\n autoHide: labelAutoHide,\n autoHideMethod: 'greedy',\n autoHideSeparation: labelAutoHideGap,\n autoLimit: labelAutoLimit,\n autoRotate: labelAutoRotate,\n autoRotateAngle: labelAutoRotateAngleRange,\n lastVisible: true,\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n lineDash: grid?.gridLineDash,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n paddingInner: [0.15, 0.1],\n paddingOuter: [0.075, 0.1],\n } as ICartesianBandAxisSpec\n\n result.axes = [...result.axes, bandAxis] as ISpec['axes']\n return result\n}\n"],"names":["yBand","spec","context","result","advancedVSeed","vseed","chartType","measures","dimensions","encoding","config","visible","label","tick","title","grid","line","labelAutoHide","labelAutoHideGap","labelAutoLimit","labelAutoLimitLength","labelAutoRotate","labelAutoRotateAngleRange","sampling","bandAxis","defaultTitleText"],"mappings":";AAIO,MAAMA,QAAkB,CAACC,MAAMC;IACpC,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IACtB,MAAM,EAAEE,QAAQ,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGL;IAC3C,MAAMM,SAASN,cAAc,MAAM,EAAE,CAACE,UAAmB,EAAE;IAE3D,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AEAb,OAAO,IAAI,GAAG;WAAIA,OAAO,IAAI;QAAEqB;KAAS;IACxC,OAAOrB;AACT"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/axes/yBand.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/yBand.ts"],"sourcesContent":["import type { ICartesianBandAxisSpec, ISpec } from '@visactor/vchart'\nimport type { SpecPipe, XBandAxis } from 'src/types'\nimport { defaultTitleText } from './title/defaultTitleText'\nimport { AXIS_LABEL_SPACE } from 'src/pipeline/utils'\n\nexport const yBand: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { measures, dimensions, encoding } = advancedVSeed\n const config = advancedVSeed.config?.[chartType as 'bar']?.yAxis as XBandAxis\n\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n labelAutoHide,\n labelAutoHideGap,\n labelAutoLimit,\n labelAutoLimitLength = 80,\n labelAutoRotate,\n labelAutoRotateAngleRange,\n } = config\n\n const sampling = !(labelAutoHide || labelAutoRotate || labelAutoLimit)\n\n const bandAxis = {\n visible,\n type: 'band',\n orient: 'left',\n maxWidth: labelAutoLimitLength + 60,\n sampling,\n hover: true,\n label: {\n visible: label?.visible,\n flush: true,\n containerAlign: 'right',\n space: AXIS_LABEL_SPACE,\n style: {\n maxLineWidth: labelAutoLimitLength,\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n // 防重叠相关\n minGap: labelAutoHideGap,\n autoHide: labelAutoHide,\n autoHideMethod: 'greedy',\n autoHideSeparation: labelAutoHideGap,\n autoLimit: labelAutoLimit,\n autoRotate: labelAutoRotate,\n autoRotateAngle: labelAutoRotateAngleRange,\n lastVisible: true,\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n lineDash: grid?.gridLineDash,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n paddingInner: [0.15, 0.1],\n paddingOuter: [0.075, 0.1],\n } as ICartesianBandAxisSpec\n\n result.axes = [...result.axes, bandAxis] as ISpec['axes']\n return result\n}\n"],"names":["yBand","spec","context","result","advancedVSeed","vseed","chartType","measures","dimensions","encoding","config","visible","label","tick","title","grid","line","labelAutoHide","labelAutoHideGap","labelAutoLimit","labelAutoLimitLength","labelAutoRotate","labelAutoRotateAngleRange","sampling","bandAxis","AXIS_LABEL_SPACE","defaultTitleText"],"mappings":";;AAKO,MAAMA,QAAkB,CAACC,MAAMC;IACpC,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IACtB,MAAM,EAAEE,QAAQ,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGL;IAC3C,MAAMM,SAASN,cAAc,MAAM,EAAE,CAACE,UAAmB,EAAE;IAE3D,IAAI,CAACH,OAAO,IAAI,EACdA,OAAO,IAAI,GAAG,EAAE;IAGlB,MAAM,EACJQ,UAAU,IAAI,EACdC,KAAK,EACLC,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,IAAI,EACJC,aAAa,EACbC,gBAAgB,EAChBC,cAAc,EACdC,uBAAuB,EAAE,EACzBC,eAAe,EACfC,yBAAyB,EAC1B,GAAGZ;IAEJ,MAAMa,WAAW,CAAEN,CAAAA,iBAAiBI,mBAAmBF,cAAa;IAEpE,MAAMK,WAAW;QACfb;QACA,MAAM;QACN,QAAQ;QACR,UAAUS,uBAAuB;QACjCG;QACA,OAAO;QACP,OAAO;YACL,SAASX,OAAO;YAChB,OAAO;YACP,gBAAgB;YAChB,OAAOa;YACP,OAAO;gBACL,cAAcL;gBACd,MAAMR,OAAO;gBACb,OAAOA,OAAO;gBACd,UAAUA,OAAO;gBACjB,YAAYA,OAAO;YACrB;YAEA,QAAQM;YACR,UAAUD;YACV,gBAAgB;YAChB,oBAAoBC;YACpB,WAAWC;YACX,YAAYE;YACZ,iBAAiBC;YACjB,aAAa;QACf;QACA,OAAO;YACL,SAASR,OAAO;YAChB,MAAMA,OAAO,aAAaY,iBAAiBnB,UAAUC,YAAYC,SAAS,CAAC;YAC3E,OAAO;gBACL,MAAMK,OAAO;gBACb,UAAUA,OAAO;gBACjB,YAAYA,OAAO;YACrB;QACF;QACA,MAAM;YACJ,SAASD,MAAM;YACf,UAAUA,MAAM;YAChB,QAAQA,MAAM;YACd,OAAO;gBACL,QAAQA,MAAM;YAChB;QACF;QACA,MAAM;YACJ,SAASE,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;gBACd,UAAUA,MAAM;YAClB;QACF;QACA,YAAY;YACV,SAASC,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,cAAc;YAAC;YAAM;SAAI;QACzB,cAAc;YAAC;YAAO;SAAI;IAC5B;IAEAb,OAAO,IAAI,GAAG;WAAIA,OAAO,IAAI;QAAEqB;KAAS;IACxC,OAAOrB;AACT"}
@@ -1,4 +1,4 @@
1
- import { LINEAR_AXIS_INNER_OFFSET_TOP, createNumFormatter, isAreaPercent, isBarPercent, isColumnPercent } from "../../../../utils/index.js";
1
+ import { AXIS_LABEL_SPACE, LINEAR_AXIS_INNER_OFFSET_TOP, createNumFormatter, isAreaPercent, isBarPercent, isColumnPercent } from "../../../../utils/index.js";
2
2
  import { createLinearFormat, createLinearPercentFormat } from "./format/linearFormat.js";
3
3
  import { defaultTitleText } from "./title/defaultTitleText.js";
4
4
  const yLinear = (spec, context)=>{
@@ -26,6 +26,7 @@ const yLinear = (spec, context)=>{
26
26
  max,
27
27
  min,
28
28
  label: {
29
+ space: AXIS_LABEL_SPACE,
29
30
  visible: label?.visible,
30
31
  formatMethod: (value)=>{
31
32
  if (isBarPercent(vseed) || isColumnPercent(vseed) || isAreaPercent(vseed)) return createLinearPercentFormat(value, autoFormat, numFormat, formatter, percentFormatter);
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/axes/yLinear.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/yLinear.ts"],"sourcesContent":["import type { ISpec } from '@visactor/vchart'\nimport {\n createNumFormatter,\n isAreaPercent,\n isBarPercent,\n isColumnPercent,\n LINEAR_AXIS_INNER_OFFSET_TOP,\n} from 'src/pipeline/utils'\nimport type { SpecPipe, YLinearAxis } from 'src/types'\nimport { createLinearFormat, createLinearPercentFormat } from './format/linearFormat'\nimport { defaultTitleText } from './title/defaultTitleText'\n\nexport const yLinear: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { measures, dimensions, encoding } = advancedVSeed\n const config = advancedVSeed.config?.[chartType as 'column']?.yAxis as YLinearAxis\n\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n\n zero,\n nice,\n inverse,\n max,\n min,\n log,\n logBase = 10,\n autoFormat,\n numFormat = {},\n } = config\n\n const formatter = createNumFormatter(numFormat)\n const percentFormatter = createNumFormatter({\n type: 'percent',\n })\n\n const linearAxis = {\n visible,\n type: log ? 'log' : 'linear',\n base: logBase,\n orient: 'left',\n nice,\n zero: log ? false : zero,\n inverse,\n max,\n min,\n label: {\n visible: label?.visible,\n formatMethod: (value: string) => {\n if (isBarPercent(vseed) || isColumnPercent(vseed) || isAreaPercent(vseed)) {\n return createLinearPercentFormat(value, autoFormat, numFormat, formatter, percentFormatter)\n }\n return createLinearFormat(value, autoFormat, numFormat, formatter)\n },\n style: {\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n lineDash: grid?.gridLineDash,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n innerOffset: {\n top: LINEAR_AXIS_INNER_OFFSET_TOP,\n // bottom: LINEAR_AXIS_INNER_OFFSET_TOP,\n },\n }\n\n result.axes = [...result.axes, linearAxis] as ISpec['axes']\n\n return result\n}\n"],"names":["yLinear","spec","context","result","advancedVSeed","vseed","chartType","measures","dimensions","encoding","config","visible","label","tick","title","grid","line","zero","nice","inverse","max","min","log","logBase","autoFormat","numFormat","formatter","createNumFormatter","percentFormatter","linearAxis","value","isBarPercent","isColumnPercent","isAreaPercent","createLinearPercentFormat","createLinearFormat","defaultTitleText","LINEAR_AXIS_INNER_OFFSET_TOP"],"mappings":";;;AAYO,MAAMA,UAAoB,CAACC,MAAMC;IACtC,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IACtB,MAAM,EAAEE,QAAQ,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGL;IAC3C,MAAMM,SAAS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;YAClB;QACF;QACA,YAAY;YACV,SAASC,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,aAAa;YACX,KAAKqB;QAEP;IACF;IAEAlC,OAAO,IAAI,GAAG;WAAIA,OAAO,IAAI;QAAE0B;KAAW;IAE1C,OAAO1B;AACT"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/axes/yLinear.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/yLinear.ts"],"sourcesContent":["import type { ISpec } from '@visactor/vchart'\nimport {\n AXIS_LABEL_SPACE,\n createNumFormatter,\n isAreaPercent,\n isBarPercent,\n isColumnPercent,\n LINEAR_AXIS_INNER_OFFSET_TOP,\n} from 'src/pipeline/utils'\nimport type { SpecPipe, YLinearAxis } from 'src/types'\nimport { createLinearFormat, createLinearPercentFormat } from './format/linearFormat'\nimport { defaultTitleText } from './title/defaultTitleText'\n\nexport const yLinear: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { measures, dimensions, encoding } = advancedVSeed\n const config = advancedVSeed.config?.[chartType as 'column']?.yAxis as YLinearAxis\n\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n\n zero,\n nice,\n inverse,\n max,\n min,\n log,\n logBase = 10,\n autoFormat,\n numFormat = {},\n } = config\n\n const formatter = createNumFormatter(numFormat)\n const percentFormatter = createNumFormatter({\n type: 'percent',\n })\n\n const linearAxis = {\n visible,\n type: log ? 'log' : 'linear',\n base: logBase,\n orient: 'left',\n nice,\n zero: log ? false : zero,\n inverse,\n max,\n min,\n label: {\n space: AXIS_LABEL_SPACE,\n visible: label?.visible,\n formatMethod: (value: string) => {\n if (isBarPercent(vseed) || isColumnPercent(vseed) || isAreaPercent(vseed)) {\n return createLinearPercentFormat(value, autoFormat, numFormat, formatter, percentFormatter)\n }\n return createLinearFormat(value, autoFormat, numFormat, formatter)\n },\n style: {\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n lineDash: grid?.gridLineDash,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n innerOffset: {\n top: LINEAR_AXIS_INNER_OFFSET_TOP,\n // bottom: LINEAR_AXIS_INNER_OFFSET_TOP,\n },\n }\n\n result.axes = [...result.axes, linearAxis] as ISpec['axes']\n\n return result\n}\n"],"names":["yLinear","spec","context","result","advancedVSeed","vseed","chartType","measures","dimensions","encoding","config","visible","label","tick","title","grid","line","zero","nice","inverse","max","min","log","logBase","autoFormat","numFormat","formatter","createNumFormatter","percentFormatter","linearAxis","AXIS_LABEL_SPACE","value","isBarPercent","isColumnPercent","isAreaPercent","createLinearPercentFormat","createLinearFormat","defaultTitleText","LINEAR_AXIS_INNER_OFFSET_TOP"],"mappings":";;;AAaO,MAAMA,UAAoB,CAACC,MAAMC;IACtC,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IACtB,MAAM,EAAEE,QAAQ,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGL;IAC3C,MAAMM,SAASN,cAAc,MAAM,EAAE,CAACE,UAAsB,EAAE;IAE9D,IAAI,CAACH,OAAO,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O;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,aAAa;YACX,KAAKsB;QAEP;IACF;IAEAnC,OAAO,IAAI,GAAG;WAAIA,OAAO,IAAI;QAAE0B;KAAW;IAE1C,OAAO1B;AACT"}
@@ -1,4 +1,4 @@
1
- import { LINEAR_AXIS_INNER_OFFSET_TOP } from "../../../../utils/constant.js";
1
+ import { AXIS_LABEL_SPACE, LINEAR_AXIS_INNER_OFFSET_TOP } from "../../../../utils/constant.js";
2
2
  import { createNumFormatter } from "../../../../utils/index.js";
3
3
  import { isEmpty, isNullish } from "remeda";
4
4
  import { createLinearFormat } from "./format/linearFormat.js";
@@ -39,6 +39,7 @@ const yLinearPrimary = (spec, context)=>{
39
39
  max,
40
40
  min,
41
41
  label: {
42
+ space: AXIS_LABEL_SPACE,
42
43
  visible: label?.visible,
43
44
  formatMethod: (value)=>createLinearFormat(value, autoFormat, numFormat, formatter),
44
45
  style: {
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/axes/yLinearPrimary.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/yLinearPrimary.ts"],"sourcesContent":["import type { ISpec } from '@visactor/vchart'\nimport { LINEAR_AXIS_INNER_OFFSET_TOP } from '../../../../utils/constant'\nimport { createNumFormatter } from '../../../../utils'\nimport type { SpecPipe, YLinearAxis } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\nimport { createLinearFormat } from './format/linearFormat'\nimport { defaultTitleText } from './title/defaultTitleText'\n\nexport const yLinearPrimary: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { datasetReshapeInfo, encoding, measures, dimensions } = advancedVSeed\n const { index, id: reshapeInfoId, foldInfoList } = datasetReshapeInfo[0]\n // TODO: default config missing\n const primaryYAxis = advancedVSeed.config?.[chartType as 'dualAxis']?.primaryYAxis as YLinearAxis | YLinearAxis[]\n const yAxisConfig = Array.isArray(primaryYAxis) ? primaryYAxis[index] || primaryYAxis[0] : primaryYAxis\n const alignTicks = advancedVSeed.config?.[chartType as 'dualAxis']?.alignTicks as boolean | boolean[]\n const alignTicksConfig = Array.isArray(alignTicks) ? alignTicks[index] || alignTicks[0] : alignTicks\n\n if (isNullish(foldInfoList?.[0])) {\n return result\n }\n\n const isEmptySecondary = isEmpty(foldInfoList?.[0].foldMap)\n\n const id = `${reshapeInfoId}-primary-axis`\n const seriesIds = [`${reshapeInfoId}-primary-series`, `${reshapeInfoId}-secondary-series`]\n const seriesId = alignTicksConfig ? seriesIds : seriesIds[0]\n\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n\n zero,\n nice,\n inverse,\n max,\n min,\n log,\n logBase = 10,\n\n autoFormat,\n numFormat = {},\n } = yAxisConfig\n\n const formatter = createNumFormatter(numFormat)\n\n const linearAxis = {\n visible: isEmptySecondary ? false : visible,\n id,\n seriesId,\n\n type: log ? 'log' : 'linear',\n base: logBase,\n orient: 'left',\n nice,\n zero: log ? false : zero,\n inverse,\n max,\n min,\n label: {\n visible: label?.visible,\n formatMethod: (value: string) => {\n return createLinearFormat(value, autoFormat, numFormat, formatter)\n },\n style: {\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n lineDash: grid?.gridLineDash,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n innerOffset: {\n top: LINEAR_AXIS_INNER_OFFSET_TOP,\n // bottom: LINEAR_AXIS_INNER_OFFSET_TOP,\n },\n }\n\n result.axes = [...result.axes, linearAxis] as ISpec['axes']\n\n return result\n}\n"],"names":["yLinearPrimary","spec","context","result","advancedVSeed","vseed","chartType","datasetReshapeInfo","encoding","measures","dimensions","index","reshapeInfoId","foldInfoList","primaryYAxis","yAxisConfig","Array","alignTicks","alignTicksConfig","isNullish","isEmptySecondary","isEmpty","id","seriesIds","seriesId","visible","label","tick","title","grid","line","zero","nice","inverse","max","min","log","logBase","autoFormat","numFormat","formatter","createNumFormatter","linearAxis","value","createLinearFormat","defaultTitleText","LINEAR_AXIS_INNER_OFFSET_TOP"],"mappings":";;;;;AAQO,MAAMA,iBAA2B,CAACC,MAAMC;IAC7C,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IACtB,MAAM,EAAEE,kBAAkB,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,UAAU,EAAE,GAAGN;IAC/D,MAAM,EAAEO,KAAK,EAAE,IAAIC,aAAa,EAAEC,YAAY,EAAE,GAAGN,kBAAkB,CAAC,EAAE;IAExE,MAAMO,eAAeV,cAAc,MAAM,EAAE,CAACE,UAAwB,EAAE;IACtE,MAAMS,cAAcC,MAAM,OAAO,CAACF,gBAAgBA,YAAY,CAACH,MAAM,IAAIG,YAAY,CAAC,EAAE,GAAGA;IAC3F,MAAMG,aAAab,cAAc,MAAM,EAAE,CAACE,UAAwB,EAAE;IACpE,MAAMY,mBAAmBF,MAAM,OAAO,CAACC,cAAcA,UAAU,CAACN,MAAM,IAAIM,UAAU,CAAC,EAAE,GAAGA;IAE1F,IAAIE,UAAUN,cAAc,CAAC,EAAE,GAC7B,OAAOV;IAGT,MAAMiB,mBAAmBC,QAAQR,cAA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AAM;gBACjB,QAAQA,MAAM;gBACd,UAAUA,MAAM;YAClB;QACF;QACA,YAAY;YACV,SAASC,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,aAAa;YACX,KAAKgB;QAEP;IACF;IAEA3C,OAAO,IAAI,GAAG;WAAIA,OAAO,IAAI;QAAEuC;KAAW;IAE1C,OAAOvC;AACT"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/axes/yLinearPrimary.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/yLinearPrimary.ts"],"sourcesContent":["import type { ISpec } from '@visactor/vchart'\nimport { AXIS_LABEL_SPACE, LINEAR_AXIS_INNER_OFFSET_TOP } from '../../../../utils/constant'\nimport { createNumFormatter } from '../../../../utils'\nimport type { SpecPipe, YLinearAxis } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\nimport { createLinearFormat } from './format/linearFormat'\nimport { defaultTitleText } from './title/defaultTitleText'\n\nexport const yLinearPrimary: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { datasetReshapeInfo, encoding, measures, dimensions } = advancedVSeed\n const { index, id: reshapeInfoId, foldInfoList } = datasetReshapeInfo[0]\n // TODO: default config missing\n const primaryYAxis = advancedVSeed.config?.[chartType as 'dualAxis']?.primaryYAxis as YLinearAxis | YLinearAxis[]\n const yAxisConfig = Array.isArray(primaryYAxis) ? primaryYAxis[index] || primaryYAxis[0] : primaryYAxis\n const alignTicks = advancedVSeed.config?.[chartType as 'dualAxis']?.alignTicks as boolean | boolean[]\n const alignTicksConfig = Array.isArray(alignTicks) ? alignTicks[index] || alignTicks[0] : alignTicks\n\n if (isNullish(foldInfoList?.[0])) {\n return result\n }\n\n const isEmptySecondary = isEmpty(foldInfoList?.[0].foldMap)\n\n const id = `${reshapeInfoId}-primary-axis`\n const seriesIds = [`${reshapeInfoId}-primary-series`, `${reshapeInfoId}-secondary-series`]\n const seriesId = alignTicksConfig ? seriesIds : seriesIds[0]\n\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n\n zero,\n nice,\n inverse,\n max,\n min,\n log,\n logBase = 10,\n\n autoFormat,\n numFormat = {},\n } = yAxisConfig\n\n const formatter = createNumFormatter(numFormat)\n\n const linearAxis = {\n visible: isEmptySecondary ? false : visible,\n id,\n seriesId,\n\n type: log ? 'log' : 'linear',\n base: logBase,\n orient: 'left',\n nice,\n zero: log ? false : zero,\n inverse,\n max,\n min,\n label: {\n space: AXIS_LABEL_SPACE,\n visible: label?.visible,\n formatMethod: (value: string) => {\n return createLinearFormat(value, autoFormat, numFormat, formatter)\n },\n style: {\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n lineDash: grid?.gridLineDash,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n innerOffset: {\n top: LINEAR_AXIS_INNER_OFFSET_TOP,\n // bottom: LINEAR_AXIS_INNER_OFFSET_TOP,\n },\n }\n\n result.axes = [...result.axes, linearAxis] as ISpec['axes']\n\n return result\n}\n"],"names":["yLinearPrimary","spec","context","result","advancedVSeed","vseed","chartType","datasetReshapeInfo","encoding","measures","dimensions","index","reshapeInfoId","foldInfoList","primaryYAxis","yAxisConfig","Array","alignTicks","alignTicksConfig","isNullish","isEmptySecondary","isEmpty","id","seriesIds","seriesId","visible","label","tick","title","grid","line","zero","nice","inverse","max","min","log","logBase","autoFormat","numFormat","formatter","createNumFormatter","linearAxis","AXIS_LABEL_SPACE","value","createLinearFormat","defaultTitleText","LINEAR_AXIS_INNER_OFFSET_TOP"],"mappings":";;;;;AAQO,MAAMA,iBAA2B,CAACC,MAAMC;IAC7C,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IACtB,MAAM,EAAEE,kBAAkB,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,UAAU,EAAE,GAAGN;IAC/D,MAAM,EAAEO,KAAK,EAAE,IAAIC,aAAa,EAAEC,YAAY,EAAE,GAAGN,kBAAkB,CAAC,EAAE;IAExE,MAAMO,eAAeV,cAAc,MAAM,EAAE,CAACE,UAAwB,EAAE;IACtE,MAAMS,cAAcC,MAAM,OAAO,CAACF,gBAAgBA,YAAY,CAACH,MAAM,IAAIG,YAAY,CAAC,EAAE,GAAGA;IAC3F,MAAMG,aAAab,cAAc,MAAM,EAAE,CAACE,UAAwB,EAAE;IACpE,MAAMY,mBAAmBF,MAAM,OAAO,CAACC,cAAcA,UAAU,CAACN,MAAM,IAAIM,UAAU,CAAC,EAAE,GAAGA;IAE1F,IAAIE,UAAUN,cAAc,CAAC,EAAE,GAC7B,OAAOV;IAGT,MAAMiB,mBAAmBC,QAAQR,cAAc,CAAC,EAAE,CAAC;IAEnD,MAAMS,KAAK,GAAGV,cAAc,aAAa,CAAC;IAC1C,MAAMW,YAAY;QAAC,GAAGX,cAAc,eAAe,CAAC;QAAE,GAAGA,cAAc,iBAAiB,CAAC;KAAC;IAC1F,MAAMY,WAAWN,mBAAmBK,YAAYA,SAAS,CAAC,EAAE;IAE5D,IAAI,CAACpB,OAAO,IAAI,EACdA,OAAO,IAAI,GAAG,EAAE;IAGlB,MAAM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 @@
1
- import { LINEAR_AXIS_INNER_OFFSET_TOP } from "../../../../utils/constant.js";
1
+ import { AXIS_LABEL_SPACE, LINEAR_AXIS_INNER_OFFSET_TOP } from "../../../../utils/constant.js";
2
2
  import { createNumFormatter } from "../../../../utils/index.js";
3
3
  import { isEmpty, isNullish } from "remeda";
4
4
  import { createLinearFormat } from "./format/linearFormat.js";
@@ -45,6 +45,7 @@ const yLinearSecondary = (spec, context)=>{
45
45
  max,
46
46
  min,
47
47
  label: {
48
+ space: AXIS_LABEL_SPACE,
48
49
  visible: label?.visible,
49
50
  formatMethod: (value)=>createLinearFormat(value, autoFormat, numFormat, formatter),
50
51
  style: {
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/axes/yLinearSecondary.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/yLinearSecondary.ts"],"sourcesContent":["import type { ISpec } from '@visactor/vchart'\nimport { LINEAR_AXIS_INNER_OFFSET_TOP } from '../../../../utils/constant'\nimport { createNumFormatter } from '../../../../utils'\nimport type { SpecPipe, YLinearAxis } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\nimport { createLinearFormat } from './format/linearFormat'\nimport { defaultTitleText } from './title/defaultTitleText'\n\nexport const yLinearSecondary: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { datasetReshapeInfo, measures, dimensions, encoding } = advancedVSeed\n const { index, id: reshapeInfoId, foldInfoList } = datasetReshapeInfo[0]\n // TODO: default config missing\n const secondaryYAxis = advancedVSeed.config?.[chartType as 'dualAxis']?.secondaryYAxis as YLinearAxis | YLinearAxis[]\n const yAxisConfig = Array.isArray(secondaryYAxis) ? secondaryYAxis[index] || secondaryYAxis[0] : secondaryYAxis\n const alignTicks = advancedVSeed.config?.[chartType as 'dualAxis']?.alignTicks as boolean | boolean[]\n const alignTicksConfig = Array.isArray(alignTicks) ? alignTicks[index] || alignTicks[0] : alignTicks\n\n if (isNullish(foldInfoList?.[1])) {\n return result\n }\n\n const isEmptySecondary = isEmpty(foldInfoList?.[1].foldMap)\n const onlySecondary = isEmpty(foldInfoList?.[0].foldMap) && !isEmptySecondary\n\n const sync = {\n axisId: `${reshapeInfoId}-primary-axis`,\n zeroAlign: true,\n }\n\n const id = `${reshapeInfoId}-secondary-axis`\n const seriesIds = [`${reshapeInfoId}-primary-series`, `${reshapeInfoId}-secondary-series`]\n const seriesId = alignTicksConfig ? seriesIds : seriesIds[1]\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n\n zero,\n nice,\n inverse,\n max,\n min,\n log,\n logBase = 10,\n numFormat = {},\n autoFormat,\n } = yAxisConfig\n\n const formatter = createNumFormatter(numFormat)\n\n const linearAxis = {\n visible: isEmptySecondary ? false : visible,\n id,\n seriesId,\n sync,\n type: log ? 'log' : 'linear',\n base: logBase,\n orient: 'right',\n nice,\n zero: log ? false : zero,\n inverse,\n max,\n min,\n label: {\n visible: label?.visible,\n formatMethod: (value: string) => {\n return createLinearFormat(value, autoFormat, numFormat, formatter)\n },\n style: {\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: onlySecondary ? true : grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n lineDash: grid?.gridLineDash,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n innerOffset: {\n top: LINEAR_AXIS_INNER_OFFSET_TOP,\n // bottom: LINEAR_AXIS_INNER_OFFSET_TOP,\n },\n }\n\n result.axes = [...result.axes, linearAxis] as ISpec['axes']\n\n return result\n}\n"],"names":["yLinearSecondary","spec","context","result","advancedVSeed","vseed","chartType","datasetReshapeInfo","measures","dimensions","encoding","index","reshapeInfoId","foldInfoList","secondaryYAxis","yAxisConfig","Array","alignTicks","alignTicksConfig","isNullish","isEmptySecondary","isEmpty","onlySecondary","sync","id","seriesIds","seriesId","visible","label","tick","title","grid","line","zero","nice","inverse","max","min","log","logBase","numFormat","autoFormat","formatter","createNumFormatter","linearAxis","value","createLinearFormat","defaultTitleText","LINEAR_AXIS_INNER_OFFSET_TOP"],"mappings":";;;;;AAQO,MAAMA,mBAA6B,CAACC,MAAMC;IAC/C,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IACtB,MAAM,EAAEE,kBAAkB,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGN;IAC/D,MAAM,EAAEO,KAAK,EAAE,IAAIC,aAAa,EAAEC,YAAY,EAAE,GAAGN,kBAAkB,CAAC,EAAE;IAExE,MAAMO,iBAAiBV,cAAc,MAAM,EAAE,CAACE,UAAwB,EAAE;IACxE,MAAMS,cAAcC,MAAM,OAAO,CAACF,kBAAkBA,cAAc,CAACH,MAAM,IAAIG,cAAc,CAAC,EAAE,GAAGA;IACjG,MAAMG,aAAab,cAAc,MAAM,EAAE,CAACE,UAAwB,EAAE;IACpE,MAAMY,mBAAmBF,MAAM,OAAO,CAACC,cAAcA,UAAU,CAACN,MAAM,IAAIM,UAAU,CAAC,EAAE,GAAGA;IAE1F,IAAIE,UAAUN,cAAc,CAAC,EAAE,GAC7B,OAAOV;IAGT,MAAMiB,mBAAmBC,QAAQR,cAAc,CAAC,EAAE,CAAC;IACnD,MAAMS,gBAAgBD,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,MAAM;YACd,OAAO;gBACL,QAAQA,MAAM;YAChB;QACF;QACA,MAAM;YACJ,SAASP,gBAAgB,OAAOS,MAAM;YACtC,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;gBACd,UAAUA,MAAM;YAClB;QACF;QACA,YAAY;YACV,SAASC,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,aAAa;YACX,KAAKgB;QAEP;IACF;IAEA7C,OAAO,IAAI,GAAG;WAAIA,OAAO,IAAI;QAAEyC;KAAW;IAE1C,OAAOzC;AACT"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/axes/yLinearSecondary.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/yLinearSecondary.ts"],"sourcesContent":["import type { ISpec } from '@visactor/vchart'\nimport { AXIS_LABEL_SPACE, LINEAR_AXIS_INNER_OFFSET_TOP } from '../../../../utils/constant'\nimport { createNumFormatter } from '../../../../utils'\nimport type { SpecPipe, YLinearAxis } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\nimport { createLinearFormat } from './format/linearFormat'\nimport { defaultTitleText } from './title/defaultTitleText'\n\nexport const yLinearSecondary: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { datasetReshapeInfo, measures, dimensions, encoding } = advancedVSeed\n const { index, id: reshapeInfoId, foldInfoList } = datasetReshapeInfo[0]\n // TODO: default config missing\n const secondaryYAxis = advancedVSeed.config?.[chartType as 'dualAxis']?.secondaryYAxis as YLinearAxis | YLinearAxis[]\n const yAxisConfig = Array.isArray(secondaryYAxis) ? secondaryYAxis[index] || secondaryYAxis[0] : secondaryYAxis\n const alignTicks = advancedVSeed.config?.[chartType as 'dualAxis']?.alignTicks as boolean | boolean[]\n const alignTicksConfig = Array.isArray(alignTicks) ? alignTicks[index] || alignTicks[0] : alignTicks\n\n if (isNullish(foldInfoList?.[1])) {\n return result\n }\n\n const isEmptySecondary = isEmpty(foldInfoList?.[1].foldMap)\n const onlySecondary = isEmpty(foldInfoList?.[0].foldMap) && !isEmptySecondary\n\n const sync = {\n axisId: `${reshapeInfoId}-primary-axis`,\n zeroAlign: true,\n }\n\n const id = `${reshapeInfoId}-secondary-axis`\n const seriesIds = [`${reshapeInfoId}-primary-series`, `${reshapeInfoId}-secondary-series`]\n const seriesId = alignTicksConfig ? seriesIds : seriesIds[1]\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n\n zero,\n nice,\n inverse,\n max,\n min,\n log,\n logBase = 10,\n numFormat = {},\n autoFormat,\n } = yAxisConfig\n\n const formatter = createNumFormatter(numFormat)\n\n const linearAxis = {\n visible: isEmptySecondary ? false : visible,\n id,\n seriesId,\n sync,\n type: log ? 'log' : 'linear',\n base: logBase,\n orient: 'right',\n nice,\n zero: log ? false : zero,\n inverse,\n max,\n min,\n label: {\n space: AXIS_LABEL_SPACE,\n visible: label?.visible,\n formatMethod: (value: string) => {\n return createLinearFormat(value, autoFormat, numFormat, formatter)\n },\n style: {\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: onlySecondary ? true : grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n lineDash: grid?.gridLineDash,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n innerOffset: {\n top: LINEAR_AXIS_INNER_OFFSET_TOP,\n // bottom: LINEAR_AXIS_INNER_OFFSET_TOP,\n },\n }\n\n result.axes = [...result.axes, linearAxis] as ISpec['axes']\n\n return result\n}\n"],"names":["yLinearSecondary","spec","context","result","advancedVSeed","vseed","chartType","datasetReshapeInfo","measures","dimensions","encoding","index","reshapeInfoId","foldInfoList","secondaryYAxis","yAxisConfig","Array","alignTicks","alignTicksConfig","isNullish","isEmptySecondary","isEmpty","onlySecondary","sync","id","seriesIds","seriesId","visible","label","tick","title","grid","line","zero","nice","inverse","max","min","log","logBase","numFormat","autoFormat","formatter","createNumFormatter","linearAxis","AXIS_LABEL_SPACE","value","createLinearFormat","defaultTitleText","LINEAR_AXIS_INNER_OFFSET_TOP"],"mappings":";;;;;AAQO,MAAMA,mBAA6B,CAACC,MAAMC;IAC/C,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IACtB,MAAM,EAAEE,kBAAkB,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGN;IAC/D,MAAM,EAAEO,KAAK,EAAE,IAAIC,aAAa,EAAEC,YAAY,EAAE,GAAGN,kBAAkB,CAAC,EAAE;IAExE,MAAMO,iBAAiBV,cAAc,MAAM,EAAE,CAACE,UAAwB,EAAE;IACxE,MAAMS,cAAcC,MAAM,OAAO,CAACF,kBAAkBA,cAAc,CAACH,MAAM,IAAIG,cAAc,CAAC,EAAE,GAAGA;IACjG,MAAMG,aAAab,cAAc,MAAM,EAAE,CAACE,UAAwB,EAAE;IACpE,MAAMY,mBAAmBF,MAAM,OAAO,CAACC,cAAcA,UAAU,CAACN,MAAM,IAAIM,UAAU,CAAC,EAAE,GAAGA;IAE1F,IAAIE,UAAUN,cAAc,CAAC,EAAE,GAC7B,OAAOV;IAGT,MAAMiB,mBAAmBC,QAAQR,cAAc,CAAC,EAAE,CAAC;IACnD,M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f,UAAUA,MAAM;YAChB,QAAQA,MAAM;YACd,OAAO;gBACL,QAAQA,MAAM;YAChB;QACF;QACA,MAAM;YACJ,SAASP,gBAAgB,OAAOS,MAAM;YACtC,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;gBACd,UAAUA,MAAM;YAClB;QACF;QACA,YAAY;YACV,SAASC,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,aAAa;YACX,KAAKiB;QAEP;IACF;IAEA9C,OAAO,IAAI,GAAG;WAAIA,OAAO,IAAI;QAAEyC;KAAW;IAE1C,OAAOzC;AACT"}
@@ -13,6 +13,10 @@ const initHistogram = (spec)=>{
13
13
  clip: true
14
14
  }
15
15
  ];
16
+ result.legends = {
17
+ visible: false
18
+ };
19
+ result.barGap = 2;
16
20
  result.animation = true;
17
21
  return result;
18
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/init/histogram.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/init/histogram.ts"],"sourcesContent":["import type { IHistogramChartSpec } from '@visactor/vchart'\nimport { BinEndMeasureId, BinStartMeasureId, FoldMeasureValue } from 'src/index'\nimport type { SpecPipe } from 'src/types'\n\nexport const initHistogram: SpecPipe = (spec) => {\n const result = { ...spec } as IHistogramChartSpec\n\n // 直方图默认支持明细数据\n result.type = 'histogram'\n result.xField = BinStartMeasureId\n result.x2Field = BinEndMeasureId\n result.yField = FoldMeasureValue\n // result.seriesField = unfoldInfo.encodingColorId\n result.padding = 0\n result.region = [\n {\n clip: true,\n },\n ]\n result.animation = true\n return result\n}\n"],"names":["initHistogram","spec","result","BinStartMeasureId","BinEndMeasureId","FoldMeasureValue"],"mappings":";AAIO,MAAMA,gBAA0B,CAACC;IACtC,MAAMC,SAAS;QAAE,GAAGD,IAAI;IAAC;IAGzBC,OAAO,IAAI,GAAG;IACdA,OAAO,MAAM,GAAGC;IAChBD,OAAO,OAAO,GAAGE;IACjBF,OAAO,MAAM,GAAGG;IAEhBH,OAAO,OAAO,GAAG;IACjBA,OAAO,MAAM,GAAG;QACd;YACE,MAAM;QACR;KACD;IACDA,OAAO,SAAS,GAAG;IACnB,OAAOA;AACT"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/init/histogram.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/init/histogram.ts"],"sourcesContent":["import type { IHistogramChartSpec } from '@visactor/vchart'\nimport { BinEndMeasureId, BinStartMeasureId, FoldMeasureValue } from 'src/index'\nimport type { SpecPipe } from 'src/types'\n\nexport const initHistogram: SpecPipe = (spec) => {\n const result = { ...spec } as IHistogramChartSpec\n\n // 直方图默认支持明细数据\n result.type = 'histogram'\n result.xField = BinStartMeasureId\n result.x2Field = BinEndMeasureId\n result.yField = FoldMeasureValue\n // result.seriesField = unfoldInfo.encodingColorId\n result.padding = 0\n result.region = [\n {\n clip: true,\n },\n ]\n result.legends = {\n visible: false,\n }\n result.barGap = 2\n result.animation = true\n return result\n}\n"],"names":["initHistogram","spec","result","BinStartMeasureId","BinEndMeasureId","FoldMeasureValue"],"mappings":";AAIO,MAAMA,gBAA0B,CAACC;IACtC,MAAMC,SAAS;QAAE,GAAGD,IAAI;IAAC;IAGzBC,OAAO,IAAI,GAAG;IACdA,OAAO,MAAM,GAAGC;IAChBD,OAAO,OAAO,GAAGE;IACjBF,OAAO,MAAM,GAAGG;IAEhBH,OAAO,OAAO,GAAG;IACjBA,OAAO,MAAM,GAAG;QACd;YACE,MAAM;QACR;KACD;IACDA,OAAO,OAAO,GAAG;QACf,SAAS;IACX;IACAA,OAAO,MAAM,GAAG;IAChBA,OAAO,SAAS,GAAG;IACnB,OAAOA;AACT"}
@@ -1,5 +1,6 @@
1
1
  import { DATUM_HIDE_KEY, createFormatter, createFormatterByMeasure, findMeasureById } from "../../../../utils/index.js";
2
2
  import { isNumber, merge, uniqueBy } from "remeda";
3
+ import { selector } from "../../../../../dataSelector/index.js";
3
4
  import { MeasureId } from "../../../../../dataReshape/constant.js";
4
5
  const label_label = (spec, context)=>{
5
6
  const result = {
@@ -44,7 +45,7 @@ const buildLabel = (label, vseedMeasures = [], vseedDimensions = [], advancedVSe
44
45
  const percentFormatter = createFormatter(percentFormat);
45
46
  const result = {
46
47
  visible: enable,
47
- dataFilter: (data)=>data.filter((entry)=>entry.data?.[DATUM_HIDE_KEY] !== true),
48
+ dataFilter: (data)=>data.filter((entry)=>entry.data?.[DATUM_HIDE_KEY] !== true && selector(entry.data, label.selector, 'Or')),
48
49
  formatMethod: (_, datum)=>{
49
50
  const result = [];
50
51
  const dimLabels = labelDims.map((item)=>{
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/label/label.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/label/label.ts"],"sourcesContent":["import type { ILineChartSpec } from '@visactor/vchart'\nimport { createFormatter, createFormatterByMeasure, DATUM_HIDE_KEY, findMeasureById } from '../../../../utils'\nimport type {\n Datum,\n Dimension,\n Dimensions,\n Encoding,\n FoldInfo,\n Formatter,\n Label,\n Measure,\n Measures,\n NumFormat,\n SpecPipe,\n} from 'src/types'\nimport { isNumber, merge, uniqueBy } from 'remeda'\nimport { MeasureId } from 'src/dataReshape/constant'\n\nexport const label: SpecPipe = (spec, context) => {\n const result = { ...spec } as ILineChartSpec\n const { advancedVSeed, vseed } = context\n const { datasetReshapeInfo } = advancedVSeed\n const { chartType, encoding } = advancedVSeed\n const baseConfig = advancedVSeed.config[chartType] as { label: Label }\n const foldInfo = datasetReshapeInfo[0].foldInfo as FoldInfo\n\n const { label } = baseConfig\n\n result.label = buildLabel(\n label,\n vseed.measures,\n vseed.dimensions,\n advancedVSeed.dimensions,\n advancedVSeed.measures,\n encoding as Encoding,\n [foldInfo],\n ) as unknown as ILineChartSpec['label']\n\n return result\n}\n\nexport const generateMeasureValue = (\n value: number | string,\n measure: Measure,\n labelAutoFormat?: boolean,\n numFormat: NumFormat = {},\n) => {\n const format = merge(numFormat, measure.numFormat || measure.format)\n const mergedMeasure = { ...measure, numFormat: format, autoFormat: labelAutoFormat || measure.autoFormat }\n\n const formatter = createFormatterByMeasure(mergedMeasure)\n return formatter(value)\n}\n\nexport const generateMeasurePercent = (value: number | string, sum: number, formatter: Formatter) => {\n if (value === undefined || value === null) return String(value)\n const num = Number(value)\n if (Number.isNaN(num)) return String(value)\n\n const percentValue = num / sum\n return formatter(percentValue)\n}\n\nexport const buildLabel = (\n label: Label,\n vseedMeasures: Measures = [],\n vseedDimensions: Dimensions = [],\n advancedVSeedDimensions: Dimensions,\n advancedVSeedMeasures: Measures,\n encoding: Encoding,\n foldInfoList: FoldInfo[],\n) => {\n const {\n enable,\n wrap,\n showValue,\n showValuePercent,\n showDimension,\n labelOverlap,\n labelColorSmartInvert,\n labelStroke,\n labelColor,\n labelFontSize,\n labelFontWeight,\n labelBackgroundColor,\n labelPosition,\n autoFormat,\n numFormat = {},\n } = label\n\n const hasDimLabelEncoding = vseedDimensions.some((item) => encoding.label?.includes(item.id))\n\n const labelDims = uniqueBy(\n hasDimLabelEncoding\n ? vseedDimensions.filter((item) => encoding.label?.includes(item.id))\n : showDimension\n ? advancedVSeedDimensions.filter((d) => d.id !== MeasureId)\n : [],\n (item: Dimension) => item.id,\n )\n\n const labelMeas = uniqueBy(\n vseedMeasures.filter((item) => encoding.label?.includes(item.id)),\n (item: Measure) => item.id,\n )\n\n const percentFormat: NumFormat = merge(numFormat, {\n type: 'percent',\n } as NumFormat)\n\n const percentFormatter = createFormatter(percentFormat)\n\n const result = {\n visible: enable,\n dataFilter: (data: Datum[]) => {\n return data.filter((entry) => {\n return entry.data?.[DATUM_HIDE_KEY] !== true\n })\n },\n formatMethod: (_: unknown, datum: Datum) => {\n const result = []\n\n const dimLabels = labelDims.map((item: Dimension) => {\n const id = item.id\n return datum[id] as number | string\n })\n\n const meaLabels = labelMeas.map((item: Measure) =>\n generateMeasureValue(datum[item.id] as number | string, item, autoFormat, numFormat),\n )\n\n result.push(...dimLabels)\n\n foldInfoList.forEach((foldInfo) => {\n const { measureId, measureValue, statistics } = foldInfo\n const measure = findMeasureById(advancedVSeedMeasures, datum[measureId] as string)\n if (measure) {\n const measureValueLabel = generateMeasureValue(\n datum[measureValue] as number | string,\n measure,\n autoFormat,\n numFormat,\n )\n // 饼图/环图需要使用实际占比数据\n const measurePercentLabel = isNumber(datum['__VCHART_ARC_RATIO'])\n ? generateMeasurePercent(datum['__VCHART_ARC_RATIO'], 1, percentFormatter)\n : generateMeasurePercent(datum[measureValue] as number | string, statistics.sum, percentFormatter)\n if (showValue) {\n result.push(measureValueLabel)\n }\n if (showValuePercent) {\n result.push(measurePercentLabel)\n }\n }\n })\n\n result.push(...meaLabels)\n\n if (wrap) {\n return result\n }\n return result.join(' ')\n },\n position: labelPosition,\n style: {\n stroke: labelStroke,\n fill: labelColor,\n fontSize: labelFontSize,\n fontWeight: labelFontWeight,\n background: labelBackgroundColor,\n },\n smartInvert: labelColorSmartInvert,\n }\n\n if (labelOverlap) {\n ;(result as any).overlap = {\n hideOnHit: true,\n clampForce: true,\n }\n }\n\n return result\n}\n"],"names":["label","spec","context","result","advancedVSeed","vseed","datasetReshapeInfo","chartType","encoding","baseConfig","foldInfo","buildLabel","generateMeasureValue","value","measure","labelAutoFormat","numFormat","format","merge","mergedMeasure","formatter","createFormatterByMeasure","generateMeasurePercent","sum","String","num","Number","percentValue","vseedMeasures","vseedDimensions","advancedVSeedDimensions","advancedVSeedMeasures","foldInfoList","enable","wrap","showValue","showValuePercent","showDimension","labelOverlap","labelColorSmartInvert","labelStroke","labelColor","labelFontSize","labelFontWeight","labelBackgroundColor","labelPosition","autoFormat","hasDimLabelEncoding","item","labelDims","uniqueBy","d","MeasureId","labelMeas","percentFormat","percentFormatter","createFormatter","data","entry","DATUM_HIDE_KEY","_","datum","dimLabels","id","meaLabels","measureId","measureValue","statistics","findMeasureById","measureValueLabel","measurePercentLabel","isNumber"],"mappings":";;;AAkBO,MAA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,UAAUsD,gBAAgBrC,uBAAuB8B,KAAK,CAACI,UAAU;gBACvE,IAAInD,SAAS;oBACX,MAAMuD,oBAAoBzD,qBACxBiD,KAAK,CAACK,aAAa,EACnBpD,SACAgC,YACA9B;oBAGF,MAAMsD,sBAAsBC,SAASV,KAAK,CAAC,qBAAqB,IAC5DvC,uBAAuBuC,KAAK,CAAC,qBAAqB,EAAE,GAAGN,oBACvDjC,uBAAuBuC,KAAK,CAACK,aAAa,EAAqBC,WAAW,GAAG,EAAEZ;oBACnF,IAAIpB,WACFhC,OAAO,IAAI,CAACkE;oBAEd,IAAIjC,kBACFjC,OAAO,IAAI,CAACmE;gBAEhB;YACF;YAEAnE,OAAO,IAAI,IAAI6D;YAEf,IAAI9B,MACF,OAAO/B;YAET,OAAOA,OAAO,IAAI,CAAC;QACrB;QACA,UAAU0C;QACV,OAAO;YACL,QAAQL;YACR,MAAMC;YACN,UAAUC;YACV,YAAYC;YACZ,YAAYC;QACd;QACA,aAAaL;IACf;IAEA,IAAID,cACAnC,OAAe,OAAO,GAAG;QACzB,WAAW;QACX,YAAY;IACd;IAGF,OAAOA;AACT"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/label/label.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/label/label.ts"],"sourcesContent":["import type { ILineChartSpec } from '@visactor/vchart'\nimport { createFormatter, createFormatterByMeasure, DATUM_HIDE_KEY, findMeasureById } from '../../../../utils'\nimport type {\n Datum,\n Dimension,\n Dimensions,\n Encoding,\n FoldInfo,\n Formatter,\n Label,\n Measure,\n Measures,\n NumFormat,\n SpecPipe,\n} from 'src/types'\nimport { isNumber, merge, uniqueBy } from 'remeda'\nimport { selector } from 'src/dataSelector'\nimport { MeasureId } from 'src/dataReshape/constant'\n\nexport const label: SpecPipe = (spec, context) => {\n const result = { ...spec } as ILineChartSpec\n const { advancedVSeed, vseed } = context\n const { datasetReshapeInfo } = advancedVSeed\n const { chartType, encoding } = advancedVSeed\n const baseConfig = advancedVSeed.config[chartType] as { label: Label }\n const foldInfo = datasetReshapeInfo[0].foldInfo as FoldInfo\n\n const { label } = baseConfig\n\n result.label = buildLabel(\n label,\n vseed.measures,\n vseed.dimensions,\n advancedVSeed.dimensions,\n advancedVSeed.measures,\n encoding as Encoding,\n [foldInfo],\n ) as unknown as ILineChartSpec['label']\n\n return result\n}\n\nexport const generateMeasureValue = (\n value: number | string,\n measure: Measure,\n labelAutoFormat?: boolean,\n numFormat: NumFormat = {},\n) => {\n const format = merge(numFormat, measure.numFormat || measure.format)\n const mergedMeasure = { ...measure, numFormat: format, autoFormat: labelAutoFormat || measure.autoFormat }\n\n const formatter = createFormatterByMeasure(mergedMeasure)\n return formatter(value)\n}\n\nexport const generateMeasurePercent = (value: number | string, sum: number, formatter: Formatter) => {\n if (value === undefined || value === null) return String(value)\n const num = Number(value)\n if (Number.isNaN(num)) return String(value)\n\n const percentValue = num / sum\n return formatter(percentValue)\n}\n\nexport const buildLabel = (\n label: Label,\n vseedMeasures: Measures = [],\n vseedDimensions: Dimensions = [],\n advancedVSeedDimensions: Dimensions,\n advancedVSeedMeasures: Measures,\n encoding: Encoding,\n foldInfoList: FoldInfo[],\n) => {\n const {\n enable,\n wrap,\n showValue,\n showValuePercent,\n showDimension,\n labelOverlap,\n labelColorSmartInvert,\n labelStroke,\n labelColor,\n labelFontSize,\n labelFontWeight,\n labelBackgroundColor,\n labelPosition,\n autoFormat,\n numFormat = {},\n } = label\n\n const hasDimLabelEncoding = vseedDimensions.some((item) => encoding.label?.includes(item.id))\n\n const labelDims = uniqueBy(\n hasDimLabelEncoding\n ? vseedDimensions.filter((item) => encoding.label?.includes(item.id))\n : showDimension\n ? advancedVSeedDimensions.filter((d) => d.id !== MeasureId)\n : [],\n (item: Dimension) => item.id,\n )\n\n const labelMeas = uniqueBy(\n vseedMeasures.filter((item) => encoding.label?.includes(item.id)),\n (item: Measure) => item.id,\n )\n\n const percentFormat: NumFormat = merge(numFormat, {\n type: 'percent',\n } as NumFormat)\n\n const percentFormatter = createFormatter(percentFormat)\n\n const result = {\n visible: enable,\n dataFilter: (data: Datum[]) => {\n return data.filter((entry) => {\n return entry.data?.[DATUM_HIDE_KEY] !== true && selector(entry.data as Datum, label.selector, 'Or')\n })\n },\n formatMethod: (_: unknown, datum: Datum) => {\n const result = []\n\n const dimLabels = labelDims.map((item: Dimension) => {\n const id = item.id\n return datum[id] as number | string\n })\n\n const meaLabels = labelMeas.map((item: Measure) =>\n generateMeasureValue(datum[item.id] as number | string, item, autoFormat, numFormat),\n )\n\n result.push(...dimLabels)\n\n foldInfoList.forEach((foldInfo) => {\n const { measureId, measureValue, statistics } = foldInfo\n const measure = findMeasureById(advancedVSeedMeasures, datum[measureId] as string)\n if (measure) {\n const measureValueLabel = generateMeasureValue(\n datum[measureValue] as number | string,\n measure,\n autoFormat,\n numFormat,\n )\n // 饼图/环图需要使用实际占比数据\n const measurePercentLabel = isNumber(datum['__VCHART_ARC_RATIO'])\n ? generateMeasurePercent(datum['__VCHART_ARC_RATIO'], 1, percentFormatter)\n : generateMeasurePercent(datum[measureValue] as number | string, statistics.sum, percentFormatter)\n if (showValue) {\n result.push(measureValueLabel)\n }\n if (showValuePercent) {\n result.push(measurePercentLabel)\n }\n }\n })\n\n result.push(...meaLabels)\n\n if (wrap) {\n return result\n }\n return result.join(' ')\n },\n position: labelPosition,\n style: {\n stroke: labelStroke,\n fill: labelColor,\n fontSize: labelFontSize,\n fontWeight: labelFontWeight,\n background: labelBackgroundColor,\n },\n smartInvert: labelColorSmartInvert,\n }\n\n if (labelOverlap) {\n ;(result as any).overlap = {\n hideOnHit: true,\n clampForce: true,\n }\n }\n\n return result\n}\n"],"names":["label","spec","context","result","advancedVSeed","vseed","datasetReshapeInfo","chartType","encoding","baseConfig","foldInfo","buildLabel","generateMeasureValue","value","measure","labelAutoFormat","numFormat","format","merge","mergedMeasure","formatter","createFormatterByMeasure","generateMeasurePercent","sum","String","num","Number","percentValue","vseedMeasures","vseedDimensions","advancedVSeedDimensions","advancedVSeedMeasures","foldInfoList","enable","wrap","showValue","showValuePercent","showDimension","labelOverlap","labelColorSmartInvert","labelStroke","labelColor","labelFontSize","labelFontWeight","labelBackgroundColor","labelPosition","autoFormat","hasDimLabelEncoding","item","labelDims","uniqueBy","d","MeasureId","labelMeas","percentFormat","percentFormatter","createFormatter","data","entry","DATUM_HIDE_KEY","selector","_","datum","dimLabels","id","meaLabels","measureId","measureValue","statistics","findMeasureById","measureValueLabel","measurePercentLabel","isNumber"],"mappings":";;;;AAmBO,MAAMA,cAAkB,CAACC,MAAMC;IACpC,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,kBAAkB,EAAE,GAAGF;IAC/B,MAAM,EAAEG,SAAS,EAAEC,QAAQ,EAAE,GAAGJ;IAChC,MAAMK,aAAaL,cAAc,MAAM,CAACG,UAAU;IAClD,MAAMG,WAAWJ,kBAAkB,CAAC,EAAE,CAAC,QAAQ;IAE/C,MAAM,EAAEN,KAAK,EAAE,GAAGS;IAElBN,OAAO,KAAK,GAAGQ,WACbX,OACAK,MAAM,QAAQ,EACdA,MAAM,UAAU,EAChBD,cAAc,UAAU,EACxBA,cAAc,QAAQ,EACtBI,UACA;QAACE;KAAS;IAGZ,OAAOP;AACT;AAEO,MAAMS,uBAAuB,CAClCC,OACAC,SACAC,iBACAC,YAAuB,CAAC,CAAC;IAEzB,MAAMC,SAASC,MAAMF,WAAWF,QAAQ,SAAS,IAAIA,QAAQ,MAAM;IACnE,MAAMK,gBAAgB;QAAE,GAAGL,OAAO;QAAE,WAAWG;QAAQ,YAAYF,mBAAmBD,QAAQ,UAAU;IAAC;IAEzG,MAAMM,YAAYC,yBAAyBF;IAC3C,OAAOC,UAAUP;AACnB;AAEO,MAAMS,yBAAyB,CAACT,OAAwBU,KAAaH;IAC1E,IAAIP,QAAAA,OAAuC,OAAOW,OAAOX;IACzD,MAAM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E;YAEjB,MAAM4D,YAAYd,UAAU,GAAG,CAAC,CAACD;gBAC/B,MAAMgB,KAAKhB,KAAK,EAAE;gBAClB,OAAOc,KAAK,CAACE,GAAG;YAClB;YAEA,MAAMC,YAAYZ,UAAU,GAAG,CAAC,CAACL,OAC/BpC,qBAAqBkD,KAAK,CAACd,KAAK,EAAE,CAAC,EAAqBA,MAAMF,YAAY9B;YAG5Eb,OAAO,IAAI,IAAI4D;YAEf/B,aAAa,OAAO,CAAC,CAACtB;gBACpB,MAAM,EAAEwD,SAAS,EAAEC,YAAY,EAAEC,UAAU,EAAE,GAAG1D;gBAChD,MAAMI,UAAUuD,gBAAgBtC,uBAAuB+B,KAAK,CAACI,UAAU;gBACvE,IAAIpD,SAAS;oBACX,MAAMwD,oBAAoB1D,qBACxBkD,KAAK,CAACK,aAAa,EACnBrD,SACAgC,YACA9B;oBAGF,MAAMuD,sBAAsBC,SAASV,KAAK,CAAC,qBAAqB,IAC5DxC,uBAAuBwC,KAAK,CAAC,qBAAqB,EAAE,GAAGP,oBACvDjC,uBAAuBwC,KAAK,CAACK,aAAa,EAAqBC,WAAW,GAAG,EAAEb;oBACnF,IAAIpB,WACFhC,OAAO,IAAI,CAACmE;oBAEd,IAAIlC,kBACFjC,OAAO,IAAI,CAACoE;gBAEhB;YACF;YAEApE,OAAO,IAAI,IAAI8D;YAEf,IAAI/B,MACF,OAAO/B;YAET,OAAOA,OAAO,IAAI,CAAC;QACrB;QACA,UAAU0C;QACV,OAAO;YACL,QAAQL;YACR,MAAMC;YACN,UAAUC;YACV,YAAYC;YACZ,YAAYC;QACd;QACA,aAAaL;IACf;IAEA,IAAID,cACAnC,OAAe,OAAO,GAAG;QACzB,WAAW;QACX,YAAY;IACd;IAGF,OAAOA;AACT"}
@@ -85,7 +85,7 @@ const discreteLegend = (spec, context)=>{
85
85
  }
86
86
  },
87
87
  label: {
88
- formatMethod: (value)=>unfoldInfo.colorIdMap[String(value)].alias ?? value,
88
+ formatMethod: (value)=>unfoldInfo.colorIdMap[String(value)]?.alias ?? value,
89
89
  style: {
90
90
  fontSize: labelFontSize,
91
91
  fill: labelColor || labelFontColor,
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/legend/discreteLegend.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/legend/discreteLegend.ts"],"sourcesContent":["import type { Legend, SpecPipe } from 'src/types'\n\nexport const discreteLegend: SpecPipe = (spec, context) => {\n const result = { ...spec }\n const { advancedVSeed } = context\n const { datasetReshapeInfo, chartType } = advancedVSeed\n const { unfoldInfo } = datasetReshapeInfo[0]\n const baseConfig = advancedVSeed.config[chartType] as { legend: Legend }\n if (!baseConfig || !baseConfig.legend) {\n return result\n }\n\n const { legend } = baseConfig\n const {\n enable,\n position = 'bottom',\n labelFontColor,\n labelColor,\n labelFontSize = 12,\n labelFontWeight,\n maxSize = 1,\n border,\n shapeType = 'rectRound',\n } = legend || {}\n\n const orient = ['bottom', 'bottomLeft', 'bottomRight', 'bl', 'br'].includes(position)\n ? 'bottom'\n : ['top', 'topLeft', 'topRight', 'tl', 'tr'].includes(position)\n ? 'top'\n : ['left', 'leftTop', 'leftBottom', 'lt', 'lb'].includes(position)\n ? 'left'\n : 'right'\n\n const legendPosition = ['topLeft', 'bottomLeft', 'leftTop', 'rightTop', 'lt', 'rt', 'tl', 'bl'].includes(position)\n ? 'start'\n : ['topRight', 'bottomRight', 'leftBottom', 'rightBottom', 'lb', 'rb', 'rt', 'br'].includes(position)\n ? 'end'\n : 'middle'\n\n result.legends = {\n type: 'discrete',\n visible: enable,\n maxCol: Math.max(1, maxSize),\n maxRow: Math.max(1, maxSize),\n autoPage: true,\n orient,\n position: legendPosition,\n item: {\n focus: true,\n maxWidth: '30%',\n focusIconStyle: {\n size: labelFontSize + 2,\n fill: labelColor || labelFontColor,\n fontWeight: labelFontWeight,\n },\n shape: {\n space: border ? 6 : 4,\n style: (item) => {\n return {\n symbolType: shapeType,\n size: border ? 8 : 10,\n fillOpacity: 1,\n opacity: 1,\n stroke: false,\n outerBorder: border\n ? {\n stroke: item.shape.fill,\n distance: 3,\n lineWidth: 1,\n }\n : null,\n }\n },\n state: {\n unSelected: {\n opacity: 0.2,\n fillOpacity: 1, // 覆盖 vchart 里的默认值\n },\n },\n },\n label: {\n formatMethod: (value) => {\n return unfoldInfo.colorIdMap[String(value)].alias ?? value\n },\n style: {\n fontSize: labelFontSize,\n fill: labelColor || labelFontColor,\n fontWeight: labelFontWeight,\n },\n state: {\n unSelected: {\n fill: labelColor || labelFontColor, // 覆盖vchart里面的默认值\n fillOpacity: 0.8, // 覆盖 vchart 里的默认值\n },\n },\n },\n background: {\n state: {\n selectedHover: {\n fill: labelColor || labelFontColor,\n fillOpacity: 0.05,\n },\n unSelectedHover: {\n fill: null,\n },\n },\n },\n },\n padding: 0,\n }\n return result\n}\n"],"names":["discreteLegend","spec","context","result","advancedVSeed","datasetReshapeInfo","chartType","unfoldInfo","baseConfig","legend","enable","position","labelFontColor","labelColor","labelFontSize","labelFontWeight","maxSize","border","shapeType","orient","legendPosition","Math","item","value","String"],"mappings":"AAEO,MAAMA,iBAA2B,CAACC,MAAMC;IAC7C,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAE,GAAGF;IAC1B,MAAM,EAAEG,kBAAkB,EAAEC,SAAS,EAAE,GAAGF;IAC1C,MAAM,EAAEG,UAAU,EAAE,GAAGF,kBAAkB,CAAC,EAAE;IAC5C,MAAMG,aAAaJ,cAAc,MAAM,CAACE,UAAU;IAClD,IAAI,CAACE,cAAc,CAACA,WAAW,MAAM,EACnC,OAAOL;IAGT,MAAM,EAAEM,MAAM,EAAE,GAAGD;IACnB,MAAM,EACJE,MAAM,EACNC,WAAW,QAAQ,EACnBC,cAAc,EACdC,UAAU,EACVC,gBAAgB,EAAE,EAClBC,eAAe,EACfC,UAAU,CAAC,EACXC,MAAM,EACNC,YAAY,WAAW,EACxB,GAAGT,UAAU,CAA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L,eAAe;wBACb,MAAMC,cAAcD;wBACpB,aAAa;oBACf;oBACA,iBAAiB;wBACf,MAAM;oBACR;gBACF;YACF;QACF;QACA,SAAS;IACX;IACA,OAAOT;AACT"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/legend/discreteLegend.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/legend/discreteLegend.ts"],"sourcesContent":["import type { Legend, SpecPipe } from 'src/types'\n\nexport const discreteLegend: SpecPipe = (spec, context) => {\n const result = { ...spec }\n const { advancedVSeed } = context\n const { datasetReshapeInfo, chartType } = advancedVSeed\n const { unfoldInfo } = datasetReshapeInfo[0]\n const baseConfig = advancedVSeed.config[chartType] as { legend: Legend }\n if (!baseConfig || !baseConfig.legend) {\n return result\n }\n\n const { legend } = baseConfig\n const {\n enable,\n position = 'bottom',\n labelFontColor,\n labelColor,\n labelFontSize = 12,\n labelFontWeight,\n maxSize = 1,\n border,\n shapeType = 'rectRound',\n } = legend || {}\n\n const orient = ['bottom', 'bottomLeft', 'bottomRight', 'bl', 'br'].includes(position)\n ? 'bottom'\n : ['top', 'topLeft', 'topRight', 'tl', 'tr'].includes(position)\n ? 'top'\n : ['left', 'leftTop', 'leftBottom', 'lt', 'lb'].includes(position)\n ? 'left'\n : 'right'\n\n const legendPosition = ['topLeft', 'bottomLeft', 'leftTop', 'rightTop', 'lt', 'rt', 'tl', 'bl'].includes(position)\n ? 'start'\n : ['topRight', 'bottomRight', 'leftBottom', 'rightBottom', 'lb', 'rb', 'rt', 'br'].includes(position)\n ? 'end'\n : 'middle'\n\n result.legends = {\n type: 'discrete',\n visible: enable,\n maxCol: Math.max(1, maxSize),\n maxRow: Math.max(1, maxSize),\n autoPage: true,\n orient,\n position: legendPosition,\n item: {\n focus: true,\n maxWidth: '30%',\n focusIconStyle: {\n size: labelFontSize + 2,\n fill: labelColor || labelFontColor,\n fontWeight: labelFontWeight,\n },\n shape: {\n space: border ? 6 : 4,\n style: (item) => {\n return {\n symbolType: shapeType,\n size: border ? 8 : 10,\n fillOpacity: 1,\n opacity: 1,\n stroke: false,\n outerBorder: border\n ? {\n stroke: item.shape.fill,\n distance: 3,\n lineWidth: 1,\n }\n : null,\n }\n },\n state: {\n unSelected: {\n opacity: 0.2,\n fillOpacity: 1, // 覆盖 vchart 里的默认值\n },\n },\n },\n label: {\n formatMethod: (value) => {\n return unfoldInfo.colorIdMap[String(value)]?.alias ?? value\n },\n style: {\n fontSize: labelFontSize,\n fill: labelColor || labelFontColor,\n fontWeight: labelFontWeight,\n },\n state: {\n unSelected: {\n fill: labelColor || labelFontColor, // 覆盖vchart里面的默认值\n fillOpacity: 0.8, // 覆盖 vchart 里的默认值\n },\n },\n },\n background: {\n state: {\n selectedHover: {\n fill: labelColor || labelFontColor,\n fillOpacity: 0.05,\n },\n unSelectedHover: {\n fill: null,\n },\n },\n },\n },\n padding: 0,\n }\n return result\n}\n"],"names":["discreteLegend","spec","context","result","advancedVSeed","datasetReshapeInfo","chartType","unfoldInfo","baseConfig","legend","enable","position","labelFontColor","labelColor","labelFontSize","labelFontWeight","maxSize","border","shapeType","orient","legendPosition","Math","item","value","String"],"mappings":"AAEO,MAAMA,iBAA2B,CAACC,MAAMC;IAC7C,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAE,GAAGF;IAC1B,MAAM,EAAEG,kBAAkB,EAAEC,SAAS,EAAE,GAAGF;IAC1C,MAAM,EAAEG,UAAU,EAAE,GAAGF,kBAAkB,CAAC,EAAE;IAC5C,MAAMG,aAAaJ,cAAc,MAAM,CAACE,UAAU;IAClD,IAAI,CAACE,cAAc,CAACA,WAAW,MAAM,EACnC,OAAOL;IAGT,MAAM,EAAEM,MAAM,EAAE,GAAGD;IACnB,MAAM,EACJE,MAAM,EACNC,WAAW,QAAQ,EACnBC,cAAc,EACdC,UAAU,EACVC,gBAAgB,EAAE,EAClBC,eAAe,EACfC,UAAU,CAAC,EACXC,MAAM,EACNC,YAAY,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AAY;gBACV,OAAO;oBACL,eAAe;wBACb,MAAMC,cAAcD;wBACpB,aAAa;oBACf;oBACA,iBAAiB;wBACf,MAAM;oBACR;gBACF;YACF;QACF;QACA,SAAS;IACX;IACA,OAAOT;AACT"}
@@ -57,6 +57,7 @@ const pivotDiscreteLegend = (spec, context)=>{
57
57
  'br'
58
58
  ].includes(position) ? 'end' : 'middle';
59
59
  const legends = {
60
+ padding: 0,
60
61
  visible: enable,
61
62
  type: 'discrete',
62
63
  orient,
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/legend/pivotDiscreteLegend.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/legend/pivotDiscreteLegend.ts"],"sourcesContent":["import type { PivotChartConstructorOptions } from '@visactor/vtable'\nimport { unique } from 'remeda'\nimport type { Color, Legend, SpecPipe } from 'src/types'\nimport { createSpecifiedForColorMapping } from '../color/color'\n\nexport const pivotDiscreteLegend: SpecPipe = (spec, context): Partial<PivotChartConstructorOptions> => {\n const result = { ...spec } as PivotChartConstructorOptions\n const { advancedVSeed } = context\n const { chartType } = advancedVSeed\n const baseConfig = advancedVSeed.config[chartType] as { legend: Legend; color: Color }\n\n if (!baseConfig || !baseConfig.legend) {\n return result\n }\n\n const { datasetReshapeInfo } = advancedVSeed\n\n const colorItems = unique(\n datasetReshapeInfo.flatMap((d) => {\n return d.unfoldInfo.colorItems\n }),\n )\n\n const colorIdMap = datasetReshapeInfo.reduce<Record<string, { id: string; alias: string }>>((prev, cur) => {\n return { ...prev, ...cur.unfoldInfo.colorIdMap }\n }, {})\n\n const { legend, color } = baseConfig\n const { colorScheme, colorMapping } = color\n\n const colorSpecified = createSpecifiedForColorMapping(colorMapping, colorIdMap, colorItems)\n\n const {\n enable,\n position = 'bottom',\n labelFontColor,\n labelColor,\n labelFontSize = 12,\n labelFontWeight = 400,\n maxSize = 1,\n border,\n shapeType = 'rectRound',\n } = legend || {}\n\n const orient = ['bottom', 'bottomLeft', 'bottomRight', 'bl', 'br'].includes(position)\n ? 'bottom'\n : ['top', 'topLeft', 'topRight', 'tl', 'tr'].includes(position)\n ? 'top'\n : ['left', 'leftTop', 'leftBottom', 'lt', 'lb'].includes(position)\n ? 'left'\n : 'right'\n\n const legendPosition = ['topLeft', 'bottomLeft', 'leftTop', 'rightTop', 'lt', 'rt', 'tl', 'bl'].includes(position)\n ? 'start'\n : ['topRight', 'bottomRight', 'leftBottom', 'rightBottom', 'lb', 'rb', 'rt', 'br'].includes(position)\n ? 'end'\n : 'middle'\n\n const legends = {\n visible: enable,\n type: 'discrete',\n orient,\n position: legendPosition,\n maxCol: Math.max(1, maxSize),\n maxRow: Math.max(1, maxSize),\n data: colorItems.map((d: string, index: number) => {\n const color = colorSpecified?.[d] ?? colorScheme?.[index % colorScheme.length]\n return {\n label: d,\n shape: {\n outerBorder: border\n ? {\n stroke: color,\n distance: 3,\n lineWidth: 1,\n }\n : undefined,\n fill: color,\n },\n }\n }),\n\n item: {\n focus: true,\n maxWidth: '30%',\n focusIconStyle: {\n size: labelFontSize + 2,\n fill: labelColor || labelFontColor,\n fontWeight: labelFontWeight,\n },\n shape: {\n space: border ? 6 : 4,\n style: {\n symbolType: shapeType,\n size: border ? 8 : 10,\n },\n },\n label: {\n formatMethod: (value: string) => {\n return colorIdMap[value]?.alias ?? value\n },\n style: {\n fontSize: labelFontSize,\n fill: labelColor || labelFontColor,\n fontWeight: labelFontWeight,\n },\n },\n background: {\n state: {\n selectedHover: {\n fill: labelColor || labelFontColor,\n fillOpacity: 0.05,\n },\n },\n },\n },\n }\n return { ...result, legends } as Partial<PivotChartConstructorOptions>\n}\n"],"names":["pivotDiscreteLegend","spec","context","result","advancedVSeed","chartType","baseConfig","datasetReshapeInfo","colorItems","unique","d","colorIdMap","prev","cur","legend","color","colorScheme","colorMapping","colorSpecified","createSpecifiedForColorMapping","enable","position","labelFontColor","labelColor","labelFontSize","labelFontWeight","maxSize","border","shapeType","orient","legendPosition","legends","Math","index","undefined","value"],"mapp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AM;QAAM;KAAK,CAAC,QAAQ,CAACA,YACxF,QACA;IAEN,MAAMU,UAAU;QACd,SAASX;QACT,MAAM;QACNS;QACA,UAAUC;QACV,QAAQE,KAAK,GAAG,CAAC,GAAGN;QACpB,QAAQM,KAAK,GAAG,CAAC,GAAGN;QACpB,MAAMlB,WAAW,GAAG,CAAC,CAACE,GAAWuB;YAC/B,MAAMlB,QAAQG,gBAAgB,CAACR,EAAE,IAAIM,aAAa,CAACiB,QAAQjB,YAAY,MAAM,CAAC;YAC9E,OAAO;gBACL,OAAON;gBACP,OAAO;oBACL,aAAaiB,SACT;wBACE,QAAQZ;wBACR,UAAU;wBACV,WAAW;oBACb,IACAmB;oBACJ,MAAMnB;gBACR;YACF;QACF;QAEA,MAAM;YACJ,OAAO;YACP,UAAU;YACV,gBAAgB;gBACd,MAAMS,gBAAgB;gBACtB,MAAMD,cAAcD;gBACpB,YAAYG;YACd;YACA,OAAO;gBACL,OAAOE,SAAS,IAAI;gBACpB,OAAO;oBACL,YAAYC;oBACZ,MAAMD,SAAS,IAAI;gBACrB;YACF;YACA,OAAO;gBACL,cAAc,CAACQ,QACNxB,UAAU,CAACwB,MAAM,EAAE,SAASA;gBAErC,OAAO;oBACL,UAAUX;oBACV,MAAMD,cAAcD;oBACpB,YAAYG;gBACd;YACF;YACA,YAAY;gBACV,OAAO;oBACL,eAAe;wBACb,MAAMF,cAAcD;wBACpB,aAAa;oBACf;gBACF;YACF;QACF;IACF;IACA,OAAO;QAAE,GAAGnB,MAAM;QAAE4B;IAAQ;AAC9B"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/legend/pivotDiscreteLegend.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/legend/pivotDiscreteLegend.ts"],"sourcesContent":["import type { PivotChartConstructorOptions } from '@visactor/vtable'\nimport { unique } from 'remeda'\nimport type { Color, Legend, SpecPipe } from 'src/types'\nimport { createSpecifiedForColorMapping } from '../color/color'\n\nexport const pivotDiscreteLegend: SpecPipe = (spec, context): Partial<PivotChartConstructorOptions> => {\n const result = { ...spec } as PivotChartConstructorOptions\n const { advancedVSeed } = context\n const { chartType } = advancedVSeed\n const baseConfig = advancedVSeed.config[chartType] as { legend: Legend; color: Color }\n\n if (!baseConfig || !baseConfig.legend) {\n return result\n }\n\n const { datasetReshapeInfo } = advancedVSeed\n\n const colorItems = unique(\n datasetReshapeInfo.flatMap((d) => {\n return d.unfoldInfo.colorItems\n }),\n )\n\n const colorIdMap = datasetReshapeInfo.reduce<Record<string, { id: string; alias: string }>>((prev, cur) => {\n return { ...prev, ...cur.unfoldInfo.colorIdMap }\n }, {})\n\n const { legend, color } = baseConfig\n const { colorScheme, colorMapping } = color\n\n const colorSpecified = createSpecifiedForColorMapping(colorMapping, colorIdMap, colorItems)\n\n const {\n enable,\n position = 'bottom',\n labelFontColor,\n labelColor,\n labelFontSize = 12,\n labelFontWeight = 400,\n maxSize = 1,\n border,\n shapeType = 'rectRound',\n } = legend || {}\n\n const orient = ['bottom', 'bottomLeft', 'bottomRight', 'bl', 'br'].includes(position)\n ? 'bottom'\n : ['top', 'topLeft', 'topRight', 'tl', 'tr'].includes(position)\n ? 'top'\n : ['left', 'leftTop', 'leftBottom', 'lt', 'lb'].includes(position)\n ? 'left'\n : 'right'\n\n const legendPosition = ['topLeft', 'bottomLeft', 'leftTop', 'rightTop', 'lt', 'rt', 'tl', 'bl'].includes(position)\n ? 'start'\n : ['topRight', 'bottomRight', 'leftBottom', 'rightBottom', 'lb', 'rb', 'rt', 'br'].includes(position)\n ? 'end'\n : 'middle'\n\n const legends = {\n padding: 0,\n visible: enable,\n type: 'discrete',\n orient,\n position: legendPosition,\n maxCol: Math.max(1, maxSize),\n maxRow: Math.max(1, maxSize),\n data: colorItems.map((d: string, index: number) => {\n const color = colorSpecified?.[d] ?? colorScheme?.[index % colorScheme.length]\n return {\n label: d,\n shape: {\n outerBorder: border\n ? {\n stroke: color,\n distance: 3,\n lineWidth: 1,\n }\n : undefined,\n fill: color,\n },\n }\n }),\n\n item: {\n focus: true,\n maxWidth: '30%',\n focusIconStyle: {\n size: labelFontSize + 2,\n fill: labelColor || labelFontColor,\n fontWeight: labelFontWeight,\n },\n shape: {\n space: border ? 6 : 4,\n style: {\n symbolType: shapeType,\n size: border ? 8 : 10,\n },\n },\n label: {\n formatMethod: (value: string) => {\n return colorIdMap[value]?.alias ?? value\n },\n style: {\n fontSize: labelFontSize,\n fill: labelColor || labelFontColor,\n fontWeight: labelFontWeight,\n },\n },\n background: {\n state: {\n selectedHover: {\n fill: labelColor || labelFontColor,\n fillOpacity: 0.05,\n },\n },\n },\n },\n }\n return { ...result, legends } as Partial<PivotChartConstructorOptions>\n}\n"],"names":["pivotDiscreteLegend","spec","context","result","advancedVSeed","chartType","baseConfig","datasetReshapeInfo","colorItems","unique","d","colorIdMap","prev","cur","legend","color","colorScheme","colorMapping","colorSpecified","createSpecifiedForColorMapping","enable","position","labelFontColor","labelColor","labelFontSize","labelFontWeight","maxSize","border","shapeType","orient","legendPosition","legends","Math","index","undefined","value"],"mappings":";;AAKO,MAAMA,sBAAgC,CAACC,MAAMC;IAClD,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAE,GAAGF;IAC1B,MAAM,EAAEG,SAAS,EAAE,GAAGD;IACtB,MAAME,aAAaF,cAAc,MAAM,CAACC,UAAU;IAElD,IAAI,CAACC,cAAc,CAACA,WAAW,MAAM,EACnC,OAAOH;IAGT,MAAM,EAAEI,kBAAkB,EAAE,GAAGH;IAE/B,MAAMI,aAAaC,OACjBF,mBAAmB,OAAO,CAAC,CAACG,IACnBA,EAAE,UAAU,CAAC,UAAU;IAIlC,MAAMC,aAAaJ,mBAAmB,MAAM,CAAgD,CAACK,MAAMC,MAC1F;YAAE,GAAGD,IAAI;YAAE,GAAGC,IAAI,UAAU,CAAC,UAAU;QAAC,IAC9C,CAAC;IAEJ,MAAM,EAAEC,MAAM,EAAEC,KAAK,EAAE,GAAGT;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,OAAO;gBACL,OAAOE,SAAS,IAAI;gBACpB,OAAO;oBACL,YAAYC;oBACZ,MAAMD,SAAS,IAAI;gBACrB;YACF;YACA,OAAO;gBACL,cAAc,CAACQ,QACNxB,UAAU,CAACwB,MAAM,EAAE,SAASA;gBAErC,OAAO;oBACL,UAAUX;oBACV,MAAMD,cAAcD;oBACpB,YAAYG;gBACd;YACF;YACA,YAAY;gBACV,OAAO;oBACL,eAAe;wBACb,MAAMF,cAAcD;wBACpB,aAAa;oBACf;gBACF;YACF;QACF;IACF;IACA,OAAO;QAAE,GAAGnB,MAAM;QAAE4B;IAAQ;AAC9B"}
@@ -25,7 +25,7 @@ const barStyle_barStyle = (spec, context)=>{
25
25
  barStyle
26
26
  ];
27
27
  const customMap = barStyles.reduce((result, style, index)=>{
28
- const { barBorderColor, barBorderStyle, barBorderWidth = 1, barColor, barColorOpacity, barRadius, barVisible = true } = style;
28
+ const { barBorderColor, barBorderStyle, barBorderWidth = 1, barColor, barColorOpacity, barBorderOpacity, barRadius, barVisible = true } = style;
29
29
  const lineDash = 'dashed' === barBorderStyle ? [
30
30
  5,
31
31
  2
@@ -49,12 +49,10 @@ const barStyle_barStyle = (spec, context)=>{
49
49
  fill: barColor,
50
50
  fillOpacity: barColorOpacity,
51
51
  cornerRadius: barRadius,
52
- innerBorder: {
53
- stroke: barBorderColor,
54
- lineWidth: barBorderWidth,
55
- distance: (barBorderWidth || 0) / 2,
56
- lineDash: lineDash
57
- }
52
+ lineWidth: barBorderWidth,
53
+ stroke: barBorderColor,
54
+ strokeOpacity: barBorderOpacity,
55
+ lineDash: lineDash
58
56
  }
59
57
  }
60
58
  };
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/markStyle/barStyle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/markStyle/barStyle.ts"],"sourcesContent":["import type { IBarChartSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { BarStyle, Datum, SpecPipe } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\n\nexport const barStyle: SpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { markStyle, dataset = [] } = advancedVSeed\n const { barStyle } = markStyle\n\n const showStroke = dataset.length <= 100\n\n const result = {\n ...spec,\n bar: {\n style: {\n visible: true,\n fillOpacity: 1,\n lineWidth: showStroke ? 1 : 0,\n },\n state: {\n hover: {\n fillOpacity: 0.6,\n },\n },\n },\n } as IBarChartSpec\n\n if (isNullish(barStyle) || isEmpty(barStyle)) {\n return result\n }\n\n const barStyles = (Array.isArray(barStyle) ? barStyle : [barStyle]) as BarStyle[]\n\n const customMap = barStyles.reduce<object>((result, style, index) => {\n const {\n barBorderColor,\n barBorderStyle,\n barBorderWidth = 1,\n barColor,\n barColorOpacity,\n barRadius,\n barVisible = true,\n } = style\n\n const lineDash = barBorderStyle === 'dashed' ? [5, 2] : barBorderStyle === 'dotted' ? [2, 5] : [0, 0]\n return {\n ...result,\n [`custom${index + 1}`]: {\n // 优先级: 后者覆盖前者\n level: index + 1,\n filter: (datum: Datum) => {\n if (selector(datum, style.selector)) {\n return true\n }\n return false\n },\n style: {\n visible: barVisible,\n fill: barColor,\n fillOpacity: barColorOpacity,\n cornerRadius: barRadius,\n innerBorder: {\n stroke: barBorderColor,\n lineWidth: barBorderWidth,\n distance: (barBorderWidth || 0) / 2,\n lineDash: lineDash,\n },\n },\n },\n }\n }, {})\n\n result.bar!.state = {\n ...result.bar!.state,\n ...customMap,\n }\n\n return result\n}\n"],"names":["barStyle","spec","context","advancedVSeed","markStyle","dataset","showStroke","result","isNullish","isEmpty","barStyles","Array","customMap","style","index","barBorderColor","barBorderStyle","barBorderWidth","barColor","barColorOpacity","barRadius","barVisible","lineDash","datum","selector"],"mappings":";;AAKO,MAAMA,oBAAqB,CAACC,MAAMC;IACvC,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAM,EAAEE,SAAS,EAAEC,UAAU,EAAE,EAAE,GAAGF;IACpC,M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barStyle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/markStyle/barStyle.ts"],"sourcesContent":["import type { IBarChartSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { BarStyle, Datum, SpecPipe } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\n\nexport const barStyle: SpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { markStyle, dataset = [] } = advancedVSeed\n const { barStyle } = markStyle\n\n const showStroke = dataset.length <= 100\n\n const result = {\n ...spec,\n bar: {\n style: {\n visible: true,\n fillOpacity: 1,\n lineWidth: showStroke ? 1 : 0,\n },\n state: {\n hover: {\n fillOpacity: 0.6,\n },\n },\n },\n } as IBarChartSpec\n\n if (isNullish(barStyle) || isEmpty(barStyle)) {\n return result\n }\n\n const barStyles = (Array.isArray(barStyle) ? barStyle : [barStyle]) as BarStyle[]\n\n const customMap = barStyles.reduce<object>((result, style, index) => {\n const {\n barBorderColor,\n barBorderStyle,\n barBorderWidth = 1,\n barColor,\n barColorOpacity,\n barBorderOpacity,\n barRadius,\n barVisible = true,\n } = style\n\n const lineDash = barBorderStyle === 'dashed' ? [5, 2] : barBorderStyle === 'dotted' ? [2, 5] : [0, 0]\n return {\n ...result,\n [`custom${index + 1}`]: {\n // 优先级: 后者覆盖前者\n level: index + 1,\n filter: (datum: Datum) => {\n if (selector(datum, style.selector)) {\n return true\n }\n return false\n },\n style: {\n visible: barVisible,\n fill: barColor,\n fillOpacity: barColorOpacity,\n cornerRadius: barRadius,\n lineWidth: barBorderWidth,\n stroke: barBorderColor,\n strokeOpacity: barBorderOpacity,\n lineDash: lineDash,\n },\n },\n }\n }, {})\n\n result.bar!.state = {\n ...result.bar!.state,\n ...customMap,\n }\n\n return result\n}\n"],"names":["barStyle","spec","context","advancedVSeed","markStyle","dataset","showStroke","result","isNullish","isEmpty","barStyles","Array","customMap","style","index","barBorderColor","barBorderStyle","barBorderWidth","barColor","barColorOpacity","barBorderOpacity","barRadius","bar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E,KAAK,GAAG;QAClB,GAAGA,OAAO,GAAG,CAAE,KAAK;QACpB,GAAGK,SAAS;IACd;IAEA,OAAOL;AACT"}
@@ -1,11 +1,28 @@
1
+ import { BAND_AXIS_INNER_OFFSET_IN_PIVOT } from "../../../../utils/constant.js";
1
2
  const pivotAxisStyle = (axisStyle)=>(spec, context)=>{
2
3
  const result = axisStyle(spec, context);
3
- if (result.axes) result.axes.forEach((axis)=>{
4
- axis.domainLine = {
5
- visible: false
6
- };
7
- if (axis.grid && axis.grid.visible && axis.grid.style) axis.grid.style.strokeOpacity = 0.3;
8
- });
4
+ if (result.axes) {
5
+ const { advancedVSeed } = context;
6
+ const { config, chartType } = advancedVSeed;
7
+ const themConfig = config?.[chartType]?.pivotGrid ?? {};
8
+ result.axes.forEach((axis)=>{
9
+ axis.domainLine = {
10
+ visible: false
11
+ };
12
+ if (themConfig.chartGridColor && axis.grid && axis.grid.visible && axis.grid.style) axis.grid.style.stroke = themConfig.chartGridColor;
13
+ if (themConfig.axisLabelColor && axis.label && axis.label.visible && axis.label.style) axis.label.style.fill = themConfig.axisLabelColor;
14
+ if ('band' === axis.type) {
15
+ if ('left' === axis.orient || 'right' === axis.orient) axis.innerOffset = {
16
+ top: BAND_AXIS_INNER_OFFSET_IN_PIVOT,
17
+ bottom: BAND_AXIS_INNER_OFFSET_IN_PIVOT
18
+ };
19
+ else if ('top' === axis.orient || 'bottom' === axis.orient) axis.innerOffset = {
20
+ left: BAND_AXIS_INNER_OFFSET_IN_PIVOT,
21
+ right: BAND_AXIS_INNER_OFFSET_IN_PIVOT
22
+ };
23
+ }
24
+ });
25
+ }
9
26
  return result;
10
27
  };
11
28
  export { pivotAxisStyle };
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/pivotChart/pivotAxisStyle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/pivotChart/pivotAxisStyle.ts"],"sourcesContent":["import type { ILineChartSpec } from '@visactor/vchart'\nimport type { SpecPipe } from 'src/types'\n\nexport const pivotAxisStyle = (axisStyle: SpecPipe): SpecPipe => {\n return (spec, context) => {\n const result = axisStyle(spec, context) as ILineChartSpec\n\n if (result.axes) {\n result.axes.forEach((axis: any) => {\n axis.domainLine = {\n visible: false,\n }\n\n if (axis.grid && axis.grid.visible && axis.grid.style) {\n axis.grid.style.strokeOpacity = 0.3\n }\n })\n }\n\n return result\n }\n}\n"],"names":["pivotAxisStyle","axisStyle","spec","context","result","axis"],"mappings":"AAGO,MAAMA,iBAAiB,CAACC,YACtB,CAACC,MAAMC;QACZ,MAAMC,SAASH,UAAUC,MAAMC;QAE/B,IAAIC,OAAO,IAAI,EACbA,OAAO,IAAI,CAAC,OAAO,CAAC,CAACC;YACnBA,KAAK,UAAU,GAAG;gBAChB,SAAS;YACX;YAEA,IAAIA,KAAK,IAAI,IAAIA,KAAK,IAAI,CAAC,OAAO,IAAIA,KAAK,IAAI,CAAC,KAAK,EACnDA,KAAK,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG;QAEpC;QAGF,OAAOD;IACT"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/pivotChart/pivotAxisStyle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/pivotChart/pivotAxisStyle.ts"],"sourcesContent":["import type { ILineChartSpec } from '@visactor/vchart'\nimport { BAND_AXIS_INNER_OFFSET_IN_PIVOT } from 'src/pipeline/utils/constant'\nimport type { Config, SpecPipe } from 'src/types'\n\nexport const pivotAxisStyle = (axisStyle: SpecPipe): SpecPipe => {\n return (spec, context) => {\n const result = axisStyle(spec, context) as ILineChartSpec\n\n if (result.axes) {\n const { advancedVSeed } = context\n const { config, chartType } = advancedVSeed\n const themConfig = (config?.[chartType] as Config['line'])?.pivotGrid ?? {}\n\n result.axes.forEach((axis: any) => {\n axis.domainLine = {\n visible: false,\n }\n\n if (themConfig.chartGridColor && axis.grid && axis.grid.visible && axis.grid.style) {\n axis.grid.style.stroke = themConfig.chartGridColor\n }\n\n if (themConfig.axisLabelColor && axis.label && axis.label.visible && axis.label.style) {\n axis.label.style.fill = themConfig.axisLabelColor\n }\n\n if (axis.type === 'band') {\n if (axis.orient === 'left' || axis.orient === 'right') {\n axis.innerOffset = {\n top: BAND_AXIS_INNER_OFFSET_IN_PIVOT,\n bottom: BAND_AXIS_INNER_OFFSET_IN_PIVOT,\n }\n } else if (axis.orient === 'top' || axis.orient === 'bottom') {\n axis.innerOffset = {\n left: BAND_AXIS_INNER_OFFSET_IN_PIVOT,\n right: BAND_AXIS_INNER_OFFSET_IN_PIVOT,\n }\n }\n }\n })\n }\n\n return result\n }\n}\n"],"names":["pivotAxisStyle","axisStyle","spec","context","result","advancedVSeed","config","chartType","themConfig","axis","BAND_AXIS_INNER_OFFSET_IN_PIVOT"],"mappings":";AAIO,MAAMA,iBAAiB,CAACC,YACtB,CAACC,MAAMC;QACZ,MAAMC,SAASH,UAAUC,MAAMC;QAE/B,IAAIC,OAAO,IAAI,EAAE;YACf,MAAM,EAAEC,aAAa,EAAE,GAAGF;YAC1B,MAAM,EAAEG,MAAM,EAAEC,SAAS,EAAE,GAAGF;YAC9B,MAAMG,aAAcF,QAAQ,CAACC,UAAU,EAAqB,aAAa,CAAC;YAE1EH,OAAO,IAAI,CAAC,OAAO,CAAC,CAACK;gBACnBA,KAAK,UAAU,GAAG;oBAChB,SAAS;gBACX;gBAEA,IAAID,WAAW,cAAc,IAAIC,KAAK,IAAI,IAAIA,KAAK,IAAI,CAAC,OAAO,IAAIA,KAAK,IAAI,CAAC,KAAK,EAChFA,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,GAAGD,WAAW,cAAc;gBAGpD,IAAIA,WAAW,cAAc,IAAIC,KAAK,KAAK,IAAIA,KAAK,KAAK,CAAC,OAAO,IAAIA,KAAK,KAAK,CAAC,KAAK,EACnFA,KAAK,KAAK,CAAC,KAAK,CAAC,IAAI,GAAGD,WAAW,cAAc;gBAGnD,IAAIC,AAAc,WAAdA,KAAK,IAAI,EACX;oBAAA,IAAIA,AAAgB,WAAhBA,KAAK,MAAM,IAAeA,AAAgB,YAAhBA,KAAK,MAAM,EACvCA,KAAK,WAAW,GAAG;wBACjB,KAAKC;wBACL,QAAQA;oBACV;yBACK,IAAID,AAAgB,UAAhBA,KAAK,MAAM,IAAcA,AAAgB,aAAhBA,KAAK,MAAM,EAC7CA,KAAK,WAAW,GAAG;wBACjB,MAAMC;wBACN,OAAOA;oBACT;gBACF;YAEJ;QACF;QAEA,OAAON;IACT"}