sea-chart 1.1.87 → 1.1.89

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.
@@ -98,7 +98,7 @@ const StyleSettings = _ref => {
98
98
  });
99
99
  }, [chart, onChange]);
100
100
  const onYAxisMinChange = useCallback(min => {
101
- const newMin = parseInt(min);
101
+ const newMin = parseFloat(min);
102
102
  if (Number.isNaN(newMin)) return;
103
103
  const {
104
104
  config
@@ -112,7 +112,7 @@ const StyleSettings = _ref => {
112
112
  });
113
113
  }, [chart, onChange]);
114
114
  const onYAxisMaxChange = useCallback(max => {
115
- const newMax = parseInt(max);
115
+ const newMax = parseFloat(max);
116
116
  if (Number.isNaN(newMax)) return;
117
117
  const {
118
118
  config
@@ -63,7 +63,7 @@ const StyleSettings = _ref => {
63
63
  });
64
64
  }, [chart, onChange]);
65
65
  const onYAxisMinChange = useCallback(min => {
66
- const newMin = parseInt(min);
66
+ const newMin = parseFloat(min);
67
67
  if (Number.isNaN(newMin)) return;
68
68
  const {
69
69
  config
@@ -77,7 +77,7 @@ const StyleSettings = _ref => {
77
77
  });
78
78
  }, [chart, onChange]);
79
79
  const onYAxisMaxChange = useCallback(max => {
80
- const newMax = parseInt(max);
80
+ const newMax = parseFloat(max);
81
81
  if (Number.isNaN(newMax)) return;
82
82
  const {
83
83
  config
@@ -55,7 +55,7 @@ const StyleSettings = _ref => {
55
55
  onChange && onChange(update);
56
56
  }, [chart, onChange]);
57
57
  const onYAxisMinChange = useCallback((key, min) => {
58
- const newMin = parseInt(min);
58
+ const newMin = parseFloat(min);
59
59
  if (Number.isNaN(newMin)) return;
60
60
  const update = {
61
61
  [key]: newMin
@@ -63,7 +63,7 @@ const StyleSettings = _ref => {
63
63
  onChange && onChange(update);
64
64
  }, [onChange]);
65
65
  const onYAxisMaxChange = useCallback((key, max) => {
66
- const newMax = parseInt(max);
66
+ const newMax = parseFloat(max);
67
67
  if (Number.isNaN(newMax)) return;
68
68
  const update = {
69
69
  [key]: newMax
@@ -47,7 +47,7 @@ const StyleSettings = _ref => {
47
47
  });
48
48
  }, [chart, onChange]);
49
49
  const onYAxisMinChange = useCallback(min => {
50
- const newMin = parseInt(min);
50
+ const newMin = parseFloat(min);
51
51
  if (Number.isNaN(newMin)) return;
52
52
  const {
53
53
  config
@@ -61,7 +61,7 @@ const StyleSettings = _ref => {
61
61
  });
62
62
  }, [chart, onChange]);
63
63
  const onYAxisMaxChange = useCallback(max => {
64
- const newMax = parseInt(max);
64
+ const newMax = parseFloat(max);
65
65
  if (Number.isNaN(newMax)) return;
66
66
  const {
67
67
  config
@@ -778,8 +778,8 @@ BaseUtils.updateTableViewList = async (result, column, nameKey, colorKey, isScat
778
778
  console.error(e);
779
779
  }
780
780
  };
781
- // sort chart
782
- BaseUtils.sortCharts = (charts, column, sortKey, isPivot) => {
781
+ // sort chart result
782
+ BaseUtils.sortCharts = (results, column, sortKey, isPivot) => {
783
783
  let {
784
784
  type: columnType,
785
785
  data
@@ -806,7 +806,7 @@ BaseUtils.sortCharts = (charts, column, sortKey, isPivot) => {
806
806
  optionIdIndexMap[option.id] = index;
807
807
  });
808
808
  }
809
- charts.sort((currResult, nextResult) => {
809
+ results.sort((currResult, nextResult) => {
810
810
  let {
811
811
  [sortKey]: current
812
812
  } = currResult;
@@ -55,14 +55,18 @@ class HorizontalBarGroup extends HorizontalComponent {
55
55
  sort_type,
56
56
  type
57
57
  } = chart.config;
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;
58
+ if (type === CHART_TYPE.STACKED_HORIZONTAL_BAR) {
59
+ if (sort_type) {
60
+ // use the opposite sort type for stacked horizontal bar
61
+ if (sort_type === CHART_DATA_SORT_TYPE.DESCENDING) {
62
+ sort_type = CHART_DATA_SORT_TYPE.ASCENDING;
63
+ } else {
64
+ sort_type = CHART_DATA_SORT_TYPE.DESCENDING;
65
+ }
66
+ data = sortDataByGroupSum(data, sort_type);
62
67
  } else {
63
- sort_type = CHART_DATA_SORT_TYPE.DESCENDING;
68
+ data.reverse();
64
69
  }
65
- data = sortDataByGroupSum(data, sort_type);
66
70
  }
67
71
  this.loadData(data);
68
72
  this.draw(data);
@@ -35,6 +35,7 @@ class HorizontalBar extends HorizontalComponent {
35
35
  } = this.props;
36
36
  data = BaseUtils.formatEmptyName(data, '', intl.get('Empty'));
37
37
  if (!Array.isArray(data)) return;
38
+ data.reverse();
38
39
  this.loadData(data);
39
40
  this.draw(data);
40
41
  isFunction(customRender) && customRender(this.chart);
@@ -75,7 +76,6 @@ class HorizontalBar extends HorizontalComponent {
75
76
  }
76
77
  const colorRules = color_option === TYPE_COLOR_USING.USE_RULES && horizontal_axis_label_color_rules && getConvertedColorRules(horizontal_axis_label_color_rules);
77
78
  const title = this.getTitle(tables, table_id, y_axis_summary_type, y_axis_column_key || y_axis_summary_column_key);
78
- data.reverse();
79
79
  this.drawLabels(data);
80
80
 
81
81
  // set Coord type
@@ -299,7 +299,7 @@ class TwoDimensionTable extends PureComponent {
299
299
  cellIdx: cells.length
300
300
  }),
301
301
  title: rowTotal
302
- }, BaseUtils.isValidValue(rowTotal, display_empty) ? formatRowTotal(rowTotal) : /*#__PURE__*/React.createElement("i", null), /*#__PURE__*/React.createElement("span", {
302
+ }, BaseUtils.isValidValue(rowTotal, display_empty) ? BaseUtils.getSummaryValueDisplayString(summaryColumn, rowTotal, summaryMethod) : /*#__PURE__*/React.createElement("i", null), /*#__PURE__*/React.createElement("span", {
303
303
  className: classnames({
304
304
  'selected-pivot-cell-border': isSelectedTotalCell
305
305
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "1.1.87",
3
+ "version": "1.1.89",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@antv/data-set": "0.11.8",