@visactor/vtable 0.13.3 → 0.13.4-alpha.2

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 (53) hide show
  1. package/cjs/components/axis/get-axis-attributes.d.ts +7 -0
  2. package/cjs/components/axis/get-axis-attributes.js +13 -17
  3. package/cjs/components/axis/get-axis-attributes.js.map +1 -1
  4. package/cjs/core/BaseTable.js +1 -1
  5. package/cjs/core/BaseTable.js.map +1 -1
  6. package/cjs/event/media-click.js +1 -2
  7. package/cjs/event/sparkline-event.js +2 -1
  8. package/cjs/index.d.ts +1 -1
  9. package/cjs/index.js +1 -1
  10. package/cjs/index.js.map +1 -1
  11. package/cjs/layout/chart-helper/get-axis-config.js +7 -5
  12. package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
  13. package/cjs/layout/chart-helper/get-axis-domain.d.ts +1 -1
  14. package/cjs/layout/chart-helper/get-axis-domain.js +17 -7
  15. package/cjs/layout/chart-helper/get-axis-domain.js.map +1 -1
  16. package/cjs/layout/chart-helper/get-chart-spec.js +3 -3
  17. package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
  18. package/cjs/scenegraph/layout/update-height.js +2 -4
  19. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  20. package/cjs/tools/LimitPromiseQueue.js +1 -1
  21. package/cjs/tools/NumberMap.js +1 -1
  22. package/cjs/tools/Rect.js +1 -1
  23. package/cjs/ts-types/base-table.js +1 -1
  24. package/cjs/ts-types/common.js +1 -1
  25. package/cjs/ts-types/customElement.js +1 -1
  26. package/dist/vtable.js +29 -12
  27. package/dist/vtable.min.js +2 -2
  28. package/es/components/axis/get-axis-attributes.d.ts +7 -0
  29. package/es/components/axis/get-axis-attributes.js +1 -1
  30. package/es/components/axis/get-axis-attributes.js.map +1 -1
  31. package/es/core/BaseTable.js +1 -1
  32. package/es/core/BaseTable.js.map +1 -1
  33. package/es/event/media-click.js +1 -2
  34. package/es/event/sparkline-event.js +2 -1
  35. package/es/index.d.ts +1 -1
  36. package/es/index.js +1 -1
  37. package/es/index.js.map +1 -1
  38. package/es/layout/chart-helper/get-axis-config.js +7 -5
  39. package/es/layout/chart-helper/get-axis-config.js.map +1 -1
  40. package/es/layout/chart-helper/get-axis-domain.d.ts +1 -1
  41. package/es/layout/chart-helper/get-axis-domain.js +19 -7
  42. package/es/layout/chart-helper/get-axis-domain.js.map +1 -1
  43. package/es/layout/chart-helper/get-chart-spec.js +3 -3
  44. package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
  45. package/es/scenegraph/layout/update-height.js +2 -4
  46. package/es/scenegraph/layout/update-height.js.map +1 -1
  47. package/es/tools/LimitPromiseQueue.js +1 -1
  48. package/es/tools/NumberMap.js +1 -1
  49. package/es/tools/Rect.js +1 -1
  50. package/es/ts-types/base-table.js +1 -1
  51. package/es/ts-types/common.js +1 -1
  52. package/es/ts-types/customElement.js +1 -1
  53. package/package.json +3 -3
@@ -54,5 +54,4 @@ function bindMediaClick(table) {
54
54
  }));
55
55
  }
56
56
 
57
- exports.bindMediaClick = bindMediaClick;
58
- //# sourceMappingURL=media-click.js.map
57
+ exports.bindMediaClick = bindMediaClick;
@@ -22,4 +22,5 @@ function bindSparklineHoverEvent(table) {
22
22
  })));
23
23
  }
24
24
 
25
- exports.bindSparklineHoverEvent = bindSparklineHoverEvent;
25
+ exports.bindSparklineHoverEvent = bindSparklineHoverEvent;
26
+ //# sourceMappingURL=sparkline-event.js.map
package/cjs/index.d.ts CHANGED
@@ -12,7 +12,7 @@ import type { MousePointerCellEvent } from './ts-types/events';
12
12
  import * as CustomLayout from './render/layout';
13
13
  export { getDataCellPath } from './tools/get-data-path';
14
14
  export * from './render/jsx';
15
- export declare const version = "0.13.3";
15
+ export declare const version = "0.13.4-alpha.2";
16
16
  export { TYPES, core, ListTable, ListTableConstructorOptions, PivotTable, PivotTableConstructorOptions, PivotChartConstructorOptions, PivotChart, IHeaderTreeDefine, IDimension, ColumnsDefine, ColumnDefine, LinkColumnDefine, ChartColumnDefine, ImageColumnDefine, SparklineColumnDefine, ProgressbarColumnDefine, TextColumnDefine, GroupColumnDefine, TextAlignType, TextBaselineType, themes, data, MousePointerCellEvent, getIcons, clearGlobal, register, DataStatistics, CustomLayout };
17
17
  declare function getIcons(): {
18
18
  [key: string]: TYPES.ColumnIconOption;
package/cjs/index.js CHANGED
@@ -101,6 +101,6 @@ Object.defineProperty(exports, "getDataCellPath", {
101
101
  get: function() {
102
102
  return get_data_path_1.getDataCellPath;
103
103
  }
104
- }), __exportStar(require("./render/jsx"), exports), exports.version = "0.13.3",
104
+ }), __exportStar(require("./render/jsx"), exports), exports.version = "0.13.4-alpha.2",
105
105
  exports.getIcons = getIcons, exports.clearGlobal = clearGlobal, TYPES.AggregationType;
106
106
  //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAAoC;AA8ClC,sBAAK;AA7CP,6CAA+B;AA8C7B,oBAAI;AA7CN,6CAA+B;AAkE7B,oBAAI;AAjEN,+CAAiC;AACjC,qDAAuC;AAqErC,4BAAQ;AApEV,iDAAmC;AA8DjC,wBAAM;AA7DR,yEAA2D;AAuEzD,wCAAc;AApDhB,2CAAwC;AAuBtC,0FAvBO,qBAAS,OAuBP;AAtBX,6CAA0C;AAwBxC,2FAxBO,uBAAU,OAwBP;AAvBZ,6CAA0C;AA0BxC,2FA1BO,uBAAU,OA0BP;AAxBZ,8DAAgD;AAiD9C,oCAAY;AA5Cd,uDAAwD;AAA/C,gHAAA,eAAe,OAAA;AACxB,+CAA6B;AAEhB,QAAA,OAAO,GAAG,QAAQ,CAAC;AA6ChC,SAAS,QAAQ;IAGf,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC;AACrB,CAAC;AAhBC,4BAAQ;AAkBV,SAAS,WAAW;IAClB,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAGtB,CAAC;AArBC,kCAAW;AAsBb,KAAK,CAAC,eAAe,CAAC","file":"index.js","sourcesContent":["/* eslint-disable sort-imports */\nimport * as TYPES from './ts-types';\nimport * as core from './core';\nimport * as data from './data';\nimport * as icons from './icons';\nimport * as register from './register';\nimport * as themes from './themes';\nimport * as DataStatistics from './dataset/DataStatistics';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n ListTableConstructorOptions,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n IHeaderTreeDefine,\n IDimension,\n TextAlignType,\n TextBaselineType\n} from './ts-types';\nimport { ListTable } from './ListTable';\nimport { PivotTable } from './PivotTable';\nimport { PivotChart } from './PivotChart';\nimport type { MousePointerCellEvent } from './ts-types/events';\nimport * as CustomLayout from './render/layout';\n\n// import { container, loadCanvasPicker } from '@visactor/vrender';\n// loadCanvasPicker(container);\n\nexport { getDataCellPath } from './tools/get-data-path';\nexport * from './render/jsx';\n\nexport const version = \"0.13.3\";\n/**\n * @namespace VTable\n */\nexport {\n /**\n * Types\n * @namespace VTable.TYPES\n */\n TYPES,\n core,\n ListTable,\n ListTableConstructorOptions,\n PivotTable,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n PivotChart,\n IHeaderTreeDefine,\n IDimension,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n themes,\n data,\n MousePointerCellEvent,\n getIcons,\n clearGlobal,\n //plugin registers\n register,\n /**\n * 暂不推荐使用\n */\n DataStatistics,\n CustomLayout\n};\n\n/** @private */\nfunction getIcons(): {\n [key: string]: TYPES.ColumnIconOption;\n} {\n return icons.get();\n}\n/** 清理内部的全局变量 如注册的icon theme等 以及共享的header column类实例 */\nfunction clearGlobal() {\n register.clearAll();\n // headers.type.clearGlobal();\n // columns.type.clearGlobal();\n}\nTYPES.AggregationType;\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAAoC;AA8ClC,sBAAK;AA7CP,6CAA+B;AA8C7B,oBAAI;AA7CN,6CAA+B;AAkE7B,oBAAI;AAjEN,+CAAiC;AACjC,qDAAuC;AAqErC,4BAAQ;AApEV,iDAAmC;AA8DjC,wBAAM;AA7DR,yEAA2D;AAuEzD,wCAAc;AApDhB,2CAAwC;AAuBtC,0FAvBO,qBAAS,OAuBP;AAtBX,6CAA0C;AAwBxC,2FAxBO,uBAAU,OAwBP;AAvBZ,6CAA0C;AA0BxC,2FA1BO,uBAAU,OA0BP;AAxBZ,8DAAgD;AAiD9C,oCAAY;AA5Cd,uDAAwD;AAA/C,gHAAA,eAAe,OAAA;AACxB,+CAA6B;AAEhB,QAAA,OAAO,GAAG,gBAAgB,CAAC;AA6CxC,SAAS,QAAQ;IAGf,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC;AACrB,CAAC;AAhBC,4BAAQ;AAkBV,SAAS,WAAW;IAClB,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAGtB,CAAC;AArBC,kCAAW;AAsBb,KAAK,CAAC,eAAe,CAAC","file":"index.js","sourcesContent":["/* eslint-disable sort-imports */\nimport * as TYPES from './ts-types';\nimport * as core from './core';\nimport * as data from './data';\nimport * as icons from './icons';\nimport * as register from './register';\nimport * as themes from './themes';\nimport * as DataStatistics from './dataset/DataStatistics';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n ListTableConstructorOptions,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n IHeaderTreeDefine,\n IDimension,\n TextAlignType,\n TextBaselineType\n} from './ts-types';\nimport { ListTable } from './ListTable';\nimport { PivotTable } from './PivotTable';\nimport { PivotChart } from './PivotChart';\nimport type { MousePointerCellEvent } from './ts-types/events';\nimport * as CustomLayout from './render/layout';\n\n// import { container, loadCanvasPicker } from '@visactor/vrender';\n// loadCanvasPicker(container);\n\nexport { getDataCellPath } from './tools/get-data-path';\nexport * from './render/jsx';\n\nexport const version = \"0.13.4-alpha.2\";\n/**\n * @namespace VTable\n */\nexport {\n /**\n * Types\n * @namespace VTable.TYPES\n */\n TYPES,\n core,\n ListTable,\n ListTableConstructorOptions,\n PivotTable,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n PivotChart,\n IHeaderTreeDefine,\n IDimension,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n themes,\n data,\n MousePointerCellEvent,\n getIcons,\n clearGlobal,\n //plugin registers\n register,\n /**\n * 暂不推荐使用\n */\n DataStatistics,\n CustomLayout\n};\n\n/** @private */\nfunction getIcons(): {\n [key: string]: TYPES.ColumnIconOption;\n} {\n return icons.get();\n}\n/** 清理内部的全局变量 如注册的icon theme等 以及共享的header column类实例 */\nfunction clearGlobal() {\n register.clearAll();\n // headers.type.clearGlobal();\n // columns.type.clearGlobal();\n}\nTYPES.AggregationType;\n"]}
@@ -8,14 +8,16 @@ const vutils_1 = require("@visactor/vutils"), get_axis_domain_1 = require("./get
8
8
 
9
9
  function getAxisConfigInPivotChart(col, row, layout) {
10
10
  var _a, _b, _c, _d, _e, _f;
11
- if (layout._table.isPivotChart()) if (layout.indicatorsAsCol) {
11
+ if (!layout._table.isPivotChart()) return;
12
+ const table = layout._table;
13
+ if (layout.indicatorsAsCol) {
12
14
  if (layout.hasTwoIndicatorAxes && row === layout.columnHeaderLevelCount - 1 && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) {
13
15
  const {axisOption: axisOption, isPercent: isPercent, isZeroAlign: isZeroAlign, seriesIndice: seriesIndice} = getAxisOption(col, row + 1, "top", layout);
14
16
  if (!1 === (null == axisOption ? void 0 : axisOption.visible)) return;
15
17
  const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, layout.columnHeaderLevelCount - 1), colPath = layout.getColKeysPath(col, row), range = getAxisRange(layout.dataset.collectedValues, indicatorKeys, isZeroAlign, colPath, null != seriesIndice ? seriesIndice : 1);
16
18
  if (!range) return;
17
19
  isPercent && (range.min = range.min < 0 ? -1 : 0, range.max = range.max > 0 ? 1 : 0);
18
- const {range: niceRange, ticks: ticks} = (0, get_axis_domain_1.getAxisDomainRangeAndLabels)(range.min, range.max, axisOption, isZeroAlign);
20
+ const {range: niceRange, ticks: ticks} = (0, get_axis_domain_1.getAxisDomainRangeAndLabels)(range.min, range.max, axisOption, isZeroAlign, table.getColWidth(col));
19
21
  return range.min = isNaN(niceRange[0]) ? 0 : niceRange[0], range.max = isNaN(niceRange[1]) ? 1 : niceRange[1],
20
22
  (0, vutils_1.isNumber)(null == axisOption ? void 0 : axisOption.min) && (range.min = axisOption.min,
21
23
  range.min > 0 && (axisOption.zero = !1)), (0, vutils_1.isNumber)(null == axisOption ? void 0 : axisOption.max) && (range.max = axisOption.max,
@@ -40,7 +42,7 @@ function getAxisConfigInPivotChart(col, row, layout) {
40
42
  const info = layout.getIndicatorInfo(key);
41
43
  info && (indicatorInfo = info);
42
44
  })), isPercent && (range.min = range.min < 0 ? -1 : 0, range.max = range.max > 0 ? 1 : 0);
43
- const {range: niceRange, ticks: ticks} = (0, get_axis_domain_1.getAxisDomainRangeAndLabels)(range.min, range.max, axisOption, isZeroAlign);
45
+ const {range: niceRange, ticks: ticks} = (0, get_axis_domain_1.getAxisDomainRangeAndLabels)(range.min, range.max, axisOption, isZeroAlign, table.getColWidth(col));
44
46
  return range.min = isNaN(niceRange[0]) ? 0 : niceRange[0], range.max = isNaN(niceRange[1]) ? 1 : niceRange[1],
45
47
  (0, vutils_1.isNumber)(null == axisOption ? void 0 : axisOption.min) && (range.min = axisOption.min,
46
48
  range.min > 0 && (axisOption.zero = !1)), (0, vutils_1.isNumber)(null == axisOption ? void 0 : axisOption.max) && (range.max = axisOption.max,
@@ -85,7 +87,7 @@ function getAxisConfigInPivotChart(col, row, layout) {
85
87
  const info = layout.getIndicatorInfo(key);
86
88
  info && (indicatorInfo = info);
87
89
  })), isPercent && (range.min = range.min < 0 ? -1 : 0, range.max = range.max > 0 ? 1 : 0);
88
- const {range: niceRange, ticks: ticks} = (0, get_axis_domain_1.getAxisDomainRangeAndLabels)(range.min, range.max, axisOption, isZeroAlign);
90
+ const {range: niceRange, ticks: ticks} = (0, get_axis_domain_1.getAxisDomainRangeAndLabels)(range.min, range.max, axisOption, isZeroAlign, table.getRowHeight(row));
89
91
  return range.min = isNaN(niceRange[0]) ? 0 : niceRange[0], range.max = isNaN(niceRange[1]) ? 1 : niceRange[1],
90
92
  (0, vutils_1.isNumber)(null == axisOption ? void 0 : axisOption.min) && (range.min = axisOption.min,
91
93
  range.min > 0 && (axisOption.zero = !1)), (0, vutils_1.isNumber)(null == axisOption ? void 0 : axisOption.max) && (range.max = axisOption.max,
@@ -111,7 +113,7 @@ function getAxisConfigInPivotChart(col, row, layout) {
111
113
  const indicatorKeys = layout.getIndicatorKeyInChartSpec(layout.rowHeaderLevelCount - 1, row), rowPath = layout.getRowKeysPath(col, row), range = getAxisRange(layout.dataset.collectedValues, indicatorKeys, isZeroAlign, rowPath, null != seriesIndice ? seriesIndice : 1);
112
114
  if (!range) return;
113
115
  isPercent && (range.min = range.min < 0 ? -1 : 0, range.max = range.max > 0 ? 1 : 0);
114
- const {range: niceRange, ticks: ticks} = (0, get_axis_domain_1.getAxisDomainRangeAndLabels)(range.min, range.max, axisOption, isZeroAlign);
116
+ const {range: niceRange, ticks: ticks} = (0, get_axis_domain_1.getAxisDomainRangeAndLabels)(range.min, range.max, axisOption, isZeroAlign, table.getRowHeight(row));
115
117
  return range.min = isNaN(niceRange[0]) ? 0 : niceRange[0], range.max = isNaN(niceRange[1]) ? 1 : niceRange[1],
116
118
  (0, vutils_1.isNumber)(null == axisOption ? void 0 : axisOption.min) && (range.min = axisOption.min,
117
119
  range.min > 0 && (axisOption.zero = !1)), (0, vutils_1.isNumber)(null == axisOption ? void 0 : axisOption.max) && (range.max = axisOption.max,
@@ -1 +1 @@
1
- {"version":3,"sources":["layout/chart-helper/get-axis-config.ts"],"names":[],"mappings":";;;AAAA,6CAAqE;AAIrE,uDAAgE;AAGhE,SAAgB,yBAAyB,CAAC,GAAW,EAAE,GAAW,EAAE,MAA4B;;IAC9F,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE;QACjC,OAAO,SAAS,CAAC;KAClB;IAGD,IAAI,MAAM,CAAC,eAAe,EAAE;QAC1B,IACE,MAAM,CAAC,mBAAmB;YAC1B,GAAG,KAAK,MAAM,CAAC,sBAAsB,GAAG,CAAC;YACzC,GAAG,IAAI,MAAM,CAAC,mBAAmB;YACjC,GAAG,GAAG,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,mBAAmB,EAClD;YACA,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;YACxG,IAAI,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,OAAO,MAAK,KAAK,EAAE;gBACjC,OAAO;aACR;YACD,MAAM,aAAa,GAAG,MAAM,CAAC,0BAA0B,CAAC,GAAG,EAAE,MAAM,CAAC,sBAAsB,GAAG,CAAC,CAAC,CAAC;YAChG,MAAM,OAAO,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YAEhD,MAAM,KAAK,GAAG,YAAY,CACx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EAAE,MAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAkC,mCAAI,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IAEvG,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,GAAG,EAAE;QACtD,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,WAAW,CAAC;KAC/B;IACD,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,GAAG,EAAE;QACtD,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,WAAW,CAAC;KAC/B;IACD,IAAI,KAAK,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG,EAAE;QAC3B,IAAI,KAAK,CAAC,GAAG,GAAG,CAAC,EAAE;YACjB,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;SACf;aAAM;YACL,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;SACf;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAhDD,oCAgDC","file":"get-axis-config.js","sourcesContent":["import { isArray, isNumber, isValid, merge } from '@visactor/vutils';\nimport type { PivotHeaderLayoutMap } from '../pivot-header-layout';\nimport type { ITableAxisOption } from '../../ts-types/component/axis';\nimport type { PivotChart } from '../../PivotChart';\nimport { getAxisDomainRangeAndLabels } from './get-axis-domain';\nimport type { CollectedValue } from '../../ts-types';\n\nexport function getAxisConfigInPivotChart(col: number, row: number, layout: PivotHeaderLayoutMap): any {\n if (!layout._table.isPivotChart()) {\n return undefined;\n }\n\n // 是否是指标\n if (layout.indicatorsAsCol) {\n if (\n layout.hasTwoIndicatorAxes &&\n row === layout.columnHeaderLevelCount - 1 &&\n col >= layout.rowHeaderLevelCount &&\n col < layout.colCount - layout.rightFrozenColCount\n ) {\n const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col, row + 1, 'top', layout);\n if (axisOption?.visible === false) {\n return;\n }\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, layout.columnHeaderLevelCount - 1);\n const colPath = layout.getColKeysPath(col, row);\n\n const range = getAxisRange(\n layout.dataset.collectedValues,\n indicatorKeys,\n isZeroAlign,\n colPath,\n seriesIndice ?? 1\n );\n if (!range) {\n return;\n }\n\n // let defaultKey = indicatorKeys?.[1];\n // if (isArray(defaultKey)) {\n // defaultKey = defaultKey[0];\n // }\n // if (!defaultKey) {\n // return undefined;\n // }\n\n // // const isZeroAlign = checkZeroAlign(col, row, 'top', layout);\n // // const data = layout.dataset.collectedValues[defaultKey];\n // const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n // ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n // : layout.dataset.collectedValues[defaultKey];\n\n // const range = merge({}, (data?.[colPath ?? ''] as { min: number; max: number }) ?? { min: 0, max: 1 });\n // if (range.positiveMax && range.positiveMax > range.max) {\n // range.max = range.positiveMax;\n // }\n // if (range.negativeMin && range.negativeMin < range.min) {\n // range.min = range.negativeMin;\n // }\n // // const { axisOption, isPercent } = getAxisOption(col, row + 1, 'top', layout);\n // if (range.min === range.max) {\n // if (range.min > 0) {\n // range.min = 0;\n // } else {\n // range.max = 0;\n // }\n // }\n if (isPercent) {\n range.min = range.min < 0 ? -1 : 0;\n range.max = range.max > 0 ? 1 : 0;\n }\n const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign);\n range.min = !isNaN(niceRange[0]) ? niceRange[0] : 0;\n range.max = !isNaN(niceRange[1]) ? niceRange[1] : 1;\n\n if (isNumber(axisOption?.min)) {\n range.min = axisOption.min;\n if (range.min > 0) {\n axisOption.zero = false;\n }\n }\n if (isNumber(axisOption?.max)) {\n range.max = axisOption.max;\n if (range.max < 0) {\n axisOption.zero = false;\n }\n }\n // 顶部副指标轴\n return merge(\n {\n range: range\n },\n axisOption,\n {\n orient: 'top',\n type: axisOption?.type || 'linear',\n label: {\n flush: true\n },\n __ticksForVTable: ticks\n }\n );\n } else if (\n row === layout.rowCount - layout.bottomFrozenRowCount &&\n col >= layout.rowHeaderLevelCount &&\n col < layout.colCount - layout.rightFrozenColCount\n ) {\n const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col, row - 1, 'bottom', layout);\n if (axisOption?.visible === false) {\n return;\n }\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n const colPath = layout.getColKeysPath(col, row);\n\n const range = getAxisRange(\n layout.dataset.collectedValues,\n indicatorKeys,\n isZeroAlign,\n colPath,\n seriesIndice ?? 0\n );\n if (!range) {\n return;\n }\n\n // let defaultKey = indicatorKeys?.[0];\n // if (isArray(defaultKey)) {\n // defaultKey = defaultKey[0];\n // }\n // const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n // ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n // : layout.dataset.collectedValues[defaultKey];\n // const range = merge({}, (data?.[colPath ?? ''] as { min: number; max: number }) ?? { min: 0, max: 1 });\n // if (range.positiveMax && range.positiveMax > range.max) {\n // range.max = range.positiveMax;\n // }\n // if (range.negativeMin && range.negativeMin < range.min) {\n // range.min = range.negativeMin;\n // }\n // if (range.min === range.max) {\n // if (range.min > 0) {\n // range.min = 0;\n // } else {\n // range.max = 0;\n // }\n // }\n\n let indicatorInfo = null;\n indicatorKeys?.forEach(key => {\n const info = layout.getIndicatorInfo(key);\n if (info) {\n indicatorInfo = info;\n }\n });\n\n // const { axisOption, isPercent } = getAxisOption(col, row - 1, 'bottom', layout);\n if (isPercent) {\n (range as any).min = (range as any).min < 0 ? -1 : 0;\n (range as any).max = (range as any).max > 0 ? 1 : 0;\n }\n const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign);\n range.min = !isNaN(niceRange[0]) ? niceRange[0] : 0;\n range.max = !isNaN(niceRange[1]) ? niceRange[1] : 1;\n\n if (isNumber(axisOption?.min)) {\n range.min = axisOption.min;\n if (range.min > 0) {\n axisOption.zero = false;\n }\n }\n if (isNumber(axisOption?.max)) {\n range.max = axisOption.max;\n if (range.max < 0) {\n axisOption.zero = false;\n }\n }\n // 底侧指标轴\n return merge(\n {\n title: {\n visible: true,\n text: (indicatorInfo as any)?.title\n // autoRotate: true\n },\n range: range\n },\n axisOption,\n {\n orient: 'bottom',\n type: axisOption?.type || 'linear',\n label: {\n flush: true\n },\n __ticksForVTable: ticks\n }\n );\n } else if (\n col === layout.rowHeaderLevelCount - 1 &&\n row >= layout.columnHeaderLevelCount &&\n row < layout.rowCount - layout.bottomFrozenRowCount\n ) {\n let rowDimensionKey = layout.getDimensionKeyInChartSpec(layout.rowHeaderLevelCount, row)?.[0];\n if (isArray(rowDimensionKey)) {\n rowDimensionKey = rowDimensionKey[0];\n }\n const data = layout.dataset.collectedValues[rowDimensionKey] ?? ([] as string[]);\n\n const rowPath = layout.getRowKeysPath(col, row);\n const domain = (data[rowPath ?? ''] as Array<string>) ?? [];\n\n const { axisOption, isPercent } = getAxisOption(col + 1, row, 'left', layout);\n if (axisOption?.visible === false) {\n return;\n }\n // 左侧维度轴\n return merge(\n {\n domain: Array.from(domain).reverse(),\n title: {\n autoRotate: true\n }\n },\n axisOption,\n {\n orient: 'left',\n type: 'band'\n }\n );\n }\n } else {\n if (\n col === layout.rowHeaderLevelCount - 1 &&\n row >= layout.columnHeaderLevelCount &&\n row < layout.rowCount - layout.bottomFrozenRowCount\n ) {\n const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col + 1, row, 'left', layout);\n if (axisOption?.visible === false) {\n return;\n }\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n const rowPath = layout.getRowKeysPath(col, row);\n const range = getAxisRange(\n layout.dataset.collectedValues,\n indicatorKeys,\n isZeroAlign,\n rowPath,\n seriesIndice ?? 0\n );\n if (!range) {\n return;\n }\n\n // let defaultKey = indicatorKeys?.[0];\n // if (isArray(defaultKey)) {\n // defaultKey = defaultKey[0];\n // }\n // const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n // ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n // : layout.dataset.collectedValues[defaultKey];\n // const range = merge({}, (data?.[rowPath ?? ''] as { min: number; max: number }) ?? { min: 0, max: 1 });\n // if (range.positiveMax && range.positiveMax > range.max) {\n // range.max = range.positiveMax;\n // }\n // if (range.negativeMin && range.negativeMin < range.min) {\n // range.min = range.negativeMin;\n // }\n // if (range.min === range.max) {\n // if (range.min > 0) {\n // range.min = 0;\n // } else {\n // range.max = 0;\n // }\n // }\n\n let indicatorInfo = null;\n indicatorKeys?.forEach(key => {\n const info = layout.getIndicatorInfo(key);\n if (info) {\n indicatorInfo = info;\n }\n });\n\n if (isPercent) {\n range.min = range.min < 0 ? -1 : 0;\n range.max = range.max > 0 ? 1 : 0;\n }\n const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign);\n range.min = !isNaN(niceRange[0]) ? niceRange[0] : 0;\n range.max = !isNaN(niceRange[1]) ? niceRange[1] : 1;\n\n if (isNumber(axisOption?.min)) {\n range.min = axisOption.min;\n if (range.min > 0) {\n axisOption.zero = false;\n }\n }\n if (isNumber(axisOption?.max)) {\n range.max = axisOption.max;\n if (range.max < 0) {\n axisOption.zero = false;\n }\n }\n // 左侧指标轴\n return merge(\n {\n title: {\n visible: true,\n text: (indicatorInfo as any)?.title,\n autoRotate: true\n },\n range: range\n },\n axisOption,\n {\n orient: 'left',\n type: axisOption?.type || 'linear',\n label: {\n flush: true\n },\n __ticksForVTable: ticks\n }\n );\n } else if (\n col === layout.colCount - layout.rightFrozenColCount &&\n row >= layout.columnHeaderLevelCount &&\n row < layout.rowCount - layout.bottomFrozenRowCount\n ) {\n const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col - 1, row, 'right', layout);\n if (axisOption?.visible === false) {\n return;\n }\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(layout.rowHeaderLevelCount - 1, row);\n const rowPath = layout.getRowKeysPath(col, row);\n const range = getAxisRange(\n layout.dataset.collectedValues,\n indicatorKeys,\n isZeroAlign,\n rowPath,\n seriesIndice ?? 1\n );\n if (!range) {\n return;\n }\n\n // let defaultKey = indicatorKeys?.[1];\n // if (isArray(defaultKey)) {\n // defaultKey = defaultKey[0];\n // }\n // if (!defaultKey) {\n // return undefined;\n // }\n // const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n // ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n // : layout.dataset.collectedValues[defaultKey];\n // const range = merge({}, (data?.[rowPath ?? ''] as { min: number; max: number }) ?? { min: 0, max: 1 });\n // if (range.positiveMax && range.positiveMax > range.max) {\n // range.max = range.positiveMax;\n // }\n // if (range.negativeMin && range.negativeMin < range.min) {\n // range.min = range.negativeMin;\n // }\n // // const { axisOption, isPercent } = getAxisOption(col - 1, row, 'right', layout);\n // if (range.min === range.max) {\n // if (range.min > 0) {\n // range.min = 0;\n // } else {\n // range.max = 0;\n // }\n // }\n\n if (isPercent) {\n (range as any).min = (range as any).min < 0 ? -1 : 0;\n (range as any).max = (range as any).max > 0 ? 1 : 0;\n }\n const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign);\n range.min = !isNaN(niceRange[0]) ? niceRange[0] : 0;\n range.max = !isNaN(niceRange[1]) ? niceRange[1] : 1;\n\n if (isNumber(axisOption?.min)) {\n range.min = axisOption.min;\n if (range.min > 0) {\n axisOption.zero = false;\n }\n }\n if (isNumber(axisOption?.max)) {\n range.max = axisOption.max;\n if (range.max < 0) {\n axisOption.zero = false;\n }\n }\n // 右侧副指标轴\n return merge(\n {\n range: range,\n title: {\n autoRotate: true\n }\n },\n axisOption,\n {\n orient: 'right',\n type: axisOption?.type || 'linear',\n label: {\n flush: true\n },\n __ticksForVTable: ticks\n }\n );\n } else if (\n row === layout.rowCount - layout.bottomFrozenRowCount &&\n col >= layout.rowHeaderLevelCount &&\n col < layout.colCount - layout.rightFrozenColCount\n ) {\n // const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n\n let columnDimensionKey = layout.getDimensionKeyInChartSpec(col, layout.columnHeaderLevelCount)?.[0];\n if (isArray(columnDimensionKey)) {\n columnDimensionKey = columnDimensionKey[0];\n }\n const data = layout.dataset.collectedValues[columnDimensionKey] ?? ([] as string[]);\n\n const colPath = layout.getColKeysPath(col, row);\n const domain = (data?.[colPath ?? ''] as Array<string>) ?? [];\n\n const { axisOption, isPercent } = getAxisOption(col, row - 1, 'bottom', layout);\n if (axisOption?.visible === false) {\n return;\n }\n // 底部维度轴\n return merge(\n {\n domain: Array.from(domain)\n },\n axisOption,\n {\n orient: 'bottom',\n type: 'band'\n }\n );\n }\n }\n\n return undefined;\n}\n\nexport function getAxisOption(col: number, row: number, orient: string, layout: PivotHeaderLayoutMap) {\n const spec = layout.getRawChartSpec(col, row);\n if (spec && isArray(spec.axes)) {\n const axisOption = spec.axes.find((axis: any) => {\n return axis.orient === orient;\n });\n if (axisOption) {\n const { seriesIndex, seriesId } = axisOption;\n let seriesIndice;\n if (isValid(seriesId) && isArray(spec.series)) {\n seriesIndice = (isArray(seriesId) ? seriesId : [seriesId]).map(id =>\n spec.series.findIndex((s: any) => s.id === id)\n );\n } else if (isValid(seriesIndex) && isArray(spec.series)) {\n seriesIndice = seriesIndex;\n }\n return {\n axisOption,\n isPercent: spec.percent,\n isZeroAlign: checkZeroAlign(spec, orient, layout),\n seriesIndice\n };\n }\n }\n const axisOption = ((layout._table as PivotChart).pivotChartAxes as ITableAxisOption[]).find(axisOption => {\n return axisOption.orient === orient;\n });\n return {\n axisOption,\n isPercent: false,\n isZeroAlign: checkZeroAlign(spec, orient, layout)\n };\n}\n\nexport function checkZeroAlign(spec: any, orient: string, layout: PivotHeaderLayoutMap) {\n // check condition:\n // 1. two axes and one set sync\n // 2. axisId in sync is another\n const orients: string[] = [];\n if (orient === 'left' || orient === 'right') {\n orients.push('left', 'right');\n } else if (orient === 'top' || orient === 'bottom') {\n orients.push('top', 'bottom');\n }\n // const spec = layout.getRawChartSpec(col, row);\n let axesSpec;\n if (spec && isArray(spec.axes)) {\n axesSpec = spec.axes;\n } else {\n axesSpec = (layout._table as PivotChart).pivotChartAxes as ITableAxisOption[];\n }\n if (isArray(axesSpec)) {\n const axes: any[] = [];\n axesSpec.forEach((axis: any) => {\n if (orients.includes(axis.orient)) {\n axes.push(axis);\n }\n });\n for (let i = 0; i < axes.length; i++) {\n const axis = axes[i];\n if (\n axis.sync &&\n axis.sync.zeroAlign &&\n axis.sync.axisId &&\n axes.find(axisSync => {\n return axisSync.id === axis.sync.axisId;\n })\n ) {\n return true;\n }\n }\n }\n\n return false;\n}\n\nexport function getAxisRange(\n collectedValues: Record<string, Record<string, CollectedValue>>,\n indicatorKeys: string[],\n isZeroAlign: boolean,\n colPath: string,\n seriesId: number | number[]\n): { max: number; min: number } | null {\n if (isArray(seriesId)) {\n const range = { min: Infinity, max: -Infinity };\n for (let i = 0; i < seriesId.length; i++) {\n const singleRange = getAxisRange(collectedValues, indicatorKeys, isZeroAlign, colPath, seriesId[i]);\n if (singleRange) {\n range.min = Math.min(range.min, singleRange.min);\n range.max = Math.max(range.max, singleRange.max);\n }\n }\n if (isFinite(range.min) && isFinite(range.max)) {\n return range;\n }\n return null;\n }\n let defaultKey = indicatorKeys?.[seriesId];\n if (isArray(defaultKey)) {\n defaultKey = defaultKey[0];\n }\n if (!defaultKey) {\n return null;\n }\n const data = collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n ? collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n : collectedValues[defaultKey];\n const range = merge({}, (data?.[colPath ?? ''] as { min: number; max: number }) ?? { min: 0, max: 1 });\n\n if (range.positiveMax && range.positiveMax > range.max) {\n range.max = range.positiveMax;\n }\n if (range.negativeMin && range.negativeMin < range.min) {\n range.min = range.negativeMin;\n }\n if (range.min === range.max) {\n if (range.min > 0) {\n range.min = 0;\n } else {\n range.max = 0;\n }\n }\n\n return range;\n}\n"]}
1
+ {"version":3,"sources":["layout/chart-helper/get-axis-config.ts"],"names":[],"mappings":";;;AAAA,6CAAqE;AAIrE,uDAAgE;AAGhE,SAAgB,yBAAyB,CAAC,GAAW,EAAE,GAAW,EAAE,MAA4B;;IAC9F,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE;QACjC,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;IAG5B,IAAI,MAAM,CAAC,eAAe,EAAE;QAC1B,IACE,MAAM,CAAC,mBAAmB;YAC1B,GAAG,KAAK,MAAM,CAAC,sBAAsB,GAAG,CAAC;YACzC,GAAG,IAAI,MAAM,CAAC,mBAAmB;YACjC,GAAG,GAAG,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,mBAAmB,EAClD;YACA,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;YACxG,IAAI,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,OAAO,MAAK,KAAK,EAAE;gBACjC,OAAO;aACR;YACD,MAAM,aAAa,GAAG,MAAM,CAAC,0BAA0B,CAAC,GAAG,EAAE,MAAM,CAAC,sBAAsB,GAAG,CAAC,CAAC,CAAC;YAChG,MAAM,OAAO,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YAEhD,MAAM,KAAK,GAAG,YAAY,CACxB,MAAM,CAAC,OAAO,CAAC,eAAe,EAC9B,aAAa,EACb,WAAW,EACX,OAAO,EACP,YAAY,aAAZ,YAAY,cAAZ,YA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ChC,MAAM,KAAK,GAAG,IAAA,cAAK,EAAC,EAAE,EAAE,MAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAkC,mCAAI,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IAEvG,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,GAAG,EAAE;QACtD,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,WAAW,CAAC;KAC/B;IACD,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,GAAG,EAAE;QACtD,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,WAAW,CAAC;KAC/B;IACD,IAAI,KAAK,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG,EAAE;QAC3B,IAAI,KAAK,CAAC,GAAG,GAAG,CAAC,EAAE;YACjB,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;SACf;aAAM;YACL,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;SACf;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAhDD,oCAgDC","file":"get-axis-config.js","sourcesContent":["import { isArray, isNumber, isValid, merge } from '@visactor/vutils';\nimport type { PivotHeaderLayoutMap } from '../pivot-header-layout';\nimport type { ITableAxisOption } from '../../ts-types/component/axis';\nimport type { PivotChart } from '../../PivotChart';\nimport { getAxisDomainRangeAndLabels } from './get-axis-domain';\nimport type { CollectedValue } from '../../ts-types';\n\nexport function getAxisConfigInPivotChart(col: number, row: number, layout: PivotHeaderLayoutMap): any {\n if (!layout._table.isPivotChart()) {\n return undefined;\n }\n\n const table = layout._table;\n\n // 是否是指标\n if (layout.indicatorsAsCol) {\n if (\n layout.hasTwoIndicatorAxes &&\n row === layout.columnHeaderLevelCount - 1 &&\n col >= layout.rowHeaderLevelCount &&\n col < layout.colCount - layout.rightFrozenColCount\n ) {\n const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col, row + 1, 'top', layout);\n if (axisOption?.visible === false) {\n return;\n }\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, layout.columnHeaderLevelCount - 1);\n const colPath = layout.getColKeysPath(col, row);\n\n const range = getAxisRange(\n layout.dataset.collectedValues,\n indicatorKeys,\n isZeroAlign,\n colPath,\n seriesIndice ?? 1\n );\n if (!range) {\n return;\n }\n\n // let defaultKey = indicatorKeys?.[1];\n // if (isArray(defaultKey)) {\n // defaultKey = defaultKey[0];\n // }\n // if (!defaultKey) {\n // return undefined;\n // }\n\n // // const isZeroAlign = checkZeroAlign(col, row, 'top', layout);\n // // const data = layout.dataset.collectedValues[defaultKey];\n // const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n // ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n // : layout.dataset.collectedValues[defaultKey];\n\n // const range = merge({}, (data?.[colPath ?? ''] as { min: number; max: number }) ?? { min: 0, max: 1 });\n // if (range.positiveMax && range.positiveMax > range.max) {\n // range.max = range.positiveMax;\n // }\n // if (range.negativeMin && range.negativeMin < range.min) {\n // range.min = range.negativeMin;\n // }\n // // const { axisOption, isPercent } = getAxisOption(col, row + 1, 'top', layout);\n // if (range.min === range.max) {\n // if (range.min > 0) {\n // range.min = 0;\n // } else {\n // range.max = 0;\n // }\n // }\n if (isPercent) {\n range.min = range.min < 0 ? -1 : 0;\n range.max = range.max > 0 ? 1 : 0;\n }\n const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(\n range.min,\n range.max,\n axisOption,\n isZeroAlign,\n table.getColWidth(col)\n );\n range.min = !isNaN(niceRange[0]) ? niceRange[0] : 0;\n range.max = !isNaN(niceRange[1]) ? niceRange[1] : 1;\n\n if (isNumber(axisOption?.min)) {\n range.min = axisOption.min;\n if (range.min > 0) {\n axisOption.zero = false;\n }\n }\n if (isNumber(axisOption?.max)) {\n range.max = axisOption.max;\n if (range.max < 0) {\n axisOption.zero = false;\n }\n }\n // 顶部副指标轴\n return merge(\n {\n range: range\n },\n axisOption,\n {\n orient: 'top',\n type: axisOption?.type || 'linear',\n label: {\n flush: true\n },\n __ticksForVTable: ticks\n }\n );\n } else if (\n row === layout.rowCount - layout.bottomFrozenRowCount &&\n col >= layout.rowHeaderLevelCount &&\n col < layout.colCount - layout.rightFrozenColCount\n ) {\n const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col, row - 1, 'bottom', layout);\n if (axisOption?.visible === false) {\n return;\n }\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n const colPath = layout.getColKeysPath(col, row);\n\n const range = getAxisRange(\n layout.dataset.collectedValues,\n indicatorKeys,\n isZeroAlign,\n colPath,\n seriesIndice ?? 0\n );\n if (!range) {\n return;\n }\n\n // let defaultKey = indicatorKeys?.[0];\n // if (isArray(defaultKey)) {\n // defaultKey = defaultKey[0];\n // }\n // const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n // ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n // : layout.dataset.collectedValues[defaultKey];\n // const range = merge({}, (data?.[colPath ?? ''] as { min: number; max: number }) ?? { min: 0, max: 1 });\n // if (range.positiveMax && range.positiveMax > range.max) {\n // range.max = range.positiveMax;\n // }\n // if (range.negativeMin && range.negativeMin < range.min) {\n // range.min = range.negativeMin;\n // }\n // if (range.min === range.max) {\n // if (range.min > 0) {\n // range.min = 0;\n // } else {\n // range.max = 0;\n // }\n // }\n\n let indicatorInfo = null;\n indicatorKeys?.forEach(key => {\n const info = layout.getIndicatorInfo(key);\n if (info) {\n indicatorInfo = info;\n }\n });\n\n // const { axisOption, isPercent } = getAxisOption(col, row - 1, 'bottom', layout);\n if (isPercent) {\n (range as any).min = (range as any).min < 0 ? -1 : 0;\n (range as any).max = (range as any).max > 0 ? 1 : 0;\n }\n const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(\n range.min,\n range.max,\n axisOption,\n isZeroAlign,\n table.getColWidth(col)\n );\n range.min = !isNaN(niceRange[0]) ? niceRange[0] : 0;\n range.max = !isNaN(niceRange[1]) ? niceRange[1] : 1;\n\n if (isNumber(axisOption?.min)) {\n range.min = axisOption.min;\n if (range.min > 0) {\n axisOption.zero = false;\n }\n }\n if (isNumber(axisOption?.max)) {\n range.max = axisOption.max;\n if (range.max < 0) {\n axisOption.zero = false;\n }\n }\n // 底侧指标轴\n return merge(\n {\n title: {\n visible: true,\n text: (indicatorInfo as any)?.title\n // autoRotate: true\n },\n range: range\n },\n axisOption,\n {\n orient: 'bottom',\n type: axisOption?.type || 'linear',\n label: {\n flush: true\n },\n __ticksForVTable: ticks\n }\n );\n } else if (\n col === layout.rowHeaderLevelCount - 1 &&\n row >= layout.columnHeaderLevelCount &&\n row < layout.rowCount - layout.bottomFrozenRowCount\n ) {\n let rowDimensionKey = layout.getDimensionKeyInChartSpec(layout.rowHeaderLevelCount, row)?.[0];\n if (isArray(rowDimensionKey)) {\n rowDimensionKey = rowDimensionKey[0];\n }\n const data = layout.dataset.collectedValues[rowDimensionKey] ?? ([] as string[]);\n\n const rowPath = layout.getRowKeysPath(col, row);\n const domain = (data[rowPath ?? ''] as Array<string>) ?? [];\n\n const { axisOption, isPercent } = getAxisOption(col + 1, row, 'left', layout);\n if (axisOption?.visible === false) {\n return;\n }\n // 左侧维度轴\n return merge(\n {\n domain: Array.from(domain).reverse(),\n title: {\n autoRotate: true\n }\n },\n axisOption,\n {\n orient: 'left',\n type: 'band'\n }\n );\n }\n } else {\n if (\n col === layout.rowHeaderLevelCount - 1 &&\n row >= layout.columnHeaderLevelCount &&\n row < layout.rowCount - layout.bottomFrozenRowCount\n ) {\n const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col + 1, row, 'left', layout);\n if (axisOption?.visible === false) {\n return;\n }\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n const rowPath = layout.getRowKeysPath(col, row);\n const range = getAxisRange(\n layout.dataset.collectedValues,\n indicatorKeys,\n isZeroAlign,\n rowPath,\n seriesIndice ?? 0\n );\n if (!range) {\n return;\n }\n\n // let defaultKey = indicatorKeys?.[0];\n // if (isArray(defaultKey)) {\n // defaultKey = defaultKey[0];\n // }\n // const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n // ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n // : layout.dataset.collectedValues[defaultKey];\n // const range = merge({}, (data?.[rowPath ?? ''] as { min: number; max: number }) ?? { min: 0, max: 1 });\n // if (range.positiveMax && range.positiveMax > range.max) {\n // range.max = range.positiveMax;\n // }\n // if (range.negativeMin && range.negativeMin < range.min) {\n // range.min = range.negativeMin;\n // }\n // if (range.min === range.max) {\n // if (range.min > 0) {\n // range.min = 0;\n // } else {\n // range.max = 0;\n // }\n // }\n\n let indicatorInfo = null;\n indicatorKeys?.forEach(key => {\n const info = layout.getIndicatorInfo(key);\n if (info) {\n indicatorInfo = info;\n }\n });\n\n if (isPercent) {\n range.min = range.min < 0 ? -1 : 0;\n range.max = range.max > 0 ? 1 : 0;\n }\n const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(\n range.min,\n range.max,\n axisOption,\n isZeroAlign,\n table.getRowHeight(row)\n );\n range.min = !isNaN(niceRange[0]) ? niceRange[0] : 0;\n range.max = !isNaN(niceRange[1]) ? niceRange[1] : 1;\n\n if (isNumber(axisOption?.min)) {\n range.min = axisOption.min;\n if (range.min > 0) {\n axisOption.zero = false;\n }\n }\n if (isNumber(axisOption?.max)) {\n range.max = axisOption.max;\n if (range.max < 0) {\n axisOption.zero = false;\n }\n }\n // 左侧指标轴\n return merge(\n {\n title: {\n visible: true,\n text: (indicatorInfo as any)?.title,\n autoRotate: true\n },\n range: range\n },\n axisOption,\n {\n orient: 'left',\n type: axisOption?.type || 'linear',\n label: {\n flush: true\n },\n __ticksForVTable: ticks\n }\n );\n } else if (\n col === layout.colCount - layout.rightFrozenColCount &&\n row >= layout.columnHeaderLevelCount &&\n row < layout.rowCount - layout.bottomFrozenRowCount\n ) {\n const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(col - 1, row, 'right', layout);\n if (axisOption?.visible === false) {\n return;\n }\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(layout.rowHeaderLevelCount - 1, row);\n const rowPath = layout.getRowKeysPath(col, row);\n const range = getAxisRange(\n layout.dataset.collectedValues,\n indicatorKeys,\n isZeroAlign,\n rowPath,\n seriesIndice ?? 1\n );\n if (!range) {\n return;\n }\n\n // let defaultKey = indicatorKeys?.[1];\n // if (isArray(defaultKey)) {\n // defaultKey = defaultKey[0];\n // }\n // if (!defaultKey) {\n // return undefined;\n // }\n // const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n // ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n // : layout.dataset.collectedValues[defaultKey];\n // const range = merge({}, (data?.[rowPath ?? ''] as { min: number; max: number }) ?? { min: 0, max: 1 });\n // if (range.positiveMax && range.positiveMax > range.max) {\n // range.max = range.positiveMax;\n // }\n // if (range.negativeMin && range.negativeMin < range.min) {\n // range.min = range.negativeMin;\n // }\n // // const { axisOption, isPercent } = getAxisOption(col - 1, row, 'right', layout);\n // if (range.min === range.max) {\n // if (range.min > 0) {\n // range.min = 0;\n // } else {\n // range.max = 0;\n // }\n // }\n\n if (isPercent) {\n (range as any).min = (range as any).min < 0 ? -1 : 0;\n (range as any).max = (range as any).max > 0 ? 1 : 0;\n }\n const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(\n range.min,\n range.max,\n axisOption,\n isZeroAlign,\n table.getRowHeight(row)\n );\n range.min = !isNaN(niceRange[0]) ? niceRange[0] : 0;\n range.max = !isNaN(niceRange[1]) ? niceRange[1] : 1;\n\n if (isNumber(axisOption?.min)) {\n range.min = axisOption.min;\n if (range.min > 0) {\n axisOption.zero = false;\n }\n }\n if (isNumber(axisOption?.max)) {\n range.max = axisOption.max;\n if (range.max < 0) {\n axisOption.zero = false;\n }\n }\n // 右侧副指标轴\n return merge(\n {\n range: range,\n title: {\n autoRotate: true\n }\n },\n axisOption,\n {\n orient: 'right',\n type: axisOption?.type || 'linear',\n label: {\n flush: true\n },\n __ticksForVTable: ticks\n }\n );\n } else if (\n row === layout.rowCount - layout.bottomFrozenRowCount &&\n col >= layout.rowHeaderLevelCount &&\n col < layout.colCount - layout.rightFrozenColCount\n ) {\n // const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n\n let columnDimensionKey = layout.getDimensionKeyInChartSpec(col, layout.columnHeaderLevelCount)?.[0];\n if (isArray(columnDimensionKey)) {\n columnDimensionKey = columnDimensionKey[0];\n }\n const data = layout.dataset.collectedValues[columnDimensionKey] ?? ([] as string[]);\n\n const colPath = layout.getColKeysPath(col, row);\n const domain = (data?.[colPath ?? ''] as Array<string>) ?? [];\n\n const { axisOption, isPercent } = getAxisOption(col, row - 1, 'bottom', layout);\n if (axisOption?.visible === false) {\n return;\n }\n // 底部维度轴\n return merge(\n {\n domain: Array.from(domain)\n },\n axisOption,\n {\n orient: 'bottom',\n type: 'band'\n }\n );\n }\n }\n\n return undefined;\n}\n\nexport function getAxisOption(col: number, row: number, orient: string, layout: PivotHeaderLayoutMap) {\n const spec = layout.getRawChartSpec(col, row);\n if (spec && isArray(spec.axes)) {\n const axisOption = spec.axes.find((axis: any) => {\n return axis.orient === orient;\n });\n if (axisOption) {\n const { seriesIndex, seriesId } = axisOption;\n let seriesIndice;\n if (isValid(seriesId) && isArray(spec.series)) {\n seriesIndice = (isArray(seriesId) ? seriesId : [seriesId]).map(id =>\n spec.series.findIndex((s: any) => s.id === id)\n );\n } else if (isValid(seriesIndex) && isArray(spec.series)) {\n seriesIndice = seriesIndex;\n }\n return {\n axisOption,\n isPercent: spec.percent,\n isZeroAlign: checkZeroAlign(spec, orient, layout),\n seriesIndice\n };\n }\n }\n const axisOption = ((layout._table as PivotChart).pivotChartAxes as ITableAxisOption[]).find(axisOption => {\n return axisOption.orient === orient;\n });\n return {\n axisOption,\n isPercent: false,\n isZeroAlign: checkZeroAlign(spec, orient, layout)\n };\n}\n\nexport function checkZeroAlign(spec: any, orient: string, layout: PivotHeaderLayoutMap) {\n // check condition:\n // 1. two axes and one set sync\n // 2. axisId in sync is another\n const orients: string[] = [];\n if (orient === 'left' || orient === 'right') {\n orients.push('left', 'right');\n } else if (orient === 'top' || orient === 'bottom') {\n orients.push('top', 'bottom');\n }\n // const spec = layout.getRawChartSpec(col, row);\n let axesSpec;\n if (spec && isArray(spec.axes)) {\n axesSpec = spec.axes;\n } else {\n axesSpec = (layout._table as PivotChart).pivotChartAxes as ITableAxisOption[];\n }\n if (isArray(axesSpec)) {\n const axes: any[] = [];\n axesSpec.forEach((axis: any) => {\n if (orients.includes(axis.orient)) {\n axes.push(axis);\n }\n });\n for (let i = 0; i < axes.length; i++) {\n const axis = axes[i];\n if (\n axis.sync &&\n axis.sync.zeroAlign &&\n axis.sync.axisId &&\n axes.find(axisSync => {\n return axisSync.id === axis.sync.axisId;\n })\n ) {\n return true;\n }\n }\n }\n\n return false;\n}\n\nexport function getAxisRange(\n collectedValues: Record<string, Record<string, CollectedValue>>,\n indicatorKeys: string[],\n isZeroAlign: boolean,\n colPath: string,\n seriesId: number | number[]\n): { max: number; min: number } | null {\n if (isArray(seriesId)) {\n const range = { min: Infinity, max: -Infinity };\n for (let i = 0; i < seriesId.length; i++) {\n const singleRange = getAxisRange(collectedValues, indicatorKeys, isZeroAlign, colPath, seriesId[i]);\n if (singleRange) {\n range.min = Math.min(range.min, singleRange.min);\n range.max = Math.max(range.max, singleRange.max);\n }\n }\n if (isFinite(range.min) && isFinite(range.max)) {\n return range;\n }\n return null;\n }\n let defaultKey = indicatorKeys?.[seriesId];\n if (isArray(defaultKey)) {\n defaultKey = defaultKey[0];\n }\n if (!defaultKey) {\n return null;\n }\n const data = collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n ? collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n : collectedValues[defaultKey];\n const range = merge({}, (data?.[colPath ?? ''] as { min: number; max: number }) ?? { min: 0, max: 1 });\n\n if (range.positiveMax && range.positiveMax > range.max) {\n range.max = range.positiveMax;\n }\n if (range.negativeMin && range.negativeMin < range.min) {\n range.min = range.negativeMin;\n }\n if (range.min === range.max) {\n if (range.min > 0) {\n range.min = 0;\n } else {\n range.max = 0;\n }\n }\n\n return range;\n}\n"]}
@@ -1,4 +1,4 @@
1
- export declare function getAxisDomainRangeAndLabels(min: number, max: number, axisOption: any, isZeroAlign: boolean, skipTick?: boolean): {
1
+ export declare function getAxisDomainRangeAndLabels(min: number, max: number, axisOption: any, isZeroAlign: boolean, axisLength: number, skipTick?: boolean): {
2
2
  range: any[];
3
3
  ticks: number[];
4
4
  };
@@ -4,26 +4,36 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.getAxisDomainRangeAndLabels = void 0;
6
6
 
7
- const vscale_1 = require("@visactor/vscale"), vutils_1 = require("@visactor/vutils"), DEFAULT_CONTINUOUS_TICK_COUNT = 5;
7
+ const vscale_1 = require("@visactor/vscale"), vutils_1 = require("@visactor/vutils"), get_axis_attributes_1 = require("../../components/axis/get-axis-attributes"), DEFAULT_CONTINUOUS_TICK_COUNT = 5;
8
8
 
9
- function getAxisDomainRangeAndLabels(min, max, axisOption, isZeroAlign, skipTick) {
10
- var _a, _b, _c, _d, _e, _f, _g;
11
- let scale, scaleTicks;
9
+ function getAxisDomainRangeAndLabels(min, max, axisOption, isZeroAlign, axisLength, skipTick) {
10
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
12
11
  if ((null == axisOption ? void 0 : axisOption.zero) && (min = Math.min(min, 0),
13
- max = Math.max(max, 0)), (0, vutils_1.isNumber)(null == axisOption ? void 0 : axisOption.min) && (min = axisOption.min),
12
+ max = Math.max(max, 0)), null == axisOption ? void 0 : axisOption.expand) {
13
+ const domainMin = min, domainMax = max;
14
+ (0, vutils_1.isValid)(axisOption.expand.min) && (min = domainMin - (domainMax - domainMin) * axisOption.expand.min),
15
+ (0, vutils_1.isValid)(axisOption.expand.max) && (max = domainMax + (domainMax - domainMin) * axisOption.expand.max);
16
+ }
17
+ let scale, scaleTicks;
18
+ if ((0, vutils_1.isNumber)(null == axisOption ? void 0 : axisOption.min) && (min = axisOption.min),
14
19
  (0, vutils_1.isNumber)(null == axisOption ? void 0 : axisOption.max) && (max = axisOption.max),
15
20
  "log" === (null == axisOption ? void 0 : axisOption.type) ? (scale = new vscale_1.LogScale,
16
21
  scale.base(null !== (_a = null == axisOption ? void 0 : axisOption.base) && void 0 !== _a ? _a : 10)) : "symlog" === (null == axisOption ? void 0 : axisOption.type) ? (scale = new vscale_1.SymlogScale,
17
22
  scale.constant(null !== (_b = null == axisOption ? void 0 : axisOption.constant) && void 0 !== _b ? _b : 10)) : scale = new vscale_1.LinearScale,
18
23
  scale.domain([ min, max ], !!(null == axisOption ? void 0 : axisOption.nice)), (null == axisOption ? void 0 : axisOption.nice) && !isZeroAlign) {
19
24
  let tickCount = null !== (_f = null !== (_d = null === (_c = axisOption.tick) || void 0 === _c ? void 0 : _c.forceTickCount) && void 0 !== _d ? _d : null === (_e = axisOption.tick) || void 0 === _e ? void 0 : _e.tickCount) && void 0 !== _f ? _f : 10;
20
- "accurateFirst" === axisOption.niceType && (tickCount = Math.max(10, tickCount)),
25
+ (0, vutils_1.isFunction)(tickCount) && (tickCount = tickCount({
26
+ axisLength: axisLength,
27
+ labelStyle: null !== (_h = null === (_g = null == axisOption ? void 0 : axisOption.label) || void 0 === _g ? void 0 : _g.style) && void 0 !== _h ? _h : {
28
+ fontSize: get_axis_attributes_1.THEME_CONSTANTS.LABEL_FONT_SIZE
29
+ }
30
+ })), "accurateFirst" === axisOption.niceType && (tickCount = Math.max(10, tickCount)),
21
31
  (0, vutils_1.isNil)(axisOption.min) && (0, vutils_1.isNil)(axisOption.max) ? scale.nice(tickCount) : (0,
22
32
  vutils_1.isValid)(axisOption.min) && (0, vutils_1.isNil)(axisOption.max) ? scale.niceMax(tickCount) : (0,
23
33
  vutils_1.isNil)(axisOption.min) && (0, vutils_1.isValid)(axisOption.max) && scale.niceMin(tickCount);
24
34
  }
25
35
  return delete scale._niceType, skipTick || (scaleTicks = scale.ticks((0, vutils_1.isNumber)(null == axisOption ? void 0 : axisOption.tickCount) ? null == axisOption ? void 0 : axisOption.tickCount : 5, {
26
- noDecimals: null === (_g = null == axisOption ? void 0 : axisOption.tick) || void 0 === _g ? void 0 : _g.noDecimals
36
+ noDecimals: null === (_j = null == axisOption ? void 0 : axisOption.tick) || void 0 === _j ? void 0 : _j.noDecimals
27
37
  })), {
28
38
  range: scale.domain(),
29
39
  ticks: scaleTicks
@@ -1 +1 @@
1
- {"version":3,"sources":["layout/chart-helper/get-axis-domain.ts"],"names":[],"mappings":";;;AAAA,6CAAsE;AACtE,6CAAwE;AAExE,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAQxC,SAAgB,2BAA2B,CACzC,GAAW,EACX,GAAW,EACX,UAAe,EACf,WAAoB,EACpB,QAAkB;;IAElB,IAAI,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,EAAE;QACpB,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACvB,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;KACxB;IACD,IAAI,IAAA,iBAAQ,EAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,GAAG,CAAC,EAAE;QAC7B,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC;KACtB;IACD,IAAI,IAAA,iBAAQ,EAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,GAAG,CAAC,EAAE;QAC7B,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC;KACtB;IAED,IAAI,KAAK,CAAC;IACV,IAAI,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,IAAI,IAAA,cAAK,EAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YAC3D,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;SAC1B;aAAM,IAAI,IAAA,cAAK,EAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAA,gBAAO,EAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YAC3D,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;SAC1B;KACF;IAED,OAAQ,KAAa,CAAC,SAAS,CAAC;IAChC,IAAI,UAAU,CAAC;IACf,IAAI,CAAC,QAAQ,EAAE;QACb,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,IAAA,iBAAQ,EAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS,CAAC,CAAC,CAAC,CAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS,CAAC,CAAC,CAAC,6BAA6B,EAAE;YAChH,UAAU,EAAE,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,0CAAE,UAAU;SACzC,CAAC,CAAC;KAEJ;IAED,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE;QACrB,KAAK,EAAE,UAAU;KAClB,CAAC;AACJ,CAAC;AA3DD,kEA2DC","file":"get-axis-domain.js","sourcesContent":["import { LinearScale, LogScale, SymlogScale } from '@visactor/vscale';\nimport { isFunction, isNil, isNumber, isValid } from '@visactor/vutils';\n\nconst DEFAULT_CONTINUOUS_TICK_COUNT = 5;\n/**\n * @description: get axis nice domain and tick label text\n * @param {number} min\n * @param {number} max\n * @param {ITableAxisOption} axisOption\n * @return {*}\n */\nexport function getAxisDomainRangeAndLabels(\n min: number,\n max: number,\n axisOption: any,\n isZeroAlign: boolean,\n skipTick?: boolean\n) {\n if (axisOption?.zero) {\n min = Math.min(min, 0);\n max = Math.max(max, 0);\n }\n if (isNumber(axisOption?.min)) {\n min = axisOption.min;\n }\n if (isNumber(axisOption?.max)) {\n max = axisOption.max;\n }\n\n let scale;\n if (axisOption?.type === 'log') {\n scale = new LogScale();\n scale.base(axisOption?.base ?? 10);\n } else if (axisOption?.type === 'symlog') {\n scale = new SymlogScale();\n scale.constant(axisOption?.constant ?? 10);\n } else {\n scale = new LinearScale();\n }\n scale.domain([min, max], !!axisOption?.nice);\n\n if (axisOption?.nice && !isZeroAlign) {\n let tickCount = axisOption.tick?.forceTickCount ?? axisOption.tick?.tickCount ?? 10;\n // 如果配置了精度优先,那么最低是10\n // 否则就直接使用tickCount即可\n if (axisOption.niceType === 'accurateFirst') {\n tickCount = Math.max(10, tickCount);\n }\n if (isNil(axisOption.min) && isNil(axisOption.max)) {\n scale.nice(tickCount);\n } else if (isValid(axisOption.min) && isNil(axisOption.max)) {\n scale.niceMax(tickCount);\n } else if (isNil(axisOption.min) && isValid(axisOption.max)) {\n scale.niceMin(tickCount);\n }\n }\n\n delete (scale as any)._niceType; // ensure scaleTicks consistent in `measurement`, `component label` and `chart`\n let scaleTicks;\n if (!skipTick) {\n scaleTicks = scale.ticks(isNumber(axisOption?.tickCount) ? axisOption?.tickCount : DEFAULT_CONTINUOUS_TICK_COUNT, {\n noDecimals: axisOption?.tick?.noDecimals\n });\n // console.log(scaleTicks);\n }\n\n return {\n range: scale.domain(),\n ticks: scaleTicks\n };\n}\n"]}
1
+ {"version":3,"sources":["layout/chart-helper/get-axis-domain.ts"],"names":[],"mappings":";;;AAAA,6CAAsE;AACtE,6CAAwE;AACxE,mFAA4E;AAE5E,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAQxC,SAAgB,2BAA2B,CACzC,GAAW,EACX,GAAW,EACX,UAAe,EACf,WAAoB,EACpB,UAAkB,EAClB,QAAkB;;IAElB,IAAI,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,EAAE;QACpB,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACvB,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC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K,EAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAA,gBAAO,EAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YAC3D,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;SAC1B;KACF;IAED,OAAQ,KAAa,CAAC,SAAS,CAAC;IAChC,IAAI,UAAU,CAAC;IACf,IAAI,CAAC,QAAQ,EAAE;QACb,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,IAAA,iBAAQ,EAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS,CAAC,CAAC,CAAC,CAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS,CAAC,CAAC,CAAC,6BAA6B,EAAE;YAChH,UAAU,EAAE,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,0CAAE,UAAU;SACzC,CAAC,CAAC;KAEJ;IAED,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE;QACrB,KAAK,EAAE,UAAU;KAClB,CAAC;AACJ,CAAC;AA9ED,kEA8EC","file":"get-axis-domain.js","sourcesContent":["import { LinearScale, LogScale, SymlogScale } from '@visactor/vscale';\nimport { isFunction, isNil, isNumber, isValid } from '@visactor/vutils';\nimport { THEME_CONSTANTS } from '../../components/axis/get-axis-attributes';\n\nconst DEFAULT_CONTINUOUS_TICK_COUNT = 5;\n/**\n * @description: get axis nice domain and tick label text\n * @param {number} min\n * @param {number} max\n * @param {ITableAxisOption} axisOption\n * @return {*}\n */\nexport function getAxisDomainRangeAndLabels(\n min: number,\n max: number,\n axisOption: any,\n isZeroAlign: boolean,\n axisLength: number,\n skipTick?: boolean\n) {\n if (axisOption?.zero) {\n min = Math.min(min, 0);\n max = Math.max(max, 0);\n }\n if (axisOption?.expand) {\n const domainMin = min;\n const domainMax = max;\n if (isValid(axisOption.expand.min)) {\n min = domainMin - (domainMax - domainMin) * axisOption.expand.min;\n }\n if (isValid(axisOption.expand.max)) {\n max = domainMax + (domainMax - domainMin) * axisOption.expand.max;\n }\n }\n if (isNumber(axisOption?.min)) {\n min = axisOption.min;\n }\n if (isNumber(axisOption?.max)) {\n max = axisOption.max;\n }\n\n let scale;\n if (axisOption?.type === 'log') {\n scale = new LogScale();\n scale.base(axisOption?.base ?? 10);\n } else if (axisOption?.type === 'symlog') {\n scale = new SymlogScale();\n scale.constant(axisOption?.constant ?? 10);\n } else {\n scale = new LinearScale();\n }\n scale.domain([min, max], !!axisOption?.nice);\n\n if (axisOption?.nice && !isZeroAlign) {\n let tickCount = axisOption.tick?.forceTickCount ?? axisOption.tick?.tickCount ?? 10;\n if (isFunction(tickCount)) {\n tickCount = tickCount({\n axisLength,\n labelStyle: axisOption?.label?.style ?? {\n fontSize: THEME_CONSTANTS.LABEL_FONT_SIZE\n }\n });\n }\n // 如果配置了精度优先,那么最低是10\n // 否则就直接使用tickCount即可\n if (axisOption.niceType === 'accurateFirst') {\n tickCount = Math.max(10, tickCount);\n }\n if (isNil(axisOption.min) && isNil(axisOption.max)) {\n scale.nice(tickCount);\n } else if (isValid(axisOption.min) && isNil(axisOption.max)) {\n scale.niceMax(tickCount);\n } else if (isNil(axisOption.min) && isValid(axisOption.max)) {\n scale.niceMin(tickCount);\n }\n }\n\n delete (scale as any)._niceType; // ensure scaleTicks consistent in `measurement`, `component label` and `chart`\n let scaleTicks;\n if (!skipTick) {\n scaleTicks = scale.ticks(isNumber(axisOption?.tickCount) ? axisOption?.tickCount : DEFAULT_CONTINUOUS_TICK_COUNT, {\n noDecimals: axisOption?.tick?.noDecimals\n });\n // console.log(scaleTicks);\n }\n\n return {\n range: scale.domain(),\n ticks: scaleTicks\n };\n}\n"]}
@@ -31,7 +31,7 @@ function getChartSpec(col, row, layout) {
31
31
 
32
32
  function getChartAxes(col, row, layout) {
33
33
  var _a, _b;
34
- const axes = [];
34
+ const axes = [], table = layout._table;
35
35
  if (layout.indicatorsAsCol) {
36
36
  const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row), colPath = layout.getColKeysPath(col, row);
37
37
  indicatorKeys.forEach(((key, index) => {
@@ -41,7 +41,7 @@ function getChartAxes(col, row, layout) {
41
41
  if (isPercent && (range.min = range.min < 0 ? -1 : 0, range.max = range.max > 0 ? 1 : 0),
42
42
  ((null == axisOption ? void 0 : axisOption.zero) || range.min === range.max) && (range.min = Math.min(range.min, 0),
43
43
  range.max = Math.max(range.max, 0)), null == axisOption ? void 0 : axisOption.nice) {
44
- const {range: axisRange} = (0, get_axis_domain_1.getAxisDomainRangeAndLabels)(range.min, range.max, axisOption, isZeroAlign);
44
+ const {range: axisRange} = (0, get_axis_domain_1.getAxisDomainRangeAndLabels)(range.min, range.max, axisOption, isZeroAlign, table.getColWidth(col));
45
45
  range.min = axisRange[0], range.max = axisRange[1];
46
46
  }
47
47
  (0, vutils_1.isNumber)(null == axisOption ? void 0 : axisOption.min) && (range.min = axisOption.min),
@@ -102,7 +102,7 @@ function getChartAxes(col, row, layout) {
102
102
  if (isPercent && (range.min = range.min < 0 ? -1 : 0, range.max = range.max > 0 ? 1 : 0),
103
103
  ((null == axisOption ? void 0 : axisOption.zero) || range.min === range.max) && (range.min = Math.min(range.min, 0),
104
104
  range.max = Math.max(range.max, 0)), null == axisOption ? void 0 : axisOption.nice) {
105
- const {range: axisRange} = (0, get_axis_domain_1.getAxisDomainRangeAndLabels)(range.min, range.max, axisOption, isZeroAlign);
105
+ const {range: axisRange} = (0, get_axis_domain_1.getAxisDomainRangeAndLabels)(range.min, range.max, axisOption, isZeroAlign, table.getRowHeight(row));
106
106
  range.min = axisRange[0], range.max = axisRange[1];
107
107
  }
108
108
  (0, vutils_1.isNumber)(null == axisOption ? void 0 : axisOption.min) && (range.min = axisOption.min),
@@ -1 +1 @@
1
- {"version":3,"sources":["layout/chart-helper/get-chart-spec.ts"],"names":[],"mappings":";;;AAAA,6CAAuE;AAGvE,uDAAgF;AAChF,uDAAgE;AAEhE,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAEpD,SAAgB,eAAe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A,MAAA,MAAA,UAAU,CAAC,IAAI,0CAAE,EAAE,mCAAI,MAAA,SAAS,CAAC,IAAI,0CAAE,EAAE,mCAAI,MAAM,CAAC,GAAG,SAAS,CAAC;iBAC9E;aACF;QACH,CAAC,CAAC,CAAC;QACH,OAAO,WAAW,CAAC;KACpB;IACD,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;AAC3B,CAAC;AA5BD,wCA4BC","file":"get-chart-spec.js","sourcesContent":["import { cloneDeep, isArray, isNumber, merge } from '@visactor/vutils';\nimport type { PivotHeaderLayoutMap } from '../pivot-header-layout';\nimport type { SimpleHeaderLayoutMap } from '../simple-header-layout';\nimport { checkZeroAlign, getAxisOption, getAxisRange } from './get-axis-config';\nimport { getAxisDomainRangeAndLabels } from './get-axis-domain';\n\nconst NO_AXISID_FRO_VTABLE = 'NO_AXISID_FRO_VTABLE';\n\nexport function getRawChartSpec(col: number, row: number, layout: PivotHeaderLayoutMap): any {\n const paths = layout.getCellHeaderPaths(col, row);\n let indicatorObj;\n if (layout.indicatorsAsCol) {\n const indicatorKey = paths.colHeaderPaths.find(colPath => colPath.indicatorKey)?.indicatorKey;\n indicatorObj = layout.columnObjects.find(indicator => indicator.indicatorKey === indicatorKey);\n } else {\n const indicatorKey = paths.rowHeaderPaths.find(rowPath => rowPath.indicatorKey)?.indicatorKey;\n indicatorObj = layout.columnObjects.find(indicator => indicator.indicatorKey === indicatorKey);\n }\n const chartSpec = indicatorObj?.chartSpec;\n\n return chartSpec;\n}\n\nexport function getChartSpec(col: number, row: number, layout: PivotHeaderLayoutMap): any {\n let chartSpec = layout.getRawChartSpec(col, row);\n if (chartSpec) {\n chartSpec = cloneDeep(chartSpec);\n chartSpec.sortDataByAxis = true;\n if (isArray(chartSpec.series)) {\n chartSpec.series.forEach((serie: any) => {\n serie.sortDataByAxis = true;\n });\n }\n chartSpec.axes = layout.getChartAxes(col, row);\n chartSpec.padding = 0;\n chartSpec.dataZoom = []; // Do not support datazoom temply\n return chartSpec;\n }\n return null;\n}\n\nexport function getChartAxes(col: number, row: number, layout: PivotHeaderLayoutMap): any {\n const axes = [];\n if (layout.indicatorsAsCol) {\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n // const colIndex = layout.getRecordIndexByCol(col);\n const colPath = layout.getColKeysPath(col, row);\n indicatorKeys.forEach((key, index) => {\n // if (isArray(key)) {\n // key = key[0];\n // }\n\n const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(\n col,\n row,\n index === 0 ? 'bottom' : 'top',\n layout\n );\n const range = getAxisRange(\n layout.dataset.collectedValues,\n indicatorKeys,\n isZeroAlign,\n colPath,\n seriesIndice ?? index\n );\n // const data = layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]\n // ? layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]\n // : layout.dataset.collectedValues[key];\n // const range = merge({}, (data?.[colPath ?? ''] as { max?: number; min?: number }) ?? { min: 0, max: 1 });\n // if (range.positiveMax && range.positiveMax > range.max) {\n // range.max = range.positiveMax;\n // }\n // if (range.negativeMin && range.negativeMin < range.min) {\n // range.min = range.negativeMin;\n // }\n if (isPercent) {\n (range as any).min = (range as any).min < 0 ? -1 : 0;\n (range as any).max = (range as any).max > 0 ? 1 : 0;\n }\n if (axisOption?.zero || range.min === range.max) {\n range.min = Math.min(range.min, 0);\n range.max = Math.max(range.max, 0);\n }\n if (axisOption?.nice) {\n const { range: axisRange } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign);\n range.min = axisRange[0];\n range.max = axisRange[1];\n }\n if (isNumber(axisOption?.min)) {\n (range as any).min = axisOption.min;\n }\n if (isNumber(axisOption?.max)) {\n (range as any).max = axisOption.max;\n }\n axes.push(\n merge(\n {\n range\n },\n axisOption,\n {\n type: axisOption?.type || 'linear',\n orient: index === 0 ? 'bottom' : 'top',\n // visible: true,\n label: { visible: false },\n title: { visible: false },\n domainLine: { visible: false },\n seriesIndex: index,\n height: -1,\n\n sync: { axisId: NO_AXISID_FRO_VTABLE } // hack for fs\n }\n )\n );\n });\n\n let rowDimensionKey = layout.getDimensionKeyInChartSpec(layout.rowHeaderLevelCount, row)?.[0];\n if (isArray(rowDimensionKey)) {\n rowDimensionKey = rowDimensionKey[0];\n }\n const data =\n layout.dataset.cacheCollectedValues[rowDimensionKey] ||\n layout.dataset.collectedValues[rowDimensionKey] ||\n ([] as string[]);\n const rowPath = layout.getRowKeysPath(col, row);\n const domain = data[rowPath ?? ''] as Set<string>;\n\n const { axisOption, isPercent } = getAxisOption(col, row, 'left', layout);\n axes.push(\n merge(\n {\n domain: Array.from(domain ?? [])\n },\n axisOption,\n {\n type: 'band',\n orient: 'left',\n // visible: true,\n label: { visible: false },\n domainLine: { visible: false },\n tick: { visible: false },\n subTick: { visible: false },\n title: { visible: false },\n // height: -1,\n width: -1\n // autoIndent: false,\n }\n )\n );\n } else {\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n const rowPath = layout.getRowKeysPath(col, row);\n indicatorKeys.forEach((key, index) => {\n // if (isArray(key)) {\n // key = key[0];\n // }\n\n const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(\n col,\n row,\n index === 0 ? 'left' : 'right',\n layout\n );\n const range = getAxisRange(\n layout.dataset.collectedValues,\n indicatorKeys,\n isZeroAlign,\n rowPath,\n seriesIndice ?? index\n );\n\n // const data = layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]\n // ? layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]\n // : layout.dataset.collectedValues[key];\n\n // const range = merge({}, (data?.[rowPath ?? ''] as { max?: number; min?: number }) ?? { min: 0, max: 1 });\n // if (range.positiveMax && range.positiveMax > range.max) {\n // range.max = range.positiveMax;\n // }\n // if (range.negativeMin && range.negativeMin < range.min) {\n // range.min = range.negativeMin;\n // }\n if (isPercent) {\n (range as any).min = (range as any).min < 0 ? -1 : 0;\n (range as any).max = (range as any).max > 0 ? 1 : 0;\n }\n if (axisOption?.zero || range.min === range.max) {\n range.min = Math.min(range.min, 0);\n range.max = Math.max(range.max, 0);\n }\n if (axisOption?.nice) {\n const { range: axisRange } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign);\n range.min = axisRange[0];\n range.max = axisRange[1];\n }\n if (isNumber(axisOption?.min)) {\n (range as any).min = axisOption.min;\n }\n if (isNumber(axisOption?.max)) {\n (range as any).max = axisOption.max;\n }\n axes.push(\n merge(\n {\n range\n },\n axisOption,\n {\n type: axisOption?.type || 'linear',\n orient: index === 0 ? 'left' : 'right',\n // visible: true,\n label: { visible: false },\n // label: { flush: true },\n title: { visible: false },\n domainLine: { visible: false },\n seriesIndex: index,\n width: -1,\n // grid: index === 0 ? undefined : { visible: false }\n\n sync: { axisId: NO_AXISID_FRO_VTABLE } // hack for fs\n }\n )\n );\n });\n\n let columnDimensionKey = layout.getDimensionKeyInChartSpec(col, layout.columnHeaderLevelCount)[0];\n if (isArray(columnDimensionKey)) {\n columnDimensionKey = columnDimensionKey[0];\n }\n const data =\n layout.dataset.cacheCollectedValues[columnDimensionKey] ||\n layout.dataset.collectedValues[columnDimensionKey] ||\n ([] as string[]);\n const colPath = layout.getColKeysPath(col, row);\n const domain: string[] | Set<string> = (data?.[colPath ?? ''] as Set<string>) ?? [];\n\n const { axisOption, isPercent } = getAxisOption(col, row, 'bottom', layout);\n axes.push(\n merge(\n {\n domain: Array.from(domain)\n },\n axisOption,\n {\n type: 'band',\n orient: 'bottom',\n visible: true,\n label: { visible: false },\n domainLine: { visible: false },\n tick: { visible: false },\n subTick: { visible: false },\n title: { visible: false },\n height: -1\n // autoIndent: false,\n }\n )\n );\n }\n return axes;\n}\n/**\n * 获取单元格对应spec的dataId。\n * 如果是spec外层的dataId,则是string,否则通过series获取到的是Record<string, string> => <dataId, series-chart的指标key用于过滤数据>\n * @param col\n * @param row\n * @param layout\n * @returns\n */\nexport function getChartDataId(\n col: number,\n row: number,\n layout: PivotHeaderLayoutMap | SimpleHeaderLayoutMap\n): string | Record<string, string> {\n const chartSpec = layout.getRawChartSpec(col, row);\n // 如果chartSpec配置了组合图 series 则需要考虑 series中存在的多个指标\n if (chartSpec?.series) {\n const dataIdfield: Record<string, string> = {};\n\n if (chartSpec.data?.id) {\n dataIdfield[chartSpec.data.id] = undefined;\n }\n chartSpec?.series.forEach((seriesSpec: any) => {\n if (!seriesSpec.data?.fromDataId) {\n if (!seriesSpec.data?.transforms) {\n const seriesField = seriesSpec.direction === 'horizontal' ? seriesSpec.xField : seriesSpec.yField;\n dataIdfield[seriesSpec.data?.id ?? chartSpec.data?.id ?? 'data'] = seriesSpec.data?.id\n ? seriesField\n : undefined;\n } else {\n dataIdfield[seriesSpec.data?.id ?? chartSpec.data?.id ?? 'data'] = undefined;\n }\n }\n });\n return dataIdfield;\n }\n return chartSpec.data.id;\n}\n"]}
1
+ {"version":3,"sources":["layout/chart-helper/get-chart-spec.ts"],"names":[],"mappings":";;;AAAA,6CAAuE;AAGvE,uDAAgF;AAChF,uDAAgE;AAEhE,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAEpD,SAAgB,eAAe,CAAC,GAAW,EAAE,GAAW,EAAE,MAA4B;;IACpF,MAAM,KAAK,GAAG,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAClD,IAAI,YAAY,CAAC;IACjB,IAAI,MAAM,CAAC,eAAe,EAAE;QAC1B,MAAM,YAAY,GAAG,MAAA,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,0CAAE,YAAY,CAAC;QAC9F,YAAY,GAAG,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,YAAY,KAAK,YAAY,CAAC,CAAC;KAChG;SAAM;QACL,MAAM,YAAY,GAAG,MAAA,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,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M,WAAW,GAA2B,EAAE,CAAC;QAE/C,IAAI,MAAA,SAAS,CAAC,IAAI,0CAAE,EAAE,EAAE;YACtB,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;SAC5C;QACD,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM,CAAC,OAAO,CAAC,CAAC,UAAe,EAAE,EAAE;;YAC5C,IAAI,CAAC,CAAA,MAAA,UAAU,CAAC,IAAI,0CAAE,UAAU,CAAA,EAAE;gBAChC,IAAI,CAAC,CAAA,MAAA,UAAU,CAAC,IAAI,0CAAE,UAAU,CAAA,EAAE;oBAChC,MAAM,WAAW,GAAG,UAAU,CAAC,SAAS,KAAK,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;oBAClG,WAAW,CAAC,MAAA,MAAA,MAAA,UAAU,CAAC,IAAI,0CAAE,EAAE,mCAAI,MAAA,SAAS,CAAC,IAAI,0CAAE,EAAE,mCAAI,MAAM,CAAC,GAAG,CAAA,MAAA,UAAU,CAAC,IAAI,0CAAE,EAAE;wBACpF,CAAC,CAAC,WAAW;wBACb,CAAC,CAAC,SAAS,CAAC;iBACf;qBAAM;oBACL,WAAW,CAAC,MAAA,MAAA,MAAA,UAAU,CAAC,IAAI,0CAAE,EAAE,mCAAI,MAAA,SAAS,CAAC,IAAI,0CAAE,EAAE,mCAAI,MAAM,CAAC,GAAG,SAAS,CAAC;iBAC9E;aACF;QACH,CAAC,CAAC,CAAC;QACH,OAAO,WAAW,CAAC;KACpB;IACD,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;AAC3B,CAAC;AA5BD,wCA4BC","file":"get-chart-spec.js","sourcesContent":["import { cloneDeep, isArray, isNumber, merge } from '@visactor/vutils';\nimport type { PivotHeaderLayoutMap } from '../pivot-header-layout';\nimport type { SimpleHeaderLayoutMap } from '../simple-header-layout';\nimport { checkZeroAlign, getAxisOption, getAxisRange } from './get-axis-config';\nimport { getAxisDomainRangeAndLabels } from './get-axis-domain';\n\nconst NO_AXISID_FRO_VTABLE = 'NO_AXISID_FRO_VTABLE';\n\nexport function getRawChartSpec(col: number, row: number, layout: PivotHeaderLayoutMap): any {\n const paths = layout.getCellHeaderPaths(col, row);\n let indicatorObj;\n if (layout.indicatorsAsCol) {\n const indicatorKey = paths.colHeaderPaths.find(colPath => colPath.indicatorKey)?.indicatorKey;\n indicatorObj = layout.columnObjects.find(indicator => indicator.indicatorKey === indicatorKey);\n } else {\n const indicatorKey = paths.rowHeaderPaths.find(rowPath => rowPath.indicatorKey)?.indicatorKey;\n indicatorObj = layout.columnObjects.find(indicator => indicator.indicatorKey === indicatorKey);\n }\n const chartSpec = indicatorObj?.chartSpec;\n\n return chartSpec;\n}\n\nexport function getChartSpec(col: number, row: number, layout: PivotHeaderLayoutMap): any {\n let chartSpec = layout.getRawChartSpec(col, row);\n if (chartSpec) {\n chartSpec = cloneDeep(chartSpec);\n chartSpec.sortDataByAxis = true;\n if (isArray(chartSpec.series)) {\n chartSpec.series.forEach((serie: any) => {\n serie.sortDataByAxis = true;\n });\n }\n chartSpec.axes = layout.getChartAxes(col, row);\n chartSpec.padding = 0;\n chartSpec.dataZoom = []; // Do not support datazoom temply\n return chartSpec;\n }\n return null;\n}\n\nexport function getChartAxes(col: number, row: number, layout: PivotHeaderLayoutMap): any {\n const axes = [];\n const table = layout._table;\n if (layout.indicatorsAsCol) {\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n // const colIndex = layout.getRecordIndexByCol(col);\n const colPath = layout.getColKeysPath(col, row);\n indicatorKeys.forEach((key, index) => {\n // if (isArray(key)) {\n // key = key[0];\n // }\n\n const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(\n col,\n row,\n index === 0 ? 'bottom' : 'top',\n layout\n );\n const range = getAxisRange(\n layout.dataset.collectedValues,\n indicatorKeys,\n isZeroAlign,\n colPath,\n seriesIndice ?? index\n );\n // const data = layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]\n // ? layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]\n // : layout.dataset.collectedValues[key];\n // const range = merge({}, (data?.[colPath ?? ''] as { max?: number; min?: number }) ?? { min: 0, max: 1 });\n // if (range.positiveMax && range.positiveMax > range.max) {\n // range.max = range.positiveMax;\n // }\n // if (range.negativeMin && range.negativeMin < range.min) {\n // range.min = range.negativeMin;\n // }\n if (isPercent) {\n (range as any).min = (range as any).min < 0 ? -1 : 0;\n (range as any).max = (range as any).max > 0 ? 1 : 0;\n }\n if (axisOption?.zero || range.min === range.max) {\n range.min = Math.min(range.min, 0);\n range.max = Math.max(range.max, 0);\n }\n if (axisOption?.nice) {\n const { range: axisRange } = getAxisDomainRangeAndLabels(\n range.min,\n range.max,\n axisOption,\n isZeroAlign,\n table.getColWidth(col)\n );\n range.min = axisRange[0];\n range.max = axisRange[1];\n }\n if (isNumber(axisOption?.min)) {\n (range as any).min = axisOption.min;\n }\n if (isNumber(axisOption?.max)) {\n (range as any).max = axisOption.max;\n }\n axes.push(\n merge(\n {\n range\n },\n axisOption,\n {\n type: axisOption?.type || 'linear',\n orient: index === 0 ? 'bottom' : 'top',\n // visible: true,\n label: { visible: false },\n title: { visible: false },\n domainLine: { visible: false },\n seriesIndex: index,\n height: -1,\n\n sync: { axisId: NO_AXISID_FRO_VTABLE } // hack for fs\n }\n )\n );\n });\n\n let rowDimensionKey = layout.getDimensionKeyInChartSpec(layout.rowHeaderLevelCount, row)?.[0];\n if (isArray(rowDimensionKey)) {\n rowDimensionKey = rowDimensionKey[0];\n }\n const data =\n layout.dataset.cacheCollectedValues[rowDimensionKey] ||\n layout.dataset.collectedValues[rowDimensionKey] ||\n ([] as string[]);\n const rowPath = layout.getRowKeysPath(col, row);\n const domain = data[rowPath ?? ''] as Set<string>;\n\n const { axisOption, isPercent } = getAxisOption(col, row, 'left', layout);\n axes.push(\n merge(\n {\n domain: Array.from(domain ?? [])\n },\n axisOption,\n {\n type: 'band',\n orient: 'left',\n // visible: true,\n label: { visible: false },\n domainLine: { visible: false },\n tick: { visible: false },\n subTick: { visible: false },\n title: { visible: false },\n // height: -1,\n width: -1\n // autoIndent: false,\n }\n )\n );\n } else {\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n const rowPath = layout.getRowKeysPath(col, row);\n indicatorKeys.forEach((key, index) => {\n // if (isArray(key)) {\n // key = key[0];\n // }\n\n const { axisOption, isPercent, isZeroAlign, seriesIndice } = getAxisOption(\n col,\n row,\n index === 0 ? 'left' : 'right',\n layout\n );\n const range = getAxisRange(\n layout.dataset.collectedValues,\n indicatorKeys,\n isZeroAlign,\n rowPath,\n seriesIndice ?? index\n );\n\n // const data = layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]\n // ? layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]\n // : layout.dataset.collectedValues[key];\n\n // const range = merge({}, (data?.[rowPath ?? ''] as { max?: number; min?: number }) ?? { min: 0, max: 1 });\n // if (range.positiveMax && range.positiveMax > range.max) {\n // range.max = range.positiveMax;\n // }\n // if (range.negativeMin && range.negativeMin < range.min) {\n // range.min = range.negativeMin;\n // }\n if (isPercent) {\n (range as any).min = (range as any).min < 0 ? -1 : 0;\n (range as any).max = (range as any).max > 0 ? 1 : 0;\n }\n if (axisOption?.zero || range.min === range.max) {\n range.min = Math.min(range.min, 0);\n range.max = Math.max(range.max, 0);\n }\n if (axisOption?.nice) {\n const { range: axisRange } = getAxisDomainRangeAndLabels(\n range.min,\n range.max,\n axisOption,\n isZeroAlign,\n table.getRowHeight(row)\n );\n range.min = axisRange[0];\n range.max = axisRange[1];\n }\n if (isNumber(axisOption?.min)) {\n (range as any).min = axisOption.min;\n }\n if (isNumber(axisOption?.max)) {\n (range as any).max = axisOption.max;\n }\n axes.push(\n merge(\n {\n range\n },\n axisOption,\n {\n type: axisOption?.type || 'linear',\n orient: index === 0 ? 'left' : 'right',\n // visible: true,\n label: { visible: false },\n // label: { flush: true },\n title: { visible: false },\n domainLine: { visible: false },\n seriesIndex: index,\n width: -1,\n // grid: index === 0 ? undefined : { visible: false }\n\n sync: { axisId: NO_AXISID_FRO_VTABLE } // hack for fs\n }\n )\n );\n });\n\n let columnDimensionKey = layout.getDimensionKeyInChartSpec(col, layout.columnHeaderLevelCount)[0];\n if (isArray(columnDimensionKey)) {\n columnDimensionKey = columnDimensionKey[0];\n }\n const data =\n layout.dataset.cacheCollectedValues[columnDimensionKey] ||\n layout.dataset.collectedValues[columnDimensionKey] ||\n ([] as string[]);\n const colPath = layout.getColKeysPath(col, row);\n const domain: string[] | Set<string> = (data?.[colPath ?? ''] as Set<string>) ?? [];\n\n const { axisOption, isPercent } = getAxisOption(col, row, 'bottom', layout);\n axes.push(\n merge(\n {\n domain: Array.from(domain)\n },\n axisOption,\n {\n type: 'band',\n orient: 'bottom',\n visible: true,\n label: { visible: false },\n domainLine: { visible: false },\n tick: { visible: false },\n subTick: { visible: false },\n title: { visible: false },\n height: -1\n // autoIndent: false,\n }\n )\n );\n }\n return axes;\n}\n/**\n * 获取单元格对应spec的dataId。\n * 如果是spec外层的dataId,则是string,否则通过series获取到的是Record<string, string> => <dataId, series-chart的指标key用于过滤数据>\n * @param col\n * @param row\n * @param layout\n * @returns\n */\nexport function getChartDataId(\n col: number,\n row: number,\n layout: PivotHeaderLayoutMap | SimpleHeaderLayoutMap\n): string | Record<string, string> {\n const chartSpec = layout.getRawChartSpec(col, row);\n // 如果chartSpec配置了组合图 series 则需要考虑 series中存在的多个指标\n if (chartSpec?.series) {\n const dataIdfield: Record<string, string> = {};\n\n if (chartSpec.data?.id) {\n dataIdfield[chartSpec.data.id] = undefined;\n }\n chartSpec?.series.forEach((seriesSpec: any) => {\n if (!seriesSpec.data?.fromDataId) {\n if (!seriesSpec.data?.transforms) {\n const seriesField = seriesSpec.direction === 'horizontal' ? seriesSpec.xField : seriesSpec.yField;\n dataIdfield[seriesSpec.data?.id ?? chartSpec.data?.id ?? 'data'] = seriesSpec.data?.id\n ? seriesField\n : undefined;\n } else {\n dataIdfield[seriesSpec.data?.id ?? chartSpec.data?.id ?? 'data'] = undefined;\n }\n }\n });\n return dataIdfield;\n }\n return chartSpec.data.id;\n}\n"]}
@@ -15,10 +15,8 @@ function updateRowHeight(scene, row, detaY) {
15
15
  scene.updateCellContentWhileResize(col, row);
16
16
  }
17
17
  let rowStart = 0, rowEnd = 0;
18
- row < scene.table.columnHeaderLevelCount ? (scene.colHeaderGroup.setAttribute("height", scene.colHeaderGroup.attribute.height + detaY),
19
- scene.rowHeaderGroup.setAttribute("y", scene.colHeaderGroup.attribute.y + detaY),
20
- scene.bodyGroup.setAttribute("y", scene.bodyGroup.attribute.y + detaY), rowStart = row + 1,
21
- rowEnd = scene.table.columnHeaderLevelCount - 1) : (rowStart = row + 1, rowEnd = scene.bodyRowEnd - scene.table.bottomFrozenRowCount);
18
+ row < scene.table.columnHeaderLevelCount ? (rowStart = row + 1, rowEnd = scene.table.columnHeaderLevelCount - 1) : (rowStart = row + 1,
19
+ rowEnd = scene.bodyRowEnd - scene.table.bottomFrozenRowCount);
22
20
  for (let rowIndex = rowStart; rowIndex <= rowEnd; rowIndex++) for (let colIndex = 0; colIndex < scene.table.colCount; colIndex++) {
23
21
  const cellGroup = scene.getCell(colIndex, rowIndex), mergeInfo = (0, get_cell_merge_1.getCellMergeInfo)(scene.table, colIndex, rowIndex);
24
22
  (!mergeInfo || mergeInfo.start.col === colIndex && mergeInfo.start.row === rowIndex) && cellGroup.setAttribute("y", cellGroup.attribute.y + detaY);
@@ -1 +1 @@
1
- {"version":3,"sources":["scenegraph/layout/update-height.ts"],"names":[],"mappings":";;;AAEA,oFAAqF;AACrF,gFAAsF;AAEtF,4DAA2D;AAC3D,gDAA4C;AAC5C,8CAAgD;AAChD,gEAAoE;AAEpE,gDAAqD;AACrD,sEAA0F;AAC1F,wDAAuD;AAEvD,SAAgB,eAAe,CAAC,KAAiB,EAAE,GAA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AAC,aAAa,CAAC;gBACjD,aAAa,GAAG,YAAY,CAAC,aAAa,CAAC;aAC5C;YAED,IAAI,IAAI,CAAC,aAAa,GAAG,CAAC,EAAE;gBAC1B,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;aACzD;iBAAM;gBACL,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;aACvC;SACF;QAED,IAAI,aAAa,EAAE;YAEjB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YAClD,IAAA,0CAAuB,EACrB,IAAI,EACJ,UAAU,EACV,KAAK,EAEL,KAAK,CAAC,KAAK,CAAC,UAAU,KAAK,YAAY,EACvC,IAAA,sBAAY,EAAC,KAAK,CAAC,OAAiB,CAAC,EACrC,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,YAAY,CACnB,CAAC;SACH;KAqCF;AACH,CAAC;AA9JD,4CA8JC","file":"update-height.js","sourcesContent":["import type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle';\nimport type { Group } from '../graphic/group';\nimport { createProgressBarCell } from '../group-creater/cell-type/progress-bar-cell';\nimport { createSparkLineCellGroup } from '../group-creater/cell-type/spark-line-cell';\nimport type { Scenegraph } from '../scenegraph';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport { getProp } from '../utils/get-prop';\nimport { getQuadProps } from '../utils/padding';\nimport { updateCellContentHeight } from '../utils/text-icon-layout';\nimport type { IProgressbarColumnBodyDefine } from '../../ts-types/list-table/define/progressbar-define';\nimport { dealWithCustom } from '../component/custom';\nimport { updateImageCellContentWhileResize } from '../group-creater/cell-type/image-cell';\nimport { getStyleTheme } from '../../core/tableHelper';\n\nexport function updateRowHeight(scene: Scenegraph, row: number, detaY: number) {\n // 更新table行高存储\n scene.table.setRowHeight(row, scene.table.getRowHeight(row) + detaY, true);\n\n for (let col = 0; col < scene.table.colCount; col++) {\n const cell = scene.getCell(col, row);\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.start.col !== col) {\n continue;\n }\n const height = cell.attribute.height;\n // cell.setAttribute('height', height);\n // (cell.firstChild as Rect).setAttribute('height', cell.attribute.height);\n updateCellHeightForRow(scene, cell, col, row, height, detaY, scene.table.isHeader(col, row));\n\n scene.updateCellContentWhileResize(col, row);\n }\n\n let rowStart = 0;\n let rowEnd = 0;\n // 更新header 高度\n if (row < scene.table.columnHeaderLevelCount) {\n scene.colHeaderGroup.setAttribute('height', scene.colHeaderGroup.attribute.height + detaY);\n scene.rowHeaderGroup.setAttribute('y', scene.colHeaderGroup.attribute.y + detaY);\n scene.bodyGroup.setAttribute('y', scene.bodyGroup.attribute.y + detaY);\n\n rowStart = row + 1;\n rowEnd = scene.table.columnHeaderLevelCount - 1;\n } else {\n rowStart = row + 1;\n // rowEnd = scene.table.rowCount - 1;\n rowEnd = scene.bodyRowEnd - scene.table.bottomFrozenRowCount;\n }\n\n // 更新以下行位置\n for (let rowIndex = rowStart; rowIndex <= rowEnd; rowIndex++) {\n // if (rowIndex === 2) debugger;\n for (let colIndex = 0; colIndex < scene.table.colCount; colIndex++) {\n const cellGroup = scene.getCell(colIndex, rowIndex);\n const mergeInfo = getCellMergeInfo(scene.table, colIndex, rowIndex);\n if (mergeInfo && (mergeInfo.start.col !== colIndex || mergeInfo.start.row !== rowIndex)) {\n continue;\n }\n\n cellGroup.setAttribute('y', cellGroup.attribute.y + detaY);\n }\n }\n}\n\n/**\n * @description: 更新单个单元格高度\n * @return {*}\n */\nexport function updateCellHeightForRow(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n // autoRowHeight: boolean\n) {\n let cellGroup;\n let distHeight;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n // TO BE FIXED 这里使用横向和纵向来判断单元格merge情况,目前没有横纵都merge的情况,\n // 如果有这里的逻辑要修改\n if (mergeInfo && mergeInfo.end.col - mergeInfo.start.col && mergeInfo.start.col === col) {\n // 更新横向merge cell height,只更新一次\n const mergeCell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n const mergeCellheight = mergeCell.attribute.height;\n mergeCell.setAttribute('height', mergeCellheight + detaY);\n\n cellGroup = mergeCell;\n distHeight = mergeCell.attribute.height;\n } else if (mergeInfo) {\n // 更新纵向merge cell width\n cell.setAttribute('height', height + detaY);\n\n cellGroup = cell;\n distHeight = height + detaY;\n } else if (!mergeInfo) {\n cell.setAttribute('height', height + detaY);\n cellGroup = cell;\n distHeight = height + detaY;\n // cell.setTheme({\n // rect: {\n // height: cell.attribute.height,\n // },\n // });\n }\n\n if (!cellGroup) {\n // 合并单元格非主单元格,不处理\n return;\n }\n\n updateCellHeight(scene, cellGroup, col, row, distHeight, detaY, isHeader);\n}\n\nexport function updateCellHeightForColumn(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n) {\n let cellGroup;\n // let distHeight;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {\n cell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n if (row === mergeInfo.start.row) {\n // 初始化高度\n (cell as any)._tempHeight = height;\n return;\n } else if (row === mergeInfo.end.row) {\n cell.setAttribute('height', (cell as any)._tempHeight + height);\n cellGroup = cell;\n height = cell.attribute.height;\n // updateCellHeight(scene, cellGroup, col, row, cell.attribute.height, 0, isHeader);\n } else {\n // 累加高度\n (cell as any)._tempHeight += height;\n return;\n }\n } else if (mergeInfo) {\n cell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n cell.setAttribute('height', height);\n cellGroup = cell;\n\n // const rect = cell.firstChild as Rect;\n // rect.setAttribute('height', cell.attribute.height);\n } else {\n cell.setAttribute('height', height);\n cellGroup = cell;\n }\n updateCellHeight(scene, cellGroup, col, row, height, 0, isHeader);\n}\n\nexport function updateCellHeight(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n distHeight: number,\n detaY: number,\n isHeader: boolean\n) {\n // 更新单元格布局\n const type = scene.table.isHeader(col, row)\n ? scene.table._getHeaderLayoutMap(col, row).headerType\n : scene.table.getBodyColumnType(col, row);\n if (type === 'progressbar') {\n // 目前先采用重新生成节点的方案\n const columnDefine = scene.table.getBodyColumnDefine(col, row) as IProgressbarColumnBodyDefine;\n const style = scene.table._getCellStyle(col, row) as ProgressBarStyle;\n const value = scene.table.getCellValue(col, row);\n const dataValue = scene.table.getCellOriginValue(col, row);\n const padding = getQuadProps(getProp('padding', style, col, row, scene.table));\n\n const newBarCell = createProgressBarCell(\n columnDefine,\n style,\n cell.attribute.width,\n // cell.attribute.height,\n value,\n dataValue,\n col,\n row,\n padding,\n scene.table\n );\n\n const oldBarCell = cell.getChildByName('progress-bar') as Group;\n // cell.replaceChild(newBarCell, oldBarCell);\n cell.insertBefore(newBarCell, oldBarCell);\n cell.removeChild(oldBarCell);\n oldBarCell.removeAllChild();\n oldBarCell.release();\n } else if (type === 'sparkline') {\n // 目前先采用重新生成节点的方案\n cell.removeAllChild();\n const headerStyle = scene.table._getCellStyle(col, row);\n const padding = getQuadProps(getProp('padding', headerStyle, col, row, scene.table));\n createSparkLineCellGroup(\n cell,\n cell.parent,\n cell.attribute.x,\n cell.attribute.y,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n padding,\n scene.table,\n getStyleTheme(headerStyle, scene.table, col, row, getProp).theme\n );\n } else if (type === 'image' || type === 'video') {\n updateImageCellContentWhileResize(cell, col, row, scene.table);\n } else if (cell.firstChild?.name === 'axis') {\n (cell.firstChild as any)?.originAxis.resize(cell.attribute.width, cell.attribute.height);\n } else {\n let renderDefault = true;\n const customContainer = cell.getChildByName('custom-container') as Group;\n if (customContainer) {\n let customElementsGroup;\n customContainer.removeAllChild();\n cell.removeChild(customContainer);\n\n let customRender;\n let customLayout;\n const cellLocation = scene.table.getCellLocation(col, row);\n if (cellLocation !== 'body') {\n const define = scene.table.getHeaderDefine(col, row);\n customRender = define?.headerCustomRender;\n customLayout = define?.headerCustomLayout;\n } else {\n const define = scene.table.getBodyColumnDefine(col, row);\n customRender = define?.customRender || scene.table.customRender;\n customLayout = define?.customLayout;\n }\n\n if (customLayout || customRender) {\n // const { autoRowHeight } = table.internalProps;\n const customResult = dealWithCustom(\n customLayout,\n customRender,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n false,\n scene.table.heightMode === 'autoHeight',\n scene.table\n );\n customElementsGroup = customResult.elementsGroup;\n renderDefault = customResult.renderDefault;\n }\n\n if (cell.childrenCount > 0) {\n cell.insertBefore(customElementsGroup, cell.firstChild);\n } else {\n cell.appendChild(customElementsGroup);\n }\n }\n\n if (renderDefault) {\n // 处理文字\n const style = scene.table._getCellStyle(col, row);\n updateCellContentHeight(\n cell,\n distHeight,\n detaY,\n // scene.table.internalProps.autoRowHeight,\n scene.table.heightMode === 'autoHeight',\n getQuadProps(style.padding as number),\n style.textAlign,\n style.textBaseline\n );\n }\n\n // // 处理自定义渲染\n // const customContainer = cell.getChildByName('custom-container') as Group;\n // if (customContainer) {\n // customContainer.removeAllChild();\n // cell.removeChild(customContainer);\n\n // let customRender;\n // let customLayout;\n // const cellType = scene.table.getCellLocation(col, row);\n // if (cellType !== 'body') {\n // const define = scene.table.getHeaderDefine(col, row);\n // customRender = define?.headerCustomRender;\n // customLayout = define?.headerCustomLayout;\n // } else {\n // const define = scene.table.getBodyColumnDefine(col, row);\n // customRender = define?.customRender || scene.table.customRender;\n // customLayout = define?.customLayout;\n // }\n // const customResult = dealWithCustom(\n // customLayout,\n // customRender,\n // col,\n // row,\n // cell.attribute.width,\n // cell.attribute.height,\n // false,\n // false,\n // scene.table\n // );\n // if (cell.childrenCount > 0) {\n // cell.insertBefore(customResult.elementsGroup, cell.firstChild);\n // } else {\n // cell.appendChild(customResult.elementsGroup);\n // }\n // }\n }\n}\n"]}
1
+ {"version":3,"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C,mBAAmB,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;aACzD;iBAAM;gBACL,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;aACvC;SACF;QAED,IAAI,aAAa,EAAE;YAEjB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YAClD,IAAA,0CAAuB,EACrB,IAAI,EACJ,UAAU,EACV,KAAK,EAEL,KAAK,CAAC,KAAK,CAAC,UAAU,KAAK,YAAY,EACvC,IAAA,sBAAY,EAAC,KAAK,CAAC,OAAiB,CAAC,EACrC,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,YAAY,CACnB,CAAC;SACH;KAqCF;AACH,CAAC;AA9JD,4CA8JC","file":"update-height.js","sourcesContent":["import type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle';\nimport type { Group } from '../graphic/group';\nimport { createProgressBarCell } from '../group-creater/cell-type/progress-bar-cell';\nimport { createSparkLineCellGroup } from '../group-creater/cell-type/spark-line-cell';\nimport type { Scenegraph } from '../scenegraph';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport { getProp } from '../utils/get-prop';\nimport { getQuadProps } from '../utils/padding';\nimport { updateCellContentHeight } from '../utils/text-icon-layout';\nimport type { IProgressbarColumnBodyDefine } from '../../ts-types/list-table/define/progressbar-define';\nimport { dealWithCustom } from '../component/custom';\nimport { updateImageCellContentWhileResize } from '../group-creater/cell-type/image-cell';\nimport { getStyleTheme } from '../../core/tableHelper';\n\nexport function updateRowHeight(scene: Scenegraph, row: number, detaY: number) {\n // 更新table行高存储\n scene.table.setRowHeight(row, scene.table.getRowHeight(row) + detaY, true);\n\n for (let col = 0; col < scene.table.colCount; col++) {\n const cell = scene.getCell(col, row);\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.start.col !== col) {\n continue;\n }\n const height = cell.attribute.height;\n // cell.setAttribute('height', height);\n // (cell.firstChild as Rect).setAttribute('height', cell.attribute.height);\n updateCellHeightForRow(scene, cell, col, row, height, detaY, scene.table.isHeader(col, row));\n\n scene.updateCellContentWhileResize(col, row);\n }\n\n let rowStart = 0;\n let rowEnd = 0;\n // 更新header 高度\n if (row < scene.table.columnHeaderLevelCount) {\n // scene.colHeaderGroup.setAttribute('height', scene.colHeaderGroup.attribute.height + detaY);\n // scene.rowHeaderGroup.setAttribute('y', scene.rowHeaderGroup.attribute.y + detaY);\n // scene.bodyGroup.setAttribute('y', scene.bodyGroup.attribute.y + detaY);\n\n rowStart = row + 1;\n rowEnd = scene.table.columnHeaderLevelCount - 1;\n } else {\n rowStart = row + 1;\n // rowEnd = scene.table.rowCount - 1;\n rowEnd = scene.bodyRowEnd - scene.table.bottomFrozenRowCount;\n }\n\n // 更新以下行位置\n for (let rowIndex = rowStart; rowIndex <= rowEnd; rowIndex++) {\n // if (rowIndex === 2) debugger;\n for (let colIndex = 0; colIndex < scene.table.colCount; colIndex++) {\n const cellGroup = scene.getCell(colIndex, rowIndex);\n const mergeInfo = getCellMergeInfo(scene.table, colIndex, rowIndex);\n if (mergeInfo && (mergeInfo.start.col !== colIndex || mergeInfo.start.row !== rowIndex)) {\n continue;\n }\n\n cellGroup.setAttribute('y', cellGroup.attribute.y + detaY);\n }\n }\n}\n\n/**\n * @description: 更新单个单元格高度\n * @return {*}\n */\nexport function updateCellHeightForRow(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n // autoRowHeight: boolean\n) {\n let cellGroup;\n let distHeight;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n // TO BE FIXED 这里使用横向和纵向来判断单元格merge情况,目前没有横纵都merge的情况,\n // 如果有这里的逻辑要修改\n if (mergeInfo && mergeInfo.end.col - mergeInfo.start.col && mergeInfo.start.col === col) {\n // 更新横向merge cell height,只更新一次\n const mergeCell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n const mergeCellheight = mergeCell.attribute.height;\n mergeCell.setAttribute('height', mergeCellheight + detaY);\n\n cellGroup = mergeCell;\n distHeight = mergeCell.attribute.height;\n } else if (mergeInfo) {\n // 更新纵向merge cell width\n cell.setAttribute('height', height + detaY);\n\n cellGroup = cell;\n distHeight = height + detaY;\n } else if (!mergeInfo) {\n cell.setAttribute('height', height + detaY);\n cellGroup = cell;\n distHeight = height + detaY;\n // cell.setTheme({\n // rect: {\n // height: cell.attribute.height,\n // },\n // });\n }\n\n if (!cellGroup) {\n // 合并单元格非主单元格,不处理\n return;\n }\n\n updateCellHeight(scene, cellGroup, col, row, distHeight, detaY, isHeader);\n}\n\nexport function updateCellHeightForColumn(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n) {\n let cellGroup;\n // let distHeight;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {\n cell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n if (row === mergeInfo.start.row) {\n // 初始化高度\n (cell as any)._tempHeight = height;\n return;\n } else if (row === mergeInfo.end.row) {\n cell.setAttribute('height', (cell as any)._tempHeight + height);\n cellGroup = cell;\n height = cell.attribute.height;\n // updateCellHeight(scene, cellGroup, col, row, cell.attribute.height, 0, isHeader);\n } else {\n // 累加高度\n (cell as any)._tempHeight += height;\n return;\n }\n } else if (mergeInfo) {\n cell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n cell.setAttribute('height', height);\n cellGroup = cell;\n\n // const rect = cell.firstChild as Rect;\n // rect.setAttribute('height', cell.attribute.height);\n } else {\n cell.setAttribute('height', height);\n cellGroup = cell;\n }\n updateCellHeight(scene, cellGroup, col, row, height, 0, isHeader);\n}\n\nexport function updateCellHeight(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n distHeight: number,\n detaY: number,\n isHeader: boolean\n) {\n // 更新单元格布局\n const type = scene.table.isHeader(col, row)\n ? scene.table._getHeaderLayoutMap(col, row).headerType\n : scene.table.getBodyColumnType(col, row);\n if (type === 'progressbar') {\n // 目前先采用重新生成节点的方案\n const columnDefine = scene.table.getBodyColumnDefine(col, row) as IProgressbarColumnBodyDefine;\n const style = scene.table._getCellStyle(col, row) as ProgressBarStyle;\n const value = scene.table.getCellValue(col, row);\n const dataValue = scene.table.getCellOriginValue(col, row);\n const padding = getQuadProps(getProp('padding', style, col, row, scene.table));\n\n const newBarCell = createProgressBarCell(\n columnDefine,\n style,\n cell.attribute.width,\n // cell.attribute.height,\n value,\n dataValue,\n col,\n row,\n padding,\n scene.table\n );\n\n const oldBarCell = cell.getChildByName('progress-bar') as Group;\n // cell.replaceChild(newBarCell, oldBarCell);\n cell.insertBefore(newBarCell, oldBarCell);\n cell.removeChild(oldBarCell);\n oldBarCell.removeAllChild();\n oldBarCell.release();\n } else if (type === 'sparkline') {\n // 目前先采用重新生成节点的方案\n cell.removeAllChild();\n const headerStyle = scene.table._getCellStyle(col, row);\n const padding = getQuadProps(getProp('padding', headerStyle, col, row, scene.table));\n createSparkLineCellGroup(\n cell,\n cell.parent,\n cell.attribute.x,\n cell.attribute.y,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n padding,\n scene.table,\n getStyleTheme(headerStyle, scene.table, col, row, getProp).theme\n );\n } else if (type === 'image' || type === 'video') {\n updateImageCellContentWhileResize(cell, col, row, scene.table);\n } else if (cell.firstChild?.name === 'axis') {\n (cell.firstChild as any)?.originAxis.resize(cell.attribute.width, cell.attribute.height);\n } else {\n let renderDefault = true;\n const customContainer = cell.getChildByName('custom-container') as Group;\n if (customContainer) {\n let customElementsGroup;\n customContainer.removeAllChild();\n cell.removeChild(customContainer);\n\n let customRender;\n let customLayout;\n const cellLocation = scene.table.getCellLocation(col, row);\n if (cellLocation !== 'body') {\n const define = scene.table.getHeaderDefine(col, row);\n customRender = define?.headerCustomRender;\n customLayout = define?.headerCustomLayout;\n } else {\n const define = scene.table.getBodyColumnDefine(col, row);\n customRender = define?.customRender || scene.table.customRender;\n customLayout = define?.customLayout;\n }\n\n if (customLayout || customRender) {\n // const { autoRowHeight } = table.internalProps;\n const customResult = dealWithCustom(\n customLayout,\n customRender,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n false,\n scene.table.heightMode === 'autoHeight',\n scene.table\n );\n customElementsGroup = customResult.elementsGroup;\n renderDefault = customResult.renderDefault;\n }\n\n if (cell.childrenCount > 0) {\n cell.insertBefore(customElementsGroup, cell.firstChild);\n } else {\n cell.appendChild(customElementsGroup);\n }\n }\n\n if (renderDefault) {\n // 处理文字\n const style = scene.table._getCellStyle(col, row);\n updateCellContentHeight(\n cell,\n distHeight,\n detaY,\n // scene.table.internalProps.autoRowHeight,\n scene.table.heightMode === 'autoHeight',\n getQuadProps(style.padding as number),\n style.textAlign,\n style.textBaseline\n );\n }\n\n // // 处理自定义渲染\n // const customContainer = cell.getChildByName('custom-container') as Group;\n // if (customContainer) {\n // customContainer.removeAllChild();\n // cell.removeChild(customContainer);\n\n // let customRender;\n // let customLayout;\n // const cellType = scene.table.getCellLocation(col, row);\n // if (cellType !== 'body') {\n // const define = scene.table.getHeaderDefine(col, row);\n // customRender = define?.headerCustomRender;\n // customLayout = define?.headerCustomLayout;\n // } else {\n // const define = scene.table.getBodyColumnDefine(col, row);\n // customRender = define?.customRender || scene.table.customRender;\n // customLayout = define?.customLayout;\n // }\n // const customResult = dealWithCustom(\n // customLayout,\n // customRender,\n // col,\n // row,\n // cell.attribute.width,\n // cell.attribute.height,\n // false,\n // false,\n // scene.table\n // );\n // if (cell.childrenCount > 0) {\n // cell.insertBefore(customResult.elementsGroup, cell.firstChild);\n // } else {\n // cell.appendChild(customResult.elementsGroup);\n // }\n // }\n }\n}\n"]}