sea-chart 1.1.80 → 1.1.82

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.
@@ -5,6 +5,7 @@ import { getNumberDisplayString } from 'dtable-utils';
5
5
  import { debounce, maxBy } from 'lodash-es';
6
6
  import classNames from 'classnames';
7
7
  import { CellType } from 'dtable-utils';
8
+ import dayjs from 'dayjs';
8
9
  import intl from '../../intl';
9
10
  import { sortDataByGroupSum } from '../../utils/column-utils';
10
11
  import { EMPTY_NAME, CHART_TYPE, CHART_SUMMARY_TYPE, DEFAULT_NUMBER_FORMAT_OBJECT, CHART_THEME_COLOR, CHART_STYLE_COLORS } from '../../constants';
@@ -94,6 +95,7 @@ class BarGroup extends ChartComponent {
94
95
  const newData = this.getChartGroupData(data);
95
96
  const column_groupby_column = this.getColumn(tables, table_id, column_groupby_column_key);
96
97
  const useSingleSelectColumnColor = (column_groupby_column === null || column_groupby_column === void 0 ? void 0 : column_groupby_column.type) === CellType.SINGLE_SELECT && color_theme === SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.SINGLE_SELECT_COLUMN_COLORS;
98
+ const isGroupByDate = [CellType.DATE, CellType.CTIME, CellType.MTIME].includes(column_groupby_column === null || column_groupby_column === void 0 ? void 0 : column_groupby_column.type);
97
99
  let singleBarWidth, singleBarRadius;
98
100
  // y-axis label width:6 + 10
99
101
  const chartWidth = this.chart.width - 6 - 10; // 10 is y-axis number width and 6 is gap between number and y axis line
@@ -171,7 +173,8 @@ class BarGroup extends ChartComponent {
171
173
  },
172
174
  position: type === CHART_TYPE.BAR_STACK ? 'middle' : ''
173
175
  }).position('name*value').size(singleBarWidth).color('group_name', group_name => {
174
- return this.colorMap[group_name] || CHART_STYLE_COLORS[0];
176
+ const groupName = isGroupByDate ? dayjs(group_name).format('YYYY-MM-DD') : group_name;
177
+ return this.colorMap[groupName] || CHART_STYLE_COLORS[0];
175
178
  }).tooltip('name*value*group_name*raw_name', (name, value, group_name, raw_name) => {
176
179
  return {
177
180
  title: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
@@ -402,7 +402,6 @@ export default class ChartComponent extends Component {
402
402
  position: legendPosition,
403
403
  itemName: {
404
404
  style: {
405
- // fill: theme.textColor,
406
405
  fill: theme.legendTextColor,
407
406
  fontSize: theme.legendFontSize
408
407
  },
@@ -454,7 +453,6 @@ export default class ChartComponent extends Component {
454
453
  ];
455
454
  },
456
455
  style: style => {
457
- // fill legend with stroke color
458
456
  if (style.stroke) {
459
457
  style.fill = style.stroke;
460
458
  }
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import { debounce, maxBy } from 'lodash-es';
4
4
  import classNames from 'classnames';
5
5
  import { CellType } from 'dtable-utils';
6
+ import dayjs from 'dayjs';
6
7
  import { CHART_TYPE, EMPTY_NAME, CHART_THEME_COLOR, CHART_STYLE_COLORS } from '../../constants';
7
8
  import { BaseUtils, isFunction } from '../../utils';
8
9
  import intl from '../../intl';
@@ -85,6 +86,7 @@ class HorizontalBarGroup extends HorizontalComponent {
85
86
  const isGroup = type === CHART_TYPE.HORIZONTAL_GROUP_BAR;
86
87
  const groupByColumn = this.getColumn(tables, table_id, column_groupby_column_key);
87
88
  const useSingleSelectColumnColor = (groupByColumn === null || groupByColumn === void 0 ? void 0 : groupByColumn.type) === CellType.SINGLE_SELECT && color_theme === SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.SINGLE_SELECT_COLUMN_COLORS;
89
+ const isGroupByDate = [CellType.DATE, CellType.CTIME, CellType.MTIME].includes(groupByColumn === null || groupByColumn === void 0 ? void 0 : groupByColumn.type);
88
90
  const newData = this.getChartGroupData(data);
89
91
  let singleBarWidth, singleBarRadius;
90
92
  // y-axis label width:(6 + 10)
@@ -127,7 +129,8 @@ class HorizontalBarGroup extends HorizontalComponent {
127
129
  ...this.labelStroke
128
130
  }
129
131
  }).position('name*value').size(singleBarWidth).color('group_name', group_name => {
130
- return this.colorMap[group_name] || CHART_STYLE_COLORS[0];
132
+ const groupName = isGroupByDate ? dayjs(group_name).format('YYYY-MM-DD') : group_name;
133
+ return this.colorMap[groupName] || CHART_STYLE_COLORS[0];
131
134
  }).tooltip('name*value*group_name*raw_name', (name, value, group_name, raw_name) => {
132
135
  return {
133
136
  title: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "1.1.80",
3
+ "version": "1.1.82",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@antv/data-set": "0.11.8",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@antv/scale": "0.3.14",
30
- "dtable-ui-component": "^6.0.14",
30
+ "dtable-ui-component": "^6.0.15",
31
31
  "dtable-utils": "~5.0.*",
32
32
  "prop-types": "15.8.1",
33
33
  "react": "^18.3.1",