sea-chart 1.1.48 → 1.1.49
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.
package/dist/settings/index.css
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -14,6 +14,19 @@ export { getDateColumnFormat, isCheckboxColumn, getColumnByKey, isStatisticMapCo
|
|
|
14
14
|
export { generatorKey } from './key-generator';
|
|
15
15
|
export { translateCalendar } from './date-translate';
|
|
16
16
|
export { isFunction } from './common-utils';
|
|
17
|
+
export function formatXAxisLabel(label) {
|
|
18
|
+
let newLabel = '';
|
|
19
|
+
while (label.length > 0) {
|
|
20
|
+
if (label.length > 12) {
|
|
21
|
+
newLabel += label.slice(0, 12) + '\n';
|
|
22
|
+
label = label.slice(12);
|
|
23
|
+
} else {
|
|
24
|
+
newLabel += label;
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return newLabel;
|
|
29
|
+
}
|
|
17
30
|
export function formatRowTotal(rowTotal) {
|
|
18
31
|
const rowTotalNum = parseFloat(rowTotal);
|
|
19
32
|
if (!Number.isNaN(rowTotalNum) && rowTotalNum % 1 !== 0) {
|
|
@@ -2,7 +2,7 @@ import { Component } from 'react';
|
|
|
2
2
|
import { getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
3
3
|
import { cloneDeep, debounce } from 'lodash-es';
|
|
4
4
|
import { Chart } from '../../utils/custom-g2';
|
|
5
|
-
import { BaseUtils } from '../../utils';
|
|
5
|
+
import { BaseUtils, formatXAxisLabel } from '../../utils';
|
|
6
6
|
import { CHART_TYPE, CHART_SUMMARY_TYPE, LABEL_POSITION_TYPE, CHART_THEME_COLOR, EMPTY_NAME, THEME_NAME_MAP, CHART_STYLE_COLORS } from '../../constants';
|
|
7
7
|
import intl from '../../intl';
|
|
8
8
|
export default class ChartComponent extends Component {
|
|
@@ -355,7 +355,7 @@ export default class ChartComponent extends Component {
|
|
|
355
355
|
return intl.get(EMPTY_NAME);
|
|
356
356
|
}
|
|
357
357
|
if (name.length > 10) {
|
|
358
|
-
return
|
|
358
|
+
return formatXAxisLabel(name);
|
|
359
359
|
}
|
|
360
360
|
return name;
|
|
361
361
|
}
|