sea-chart 1.1.86 → 1.1.87

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.
@@ -669,6 +669,7 @@ BaseUtils.formatPieChartData = (data, chart, tables, currentTheme, useColumnColo
669
669
  // format SINGLE_SELECT, LAST_MODIFIER, CREATOR, COLLABORATOR, DATE, NUMBER
670
670
  BaseUtils.updateTableViewListItemNameAndColor = async (result, column, nameKey, colorKey, isScatterChart, isNameField) => {
671
671
  return new Promise((resolve, reject) => {
672
+ let resultPromise = Promise.resolve();
672
673
  let {
673
674
  type: columnType,
674
675
  data: columnData
@@ -759,9 +760,10 @@ BaseUtils.updateTableViewListItemNameAndColor = async (result, column, nameKey,
759
760
  type: array_type,
760
761
  data: array_data
761
762
  };
762
- return _BaseUtils.updateTableViewListItemNameAndColor(result, linkedColumn, nameKey, colorKey, isScatterChart);
763
+ // for linked formula, need to call recursively, using it's result as the result of the promise
764
+ resultPromise = _BaseUtils.updateTableViewListItemNameAndColor(result, linkedColumn, nameKey, colorKey, isScatterChart);
763
765
  }
764
- resolve();
766
+ resolve(resultPromise);
765
767
  });
766
768
  };
767
769
  BaseUtils.updateTableViewList = async (result, column, nameKey, colorKey, isScatterChart, isNameField) => {
@@ -237,7 +237,10 @@ async function calculateTwoDimensionTable(chart, value, _ref2) {
237
237
  const isGroupbyColumnDataAsAnArray = isArrayCellValue(groupbyColumn);
238
238
  const rowGroupbyColumn = getTableColumnByKey(table, column_groupby_column_key);
239
239
  if (!rowGroupbyColumn) {
240
- return calculateOneDimensionTable(chart, value);
240
+ return calculateOneDimensionTable(chart, value, {
241
+ getViewRows,
242
+ getTableFormulaResults
243
+ });
241
244
  }
242
245
  const isRowGroupbyColumnDataAsAnArray = isArrayCellValue(rowGroupbyColumn);
243
246
  const statRows = await getViewRows(view, table);
@@ -4,7 +4,7 @@ import { debounce, maxBy } from 'lodash-es';
4
4
  import classNames from 'classnames';
5
5
  import { CellType } from 'dtable-utils';
6
6
  import dayjs from 'dayjs';
7
- import { CHART_TYPE, EMPTY_NAME, CHART_THEME_COLOR, CHART_STYLE_COLORS } from '../../constants';
7
+ import { CHART_TYPE, EMPTY_NAME, CHART_THEME_COLOR, CHART_STYLE_COLORS, CHART_DATA_SORT_TYPE } from '../../constants';
8
8
  import { BaseUtils, isFunction } from '../../utils';
9
9
  import intl from '../../intl';
10
10
  import { SUPPORT_SINGLE_SELECT_THEMES_OPTIONS } from '../../constants/color-rules';
@@ -51,11 +51,17 @@ class HorizontalBarGroup extends HorizontalComponent {
51
51
  this.chart.scale(this.groupName, {
52
52
  type: 'cat'
53
53
  });
54
- const {
54
+ let {
55
55
  sort_type,
56
56
  type
57
57
  } = chart.config;
58
58
  if (type === CHART_TYPE.STACKED_HORIZONTAL_BAR && sort_type) {
59
+ // use the opposite sort type for stacked horizontal bar
60
+ if (sort_type === CHART_DATA_SORT_TYPE.DESCENDING) {
61
+ sort_type = CHART_DATA_SORT_TYPE.ASCENDING;
62
+ } else {
63
+ sort_type = CHART_DATA_SORT_TYPE.DESCENDING;
64
+ }
59
65
  data = sortDataByGroupSum(data, sort_type);
60
66
  }
61
67
  this.loadData(data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "1.1.86",
3
+ "version": "1.1.87",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@antv/data-set": "0.11.8",