@visactor/vchart 1.5.3 → 1.5.4

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 (69) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +187 -69
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/chart/bar/bar.js +2 -1
  6. package/cjs/chart/bar/bar.js.map +1 -1
  7. package/cjs/chart/correlation/correlation.js.map +1 -1
  8. package/cjs/chart/range-column/range-column.js +2 -1
  9. package/cjs/chart/range-column/range-column.js.map +1 -1
  10. package/cjs/chart/stack.js +2 -1
  11. package/cjs/component/index.js +1 -2
  12. package/cjs/component/tooltip/handler/utils/common.js +14 -31
  13. package/cjs/component/tooltip/handler/utils/common.js.map +1 -1
  14. package/cjs/constant/base.js +1 -2
  15. package/cjs/constant/waterfall.js +2 -1
  16. package/cjs/core/index.d.ts +1 -1
  17. package/cjs/core/index.js +1 -1
  18. package/cjs/core/index.js.map +1 -1
  19. package/cjs/data/transforms/funnel.js +2 -2
  20. package/cjs/data/transforms/funnel.js.map +1 -1
  21. package/cjs/series/bar/bar.d.ts +13 -2
  22. package/cjs/series/bar/bar.js +99 -13
  23. package/cjs/series/bar/bar.js.map +1 -1
  24. package/cjs/series/bar/constant.js +4 -0
  25. package/cjs/series/bar/constant.js.map +1 -1
  26. package/cjs/series/bar/interface.d.ts +2 -0
  27. package/cjs/series/bar/interface.js.map +1 -1
  28. package/cjs/series/interface/type.d.ts +2 -1
  29. package/cjs/series/interface/type.js +2 -1
  30. package/cjs/series/interface/type.js.map +1 -1
  31. package/cjs/series/range-column/range-column.js +8 -7
  32. package/cjs/series/range-column/range-column.js.map +1 -1
  33. package/cjs/series/waterfall/waterfall.js +4 -4
  34. package/cjs/series/waterfall/waterfall.js.map +1 -1
  35. package/cjs/theme/builtin/common/mark.js +10 -0
  36. package/cjs/theme/builtin/common/mark.js.map +1 -1
  37. package/esm/chart/bar/bar.js +2 -1
  38. package/esm/chart/bar/bar.js.map +1 -1
  39. package/esm/chart/correlation/correlation.js.map +1 -1
  40. package/esm/chart/range-column/range-column.js +2 -1
  41. package/esm/chart/range-column/range-column.js.map +1 -1
  42. package/esm/chart/stack.js +2 -1
  43. package/esm/component/index.js +1 -2
  44. package/esm/component/tooltip/handler/utils/common.js +15 -32
  45. package/esm/component/tooltip/handler/utils/common.js.map +1 -1
  46. package/esm/constant/base.js +1 -2
  47. package/esm/constant/waterfall.js +2 -1
  48. package/esm/core/index.d.ts +1 -1
  49. package/esm/core/index.js +1 -1
  50. package/esm/core/index.js.map +1 -1
  51. package/esm/data/transforms/funnel.js +1 -1
  52. package/esm/data/transforms/funnel.js.map +1 -1
  53. package/esm/series/bar/bar.d.ts +13 -2
  54. package/esm/series/bar/bar.js +108 -12
  55. package/esm/series/bar/bar.js.map +1 -1
  56. package/esm/series/bar/constant.js +4 -0
  57. package/esm/series/bar/constant.js.map +1 -1
  58. package/esm/series/bar/interface.d.ts +2 -0
  59. package/esm/series/bar/interface.js.map +1 -1
  60. package/esm/series/interface/type.d.ts +2 -1
  61. package/esm/series/interface/type.js +2 -1
  62. package/esm/series/interface/type.js.map +1 -1
  63. package/esm/series/range-column/range-column.js +8 -7
  64. package/esm/series/range-column/range-column.js.map +1 -1
  65. package/esm/series/waterfall/waterfall.js +4 -4
  66. package/esm/series/waterfall/waterfall.js.map +1 -1
  67. package/esm/theme/builtin/common/mark.js +10 -0
  68. package/esm/theme/builtin/common/mark.js.map +1 -1
  69. package/package.json +3 -3
@@ -16,7 +16,8 @@ class BarChart extends cartesian_1.CartesianChart {
16
16
  barMaxWidth: spec.barMaxWidth,
17
17
  barMinWidth: spec.barMinWidth,
18
18
  barGapInGroup: spec.barGapInGroup,
19
- barMinHeight: spec.barMinHeight
19
+ barMinHeight: spec.barMinHeight,
20
+ barBackground: spec.barBackground
20
21
  });
21
22
  }
22
23
  transformSpec(spec) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/chart/bar/bar.ts"],"names":[],"mappings":";;;AAAA,8CAAoE;AACpE,sDAAwD;AACxD,sDAAwD;AACxD,4CAA6C;AAC7C,kCAA+D;AAE/D,gDAA6C;AAE7C,MAAa,QAAS,SAAQ,0BAAc;IAA5C;;QAGW,SAAI,GAAW,yBAAa,CAAC,GAAG,CAAC;QACjC,eAAU,GAAW,0BAAc,CAAC,GAAG,CAAC;IAiBnD,CAAC;IAfW,qBAAqB,CAAC,IAAS;QACvC,uCACK,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,KACpC,QAAQ,EAAkB,IAAK,CAAC,QAAQ,EACxC,WAAW,EAAkB,IAAK,CAAC,WAAW,EAC9C,WAAW,EAAkB,IAAK,CAAC,WAAW,EAC9C,aAAa,EAAkB,IAAK,CAAC,aAAa,EAClD,YAAY,EAAkB,IAAK,CAAC,YAAY,IAChD;IACJ,CAAC;IAED,aAAa,CAAC,IAAS;QACrB,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAA,2CAAoC,EAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;;AApBH,4BAqBC;AApBiB,aAAI,GAAW,yBAAa,CAAC,GAAG,CAAC;AACjC,aAAI,GAAW,eAAe,CAAC;AAqB1C,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,IAAA,uBAAiB,GAAE,CAAC;IACpB,iBAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACjD,CAAC,CAAC;AAHW,QAAA,gBAAgB,oBAG3B","file":"bar.js","sourcesContent":["import { BarSeries, registerBarSeries } from '../../series/bar/bar';\nimport { SeriesTypeEnum } from '../../series/interface';\nimport { CartesianChart } from '../cartesian/cartesian';\nimport { ChartTypeEnum } from '../interface';\nimport { setDefaultCrosshairForCartesianChart } from '../util';\nimport type { IBarChartSpec } from './interface';\nimport { Factory } from '../../core/factory';\n\nexport class BarChart extends CartesianChart {\n static readonly type: string = ChartTypeEnum.bar;\n static readonly view: string = 'singleDefault';\n readonly type: string = ChartTypeEnum.bar;\n readonly seriesType: string = SeriesTypeEnum.bar;\n\n protected _getDefaultSeriesSpec(spec: any): any {\n return {\n ...super._getDefaultSeriesSpec(spec),\n barWidth: (<IBarChartSpec>spec).barWidth,\n barMaxWidth: (<IBarChartSpec>spec).barMaxWidth,\n barMinWidth: (<IBarChartSpec>spec).barMinWidth,\n barGapInGroup: (<IBarChartSpec>spec).barGapInGroup,\n barMinHeight: (<IBarChartSpec>spec).barMinHeight\n };\n }\n\n transformSpec(spec: any): void {\n super.transformSpec(spec);\n setDefaultCrosshairForCartesianChart(spec);\n }\n}\n\nexport const registerBarChart = () => {\n registerBarSeries();\n Factory.registerChart(BarChart.type, BarChart);\n};\n"]}
1
+ {"version":3,"sources":["../src/chart/bar/bar.ts"],"names":[],"mappings":";;;AAAA,8CAAoE;AACpE,sDAAwD;AACxD,sDAAwD;AACxD,4CAA6C;AAC7C,kCAA+D;AAE/D,gDAA6C;AAE7C,MAAa,QAAS,SAAQ,0BAAc;IAA5C;;QAGW,SAAI,GAAW,yBAAa,CAAC,GAAG,CAAC;QACjC,eAAU,GAAW,0BAAc,CAAC,GAAG,CAAC;IAkBnD,CAAC;IAhBW,qBAAqB,CAAC,IAAS;QACvC,uCACK,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,KACpC,QAAQ,EAAkB,IAAK,CAAC,QAAQ,EACxC,WAAW,EAAkB,IAAK,CAAC,WAAW,EAC9C,WAAW,EAAkB,IAAK,CAAC,WAAW,EAC9C,aAAa,EAAkB,IAAK,CAAC,aAAa,EAClD,YAAY,EAAkB,IAAK,CAAC,YAAY,EAChD,aAAa,EAAkB,IAAK,CAAC,aAAa,IAClD;IACJ,CAAC;IAED,aAAa,CAAC,IAAS;QACrB,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAA,2CAAoC,EAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;;AArBH,4BAsBC;AArBiB,aAAI,GAAW,yBAAa,CAAC,GAAG,CAAC;AACjC,aAAI,GAAW,eAAe,CAAC;AAsB1C,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,IAAA,uBAAiB,GAAE,CAAC;IACpB,iBAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACjD,CAAC,CAAC;AAHW,QAAA,gBAAgB,oBAG3B","file":"bar.js","sourcesContent":["import { BarSeries, registerBarSeries } from '../../series/bar/bar';\nimport { SeriesTypeEnum } from '../../series/interface';\nimport { CartesianChart } from '../cartesian/cartesian';\nimport { ChartTypeEnum } from '../interface';\nimport { setDefaultCrosshairForCartesianChart } from '../util';\nimport type { IBarChartSpec } from './interface';\nimport { Factory } from '../../core/factory';\n\nexport class BarChart extends CartesianChart {\n static readonly type: string = ChartTypeEnum.bar;\n static readonly view: string = 'singleDefault';\n readonly type: string = ChartTypeEnum.bar;\n readonly seriesType: string = SeriesTypeEnum.bar;\n\n protected _getDefaultSeriesSpec(spec: any): any {\n return {\n ...super._getDefaultSeriesSpec(spec),\n barWidth: (<IBarChartSpec>spec).barWidth,\n barMaxWidth: (<IBarChartSpec>spec).barMaxWidth,\n barMinWidth: (<IBarChartSpec>spec).barMinWidth,\n barGapInGroup: (<IBarChartSpec>spec).barGapInGroup,\n barMinHeight: (<IBarChartSpec>spec).barMinHeight,\n barBackground: (<IBarChartSpec>spec).barBackground\n };\n }\n\n transformSpec(spec: any): void {\n super.transformSpec(spec);\n setDefaultCrosshairForCartesianChart(spec);\n }\n}\n\nexport const registerBarChart = () => {\n registerBarSeries();\n Factory.registerChart(BarChart.type, BarChart);\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/chart/correlation/correlation.ts"],"names":[],"mappings":";;;AAAA,sEAAiF;AACjF,8CAA0C;AAC1C,4CAA6C;AAC7C,sDAAwD;AAKxD,gDAA6C;AAE7C,MAAa,gBAAiB,SAAQ,sBAAS;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AE;YAC5C,IAAI,CAAC,MAAM,GAAG,CAAC,iBAAiB,CAAC,CAAC;SACnC;aAAM;YACL,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;gBACtB,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE;oBAC/B,OAAO;iBACR;gBACD,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;oBACzC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE;wBACb,CAAC,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;qBAC7B;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;;AAtDH,4CAuDC;AAtDiB,qBAAI,GAAW,yBAAa,CAAC,WAAW,CAAC;AACzC,qBAAI,GAAW,eAAe,CAAC;AAuD1C,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,IAAA,uCAAyB,GAAE,CAAC;IAC5B,iBAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;AACjE,CAAC,CAAC;AAHW,QAAA,wBAAwB,4BAGnC","file":"correlation.js","sourcesContent":["import { registerCorrelationSeries } from '../../series/correlation/correlation';\nimport { BaseChart } from '../base-chart';\nimport { ChartTypeEnum } from '../interface';\nimport { SeriesTypeEnum } from '../../series/interface';\nimport type { ICorrelationChartSpec } from './interface';\nimport type { ICorrelationSeriesSpec } from '../../series/correlation/interface';\nimport { VChart } from '../../core/vchart';\nimport { CorrelationSeries } from '../../series/correlation/correlation';\nimport { Factory } from '../../core/factory';\n\nexport class CorrelationChart extends BaseChart {\n static readonly type: string = ChartTypeEnum.correlation;\n static readonly view: string = 'singleDefault';\n readonly type: string = ChartTypeEnum.correlation;\n readonly seriesType: string = SeriesTypeEnum.correlation;\n\n protected _getDefaultSeriesSpec(spec: ICorrelationChartSpec): any {\n const series: ICorrelationSeriesSpec = {\n ...super._getDefaultSeriesSpec(spec),\n categoryField: spec.categoryField,\n valueField: spec.valueField,\n seriesField: spec.seriesField,\n sizeField: spec.sizeField,\n sizeRange: spec.sizeRange,\n\n centerX: spec.centerX,\n centerY: spec.centerY,\n innerRadius: spec.innerRadius,\n outerRadius: spec.outerRadius,\n startAngle: spec.startAngle,\n endAngle: spec.endAngle,\n\n ripplePoint: spec.ripplePoint,\n centerPoint: spec.centerPoint,\n centerLabel: spec.centerLabel,\n nodePoint: spec.nodePoint,\n label: spec.label\n };\n const seriesType = SeriesTypeEnum.correlation;\n series.type = seriesType;\n series[seriesType] = spec[seriesType];\n\n return series;\n }\n\n transformSpec(spec: ICorrelationChartSpec): void {\n super.transformSpec(spec);\n\n /* 处理 series 配置 */\n const defaultSeriesSpec = this._getDefaultSeriesSpec(spec);\n if (!spec.series || spec.series.length === 0) {\n spec.series = [defaultSeriesSpec];\n } else {\n spec.series.forEach(s => {\n if (!this.isValidSeries(s.type)) {\n return;\n }\n Object.keys(defaultSeriesSpec).forEach(k => {\n if (!(k in s)) {\n s[k] = defaultSeriesSpec[k];\n }\n });\n });\n }\n }\n}\n\nexport const registerCorrelationChart = () => {\n registerCorrelationSeries();\n Factory.registerChart(CorrelationChart.type, CorrelationChart);\n};\n"]}
1
+ {"version":3,"sources":["../src/chart/correlation/correlation.ts"],"names":[],"mappings":";;;AAAA,sEAAiF;AACjF,8CAA0C;AAC1C,4CAA6C;AAC7C,sDAAwD;AAGxD,gDAA6C;AAE7C,MAAa,gBAAiB,SAAQ,sBAAS;IAA/C;;QAGW,SAAI,GAAW,yBAAa,CAAC,WAAW,CAAC;QACzC,eAAU,GAAW,0BAAc,CAAC,WAAW,CAAC;IAmD3D,CAAC;IAjDW,qBAAqB,CAAC,IAA2B;QACzD,MAAM,MAAM,mCACP,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,KACpC,aAAa,EAAE,IAAI,CA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BACD,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;oBACzC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE;wBACb,CAAC,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;qBAC7B;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;;AAtDH,4CAuDC;AAtDiB,qBAAI,GAAW,yBAAa,CAAC,WAAW,CAAC;AACzC,qBAAI,GAAW,eAAe,CAAC;AAuD1C,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,IAAA,uCAAyB,GAAE,CAAC;IAC5B,iBAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;AACjE,CAAC,CAAC;AAHW,QAAA,wBAAwB,4BAGnC","file":"correlation.js","sourcesContent":["import { registerCorrelationSeries } from '../../series/correlation/correlation';\nimport { BaseChart } from '../base-chart';\nimport { ChartTypeEnum } from '../interface';\nimport { SeriesTypeEnum } from '../../series/interface';\nimport type { ICorrelationChartSpec } from './interface';\nimport type { ICorrelationSeriesSpec } from '../../series/correlation/interface';\nimport { Factory } from '../../core/factory';\n\nexport class CorrelationChart extends BaseChart {\n static readonly type: string = ChartTypeEnum.correlation;\n static readonly view: string = 'singleDefault';\n readonly type: string = ChartTypeEnum.correlation;\n readonly seriesType: string = SeriesTypeEnum.correlation;\n\n protected _getDefaultSeriesSpec(spec: ICorrelationChartSpec): any {\n const series: ICorrelationSeriesSpec = {\n ...super._getDefaultSeriesSpec(spec),\n categoryField: spec.categoryField,\n valueField: spec.valueField,\n seriesField: spec.seriesField,\n sizeField: spec.sizeField,\n sizeRange: spec.sizeRange,\n\n centerX: spec.centerX,\n centerY: spec.centerY,\n innerRadius: spec.innerRadius,\n outerRadius: spec.outerRadius,\n startAngle: spec.startAngle,\n endAngle: spec.endAngle,\n\n ripplePoint: spec.ripplePoint,\n centerPoint: spec.centerPoint,\n centerLabel: spec.centerLabel,\n nodePoint: spec.nodePoint,\n label: spec.label\n };\n const seriesType = SeriesTypeEnum.correlation;\n series.type = seriesType;\n series[seriesType] = spec[seriesType];\n\n return series;\n }\n\n transformSpec(spec: ICorrelationChartSpec): void {\n super.transformSpec(spec);\n\n /* 处理 series 配置 */\n const defaultSeriesSpec = this._getDefaultSeriesSpec(spec);\n if (!spec.series || spec.series.length === 0) {\n spec.series = [defaultSeriesSpec];\n } else {\n spec.series.forEach(s => {\n if (!this.isValidSeries(s.type)) {\n return;\n }\n Object.keys(defaultSeriesSpec).forEach(k => {\n if (!(k in s)) {\n s[k] = defaultSeriesSpec[k];\n }\n });\n });\n }\n }\n}\n\nexport const registerCorrelationChart = () => {\n registerCorrelationSeries();\n Factory.registerChart(CorrelationChart.type, CorrelationChart);\n};\n"]}
@@ -13,7 +13,8 @@ class RangeColumnChart extends cartesian_1.CartesianChart {
13
13
  _getDefaultSeriesSpec(spec) {
14
14
  var _a, _b;
15
15
  const series = Object.assign(Object.assign({}, super._getDefaultSeriesSpec(spec)), {
16
- barGapInGroup: spec.barGapInGroup
16
+ barGapInGroup: spec.barGapInGroup,
17
+ barBackground: spec.barBackground
17
18
  });
18
19
  return series.bar = spec.bar, spec.direction === typings_1.Direction.horizontal ? series.xField = null !== (_a = spec.xField) && void 0 !== _a ? _a : [ spec.minField, spec.maxField ] : series.yField = null !== (_b = spec.yField) && void 0 !== _b ? _b : [ spec.minField, spec.maxField ],
19
20
  series;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/chart/range-column/range-column.ts"],"names":[],"mappings":";;;AAAA,sDAAwD;AACxD,4CAA6C;AAC7C,sDAAwD;AACxD,2CAA0C;AAC1C,kCAA+D;AAE/D,gDAA6C;AAC7C,yEAAmF;AAEnF,MAAa,gBAAiB,SAAQ,0BAAc;IAApD;;QAGW,SAAI,GAAW,yBAAa,CAAC,WAAW,CAAC;QACzC,eAAU,GAAW,0BAAc,CAAC,WAAW,CAAC;IAoB3D,CAAC;IAlBW,qBAAqB,CAAC,IAAS;;QACvC,MAAM,MAAM,mCACP,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,KACpC,aAAa,EAAG,IAA8B,CAAC,aAAa,GAC7D,CAAC;QACF,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACtB,IAAI,IAAI,CAAC,SAAS,KAAK,mBAAS,CAAC,UAAU,EAAE;YAC3C,MAAM,CAAC,MAAM,GAAG,MAAA,IAAI,CAAC,MAAM,mCAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC/D;aAAM;YACL,MAAM,CAAC,MAAM,GAAG,MAAA,IAAI,CAAC,MAAM,mCAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC/D;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,aAAa,CAAC,IAAS;QACrB,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAA,2CAAoC,EAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;;AAvBH,4CAwBC;AAvBiB,qBAAI,GAAW,yBAAa,CAAC,WAAW,CAAC;AACzC,qBAAI,GAAW,eAAe,CAAC;AAwB1C,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,IAAA,wCAAyB,GAAE,CAAC;IAC5B,iBAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;AACjE,CAAC,CAAC;AAHW,QAAA,wBAAwB,4BAGnC","file":"range-column.js","sourcesContent":["import { CartesianChart } from '../cartesian/cartesian';\nimport { ChartTypeEnum } from '../interface';\nimport { SeriesTypeEnum } from '../../series/interface';\nimport { Direction } from '../../typings';\nimport { setDefaultCrosshairForCartesianChart } from '../util';\nimport type { IRangeColumnChartSpec } from './interface';\nimport { Factory } from '../../core/factory';\nimport { registerRangeColumnSeries } from '../../series/range-column/range-column';\n\nexport class RangeColumnChart extends CartesianChart {\n static readonly type: string = ChartTypeEnum.rangeColumn;\n static readonly view: string = 'singleDefault';\n readonly type: string = ChartTypeEnum.rangeColumn;\n readonly seriesType: string = SeriesTypeEnum.rangeColumn;\n\n protected _getDefaultSeriesSpec(spec: any): any {\n const series: any = {\n ...super._getDefaultSeriesSpec(spec),\n barGapInGroup: (spec as IRangeColumnChartSpec).barGapInGroup\n };\n series.bar = spec.bar;\n if (spec.direction === Direction.horizontal) {\n series.xField = spec.xField ?? [spec.minField, spec.maxField];\n } else {\n series.yField = spec.yField ?? [spec.minField, spec.maxField];\n }\n return series;\n }\n\n transformSpec(spec: any): void {\n super.transformSpec(spec);\n setDefaultCrosshairForCartesianChart(spec);\n }\n}\n\nexport const registerRangeColumnChart = () => {\n registerRangeColumnSeries();\n Factory.registerChart(RangeColumnChart.type, RangeColumnChart);\n};\n"]}
1
+ {"version":3,"sources":["../src/chart/range-column/range-column.ts"],"names":[],"mappings":";;;AAAA,sDAAwD;AACxD,4CAA6C;AAC7C,sDAAwD;AACxD,2CAA0C;AAC1C,kCAA+D;AAE/D,gDAA6C;AAC7C,yEAAmF;AAEnF,MAAa,gBAAiB,SAAQ,0BAAc;IAApD;;QAGW,SAAI,GAAW,yBAAa,CAAC,WAAW,CAAC;QACzC,eAAU,GAAW,0BAAc,CAAC,WAAW,CAAC;IAqB3D,CAAC;IAnBW,qBAAqB,CAAC,IAAS;;QACvC,MAAM,MAAM,mCACP,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,KACpC,aAAa,EAAG,IAA8B,CAAC,aAAa,EAC5D,aAAa,EAAG,IAA8B,CAAC,aAAa,GAC7D,CAAC;QACF,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACtB,IAAI,IAAI,CAAC,SAAS,KAAK,mBAAS,CAAC,UAAU,EAAE;YAC3C,MAAM,CAAC,MAAM,GAAG,MAAA,IAAI,CAAC,MAAM,mCAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC/D;aAAM;YACL,MAAM,CAAC,MAAM,GAAG,MAAA,IAAI,CAAC,MAAM,mCAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC/D;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,aAAa,CAAC,IAAS;QACrB,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAA,2CAAoC,EAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;;AAxBH,4CAyBC;AAxBiB,qBAAI,GAAW,yBAAa,CAAC,WAAW,CAAC;AACzC,qBAAI,GAAW,eAAe,CAAC;AAyB1C,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,IAAA,wCAAyB,GAAE,CAAC;IAC5B,iBAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;AACjE,CAAC,CAAC;AAHW,QAAA,wBAAwB,4BAGnC","file":"range-column.js","sourcesContent":["import { CartesianChart } from '../cartesian/cartesian';\nimport { ChartTypeEnum } from '../interface';\nimport { SeriesTypeEnum } from '../../series/interface';\nimport { Direction } from '../../typings';\nimport { setDefaultCrosshairForCartesianChart } from '../util';\nimport type { IRangeColumnChartSpec } from './interface';\nimport { Factory } from '../../core/factory';\nimport { registerRangeColumnSeries } from '../../series/range-column/range-column';\n\nexport class RangeColumnChart extends CartesianChart {\n static readonly type: string = ChartTypeEnum.rangeColumn;\n static readonly view: string = 'singleDefault';\n readonly type: string = ChartTypeEnum.rangeColumn;\n readonly seriesType: string = SeriesTypeEnum.rangeColumn;\n\n protected _getDefaultSeriesSpec(spec: any): any {\n const series: any = {\n ...super._getDefaultSeriesSpec(spec),\n barGapInGroup: (spec as IRangeColumnChartSpec).barGapInGroup,\n barBackground: (spec as IRangeColumnChartSpec).barBackground\n };\n series.bar = spec.bar;\n if (spec.direction === Direction.horizontal) {\n series.xField = spec.xField ?? [spec.minField, spec.maxField];\n } else {\n series.yField = spec.yField ?? [spec.minField, spec.maxField];\n }\n return series;\n }\n\n transformSpec(spec: any): void {\n super.transformSpec(spec);\n setDefaultCrosshairForCartesianChart(spec);\n }\n}\n\nexport const registerRangeColumnChart = () => {\n registerRangeColumnSeries();\n Factory.registerChart(RangeColumnChart.type, RangeColumnChart);\n};\n"]}
@@ -36,4 +36,5 @@ class Stack {
36
36
  }
37
37
  }
38
38
 
39
- exports.Stack = Stack;
39
+ exports.Stack = Stack;
40
+ //# sourceMappingURL=stack.js.map
@@ -362,5 +362,4 @@ Object.defineProperty(exports, "registerPoptip", {
362
362
  get: function() {
363
363
  return index_2.registerPoptip;
364
364
  }
365
- });
366
- //# sourceMappingURL=index.js.map
365
+ });
@@ -58,38 +58,21 @@ exports.getScale = getScale;
58
58
 
59
59
  const measureTooltipText = (text, style) => {
60
60
  var _a;
61
- text = (null != text ? text : "").toString();
62
- const measure = (0, util_1.initTextMeasure)(style);
63
- if (!style.multiLine) {
64
- const {width: width, height: height} = measure.fullMeasure(text);
65
- return {
66
- width: width,
67
- height: height,
68
- text: text
69
- };
70
- }
71
- let textLines = text.split("\n");
72
- textLines = textLines.map(((line, i) => i < textLines.length - 1 ? line + "\n" : line));
73
- const {width: width, height: height} = measure.fullMeasure(textLines);
74
- if (style.maxWidth && style.maxWidth <= width) {
75
- const bound = (0, vrender_core_1.getRichTextBounds)({
76
- wordBreak: null !== (_a = style.wordBreak) && void 0 !== _a ? _a : "break-word",
77
- maxWidth: style.maxWidth,
78
- width: 0,
79
- height: 0,
80
- textConfig: textLines.map(((line, i) => Object.assign(Object.assign({}, style), {
81
- text: line
82
- })))
83
- });
84
- return {
85
- width: bound.width(),
86
- height: bound.height(),
87
- text: textLines
88
- };
89
- }
61
+ let textLines;
62
+ text = (null != text ? text : "").toString(), style.multiLine ? (textLines = text.split("\n"),
63
+ textLines = textLines.map(((line, i) => i < textLines.length - 1 ? line + "\n" : line))) : textLines = [ text ];
64
+ const bound = (0, vrender_core_1.getRichTextBounds)({
65
+ wordBreak: null !== (_a = style.wordBreak) && void 0 !== _a ? _a : "break-word",
66
+ maxWidth: style.maxWidth ? style.maxWidth : void 0,
67
+ width: 0,
68
+ height: 0,
69
+ textConfig: textLines.map((line => Object.assign(Object.assign({}, style), {
70
+ text: line
71
+ })))
72
+ });
90
73
  return {
91
- width: width,
92
- height: height,
74
+ width: bound.width(),
75
+ height: bound.height(),
93
76
  text: textLines
94
77
  };
95
78
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/tooltip/handler/utils/common.ts"],"names":[],"mappings":";;;AAEA,2CAA4G;AAK5G,yDAA2D;AAgB3D,SAAgB,UAAU,CAAC,KAAU;IACnC,OAAO,MAAM,CAAC,KAAK,CAAC;SACjB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC;SACvB,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAC/B,CAAC;AAPD,gCAOC;AAEM,MAAM,sBAAsB,GAAG,CACpC,KAAiC,EACjC,KAAW,EACX,MAA6B,EACd,EAAE;IACjB,IAAI,IAAA,YAAK,EAAC,KAAK,CAAC,EAAE;QAChB,OAAO,KAAK,CAAC;KACd;IACD,IAAI,IAAA,iBAAU,EAAC,KAAK,CAAC,EAAE;QACrB,OAAO,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;KAC7B;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAZW,QAAA,sBAAsB,0BAYjC;AAEK,MAAM,sBAAsB,GAAG,CACpC,KAA6C,EAC7C,IAAkB,EAClB,MAA6B,EAC4D,EAAE;IAC3F,IAAI,IAAA,YAAK,EAAC,KAAK,CAAC,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AAM;QACN,IAAI,EAAE,SAAS;KAChB,CAAC;AACJ,CAAC,CAAC;AA5CW,QAAA,kBAAkB,sBA4C7B","file":"common.js","sourcesContent":["import type { Datum } from '@visactor/vgrammar-core';\nimport type { MaybeArray, TooltipContentProperty, TooltipData, TooltipPatternProperty } from '../../../../typings';\nimport { isFunction, isObject, isString, isNil, isArray, isValid, initTextMeasure } from '../../../../util';\nimport type { TooltipHandlerParams } from '../../interface';\nimport type { IDimensionData, IDimensionInfo } from '../../../../event/events/dimension';\nimport type { IRichTextParagraphCharacter } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { getRichTextBounds } from '@visactor/vrender-core';\nimport type { ITooltipTextStyle } from '../interface/style';\n\ninterface IGradientColor {\n [key: string]: any;\n stops: {\n offset: number;\n color: string;\n }[];\n}\n\n/**\n * Escape special HTML characters.\n *\n * @param value A value to convert to string and HTML-escape.\n */\nexport function escapeHTML(value: any): string {\n return String(value)\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\\(/g, '&#40;')\n .replace(/ /g, ' &nbsp;'); // 转义符和真空格夹杂,在转义和正常换行之间取得平衡\n}\n\nexport const getTooltipContentValue = <T>(\n field?: TooltipContentProperty<T>,\n datum?: any,\n params?: TooltipHandlerParams\n): T | undefined => {\n if (isNil(field)) {\n return field;\n }\n if (isFunction(field)) {\n return field(datum, params);\n }\n return field;\n};\n\nexport const getTooltipPatternValue = <T>(\n field?: MaybeArray<TooltipPatternProperty<T>>,\n data?: TooltipData,\n params?: TooltipHandlerParams\n): (typeof field extends Array<TooltipPatternProperty<T>> ? MaybeArray<T> : T) | undefined => {\n if (isNil(field)) {\n return field;\n }\n if (isArray(field)) {\n const result: T[] = [];\n field.forEach(item => {\n if (isFunction(item)) {\n const value = item(data, params);\n if (isValid(value)) {\n result.push(value);\n }\n } else {\n result.push(item);\n }\n });\n return result as any;\n }\n if (isFunction(field)) {\n return field(data, params);\n }\n return field;\n};\n\nexport function getFirstDatumFromTooltipData(data: TooltipData): Datum {\n // 找到第一个可用的datum\n const dimInfoList: IDimensionInfo[] = (data as IDimensionData[])[0]?.series\n ? [{ data: data as IDimensionData[], value: '' }]\n : (data as IDimensionInfo[]);\n for (const { data: dataList } of dimInfoList) {\n for (const { datum: datumList } of dataList) {\n for (const datumItem of datumList ?? []) {\n if (datumItem) {\n return datumItem;\n }\n }\n }\n }\n}\n\nexport function pickFirstValidValue<T>(isValid: (element?: T) => any, ...elements: T[]): T | undefined {\n for (const ele of elements) {\n if (isValid(ele)) {\n return ele;\n }\n }\n return undefined;\n}\n\n// 针对渐变色,受底层渲染引擎影响,不一定都能绘制正确,所以这里取 colorStop 的第一个颜色作为 color\nexport function convertToColorString(color: any, defaultColor: string = '#000') {\n if (!color) {\n return defaultColor;\n }\n if (isString(color)) {\n return color;\n }\n\n if (isObject(color) && (color as IGradientColor).stops && (color as IGradientColor).stops[0]) {\n return (color as IGradientColor).stops[0].color || defaultColor;\n }\n\n return defaultColor;\n}\n\n/** 获取元素的绝对缩放因数(支持外部传入 boundingClientRect 提升性能) */\nexport const getScale = (element: HTMLElement, boundingClientRect?: DOMRect) => {\n if (!element) {\n return 1;\n }\n if (!boundingClientRect) {\n boundingClientRect = element.getBoundingClientRect();\n }\n if (element.offsetWidth > 0) {\n return boundingClientRect.width / element.offsetWidth;\n }\n return boundingClientRect.height / element.offsetHeight;\n};\n\ninterface ITooltipTextInfo {\n width: number;\n height: number;\n text: MaybeArray<number> | MaybeArray<string>;\n}\n\n/** 测量 tooltip 标签文本 */\nexport const measureTooltipText = (text: string, style: ITooltipTextStyle): ITooltipTextInfo => {\n text = (text ?? '').toString();\n const measure = initTextMeasure(style as any);\n if (!style.multiLine) {\n // 单行文本\n const { width, height } = measure.fullMeasure(text);\n return {\n width,\n height,\n text\n };\n }\n // 多行文本\n let textLines = text.split('\\n');\n textLines = textLines.map((line, i) => (i < textLines.length - 1 ? line + '\\n' : line));\n const { width, height } = measure.fullMeasure(textLines);\n\n if (style.maxWidth && style.maxWidth <= width) {\n // 允许自动换行的情况,改用 richText 测量\n const bound = getRichTextBounds({\n wordBreak: style.wordBreak ?? 'break-word',\n maxWidth: style.maxWidth,\n width: 0,\n height: 0,\n textConfig: textLines.map(\n (line, i) =>\n ({\n ...style,\n text: line\n }) as unknown as IRichTextParagraphCharacter\n )\n });\n return {\n width: bound.width(),\n height: bound.height(),\n text: textLines\n };\n }\n\n return {\n width,\n height,\n text: textLines\n };\n};\n"]}
1
+ {"version":3,"sources":["../src/component/tooltip/handler/utils/common.ts"],"names":[],"mappings":";;;AAEA,2CAA4G;AAK5G,yDAA2D;AAgB3D,SAAgB,UAAU,CAAC,KAAU;IACnC,OAAO,MAAM,CAAC,KAAK,CAAC;SACjB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC;SACvB,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAC/B,CAAC;AAPD,gCAOC;AAEM,MAAM,sBAAsB,GAAG,CACpC,KAAiC,EACjC,KAAW,EACX,MAA6B,EACd,EAAE;IACjB,IAAI,IAAA,YAAK,EAAC,KAAK,CAAC,EAAE;QAChB,OAAO,KAAK,CAAC;KACd;IACD,IAAI,IAAA,iBAAU,EAAC,KAAK,CAAC,EAAE;QACrB,OAAO,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;KAC7B;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAZW,QAAA,sBAAsB,0BAYjC;AAEK,MAAM,sBAAsB,GAAG,CACpC,KAA6C,EAC7C,IAAkB,EAClB,MAA6B,EAC4D,EAAE;IAC3F,IAAI,IAAA,YAAK,EAAC,KAAK,CAAC,EAAE;QAChB,OAAO,KAAK,CAAC;KACd;IACD,IAAI,IAAA,cAAO,EA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;IACxB,IAAI,KAAK,CAAC,SAAS,EAAE;QACnB,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;KACzF;SAAM;QACL,SAAS,GAAG,CAAC,IAAI,CAAC,CAAC;KACpB;IAED,MAAM,KAAK,GAAG,IAAA,gCAAiB,EAAC;QAC9B,SAAS,EAAE,MAAA,KAAK,CAAC,SAAS,mCAAI,YAAY;QAC1C,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;QACrD,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,UAAU,EAAE,SAAS,CAAC,GAAG,CACvB,IAAI,CAAC,EAAE,CACL,CAAC,gCACI,KAAK,KACR,IAAI,EAAE,IAAI,GACgC,CAAA,CAC/C;KACF,CAAC,CAAC;IACH,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE;QACpB,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE;QACtB,IAAI,EAAE,SAAS;KAChB,CAAC;AACJ,CAAC,CAAC;AA5BW,QAAA,kBAAkB,sBA4B7B","file":"common.js","sourcesContent":["import type { Datum } from '@visactor/vgrammar-core';\nimport type { MaybeArray, TooltipContentProperty, TooltipData, TooltipPatternProperty } from '../../../../typings';\nimport { isFunction, isObject, isString, isNil, isArray, isValid, initTextMeasure } from '../../../../util';\nimport type { TooltipHandlerParams } from '../../interface';\nimport type { IDimensionData, IDimensionInfo } from '../../../../event/events/dimension';\nimport type { IRichTextParagraphCharacter } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { getRichTextBounds } from '@visactor/vrender-core';\nimport type { ITooltipTextStyle } from '../interface/style';\n\ninterface IGradientColor {\n [key: string]: any;\n stops: {\n offset: number;\n color: string;\n }[];\n}\n\n/**\n * Escape special HTML characters.\n *\n * @param value A value to convert to string and HTML-escape.\n */\nexport function escapeHTML(value: any): string {\n return String(value)\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\\(/g, '&#40;')\n .replace(/ /g, ' &nbsp;'); // 转义符和真空格夹杂,在转义和正常换行之间取得平衡\n}\n\nexport const getTooltipContentValue = <T>(\n field?: TooltipContentProperty<T>,\n datum?: any,\n params?: TooltipHandlerParams\n): T | undefined => {\n if (isNil(field)) {\n return field;\n }\n if (isFunction(field)) {\n return field(datum, params);\n }\n return field;\n};\n\nexport const getTooltipPatternValue = <T>(\n field?: MaybeArray<TooltipPatternProperty<T>>,\n data?: TooltipData,\n params?: TooltipHandlerParams\n): (typeof field extends Array<TooltipPatternProperty<T>> ? MaybeArray<T> : T) | undefined => {\n if (isNil(field)) {\n return field;\n }\n if (isArray(field)) {\n const result: T[] = [];\n field.forEach(item => {\n if (isFunction(item)) {\n const value = item(data, params);\n if (isValid(value)) {\n result.push(value);\n }\n } else {\n result.push(item);\n }\n });\n return result as any;\n }\n if (isFunction(field)) {\n return field(data, params);\n }\n return field;\n};\n\nexport function getFirstDatumFromTooltipData(data: TooltipData): Datum {\n // 找到第一个可用的datum\n const dimInfoList: IDimensionInfo[] = (data as IDimensionData[])[0]?.series\n ? [{ data: data as IDimensionData[], value: '' }]\n : (data as IDimensionInfo[]);\n for (const { data: dataList } of dimInfoList) {\n for (const { datum: datumList } of dataList) {\n for (const datumItem of datumList ?? []) {\n if (datumItem) {\n return datumItem;\n }\n }\n }\n }\n}\n\nexport function pickFirstValidValue<T>(isValid: (element?: T) => any, ...elements: T[]): T | undefined {\n for (const ele of elements) {\n if (isValid(ele)) {\n return ele;\n }\n }\n return undefined;\n}\n\n// 针对渐变色,受底层渲染引擎影响,不一定都能绘制正确,所以这里取 colorStop 的第一个颜色作为 color\nexport function convertToColorString(color: any, defaultColor: string = '#000') {\n if (!color) {\n return defaultColor;\n }\n if (isString(color)) {\n return color;\n }\n\n if (isObject(color) && (color as IGradientColor).stops && (color as IGradientColor).stops[0]) {\n return (color as IGradientColor).stops[0].color || defaultColor;\n }\n\n return defaultColor;\n}\n\n/** 获取元素的绝对缩放因数(支持外部传入 boundingClientRect 提升性能) */\nexport const getScale = (element: HTMLElement, boundingClientRect?: DOMRect) => {\n if (!element) {\n return 1;\n }\n if (!boundingClientRect) {\n boundingClientRect = element.getBoundingClientRect();\n }\n if (element.offsetWidth > 0) {\n return boundingClientRect.width / element.offsetWidth;\n }\n return boundingClientRect.height / element.offsetHeight;\n};\n\ninterface ITooltipTextInfo {\n width: number;\n height: number;\n text: MaybeArray<number> | MaybeArray<string>;\n}\n\n/** 测量 tooltip 标签文本 */\nexport const measureTooltipText = (text: string, style: ITooltipTextStyle): ITooltipTextInfo => {\n text = (text ?? '').toString();\n let textLines: string[];\n if (style.multiLine) {\n textLines = text.split('\\n');\n textLines = textLines.map((line, i) => (i < textLines.length - 1 ? line + '\\n' : line));\n } else {\n textLines = [text];\n }\n\n const bound = getRichTextBounds({\n wordBreak: style.wordBreak ?? 'break-word',\n maxWidth: style.maxWidth ? style.maxWidth : undefined,\n width: 0,\n height: 0,\n textConfig: textLines.map(\n line =>\n ({\n ...style,\n text: line\n } as unknown as IRichTextParagraphCharacter)\n )\n });\n return {\n width: bound.width(),\n height: bound.height(),\n text: textLines\n };\n};\n"]}
@@ -3,5 +3,4 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.DEFAULT_CHART_HEIGHT = exports.DEFAULT_CHART_WIDTH = exports.PREFIX = void 0,
6
- exports.PREFIX = "__VCHART", exports.DEFAULT_CHART_WIDTH = 500, exports.DEFAULT_CHART_HEIGHT = 500;
7
- //# sourceMappingURL=base.js.map
6
+ exports.PREFIX = "__VCHART", exports.DEFAULT_CHART_WIDTH = 500, exports.DEFAULT_CHART_HEIGHT = 500;
@@ -6,4 +6,5 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  const base_1 = require("./base");
8
8
 
9
- exports.WaterfallDefaultSeriesField = `${base_1.PREFIX}_waterfall_default_seriesField`;
9
+ exports.WaterfallDefaultSeriesField = `${base_1.PREFIX}_waterfall_default_seriesField`;
10
+ //# sourceMappingURL=waterfall.js.map
@@ -1,7 +1,7 @@
1
1
  import { VChart } from './vchart';
2
2
  import { Factory } from './factory';
3
3
  export { VChart, Factory };
4
- export declare const version = "1.5.3";
4
+ export declare const version = "1.5.4";
5
5
  export type { IVChart } from './interface';
6
6
  export * from '../event/interface';
7
7
  export * from '../typings/spec/common';
package/cjs/core/index.js CHANGED
@@ -35,6 +35,6 @@ Object.defineProperty(exports, "Factory", {
35
35
  get: function() {
36
36
  return factory_1.Factory;
37
37
  }
38
- }), exports.version = "1.5.3", __exportStar(require("../event/interface"), exports),
38
+ }), exports.version = "1.5.4", __exportStar(require("../event/interface"), exports),
39
39
  __exportStar(require("../typings/spec/common"), exports), __exportStar(require("../theme/interface"), exports);
40
40
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,qCAAkC;AAGzB,uFAHA,eAAM,OAGA;AAFf,uCAAoC;AAEnB,wFAFR,iBAAO,OAEQ;AAGX,QAAA,OAAO,GAAG,OAAO,CAAC;AAM/B,qDAAmC;AACnC,yDAAuC;AACvC,qDAAmC","file":"index.js","sourcesContent":["/**\n * @description The core module of VChart, containing the necessary interfaces for using VChart.\n */\n\nimport { VChart } from './vchart';\nimport { Factory } from './factory';\n\nexport { VChart, Factory };\n\n// export the version\nexport const version = \"1.5.3\";\n\n// export necessary types\nexport type { IVChart } from './interface';\n\n// the event types\nexport * from '../event/interface';\nexport * from '../typings/spec/common';\nexport * from '../theme/interface';\nexport type { IStateSpec, StateValueType } from '../compile/mark';\n"]}
1
+ {"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,qCAAkC;AAGzB,uFAHA,eAAM,OAGA;AAFf,uCAAoC;AAEnB,wFAFR,iBAAO,OAEQ;AAGX,QAAA,OAAO,GAAG,OAAO,CAAC;AAM/B,qDAAmC;AACnC,yDAAuC;AACvC,qDAAmC","file":"index.js","sourcesContent":["/**\n * @description The core module of VChart, containing the necessary interfaces for using VChart.\n */\n\nimport { VChart } from './vchart';\nimport { Factory } from './factory';\n\nexport { VChart, Factory };\n\n// export the version\nexport const version = \"1.5.4\";\n\n// export necessary types\nexport type { IVChart } from './interface';\n\n// the event types\nexport * from '../event/interface';\nexport * from '../typings/spec/common';\nexport * from '../theme/interface';\nexport type { IStateSpec, StateValueType } from '../compile/mark';\n"]}
@@ -12,8 +12,8 @@ const vutils_1 = require("@visactor/vutils"), funnel = (originData, op) => {
12
12
  return data.forEach(((d, i) => {
13
13
  var _a, _b;
14
14
  const currentValue = Number.parseFloat(d[valueField]), lastValue = Number.parseFloat(null === (_a = data[i - 1]) || void 0 === _a ? void 0 : _a[valueField]), nextValue = Number.parseFloat(null === (_b = data[i + 1]) || void 0 === _b ? void 0 : _b[valueField]), transformRatio = (0,
15
- vutils_1.isValidNumber)(nextValue * currentValue) ? nextValue / currentValue : null, reachRatio = (0,
16
- vutils_1.isValidNumber)(currentValue * currentValue) ? currentValue / lastValue : null;
15
+ vutils_1.isValidNumber)(nextValue * currentValue) && 0 !== currentValue ? nextValue / currentValue : 0, reachRatio = (0,
16
+ vutils_1.isValidNumber)(currentValue * lastValue) && 0 !== lastValue ? currentValue / lastValue : 0;
17
17
  asLastValue && (d[asLastValue] = lastValue), asNextValue && (d[asNextValue] = nextValue),
18
18
  asTransformRatio && (d[asTransformRatio] = transformRatio), asReachRatio && (d[asReachRatio] = 0 === i ? 1 : reachRatio),
19
19
  asHeightRatio && (d[asHeightRatio] = !0 === heightVisual ? transformRatio : 1 / data.length),
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/data/transforms/funnel.ts"],"names":[],"mappings":";;;AACA,6CAAiD;AAgC1C,MAAM,MAAM,GAAG,CAAC,UAA2B,EAAE,EAAc,EAAE,EAAE;;IACpE,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,mBAAM,KAAK,EAAG,CAAC,CAAC;IACrD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QAC9B,OAAO,IAAI,CAAC;KACb;IACD,MAAM,EACJ,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,WAAW,EACX,YAAY,GAAG,KAAK,EACpB,MAAM,GAAG,IAAI,EACb,KAAK,EACN,GAAG,EAAE,CAAC;IAEP,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IACzG,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;IACvG,MAAM,QAAQ,GAAG,CAAC,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,GAAG,mCAAI,GAAG,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,GAAG,mCAAI,GAAG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BAU1B","file":"funnel.js","sourcesContent":["import type { DataView } from '@visactor/vdataset';\nimport { isValidNumber } from '@visactor/vutils';\n\nexport interface IFunnelOpt {\n valueField: string;\n /** 转化率(当前层到下一层的比例) **/\n asTransformRatio: string;\n /** 到达率 (上一层到当前层的比例)*/\n asReachRatio: string;\n /** 高度轴占总量的比例 **/\n asHeightRatio: string;\n /** 当前值大小占比 */\n asValueRatio: string;\n /** 上一层值大小占比 */\n asLastValueRatio: string;\n /** 下一层值大小占比 */\n asNextValueRatio: string;\n /** 当前层的值 */\n asCurrentValue: string;\n /** 上一层的值 **/\n asLastValue: string;\n /** 下一层的值 **/\n asNextValue: string;\n\n /** 最底层漏斗是否为锥形 */\n isCone?: boolean;\n /** 高度是否进行数据映射 **/\n heightVisual?: boolean;\n\n /** 数值范围 */\n range?: { min: number; max: number };\n}\n\nexport const funnel = (originData: Array<DataView>, op: IFunnelOpt) => {\n const data = originData.map(datum => ({ ...datum }));\n if (!data || data.length === 0) {\n return data;\n }\n const {\n valueField,\n asTransformRatio,\n asReachRatio,\n asHeightRatio,\n asValueRatio,\n asNextValueRatio,\n asLastValueRatio,\n asLastValue,\n asCurrentValue,\n asNextValue,\n heightVisual = false,\n isCone = true,\n range\n } = op;\n\n const max = data.reduce((m, d) => Math.max(m, Number.parseFloat(d[valueField]) || -Infinity), -Infinity);\n const min = data.reduce((m, d) => Math.min(m, Number.parseFloat(d[valueField]) || Infinity), Infinity);\n const rangeArr = [range?.min ?? min, range?.max ?? max];\n\n data.forEach((d, i) => {\n const currentValue: number = Number.parseFloat(d[valueField]);\n const lastValue: number = Number.parseFloat(data[i - 1]?.[valueField]);\n const nextValue: number = Number.parseFloat(data[i + 1]?.[valueField]);\n\n const transformRatio = !isValidNumber(nextValue * currentValue) ? null : nextValue / currentValue;\n\n const reachRatio = !isValidNumber(currentValue * currentValue) ? null : currentValue / lastValue;\n\n asLastValue && (d[asLastValue] = lastValue);\n asNextValue && (d[asNextValue] = nextValue);\n asTransformRatio && (d[asTransformRatio] = transformRatio);\n asReachRatio && (d[asReachRatio] = i === 0 ? 1 : reachRatio);\n asHeightRatio && (d[asHeightRatio] = heightVisual === true ? transformRatio : 1 / data.length);\n asValueRatio && (d[asValueRatio] = currentValue / rangeArr[1]);\n asNextValueRatio &&\n (d[asNextValueRatio] = i === data.length - 1 ? (isCone ? 0 : d[asValueRatio]) : nextValue / rangeArr[1]);\n asLastValueRatio && (d[asLastValueRatio] = i === 0 ? 1 : lastValue / rangeArr[1]);\n asCurrentValue && (d[asCurrentValue] = currentValue);\n });\n\n return data;\n};\n\nexport interface IFunnelTransformOpt {\n asIsTransformLevel: string;\n}\n\nexport const funnelTransform = (originData: Array<DataView>, op: IFunnelTransformOpt) => {\n const data = originData[0]?.latestData?.map((datum: any) => ({ ...datum }));\n if (!data || data.length === 0) {\n return data;\n }\n data.shift();\n data.forEach((d: any) => {\n d[op.asIsTransformLevel] = true;\n });\n return data;\n};\n"]}
1
+ {"version":3,"sources":["../src/data/transforms/funnel.ts"],"names":[],"mappings":";;;AACA,6CAAiD;AAgC1C,MAAM,MAAM,GAAG,CAAC,UAA2B,EAAE,EAAc,EAAE,EAAE;;IACpE,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,mBAAM,KAAK,EAAG,CAAC,CAAC;IACrD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QAC9B,OAAO,IAAI,CAAC;KACb;IACD,MAAM,EACJ,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,WAAW,EACX,YAAY,GAAG,KAAK,EACpB,MAAM,GAAG,IAAI,EACb,KAAK,EACN,GAAG,EAAE,CAAC;IAEP,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CA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CW,QAAA,MAAM,UA+CjB;AAMK,MAAM,eAAe,GAAG,CAAC,UAA2B,EAAE,EAAuB,EAAE,EAAE;;IACtF,MAAM,IAAI,GAAG,MAAA,MAAA,UAAU,CAAC,CAAC,CAAC,0CAAE,UAAU,0CAAE,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,mBAAM,KAAK,EAAG,CAAC,CAAC;IAC5E,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QAC9B,OAAO,IAAI,CAAC;KACb;IACD,IAAI,CAAC,KAAK,EAAE,CAAC;IACb,IAAI,CAAC,OAAO,CAAC,CAAC,CAAM,EAAE,EAAE;QACtB,CAAC,CAAC,EAAE,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC;IAClC,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAVW,QAAA,eAAe,mBAU1B","file":"funnel.js","sourcesContent":["import type { DataView } from '@visactor/vdataset';\nimport { isValidNumber } from '@visactor/vutils';\n\nexport interface IFunnelOpt {\n valueField: string;\n /** 转化率(当前层到下一层的比例) **/\n asTransformRatio: string;\n /** 到达率 (上一层到当前层的比例)*/\n asReachRatio: string;\n /** 高度轴占总量的比例 **/\n asHeightRatio: string;\n /** 当前值大小占比 */\n asValueRatio: string;\n /** 上一层值大小占比 */\n asLastValueRatio: string;\n /** 下一层值大小占比 */\n asNextValueRatio: string;\n /** 当前层的值 */\n asCurrentValue: string;\n /** 上一层的值 **/\n asLastValue: string;\n /** 下一层的值 **/\n asNextValue: string;\n\n /** 最底层漏斗是否为锥形 */\n isCone?: boolean;\n /** 高度是否进行数据映射 **/\n heightVisual?: boolean;\n\n /** 数值范围 */\n range?: { min: number; max: number };\n}\n\nexport const funnel = (originData: Array<DataView>, op: IFunnelOpt) => {\n const data = originData.map(datum => ({ ...datum }));\n if (!data || data.length === 0) {\n return data;\n }\n const {\n valueField,\n asTransformRatio,\n asReachRatio,\n asHeightRatio,\n asValueRatio,\n asNextValueRatio,\n asLastValueRatio,\n asLastValue,\n asCurrentValue,\n asNextValue,\n heightVisual = false,\n isCone = true,\n range\n } = op;\n\n const max = data.reduce((m, d) => Math.max(m, Number.parseFloat(d[valueField]) || -Infinity), -Infinity);\n const min = data.reduce((m, d) => Math.min(m, Number.parseFloat(d[valueField]) || Infinity), Infinity);\n const rangeArr = [range?.min ?? min, range?.max ?? max];\n\n data.forEach((d, i) => {\n const currentValue: number = Number.parseFloat(d[valueField]);\n const lastValue: number = Number.parseFloat(data[i - 1]?.[valueField]);\n const nextValue: number = Number.parseFloat(data[i + 1]?.[valueField]);\n\n const transformRatio =\n !isValidNumber(nextValue * currentValue) || currentValue === 0 ? 0 : nextValue / currentValue;\n const reachRatio = !isValidNumber(currentValue * lastValue) || lastValue === 0 ? 0 : currentValue / lastValue;\n\n asLastValue && (d[asLastValue] = lastValue);\n asNextValue && (d[asNextValue] = nextValue);\n asTransformRatio && (d[asTransformRatio] = transformRatio);\n asReachRatio && (d[asReachRatio] = i === 0 ? 1 : reachRatio);\n asHeightRatio && (d[asHeightRatio] = heightVisual === true ? transformRatio : 1 / data.length);\n asValueRatio && (d[asValueRatio] = currentValue / rangeArr[1]);\n asNextValueRatio &&\n (d[asNextValueRatio] = i === data.length - 1 ? (isCone ? 0 : d[asValueRatio]) : nextValue / rangeArr[1]);\n asLastValueRatio && (d[asLastValueRatio] = i === 0 ? 1 : lastValue / rangeArr[1]);\n asCurrentValue && (d[asCurrentValue] = currentValue);\n });\n\n return data;\n};\n\nexport interface IFunnelTransformOpt {\n asIsTransformLevel: string;\n}\n\nexport const funnelTransform = (originData: Array<DataView>, op: IFunnelTransformOpt) => {\n const data = originData[0]?.latestData?.map((datum: any) => ({ ...datum }));\n if (!data || data.length === 0) {\n return data;\n }\n data.shift();\n data.forEach((d: any) => {\n d[op.asIsTransformLevel] = true;\n });\n return data;\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  import { CartesianSeries } from '../cartesian/cartesian';
2
- import type { IMark } from '../../mark/interface';
2
+ import type { IMark, IMarkProgressiveConfig } from '../../mark/interface';
3
3
  import { MarkTypeEnum } from '../../mark/interface';
4
4
  import type { Maybe, Datum, DirectionType } from '../../typings';
5
5
  import type { IBarSeriesSpec, IBarSeriesTheme } from './interface';
@@ -10,6 +10,8 @@ import type { ITextMark } from '../../mark/text';
10
10
  import type { SeriesMarkMap } from '../interface';
11
11
  import { SeriesMarkNameEnum } from '../interface/type';
12
12
  import { SeriesTypeEnum } from '../interface';
13
+ import { SeriesData } from '../base/series-data';
14
+ import { DataView } from '@visactor/vdataset';
13
15
  export declare const DefaultBandWidth = 6;
14
16
  export declare class BarSeries<T extends IBarSeriesSpec = IBarSeriesSpec> extends CartesianSeries<T> {
15
17
  static readonly type: string;
@@ -20,16 +22,21 @@ export declare class BarSeries<T extends IBarSeriesSpec = IBarSeriesSpec> extend
20
22
  protected _theme: Maybe<IBarSeriesTheme>;
21
23
  protected _supportStack: boolean;
22
24
  protected _bandPosition: number;
23
- protected _rectMark: IRectMark;
25
+ protected _barMark: IRectMark;
26
+ protected _barBackgroundMark: IRectMark;
27
+ protected _barBackgroundViewData: SeriesData;
24
28
  initMark(): void;
29
+ protected _initBarBackgroundMark(progressive?: IMarkProgressiveConfig): void;
25
30
  initMarkStyle(): void;
26
31
  initLabelMarkStyle(textMark: ITextMark): void;
27
32
  protected initTooltip(): void;
33
+ protected _statisticViewData(): void;
28
34
  init(option: IModelInitOption): void;
29
35
  private _shouldDoPreCalculate;
30
36
  private _calculateStackRectPosition;
31
37
  private _calculateRectPosition;
32
38
  initBandRectMarkStyle(): void;
39
+ protected _initBarBackgroundMarkStyle(): void;
33
40
  initLinearRectMarkStyle(): void;
34
41
  initAnimation(): void;
35
42
  protected _getBarWidth(axisHelper: IAxisHelper): number;
@@ -37,5 +44,9 @@ export declare class BarSeries<T extends IBarSeriesSpec = IBarSeriesSpec> extend
37
44
  onLayoutEnd(ctx: any): void;
38
45
  getDefaultShapeType(): string;
39
46
  getActiveMarks(): IMark[];
47
+ compileData(): void;
48
+ fillData(): void;
49
+ viewDataUpdate(d: DataView): void;
50
+ release(): void;
40
51
  }
41
52
  export declare const registerBarSeries: () => void;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.registerBarSeries = exports.BarSeries = exports.DefaultBandWidth = void 0;
6
6
 
7
- const index_1 = require("./../../constant/index"), vscale_1 = require("@visactor/vscale"), space_1 = require("../../typings/space"), cartesian_1 = require("../cartesian/cartesian"), interface_1 = require("../../mark/interface"), constant_1 = require("../../constant"), util_1 = require("../../util"), animation_1 = require("./animation"), utils_1 = require("../../animation/utils"), type_1 = require("../interface/type"), interface_2 = require("../interface"), rect_1 = require("../../mark/rect"), vutils_1 = require("@visactor/vutils"), constant_2 = require("./constant"), stack_1 = require("../util/stack"), factory_1 = require("../../core/factory");
7
+ const index_1 = require("./../../constant/index"), vscale_1 = require("@visactor/vscale"), space_1 = require("../../typings/space"), cartesian_1 = require("../cartesian/cartesian"), interface_1 = require("../../mark/interface"), constant_1 = require("../../constant"), util_1 = require("../../util"), animation_1 = require("./animation"), utils_1 = require("../../animation/utils"), type_1 = require("../interface/type"), interface_2 = require("../interface"), rect_1 = require("../../mark/rect"), vutils_1 = require("@visactor/vutils"), constant_2 = require("./constant"), stack_1 = require("../util/stack"), factory_1 = require("../../core/factory"), register_1 = require("../../data/register"), series_data_1 = require("../base/series-data"), vdataset_1 = require("@visactor/vdataset"), add_property_1 = require("../../data/transforms/add-property"), data_key_1 = require("../../data/transforms/data-key");
8
8
 
9
9
  exports.DefaultBandWidth = 6;
10
10
 
@@ -22,7 +22,7 @@ class BarSeries extends cartesian_1.CartesianSeries {
22
22
  large: this._spec.large,
23
23
  largeThreshold: this._spec.largeThreshold
24
24
  };
25
- this._rectMark = this._createMark(Object.assign(Object.assign({}, BarSeries.mark.bar), {
25
+ this._initBarBackgroundMark(progressive), this._barMark = this._createMark(Object.assign(Object.assign({}, BarSeries.mark.bar), {
26
26
  name: this._barMarkName,
27
27
  type: this._barMarkType
28
28
  }), {
@@ -36,11 +36,18 @@ class BarSeries extends cartesian_1.CartesianSeries {
36
36
  progressive: progressive
37
37
  });
38
38
  }
39
+ _initBarBackgroundMark(progressive) {
40
+ var _a;
41
+ (null === (_a = this._spec.barBackground) || void 0 === _a ? void 0 : _a.visible) && (this._barBackgroundMark = this._createMark(BarSeries.mark.barBackground, {
42
+ dataView: this._barBackgroundViewData.getDataView(),
43
+ dataProductId: this._barBackgroundViewData.getProductId(),
44
+ progressive: progressive
45
+ }));
46
+ }
39
47
  initMarkStyle() {
40
- const rectMark = this._rectMark;
41
- rectMark && (this.setMarkStyle(rectMark, {
48
+ this._barMark && (this.setMarkStyle(this._barMark, {
42
49
  fill: this.getColorAttribute()
43
- }, "normal", constant_1.AttributeLevel.Series), this._trigger.registerMark(rectMark));
50
+ }, "normal", constant_1.AttributeLevel.Series), this._trigger.registerMark(this._barMark));
44
51
  }
45
52
  initLabelMarkStyle(textMark) {
46
53
  textMark && this.setMarkStyle(textMark, {
@@ -50,7 +57,40 @@ class BarSeries extends cartesian_1.CartesianSeries {
50
57
  });
51
58
  }
52
59
  initTooltip() {
53
- super.initTooltip(), this._rectMark && this._tooltipHelper.activeTriggerSet.mark.add(this._rectMark);
60
+ super.initTooltip(), this._barMark && this._tooltipHelper.activeTriggerSet.mark.add(this._barMark);
61
+ }
62
+ _statisticViewData() {
63
+ var _a, _b;
64
+ if (super._statisticViewData(), !(null === (_a = this._spec.barBackground) || void 0 === _a ? void 0 : _a.visible)) return;
65
+ (0, register_1.registerDataSetInstanceTransform)(this._option.dataSet, "addVChartProperty", add_property_1.addVChartProperty),
66
+ (0, register_1.registerDataSetInstanceTransform)(this._option.dataSet, "dimensionItems", (([data], op) => {
67
+ var _a;
68
+ let dataCollect = [ {} ];
69
+ const fields = this.getDimensionField();
70
+ for (let i = 0; i < fields.length; i++) {
71
+ const field = fields[i], values = null === (_a = data.latestData[field]) || void 0 === _a ? void 0 : _a.values;
72
+ if (!(null == values ? void 0 : values.length)) continue;
73
+ const newDataCollect = [];
74
+ for (let j = 0; j < values.length; j++) for (let k = 0; k < dataCollect.length; k++) newDataCollect.push(Object.assign(Object.assign({}, dataCollect[k]), {
75
+ [field]: values[j]
76
+ }));
77
+ dataCollect = newDataCollect;
78
+ }
79
+ return dataCollect;
80
+ }));
81
+ const barBackgroundData = new vdataset_1.DataView(this._option.dataSet).parse([ this._viewDataStatistics ], {
82
+ type: "dataview"
83
+ }).transform({
84
+ type: "dimensionItems"
85
+ }, !1).transform({
86
+ type: "addVChartProperty",
87
+ options: {
88
+ beforeCall: data_key_1.initKeyMap,
89
+ call: data_key_1.addDataKey.bind(this)
90
+ }
91
+ }, !1);
92
+ null === (_b = this._viewDataStatistics) || void 0 === _b || _b.target.addListener("change", barBackgroundData.reRunAllTransform),
93
+ this._barBackgroundViewData = new series_data_1.SeriesData(this._option, barBackgroundData);
54
94
  }
55
95
  init(option) {
56
96
  var _a, _b;
@@ -94,7 +134,7 @@ class BarSeries extends cartesian_1.CartesianSeries {
94
134
  initBandRectMarkStyle() {
95
135
  var _a, _b, _c, _d;
96
136
  const xScale = null === (_b = null === (_a = this._xAxisHelper) || void 0 === _a ? void 0 : _a.getScale) || void 0 === _b ? void 0 : _b.call(_a, 0), yScale = null === (_d = null === (_c = this._yAxisHelper) || void 0 === _c ? void 0 : _c.getScale) || void 0 === _d ? void 0 : _d.call(_c, 0);
97
- this.direction === space_1.Direction.horizontal ? this.setMarkStyle(this._rectMark, {
137
+ this.direction === space_1.Direction.horizontal ? this.setMarkStyle(this._barMark, {
98
138
  x: datum => this._shouldDoPreCalculate() ? (this._calculateStackRectPosition(!1),
99
139
  datum[RECT_X]) : this._spec.barMinHeight ? this._calculateRectPosition(datum, !1) : (0,
100
140
  util_1.valueInScaleRange)(this.dataToPositionX(datum), xScale),
@@ -102,7 +142,7 @@ class BarSeries extends cartesian_1.CartesianSeries {
102
142
  datum[RECT_X1]) : (0, util_1.valueInScaleRange)(this.dataToPositionX1(datum), xScale),
103
143
  y: datum => this._getPosition(this.direction, datum),
104
144
  height: () => this._getBarWidth(this._yAxisHelper)
105
- }, "normal", constant_1.AttributeLevel.Series) : this.setMarkStyle(this._rectMark, {
145
+ }, "normal", constant_1.AttributeLevel.Series) : this.setMarkStyle(this._barMark, {
106
146
  x: datum => this._getPosition(this.direction, datum),
107
147
  y: (datum, ctx, opt, dataView) => this._shouldDoPreCalculate() ? (this._calculateStackRectPosition(!0),
108
148
  datum[RECT_Y]) : this._spec.barMinHeight ? this._calculateRectPosition(datum, !0) : (0,
@@ -110,12 +150,40 @@ class BarSeries extends cartesian_1.CartesianSeries {
110
150
  y1: datum => this._shouldDoPreCalculate() ? (this._calculateStackRectPosition(!0),
111
151
  datum[RECT_Y1]) : (0, util_1.valueInScaleRange)(this.dataToPositionY1(datum), yScale),
112
152
  width: () => this._getBarWidth(this._xAxisHelper)
153
+ }, "normal", constant_1.AttributeLevel.Series), this._initBarBackgroundMarkStyle();
154
+ }
155
+ _initBarBackgroundMarkStyle() {
156
+ var _a, _b, _c, _d;
157
+ if (!this._barBackgroundMark) return;
158
+ const xScale = null === (_b = null === (_a = this._xAxisHelper) || void 0 === _a ? void 0 : _a.getScale) || void 0 === _b ? void 0 : _b.call(_a, 0), yScale = null === (_d = null === (_c = this._yAxisHelper) || void 0 === _c ? void 0 : _c.getScale) || void 0 === _d ? void 0 : _d.call(_c, 0);
159
+ this.direction === space_1.Direction.horizontal ? this.setMarkStyle(this._barBackgroundMark, {
160
+ x: () => {
161
+ const range = xScale.range();
162
+ return Math.min(range[0], range[range.length - 1]);
163
+ },
164
+ x1: () => {
165
+ const range = xScale.range();
166
+ return Math.max(range[0], range[range.length - 1]);
167
+ },
168
+ y: datum => this._getPosition(this.direction, datum),
169
+ height: () => this._getBarWidth(this._yAxisHelper)
170
+ }, "normal", constant_1.AttributeLevel.Series) : this.setMarkStyle(this._barBackgroundMark, {
171
+ x: datum => this._getPosition(this.direction, datum),
172
+ y: () => {
173
+ const range = yScale.range();
174
+ return Math.min(range[0], range[range.length - 1]);
175
+ },
176
+ y1: () => {
177
+ const range = yScale.range();
178
+ return Math.max(range[0], range[range.length - 1]);
179
+ },
180
+ width: () => this._getBarWidth(this._xAxisHelper)
113
181
  }, "normal", constant_1.AttributeLevel.Series);
114
182
  }
115
183
  initLinearRectMarkStyle() {
116
184
  var _a, _b, _c, _d;
117
185
  const xScale = null === (_b = null === (_a = this._xAxisHelper) || void 0 === _a ? void 0 : _a.getScale) || void 0 === _b ? void 0 : _b.call(_a, 0), yScale = null === (_d = null === (_c = this._yAxisHelper) || void 0 === _c ? void 0 : _c.getScale) || void 0 === _d ? void 0 : _d.call(_c, 0);
118
- this.direction === space_1.Direction.vertical ? this.setMarkStyle(this._rectMark, {
186
+ this.direction === space_1.Direction.vertical ? this.setMarkStyle(this._barMark, {
119
187
  x: datum => (0, util_1.valueInScaleRange)(this.dataToPositionX(datum), xScale),
120
188
  x1: datum => (0, util_1.valueInScaleRange)(this.dataToPositionX1(datum), xScale),
121
189
  y: (datum, ctx, opt, dataView) => this._shouldDoPreCalculate() ? (this._calculateStackRectPosition(!0),
@@ -123,7 +191,7 @@ class BarSeries extends cartesian_1.CartesianSeries {
123
191
  util_1.valueInScaleRange)(this.dataToPositionY(datum), yScale),
124
192
  y1: datum => this._shouldDoPreCalculate() ? (this._calculateStackRectPosition(!0),
125
193
  datum[RECT_Y1]) : (0, util_1.valueInScaleRange)(this.dataToPositionY1(datum), yScale)
126
- }, "normal", constant_1.AttributeLevel.Series) : this.setMarkStyle(this._rectMark, {
194
+ }, "normal", constant_1.AttributeLevel.Series) : this.setMarkStyle(this._barMark, {
127
195
  x: datum => this._shouldDoPreCalculate() ? (this._calculateStackRectPosition(!1),
128
196
  datum[RECT_X]) : this._spec.barMinHeight ? this._calculateRectPosition(datum, !1) : (0,
129
197
  util_1.valueInScaleRange)(this.dataToPositionX(datum), xScale),
@@ -144,7 +212,7 @@ class BarSeries extends cartesian_1.CartesianSeries {
144
212
  return "horizontal" === this.direction ? null === (_a = this._xAxisHelper) || void 0 === _a ? void 0 : _a.getScale(0).scale(0) : null === (_b = this._yAxisHelper) || void 0 === _b ? void 0 : _b.getScale(0).scale(0);
145
213
  }
146
214
  }, appearPreset = null === (_b = null === (_a = this._spec) || void 0 === _a ? void 0 : _a.animationAppear) || void 0 === _b ? void 0 : _b.preset;
147
- this._rectMark.setAnimationConfig((0, utils_1.animationConfig)(null === (_c = factory_1.Factory.getAnimationInKey("bar")) || void 0 === _c ? void 0 : _c(animationParams, appearPreset), (0,
215
+ this._barMark.setAnimationConfig((0, utils_1.animationConfig)(null === (_c = factory_1.Factory.getAnimationInKey("bar")) || void 0 === _c ? void 0 : _c(animationParams, appearPreset), (0,
148
216
  utils_1.userAnimationConfig)(this._barMarkName, this._spec), {
149
217
  dataIndex: datum => {
150
218
  var _a, _b, _c;
@@ -169,7 +237,7 @@ class BarSeries extends cartesian_1.CartesianSeries {
169
237
  direction === space_1.Direction.horizontal ? (axisHelper = this.getYAxisHelper(),
170
238
  sizeAttribute = "height", dataToPosition = this.dataToPositionY.bind(this)) : (axisHelper = this.getXAxisHelper(),
171
239
  sizeAttribute = "width", dataToPosition = this.dataToPositionX.bind(this));
172
- const scale = axisHelper.getScale(0), size = this._rectMark.getAttribute(sizeAttribute, datum), bandWidth = null !== (_b = null === (_a = axisHelper.getBandwidth) || void 0 === _a ? void 0 : _a.call(axisHelper, this._groups ? this._groups.fields.length - 1 : 0)) && void 0 !== _b ? _b : exports.DefaultBandWidth;
240
+ const scale = axisHelper.getScale(0), size = this._barMark.getAttribute(sizeAttribute, datum), bandWidth = null !== (_b = null === (_a = axisHelper.getBandwidth) || void 0 === _a ? void 0 : _a.call(axisHelper, this._groups ? this._groups.fields.length - 1 : 0)) && void 0 !== _b ? _b : exports.DefaultBandWidth;
173
241
  if ((null === (_d = null === (_c = this._groups) || void 0 === _c ? void 0 : _c.fields) || void 0 === _d ? void 0 : _d.length) > 1 && (0,
174
242
  vutils_1.isValid)(this._spec.barGapInGroup)) {
175
243
  const groupFields = this._groups.fields, barInGroup = (0, vutils_1.array)(this._spec.barGapInGroup);
@@ -194,7 +262,25 @@ class BarSeries extends cartesian_1.CartesianSeries {
194
262
  return "square";
195
263
  }
196
264
  getActiveMarks() {
197
- return [ this._rectMark ];
265
+ return [ this._barMark ];
266
+ }
267
+ compileData() {
268
+ var _a;
269
+ super.compileData(), null === (_a = this._barBackgroundViewData) || void 0 === _a || _a.compile();
270
+ }
271
+ fillData() {
272
+ var _a, _b;
273
+ super.fillData(), null === (_b = null === (_a = this._barBackgroundViewData) || void 0 === _a ? void 0 : _a.getDataView()) || void 0 === _b || _b.reRunAllTransform();
274
+ }
275
+ viewDataUpdate(d) {
276
+ var _a, _b, _c;
277
+ super.viewDataUpdate(d), null === (_b = null === (_a = this._barBackgroundViewData) || void 0 === _a ? void 0 : _a.getDataView()) || void 0 === _b || _b.reRunAllTransform(),
278
+ null === (_c = this._barBackgroundViewData) || void 0 === _c || _c.updateData();
279
+ }
280
+ release() {
281
+ var _a;
282
+ super.release(), null === (_a = this._barBackgroundViewData) || void 0 === _a || _a.release(),
283
+ this._barBackgroundViewData = null;
198
284
  }
199
285
  }
200
286