sea-chart 2.0.47 → 2.0.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/api/index.js +11 -4
- package/dist/components/cell-factory/FormatterConfig.js +62 -55
- package/dist/components/cell-factory/SimpleCellFormatter.js +11 -4
- package/dist/components/cell-factory/SingleSelectOption.js +18 -11
- package/dist/components/cell-factory/cell-editor-factory.js +12 -5
- package/dist/components/cell-factory/cell-formatter-factory.js +11 -4
- package/dist/components/cell-factory/link-content.js +35 -27
- package/dist/components/chart-color-selector/color-selector.js +18 -11
- package/dist/components/collaborator/index.js +14 -7
- package/dist/components/color-picker/index.js +18 -11
- package/dist/components/color-popover/color-rules/color-rule.js +33 -25
- package/dist/components/color-popover/color-rules/index.js +14 -6
- package/dist/components/color-popover/color-rules/rule-filters/filter.js +34 -27
- package/dist/components/color-popover/color-rules/rule-filters/index.js +25 -17
- package/dist/components/color-popover/color-rules/rule-filters/number-input.js +18 -10
- package/dist/components/color-popover/color-rules-popover.js +34 -26
- package/dist/components/color-popover/color-selector-popover.js +18 -10
- package/dist/components/color-setting/color-group-selector.js +20 -12
- package/dist/components/common-add-tool/index.js +13 -6
- package/dist/components/data-process-setter/data-setting-header.js +14 -7
- package/dist/components/data-process-setter/hide-column-setter.js +19 -12
- package/dist/components/data-process-setter/index.js +27 -4
- package/dist/components/data-process-setter/sort-setter.js +24 -16
- package/dist/components/draggable/Draggable.js +13 -7
- package/dist/components/drill-down-settings/drill-down-fields-popover/index.js +48 -40
- package/dist/components/drill-down-settings/drill-down-fields-settings/index.js +18 -10
- package/dist/components/drill-down-settings/index.js +18 -11
- package/dist/components/dtable-popover/index.js +20 -13
- package/dist/components/dtable-search-input/index.js +21 -13
- package/dist/components/font-settings/index.js +22 -14
- package/dist/components/goal-line-setting/goal-setting-item.js +14 -6
- package/dist/components/goal-line-setting/index.js +19 -12
- package/dist/components/highlighter/highlighter.js +14 -7
- package/dist/components/icon/index.js +11 -4
- package/dist/components/index.js +48 -7
- package/dist/components/loading/index.js +13 -6
- package/dist/components/number-input/index.js +11 -4
- package/dist/components/pixel-editor/index.js +23 -15
- package/dist/components/popover/hide-column-popover/hide-column-popover-widgets/hide-column-item.js +15 -8
- package/dist/components/popover/hide-column-popover/hide-column-popover.js +33 -25
- package/dist/components/popover/sort-popover/sort-popover-widgets/sort-utils.js +18 -9
- package/dist/components/popover/sort-popover/sort-popover.js +64 -54
- package/dist/components/resize-handle/ResizeHandle.js +13 -6
- package/dist/components/row-card/row-card-header-cell.js +22 -15
- package/dist/components/row-card/row-card-header.js +21 -14
- package/dist/components/row-card/row-card-item.js +41 -33
- package/dist/components/row-card/row-card.js +23 -15
- package/dist/components/statistic-record-dialog/index.js +64 -56
- package/dist/components/tooltip/index.js +22 -15
- package/dist/components/types-dialog/index.js +64 -56
- package/dist/components/types-dialog/use-force-update.js +10 -4
- package/dist/constants/color-rules.js +14 -8
- package/dist/constants/common-constants.js +14 -8
- package/dist/constants/error.js +8 -2
- package/dist/constants/geolocation.js +15 -9
- package/dist/constants/index.js +274 -145
- package/dist/constants/key-codes.js +2 -0
- package/dist/constants/model.js +9 -3
- package/dist/constants/regions.js +8 -3
- package/dist/constants/style.js +12 -6
- package/dist/constants/table.js +7 -1
- package/dist/constants/type-image.js +39 -33
- package/dist/constants/type.js +9 -3
- package/dist/context.js +18 -11
- package/dist/editor/index.js +15 -8
- package/dist/index.js +104 -13
- package/dist/intl.js +17 -10
- package/dist/locale/index.js +23 -16
- package/dist/locale/lang/de.js +7 -1
- package/dist/locale/lang/en.js +7 -1
- package/dist/locale/lang/es.js +7 -1
- package/dist/locale/lang/fr.js +7 -1
- package/dist/locale/lang/pt.js +7 -1
- package/dist/locale/lang/ru.js +7 -1
- package/dist/locale/lang/zh_CN.js +7 -1
- package/dist/model/area-group.js +19 -12
- package/dist/model/area.js +19 -12
- package/dist/model/bar-custom.js +18 -11
- package/dist/model/bar-group.js +19 -12
- package/dist/model/bar-stack.js +17 -10
- package/dist/model/bar.js +18 -11
- package/dist/model/base-model.js +11 -4
- package/dist/model/basic-number-card.js +20 -13
- package/dist/model/chart.js +13 -7
- package/dist/model/combination.js +22 -15
- package/dist/model/compare-bar.js +21 -14
- package/dist/model/completeness-group.js +18 -11
- package/dist/model/completeness.js +17 -10
- package/dist/model/dashboard.js +14 -7
- package/dist/model/funnel.js +21 -14
- package/dist/model/generic-model.js +143 -135
- package/dist/model/heat-map.js +16 -9
- package/dist/model/horizontal-bar.js +18 -11
- package/dist/model/horizontal-group-bar.js +17 -10
- package/dist/model/index.js +93 -69
- package/dist/model/line-group.js +20 -13
- package/dist/model/line.js +19 -12
- package/dist/model/map-bubble.js +19 -12
- package/dist/model/map.js +19 -12
- package/dist/model/mirror.js +20 -13
- package/dist/model/pie.js +19 -12
- package/dist/model/ring.js +19 -12
- package/dist/model/scatter.js +17 -10
- package/dist/model/stacked-horizontal-bar.js +18 -11
- package/dist/model/table-element.js +12 -5
- package/dist/model/table.js +14 -7
- package/dist/model/tree-map.js +14 -7
- package/dist/model/trend.js +18 -11
- package/dist/model/user.js +7 -1
- package/dist/model/world-map-bubble.js +19 -12
- package/dist/model/world-map.js +19 -12
- package/dist/services/map-json.js +13 -7
- package/dist/settings/advance-bar-settings/data-settings.js +44 -36
- package/dist/settings/advance-bar-settings/index.js +20 -3
- package/dist/settings/advance-bar-settings/style-settings.js +74 -66
- package/dist/settings/bar-settings/data-settings.js +47 -39
- package/dist/settings/bar-settings/index.js +20 -3
- package/dist/settings/bar-settings/style-settings.js +60 -52
- package/dist/settings/basic-number-card/data-settings.js +57 -49
- package/dist/settings/basic-number-card/index.js +20 -3
- package/dist/settings/basic-number-card/style-settings.js +26 -18
- package/dist/settings/combination-settings/data-settings.js +63 -55
- package/dist/settings/combination-settings/index.js +20 -3
- package/dist/settings/combination-settings/style-settings.js +77 -69
- package/dist/settings/completeness-settings/callbacks/callbacks.js +27 -16
- package/dist/settings/completeness-settings/data-settings/completion-settings.js +28 -21
- package/dist/settings/completeness-settings/data-settings/data-settings.js +32 -25
- package/dist/settings/completeness-settings/index.js +20 -3
- package/dist/settings/completeness-settings/style-settings.js +26 -19
- package/dist/settings/dashboard-settings/data-settings.js +51 -43
- package/dist/settings/dashboard-settings/index.js +13 -2
- package/dist/settings/data-settings.js +79 -72
- package/dist/settings/funnel-settings/components/dnd-item/dnd-item.js +19 -12
- package/dist/settings/funnel-settings/components/dnd-list.js +23 -15
- package/dist/settings/funnel-settings/components/funnel-label-setting.js +40 -32
- package/dist/settings/funnel-settings/components/funnel-layer-setting.js +28 -20
- package/dist/settings/funnel-settings/data-settings.js +31 -23
- package/dist/settings/funnel-settings/index.js +20 -3
- package/dist/settings/funnel-settings/style-settings.js +19 -11
- package/dist/settings/heat-map-settings/data-settings.js +26 -18
- package/dist/settings/heat-map-settings/index.js +20 -3
- package/dist/settings/heat-map-settings/style-settings.js +26 -18
- package/dist/settings/horizontal-bar-settings/data-settings.js +19 -12
- package/dist/settings/horizontal-bar-settings/index.js +20 -3
- package/dist/settings/horizontal-bar-settings/style-settings.js +19 -12
- package/dist/settings/index.js +70 -52
- package/dist/settings/map-settings/components/location-field-selector.js +17 -10
- package/dist/settings/map-settings/components/map-level-selector.js +18 -11
- package/dist/settings/map-settings/components/map-province-city-selector.js +26 -19
- package/dist/settings/map-settings/index.js +20 -3
- package/dist/settings/map-settings/map-data-settings.js +30 -23
- package/dist/settings/map-settings/map-style-settings.js +34 -26
- package/dist/settings/mirror-settings/data-settings.js +34 -26
- package/dist/settings/mirror-settings/index.js +13 -2
- package/dist/settings/pie-settings/data-settings.js +41 -33
- package/dist/settings/pie-settings/index.js +20 -3
- package/dist/settings/pie-settings/style-settings.js +55 -47
- package/dist/settings/scatter/data-settings.js +34 -27
- package/dist/settings/scatter/index.js +12 -3
- package/dist/settings/stacks-settings/index.js +27 -19
- package/dist/settings/stacks-settings/stack-item-settings.js +27 -19
- package/dist/settings/style-settings.js +72 -64
- package/dist/settings/table-element-settings/components/data-filter.js +38 -30
- package/dist/settings/table-element-settings/data-settings.js +29 -21
- package/dist/settings/table-element-settings/index.js +13 -2
- package/dist/settings/table-settings/data-settings.js +119 -111
- package/dist/settings/table-settings/index.js +13 -2
- package/dist/settings/time-comparison-settings/data-settings.js +51 -43
- package/dist/settings/time-comparison-settings/index.js +20 -3
- package/dist/settings/time-comparison-settings/style-settings.js +53 -45
- package/dist/settings/trend-settings/data-settings.js +32 -24
- package/dist/settings/trend-settings/index.js +20 -3
- package/dist/settings/trend-settings/style-setting.js +25 -17
- package/dist/settings/widgets/axis-title-font-settings/index.js +17 -10
- package/dist/settings/widgets/basic-summary/index.js +63 -55
- package/dist/settings/widgets/chart-type/index.js +26 -18
- package/dist/settings/widgets/color-settings/index.js +80 -72
- package/dist/settings/widgets/common-data-settings.js +29 -21
- package/dist/settings/widgets/data-filter/index.js +43 -35
- package/dist/settings/widgets/data-sort.js +24 -16
- package/dist/settings/widgets/date-summary-item.js +32 -24
- package/dist/settings/widgets/display-values-settings/index.js +22 -14
- package/dist/settings/widgets/divider/index.js +16 -8
- package/dist/settings/widgets/font-settings/font-color-settings.js +19 -11
- package/dist/settings/widgets/font-settings/font-size-settings.js +22 -14
- package/dist/settings/widgets/font-settings/font-weight-settings.js +25 -17
- package/dist/settings/widgets/font-settings/index.js +27 -4
- package/dist/settings/widgets/group-by.js +59 -51
- package/dist/settings/widgets/min-max-setting.js +18 -10
- package/dist/settings/widgets/mininum-slice-percent.js +18 -10
- package/dist/settings/widgets/numeric-summary-item.js +31 -23
- package/dist/settings/widgets/select-line-type/index.js +17 -10
- package/dist/settings/widgets/select-table/index.js +16 -9
- package/dist/settings/widgets/select-view/index.js +28 -20
- package/dist/settings/widgets/stack.js +22 -14
- package/dist/settings/widgets/summary-method-setting.js +25 -17
- package/dist/settings/widgets/summary-settings.js +80 -72
- package/dist/settings/widgets/switch/index.js +15 -8
- package/dist/settings/widgets/text-horizontal-settings.js +23 -15
- package/dist/settings/widgets/time-picker.js +37 -29
- package/dist/settings/widgets/title-settings/index.js +37 -29
- package/dist/settings/widgets/title-settings/title-text.js +12 -5
- package/dist/settings/widgets/x-axios.js +1 -0
- package/dist/settings/widgets/y-axis-group-settings.js +71 -63
- package/dist/utils/cell-format-utils.js +28 -18
- package/dist/utils/cell-value-utils.js +12 -5
- package/dist/utils/chart-utils/base-utils.js +345 -337
- package/dist/utils/chart-utils/index.js +41 -28
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +85 -78
- package/dist/utils/chart-utils/original-data-utils/card-calculator.js +20 -13
- package/dist/utils/chart-utils/original-data-utils/combination-calculator.js +52 -45
- package/dist/utils/chart-utils/original-data-utils/compare-bar-chart-calculator.js +26 -19
- package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +39 -32
- package/dist/utils/chart-utils/original-data-utils/dashboard-calculator.js +23 -16
- package/dist/utils/chart-utils/original-data-utils/index.js +57 -50
- package/dist/utils/chart-utils/original-data-utils/mirror-calculator.js +28 -21
- package/dist/utils/chart-utils/original-data-utils/pivot-table-calculator.js +97 -91
- package/dist/utils/chart-utils/original-data-utils/scatter-calculator.js +26 -19
- package/dist/utils/chart-utils/original-data-utils/trend-calculator.js +38 -31
- package/dist/utils/chart-utils/sql-statistics-utils.js +240 -232
- package/dist/utils/chart.js +17 -9
- package/dist/utils/collaborator-manager.js +9 -3
- package/dist/utils/collaborator-utils.js +30 -18
- package/dist/utils/collaborator.js +13 -4
- package/dist/utils/color-utils.js +29 -18
- package/dist/utils/column-utils.js +92 -65
- package/dist/utils/common-utils.js +52 -27
- package/dist/utils/concurrency-manager.js +7 -1
- package/dist/utils/contexts.js +12 -5
- package/dist/utils/date-translate.js +19 -11
- package/dist/utils/digital-sign-utils.js +14 -7
- package/dist/utils/event-bus.js +7 -1
- package/dist/utils/hotkey.js +11 -5
- package/dist/utils/index.js +221 -54
- package/dist/utils/key-generator.js +9 -2
- package/dist/utils/map.js +31 -22
- package/dist/utils/object-utils.js +7 -1
- package/dist/utils/options-utils.js +16 -8
- package/dist/utils/row-record-utils.js +180 -168
- package/dist/utils/row-utils.js +38 -27
- package/dist/utils/search.js +32 -24
- package/dist/utils/sql/chart-data-sql.js +55 -49
- package/dist/utils/sql/column-2-sql-column.js +156 -146
- package/dist/utils/sql/index.js +27 -3
- package/dist/utils/trend-utils.js +47 -39
- package/dist/view/index.js +95 -89
- package/dist/view/title/index.js +23 -15
- package/dist/view/wrapper/area-group.js +47 -39
- package/dist/view/wrapper/area.js +45 -37
- package/dist/view/wrapper/bar-compare.js +41 -33
- package/dist/view/wrapper/bar-custom-stack.js +39 -31
- package/dist/view/wrapper/bar-group.js +48 -40
- package/dist/view/wrapper/bar-stack.js +51 -43
- package/dist/view/wrapper/bar.js +43 -35
- package/dist/view/wrapper/basic-number-card.js +26 -18
- package/dist/view/wrapper/chart-component.js +112 -104
- package/dist/view/wrapper/combination.js +55 -47
- package/dist/view/wrapper/completeness-group.js +38 -30
- package/dist/view/wrapper/completeness.js +36 -28
- package/dist/view/wrapper/dashboard.js +33 -25
- package/dist/view/wrapper/funnel.js +38 -30
- package/dist/view/wrapper/heat-map.js +64 -56
- package/dist/view/wrapper/horizontal-bar-group.js +55 -47
- package/dist/view/wrapper/horizontal-bar-stack.js +49 -41
- package/dist/view/wrapper/horizontal-bar.js +43 -35
- package/dist/view/wrapper/index.js +115 -107
- package/dist/view/wrapper/line-group.js +45 -37
- package/dist/view/wrapper/line.js +44 -36
- package/dist/view/wrapper/map-bubble.js +46 -38
- package/dist/view/wrapper/map-world-bubble.js +45 -37
- package/dist/view/wrapper/map-world.js +47 -39
- package/dist/view/wrapper/map.js +48 -40
- package/dist/view/wrapper/mirror.js +41 -33
- package/dist/view/wrapper/pie.js +47 -39
- package/dist/view/wrapper/ring.js +50 -42
- package/dist/view/wrapper/scatter.js +45 -37
- package/dist/view/wrapper/table/index.js +21 -13
- package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +57 -49
- package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +58 -50
- package/dist/view/wrapper/table/pivot-table-display-name.js +91 -83
- package/dist/view/wrapper/table/two-dimension-table.js +84 -76
- package/dist/view/wrapper/table-element/components/dataset-utils.js +36 -23
- package/dist/view/wrapper/table-element/components/formatter.js +105 -96
- package/dist/view/wrapper/table-element/components/formatters/FileFormatter/index.js +31 -22
- package/dist/view/wrapper/table-element/components/formatters/formula-formatter.js +16 -9
- package/dist/view/wrapper/table-element/components/formatters/link-formatter.js +80 -73
- package/dist/view/wrapper/table-element/components/formula-formatter.js +16 -9
- package/dist/view/wrapper/table-element/components/link-formatter.js +80 -73
- package/dist/view/wrapper/table-element/components/record.js +17 -10
- package/dist/view/wrapper/table-element/components/records-body.js +17 -9
- package/dist/view/wrapper/table-element/components/records-header/index.js +15 -7
- package/dist/view/wrapper/table-element/components/records-header/records-header-cell.js +16 -8
- package/dist/view/wrapper/table-element/components/records.js +29 -21
- package/dist/view/wrapper/table-element/components/resize-column-handle/resize-column-handle.js +12 -5
- package/dist/view/wrapper/table-element/components/utils.js +15 -5
- package/dist/view/wrapper/table-element/components/value-display-utils.js +11 -4
- package/dist/view/wrapper/table-element/components/vertical-scrollbar/index.js +13 -6
- package/dist/view/wrapper/table-element/index.js +26 -18
- package/dist/view/wrapper/treemap.js +41 -33
- package/dist/view/wrapper/trend.js +49 -41
- package/package.json +7 -2
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var d3 = _interopRequireWildcard(require("d3"));
|
|
11
|
+
var _lodashEs = require("lodash-es");
|
|
12
|
+
var _dtableUtils = require("dtable-utils");
|
|
13
|
+
var _utils = require("../../utils");
|
|
14
|
+
var _constants = require("../../constants");
|
|
15
|
+
var _style = require("../../constants/style");
|
|
16
|
+
var _intl = _interopRequireDefault(require("../../intl"));
|
|
17
|
+
require("../../assets/css/sea-chart-d3-tooltip.css");
|
|
18
|
+
class ChartComponent extends _react.Component {
|
|
12
19
|
constructor(props) {
|
|
13
20
|
var _this;
|
|
14
21
|
super(props);
|
|
@@ -46,13 +53,13 @@ export default class ChartComponent extends Component {
|
|
|
46
53
|
this.drawChart();
|
|
47
54
|
};
|
|
48
55
|
this.initLabelStroke = theme => {
|
|
49
|
-
this.globalTheme = theme || THEME_NAME_MAP.LIGHT;
|
|
50
|
-
this.labelStroke = theme === THEME_NAME_MAP.DARK ? {} : {
|
|
56
|
+
this.globalTheme = theme || _constants.THEME_NAME_MAP.LIGHT;
|
|
57
|
+
this.labelStroke = theme === _constants.THEME_NAME_MAP.DARK ? {} : {
|
|
51
58
|
stroke: '#fff',
|
|
52
59
|
lineWidth: 1
|
|
53
60
|
};
|
|
54
61
|
};
|
|
55
|
-
this.handleResize = debounce(() => {
|
|
62
|
+
this.handleResize = (0, _lodashEs.debounce)(() => {
|
|
56
63
|
if (!this.createChart || !this.drawChart) return;
|
|
57
64
|
this.destroyChart();
|
|
58
65
|
this.createChart();
|
|
@@ -76,11 +83,11 @@ export default class ChartComponent extends Component {
|
|
|
76
83
|
_this.props.toggleRecords && _this.props.toggleRecords(statisticRecord, ...args);
|
|
77
84
|
};
|
|
78
85
|
this.getTitle = (tables, table_id, yAxisType, yAxisKey) => {
|
|
79
|
-
return yAxisType === CHART_SUMMARY_TYPE.COUNT ?
|
|
86
|
+
return yAxisType === _constants.CHART_SUMMARY_TYPE.COUNT ? _intl.default.get('Amount') : this.getAxisLabel(tables, table_id, yAxisKey);
|
|
80
87
|
};
|
|
81
88
|
this.getColumn = (tables, table_id, columnKey) => {
|
|
82
|
-
const table = getTableById(tables, table_id);
|
|
83
|
-
const column = getTableColumnByKey(table, columnKey) || {};
|
|
89
|
+
const table = (0, _dtableUtils.getTableById)(tables, table_id);
|
|
90
|
+
const column = (0, _dtableUtils.getTableColumnByKey)(table, columnKey) || {};
|
|
84
91
|
return column;
|
|
85
92
|
};
|
|
86
93
|
this.getAxisLabel = (tables, tableId, columnKey) => {
|
|
@@ -88,7 +95,7 @@ export default class ChartComponent extends Component {
|
|
|
88
95
|
return column.name || '';
|
|
89
96
|
};
|
|
90
97
|
this.getAxisTitleHeight = fontSize => {
|
|
91
|
-
const safeFontSize = Number(fontSize) || DEFAULT_AXIS_LABEL_FONT_SIZE;
|
|
98
|
+
const safeFontSize = Number(fontSize) || _constants.DEFAULT_AXIS_LABEL_FONT_SIZE;
|
|
92
99
|
return Math.max(this.axisTitleMinHeight, safeFontSize + 4);
|
|
93
100
|
};
|
|
94
101
|
this.setAxisTitlePadding = function (chartContainer) {
|
|
@@ -175,7 +182,7 @@ export default class ChartComponent extends Component {
|
|
|
175
182
|
if (item.group_name === 'rest' && isCompleteness) return;
|
|
176
183
|
const groupData = chartGroupData.find(g => g.name === item.name);
|
|
177
184
|
if (!groupData) {
|
|
178
|
-
const newItem = cloneDeep(item);
|
|
185
|
+
const newItem = (0, _lodashEs.cloneDeep)(item);
|
|
179
186
|
newItem.currentGroupCount = 1;
|
|
180
187
|
chartGroupData.push(newItem);
|
|
181
188
|
} else {
|
|
@@ -229,13 +236,13 @@ export default class ChartComponent extends Component {
|
|
|
229
236
|
// mark the first item in each group,but if item value is 0, mark the next item
|
|
230
237
|
let targetMarkItem = item[0],
|
|
231
238
|
i = 1;
|
|
232
|
-
while (!((_targetMarkItem = targetMarkItem)
|
|
239
|
+
while (!((_targetMarkItem = targetMarkItem) !== null && _targetMarkItem !== void 0 && _targetMarkItem.value) && !Number.isNaN((_targetMarkItem2 = targetMarkItem) === null || _targetMarkItem2 === void 0 ? void 0 : _targetMarkItem2.value)) {
|
|
233
240
|
var _targetMarkItem, _targetMarkItem2;
|
|
234
241
|
targetMarkItem = item[i];
|
|
235
242
|
i++;
|
|
236
243
|
if (i >= item.length) break;
|
|
237
244
|
}
|
|
238
|
-
if (!((_targetMarkItem3 = targetMarkItem)
|
|
245
|
+
if (!((_targetMarkItem3 = targetMarkItem) !== null && _targetMarkItem3 !== void 0 && _targetMarkItem3.value)) return;
|
|
239
246
|
targetMarkItem.isFirst = 1;
|
|
240
247
|
} else if (position === 'last') {
|
|
241
248
|
var _targetMarkItem6;
|
|
@@ -243,13 +250,13 @@ export default class ChartComponent extends Component {
|
|
|
243
250
|
const l = item.length;
|
|
244
251
|
let targetMarkItem = item[l - 1],
|
|
245
252
|
i = l - 2;
|
|
246
|
-
while (!((_targetMarkItem4 = targetMarkItem)
|
|
253
|
+
while (!((_targetMarkItem4 = targetMarkItem) !== null && _targetMarkItem4 !== void 0 && _targetMarkItem4.value) && !Number.isNaN((_targetMarkItem5 = targetMarkItem) === null || _targetMarkItem5 === void 0 ? void 0 : _targetMarkItem5.value)) {
|
|
247
254
|
var _targetMarkItem4, _targetMarkItem5;
|
|
248
255
|
targetMarkItem = item[i];
|
|
249
256
|
i--;
|
|
250
257
|
if (i < 0) break;
|
|
251
258
|
}
|
|
252
|
-
if (!((_targetMarkItem6 = targetMarkItem)
|
|
259
|
+
if (!((_targetMarkItem6 = targetMarkItem) !== null && _targetMarkItem6 !== void 0 && _targetMarkItem6.value)) return;
|
|
253
260
|
targetMarkItem.isLast = 1;
|
|
254
261
|
} else {
|
|
255
262
|
console.error('on markFirstOrLast: unknown position');
|
|
@@ -319,16 +326,16 @@ export default class ChartComponent extends Component {
|
|
|
319
326
|
if (y_axis_summary_column_key) {
|
|
320
327
|
y_axis_column_key = y_axis_summary_column_key;
|
|
321
328
|
}
|
|
322
|
-
const table = getTableById(tables, table_id);
|
|
323
|
-
const defaultTextColor = this.globalTheme === THEME_NAME_MAP.DARK ? DEFAULT_AXIS_LABEL_FONT_COLOR_DARK : DEFAULT_AXIS_LABEL_FONT_COLOR;
|
|
329
|
+
const table = (0, _dtableUtils.getTableById)(tables, table_id);
|
|
330
|
+
const defaultTextColor = this.globalTheme === _constants.THEME_NAME_MAP.DARK ? _constants.DEFAULT_AXIS_LABEL_FONT_COLOR_DARK : _constants.DEFAULT_AXIS_LABEL_FONT_COLOR;
|
|
324
331
|
const xColor = x_axis_label_font_color || defaultTextColor;
|
|
325
|
-
const xFontSize = x_axis_label_font_size || DEFAULT_AXIS_LABEL_FONT_SIZE;
|
|
332
|
+
const xFontSize = x_axis_label_font_size || _constants.DEFAULT_AXIS_LABEL_FONT_SIZE;
|
|
326
333
|
const yColor = y_axis_label_font_color || defaultTextColor;
|
|
327
|
-
const yFontSize = y_axis_label_font_size || DEFAULT_AXIS_LABEL_FONT_SIZE;
|
|
334
|
+
const yFontSize = y_axis_label_font_size || _constants.DEFAULT_AXIS_LABEL_FONT_SIZE;
|
|
328
335
|
const yLeftColor = y_axis_left_label_font_color || defaultTextColor;
|
|
329
|
-
const yLeftFontSize = y_axis_left_label_font_size || DEFAULT_AXIS_LABEL_FONT_SIZE;
|
|
336
|
+
const yLeftFontSize = y_axis_left_label_font_size || _constants.DEFAULT_AXIS_LABEL_FONT_SIZE;
|
|
330
337
|
const yRightColor = y_axis_right_label_font_color || defaultTextColor;
|
|
331
|
-
const yRightFontSize = y_axis_right_label_font_size || DEFAULT_AXIS_LABEL_FONT_SIZE;
|
|
338
|
+
const yRightFontSize = y_axis_right_label_font_size || _constants.DEFAULT_AXIS_LABEL_FONT_SIZE;
|
|
332
339
|
|
|
333
340
|
// xAxis
|
|
334
341
|
const xAxisID = `chart-x-axis-label_${chart.id}`;
|
|
@@ -341,7 +348,7 @@ export default class ChartComponent extends Component {
|
|
|
341
348
|
const div = document.createElement('div');
|
|
342
349
|
div.id = xAxisID;
|
|
343
350
|
div.className = 'chart-axis-label';
|
|
344
|
-
const column = getTableColumnByKey(table, x_axis_column_key);
|
|
351
|
+
const column = (0, _dtableUtils.getTableColumnByKey)(table, x_axis_column_key);
|
|
345
352
|
div.innerHTML = `${column ? column.name : ''}`;
|
|
346
353
|
div.setAttribute('style', `color:${xColor}; font-size:${xFontSize}px; width: ${containerWidth}px; height: ${xTitleHeight}px; line-height: ${xTitleHeight}px; text-align: ${x_axis_label_position}; position: absolute; bottom: 0;`);
|
|
347
354
|
chartContainer.appendChild(div);
|
|
@@ -362,12 +369,12 @@ export default class ChartComponent extends Component {
|
|
|
362
369
|
div.id = yAxisID;
|
|
363
370
|
div.className = 'chart-axis-label';
|
|
364
371
|
// SCATTER always has y_axis_column_key
|
|
365
|
-
if (y_axis_summary_type === CHART_SUMMARY_TYPE.COUNT && type !== CHART_TYPE.SCATTER) {
|
|
366
|
-
div.innerHTML =
|
|
372
|
+
if (y_axis_summary_type === _constants.CHART_SUMMARY_TYPE.COUNT && type !== _constants.CHART_TYPE.SCATTER) {
|
|
373
|
+
div.innerHTML = _intl.default.get('Amount');
|
|
367
374
|
} else {
|
|
368
|
-
const column = getTableColumnByKey(table, y_axis_column_key) || {};
|
|
375
|
+
const column = (0, _dtableUtils.getTableColumnByKey)(table, y_axis_column_key) || {};
|
|
369
376
|
div.innerHTML = column.name || '';
|
|
370
|
-
if (type === CHART_TYPE.BAR_STACK) {
|
|
377
|
+
if (type === _constants.CHART_TYPE.BAR_STACK) {
|
|
371
378
|
div.innerHTML = title_name || '';
|
|
372
379
|
}
|
|
373
380
|
}
|
|
@@ -375,8 +382,8 @@ export default class ChartComponent extends Component {
|
|
|
375
382
|
height: containerHeight
|
|
376
383
|
} = this.chartBoundingClientRect;
|
|
377
384
|
let textAlign = 'center';
|
|
378
|
-
if (y_axis_label_position === LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
379
|
-
if (y_axis_label_position === LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
385
|
+
if (y_axis_label_position === _constants.LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
386
|
+
if (y_axis_label_position === _constants.LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
380
387
|
div.setAttribute('style', `color:${yColor}; font-size:${yFontSize}px; position: absolute; width: ${containerHeight}px; height: ${yTitleHeight}px; line-height: ${yTitleHeight}px; text-align: ${textAlign}; top: 0; left: 0; transform: ${this.getRotatedAxisTitleTransform(containerHeight, yTitleHeight)}`);
|
|
381
388
|
chartContainer.appendChild(div);
|
|
382
389
|
}
|
|
@@ -385,8 +392,8 @@ export default class ChartComponent extends Component {
|
|
|
385
392
|
height: containerHeight
|
|
386
393
|
} = this.chartBoundingClientRect;
|
|
387
394
|
let textAlign = 'center';
|
|
388
|
-
if (y_axis_label_position === LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
389
|
-
if (y_axis_label_position === LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
395
|
+
if (y_axis_label_position === _constants.LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
396
|
+
if (y_axis_label_position === _constants.LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
390
397
|
yLabel.setAttribute('style', `color:${yColor}; font-size:${yFontSize}px; position: absolute; width: ${containerHeight}px; height: ${yTitleHeight}px; line-height: ${yTitleHeight}px; text-align: ${textAlign}; top: 0; left: 0; transform: ${this.getRotatedAxisTitleTransform(containerHeight, yTitleHeight)}`);
|
|
391
398
|
}
|
|
392
399
|
if (yLabel && !y_axis_show_label) {
|
|
@@ -401,16 +408,16 @@ export default class ChartComponent extends Component {
|
|
|
401
408
|
const div = document.createElement('div');
|
|
402
409
|
div.id = yAxisLeftID;
|
|
403
410
|
div.className = 'chart-axis-label text-truncate';
|
|
404
|
-
if (y_axis_left_summary_type === CHART_SUMMARY_TYPE.COUNT) {
|
|
405
|
-
div.innerHTML =
|
|
411
|
+
if (y_axis_left_summary_type === _constants.CHART_SUMMARY_TYPE.COUNT) {
|
|
412
|
+
div.innerHTML = _intl.default.get('Amount');
|
|
406
413
|
} else {
|
|
407
|
-
const column = getTableColumnByKey(table, y_axis_left_summary_column) || {};
|
|
414
|
+
const column = (0, _dtableUtils.getTableColumnByKey)(table, y_axis_left_summary_column) || {};
|
|
408
415
|
div.innerHTML = column.name || '';
|
|
409
416
|
}
|
|
410
417
|
const containerHeight = chartContainer.offsetHeight;
|
|
411
418
|
let textAlign = 'center';
|
|
412
|
-
if (y_axis_left_label_position === LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
413
|
-
if (y_axis_left_label_position === LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
419
|
+
if (y_axis_left_label_position === _constants.LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
420
|
+
if (y_axis_left_label_position === _constants.LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
414
421
|
div.setAttribute('style', `color:${yLeftColor}; font-size:${yLeftFontSize}px; position: absolute; width: ${containerHeight}px; height: ${yLeftTitleHeight}px; line-height: ${yLeftTitleHeight}px; text-align: ${textAlign}; top: 0; left: 0; transform: ${this.getRotatedAxisTitleTransform(containerHeight, yLeftTitleHeight)}`);
|
|
415
422
|
chartContainer.appendChild(div);
|
|
416
423
|
}
|
|
@@ -433,16 +440,16 @@ export default class ChartComponent extends Component {
|
|
|
433
440
|
const div = document.createElement('div');
|
|
434
441
|
div.id = yAxisRightID;
|
|
435
442
|
div.className = 'chart-axis-label text-truncate';
|
|
436
|
-
if (y_axis_right_summary_type === CHART_SUMMARY_TYPE.COUNT) {
|
|
437
|
-
div.innerHTML =
|
|
443
|
+
if (y_axis_right_summary_type === _constants.CHART_SUMMARY_TYPE.COUNT) {
|
|
444
|
+
div.innerHTML = _intl.default.get('Amount');
|
|
438
445
|
} else {
|
|
439
|
-
const column = getTableColumnByKey(table, y_axis_right_summary_column) || {};
|
|
446
|
+
const column = (0, _dtableUtils.getTableColumnByKey)(table, y_axis_right_summary_column) || {};
|
|
440
447
|
div.innerHTML = column.name || '';
|
|
441
448
|
}
|
|
442
449
|
const containerHeight = chartContainer.offsetHeight;
|
|
443
450
|
let textAlign = 'center';
|
|
444
|
-
if (y_axis_right_label_position === LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
445
|
-
if (y_axis_right_label_position === LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
451
|
+
if (y_axis_right_label_position === _constants.LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
452
|
+
if (y_axis_right_label_position === _constants.LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
446
453
|
div.setAttribute('style', `color:${yRightColor}; font-size:${yRightFontSize}px; position: absolute; width: ${containerHeight}px; height: ${yRightTitleHeight}px; line-height: ${yRightTitleHeight}px; text-align: ${textAlign}; top: 0; right: 0; transform: ${this.getRotatedAxisTitleTransform(containerHeight, yRightTitleHeight, 'right')}`);
|
|
447
454
|
chartContainer.appendChild(div);
|
|
448
455
|
}
|
|
@@ -478,12 +485,12 @@ export default class ChartComponent extends Component {
|
|
|
478
485
|
vertical_axis_label_font_size,
|
|
479
486
|
vertical_axis_label_font_color
|
|
480
487
|
} = chart.config;
|
|
481
|
-
const table = getTableById(tables, table_id);
|
|
482
|
-
const defaultTextColor = this.globalTheme === THEME_NAME_MAP.DARK ? DEFAULT_AXIS_LABEL_FONT_COLOR_DARK : DEFAULT_AXIS_LABEL_FONT_COLOR;
|
|
488
|
+
const table = (0, _dtableUtils.getTableById)(tables, table_id);
|
|
489
|
+
const defaultTextColor = this.globalTheme === _constants.THEME_NAME_MAP.DARK ? _constants.DEFAULT_AXIS_LABEL_FONT_COLOR_DARK : _constants.DEFAULT_AXIS_LABEL_FONT_COLOR;
|
|
483
490
|
const xColor = horizontal_axis_label_font_color || defaultTextColor;
|
|
484
|
-
const xFontSize = horizontal_axis_label_font_size || DEFAULT_AXIS_LABEL_FONT_SIZE;
|
|
491
|
+
const xFontSize = horizontal_axis_label_font_size || _constants.DEFAULT_AXIS_LABEL_FONT_SIZE;
|
|
485
492
|
const yColor = vertical_axis_label_font_color || defaultTextColor;
|
|
486
|
-
const yFontSize = vertical_axis_label_font_size || DEFAULT_AXIS_LABEL_FONT_SIZE;
|
|
493
|
+
const yFontSize = vertical_axis_label_font_size || _constants.DEFAULT_AXIS_LABEL_FONT_SIZE;
|
|
487
494
|
const xAxisID = `chart-x-axis-label_${chart.id}`;
|
|
488
495
|
const xLabel = chartContainer.querySelector(`#${xAxisID}`);
|
|
489
496
|
const {
|
|
@@ -494,10 +501,10 @@ export default class ChartComponent extends Component {
|
|
|
494
501
|
const div = document.createElement('div');
|
|
495
502
|
div.id = xAxisID;
|
|
496
503
|
div.className = 'chart-axis-label';
|
|
497
|
-
if (horizontal_axis_summary_type === CHART_SUMMARY_TYPE.COUNT) {
|
|
498
|
-
div.innerHTML =
|
|
504
|
+
if (horizontal_axis_summary_type === _constants.CHART_SUMMARY_TYPE.COUNT) {
|
|
505
|
+
div.innerHTML = _intl.default.get('Amount');
|
|
499
506
|
} else {
|
|
500
|
-
const column = getTableColumnByKey(table, horizontal_axis_column_key);
|
|
507
|
+
const column = (0, _dtableUtils.getTableColumnByKey)(table, horizontal_axis_column_key);
|
|
501
508
|
div.innerHTML = `${column ? column.name : ''}`;
|
|
502
509
|
}
|
|
503
510
|
div.setAttribute('style', `color:${xColor}; font-size:${xFontSize}px; width: ${containerWidth}px; height: ${xTitleHeight}px; line-height: ${xTitleHeight}px; text-align: ${horizontal_axis_label_position}; position: absolute`);
|
|
@@ -516,14 +523,14 @@ export default class ChartComponent extends Component {
|
|
|
516
523
|
const div = document.createElement('div');
|
|
517
524
|
div.id = yAxisID;
|
|
518
525
|
div.className = 'chart-axis-label';
|
|
519
|
-
const column = getTableColumnByKey(table, vertical_axis_column_key) || {};
|
|
526
|
+
const column = (0, _dtableUtils.getTableColumnByKey)(table, vertical_axis_column_key) || {};
|
|
520
527
|
div.innerHTML = column.name || '';
|
|
521
528
|
const {
|
|
522
529
|
height: containerHeight
|
|
523
530
|
} = this.chartBoundingClientRect;
|
|
524
531
|
let textAlign = 'center';
|
|
525
|
-
if (vertical_axis_label_position === LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
526
|
-
if (vertical_axis_label_position === LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
532
|
+
if (vertical_axis_label_position === _constants.LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
533
|
+
if (vertical_axis_label_position === _constants.LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
527
534
|
div.setAttribute('style', `color:${yColor}; font-size:${yFontSize}px; position: absolute; width: ${containerHeight}px; height: ${yTitleHeight}px; line-height: ${yTitleHeight}px; text-align: ${textAlign}; top: 0; left: 0; transform: ${this.getRotatedAxisTitleTransform(containerHeight, yTitleHeight)}`);
|
|
528
535
|
chartContainer.appendChild(div);
|
|
529
536
|
}
|
|
@@ -532,8 +539,8 @@ export default class ChartComponent extends Component {
|
|
|
532
539
|
height: containerHeight
|
|
533
540
|
} = this.chartBoundingClientRect;
|
|
534
541
|
let textAlign = 'center';
|
|
535
|
-
if (vertical_axis_label_position === LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
536
|
-
if (vertical_axis_label_position === LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
542
|
+
if (vertical_axis_label_position === _constants.LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
543
|
+
if (vertical_axis_label_position === _constants.LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
537
544
|
yLabel.setAttribute('style', `color:${yColor}; font-size:${yFontSize}px; position: absolute; width: ${containerHeight}px; height: ${yTitleHeight}px; line-height: ${yTitleHeight}px; text-align: ${textAlign}; top: 0; left: 0; transform: ${this.getRotatedAxisTitleTransform(containerHeight, yTitleHeight)}`);
|
|
538
545
|
}
|
|
539
546
|
if (yLabel && !show_vertical_axis_label) {
|
|
@@ -547,22 +554,22 @@ export default class ChartComponent extends Component {
|
|
|
547
554
|
};
|
|
548
555
|
this.formatterLegendName = name => {
|
|
549
556
|
if (typeof name !== 'string') {
|
|
550
|
-
if (!name && typeof name !== 'number') return
|
|
551
|
-
return
|
|
557
|
+
if (!name && typeof name !== 'number') return _intl.default.get(_constants.EMPTY_NAME);
|
|
558
|
+
return _intl.default.get(String(name)) || String(name);
|
|
552
559
|
}
|
|
553
560
|
if (name.trim() === 'undefined' || name.trim() === 'null' || name.trim() === '') {
|
|
554
|
-
return
|
|
561
|
+
return _intl.default.get(_constants.EMPTY_NAME);
|
|
555
562
|
} else if (name === '_Others') {
|
|
556
|
-
return
|
|
563
|
+
return _intl.default.get('Others');
|
|
557
564
|
} else {
|
|
558
|
-
return
|
|
565
|
+
return _intl.default.get(name) || name;
|
|
559
566
|
}
|
|
560
567
|
};
|
|
561
568
|
this.setLegend = _ref => {
|
|
562
569
|
var _chart$config, _chart$config2;
|
|
563
570
|
let {
|
|
564
571
|
legendName,
|
|
565
|
-
theme = CHART_THEME_COLOR['light'],
|
|
572
|
+
theme = _constants.CHART_THEME_COLOR['light'],
|
|
566
573
|
legendPosition = 'top-left',
|
|
567
574
|
data,
|
|
568
575
|
colorScale,
|
|
@@ -571,8 +578,8 @@ export default class ChartComponent extends Component {
|
|
|
571
578
|
} = _ref;
|
|
572
579
|
if (!this.chart) return;
|
|
573
580
|
this.legendConfig = {
|
|
574
|
-
legendRectWidth: [CHART_TYPE.SCATTER, CHART_TYPE.MIRROR].includes(chart === null || chart === void 0 ? void 0 : (_chart$config = chart.config) === null || _chart$config === void 0 ? void 0 : _chart$config.type) ? 8 : 20,
|
|
575
|
-
legendRectHeight: [CHART_TYPE.SCATTER, CHART_TYPE.MIRROR].includes(chart === null || chart === void 0 ? void 0 : (_chart$config2 = chart.config) === null || _chart$config2 === void 0 ? void 0 : _chart$config2.type) ? 8 : 6,
|
|
581
|
+
legendRectWidth: [_constants.CHART_TYPE.SCATTER, _constants.CHART_TYPE.MIRROR].includes(chart === null || chart === void 0 ? void 0 : (_chart$config = chart.config) === null || _chart$config === void 0 ? void 0 : _chart$config.type) ? 8 : 20,
|
|
582
|
+
legendRectHeight: [_constants.CHART_TYPE.SCATTER, _constants.CHART_TYPE.MIRROR].includes(chart === null || chart === void 0 ? void 0 : (_chart$config2 = chart.config) === null || _chart$config2 === void 0 ? void 0 : _chart$config2.type) ? 8 : 6,
|
|
576
583
|
r: this.getLegendR(chart),
|
|
577
584
|
legendItemPaddingTop: 5,
|
|
578
585
|
legendItemTextPaddingTop: 13,
|
|
@@ -591,9 +598,9 @@ export default class ChartComponent extends Component {
|
|
|
591
598
|
};
|
|
592
599
|
|
|
593
600
|
// sort legend data and format data
|
|
594
|
-
const clonedData = cloneDeep(data);
|
|
601
|
+
const clonedData = (0, _lodashEs.cloneDeep)(data);
|
|
595
602
|
clonedData.forEach(item => item[legendName] = String(item[legendName]));
|
|
596
|
-
const legendData = BaseUtils.sortDataByGroupName(clonedData, legendName, groupColumn, chart);
|
|
603
|
+
const legendData = _utils.BaseUtils.sortDataByGroupName(clonedData, legendName, groupColumn, chart);
|
|
597
604
|
|
|
598
605
|
// Record every legend group name so legend click can keep at least one visible.
|
|
599
606
|
this.legendGroupNames = new Set(legendData.map(item => String(item[legendName])));
|
|
@@ -744,7 +751,7 @@ export default class ChartComponent extends Component {
|
|
|
744
751
|
}).append('rect').attr('width', legendRectWidth).attr('height', legendRectHeight).attr('y', legendItemPaddingTop).attr('rx', r).attr('fill', _ref4 => {
|
|
745
752
|
let [groupName] = _ref4;
|
|
746
753
|
if (colorScale) return colorScale(groupName);
|
|
747
|
-
return this.colorMap[groupName] || CHART_STYLE_COLORS[0];
|
|
754
|
+
return this.colorMap[groupName] || _constants.CHART_STYLE_COLORS[0];
|
|
748
755
|
}).attr('data-text', _ref5 => {
|
|
749
756
|
let [groupName] = _ref5;
|
|
750
757
|
return groupName;
|
|
@@ -828,7 +835,7 @@ export default class ChartComponent extends Component {
|
|
|
828
835
|
if (top && bottom) {
|
|
829
836
|
let allHeight = top;
|
|
830
837
|
const groupsData = [];
|
|
831
|
-
const newLegendData = cloneDeep(legendData);
|
|
838
|
+
const newLegendData = (0, _lodashEs.cloneDeep)(legendData);
|
|
832
839
|
let lastIndex = 0;
|
|
833
840
|
legendData.forEach((item, index) => {
|
|
834
841
|
const virtualLegend = this.chart.append('g').attr('opacity', 0);
|
|
@@ -853,7 +860,7 @@ export default class ChartComponent extends Component {
|
|
|
853
860
|
} else {
|
|
854
861
|
let allWidth = start;
|
|
855
862
|
const groupsData = [];
|
|
856
|
-
const newLegendData = cloneDeep(legendData);
|
|
863
|
+
const newLegendData = (0, _lodashEs.cloneDeep)(legendData);
|
|
857
864
|
let lastIndex = 0;
|
|
858
865
|
legendData.forEach((item, index) => {
|
|
859
866
|
const virtualLegend = this.chart.append('g').attr('opacity', 0);
|
|
@@ -950,13 +957,13 @@ export default class ChartComponent extends Component {
|
|
|
950
957
|
this.sortLegend = (result, groupColumn, legendName) => {
|
|
951
958
|
result.forEach(item => {
|
|
952
959
|
const option = groupColumn.data.options.find(option => option.name === item[legendName]);
|
|
953
|
-
if (option
|
|
960
|
+
if (option !== null && option !== void 0 && option.id) {
|
|
954
961
|
item['group_name_id'] = option.id;
|
|
955
962
|
item['oldName'] = item.name;
|
|
956
963
|
item.name = item['group_name_id'];
|
|
957
964
|
}
|
|
958
965
|
});
|
|
959
|
-
BaseUtils.sortCharts(result, groupColumn, 'name');
|
|
966
|
+
_utils.BaseUtils.sortCharts(result, groupColumn, 'name');
|
|
960
967
|
result.forEach(item => {
|
|
961
968
|
item.name = item['oldName'];
|
|
962
969
|
});
|
|
@@ -969,8 +976,8 @@ export default class ChartComponent extends Component {
|
|
|
969
976
|
const {
|
|
970
977
|
type
|
|
971
978
|
} = config;
|
|
972
|
-
if (type === CHART_TYPE.SCATTER) return 4;
|
|
973
|
-
if (type === CHART_TYPE.MIRROR) return 0;
|
|
979
|
+
if (type === _constants.CHART_TYPE.SCATTER) return 4;
|
|
980
|
+
if (type === _constants.CHART_TYPE.MIRROR) return 0;
|
|
974
981
|
return 3;
|
|
975
982
|
};
|
|
976
983
|
this.calcEquilateralTriangle = (cx, cy, size, direction) => {
|
|
@@ -984,12 +991,12 @@ export default class ChartComponent extends Component {
|
|
|
984
991
|
let groupName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'group_name';
|
|
985
992
|
let groupColumn = arguments.length > 3 ? arguments[3] : undefined;
|
|
986
993
|
let chart = arguments.length > 4 ? arguments[4] : undefined;
|
|
987
|
-
const newData = BaseUtils.sortDataByGroupName(cloneDeep(data), groupName, groupColumn, chart);
|
|
994
|
+
const newData = _utils.BaseUtils.sortDataByGroupName((0, _lodashEs.cloneDeep)(data), groupName, groupColumn, chart);
|
|
988
995
|
let currentIdx = 0;
|
|
989
|
-
const defaultColors = CHART_STYLE_COLORS;
|
|
996
|
+
const defaultColors = _constants.CHART_STYLE_COLORS;
|
|
990
997
|
let colors = defaultColors;
|
|
991
998
|
if (chartColorTheme) {
|
|
992
|
-
colors = BaseUtils.getCurrentTheme(chartColorTheme).colors;
|
|
999
|
+
colors = _utils.BaseUtils.getCurrentTheme(chartColorTheme).colors;
|
|
993
1000
|
}
|
|
994
1001
|
const colorMap = newData.reduce((acc, cur) => {
|
|
995
1002
|
const key = cur[groupName] || cur[groupName] === 0 ? cur[groupName] : '';
|
|
@@ -1089,13 +1096,13 @@ export default class ChartComponent extends Component {
|
|
|
1089
1096
|
formatted_value: item.formatted_value + ''
|
|
1090
1097
|
});
|
|
1091
1098
|
}
|
|
1092
|
-
if (type === CHART_TYPE.WORLD_MAP_BUBBLE) {
|
|
1099
|
+
if (type === _constants.CHART_TYPE.WORLD_MAP_BUBBLE) {
|
|
1093
1100
|
sum += item.value;
|
|
1094
1101
|
}
|
|
1095
1102
|
}
|
|
1096
1103
|
}
|
|
1097
1104
|
});
|
|
1098
|
-
if (type === CHART_TYPE.WORLD_MAP_BUBBLE) {
|
|
1105
|
+
if (type === _constants.CHART_TYPE.WORLD_MAP_BUBBLE) {
|
|
1099
1106
|
statisticNewData.sum = sum;
|
|
1100
1107
|
}
|
|
1101
1108
|
return statisticNewData;
|
|
@@ -1104,10 +1111,10 @@ export default class ChartComponent extends Component {
|
|
|
1104
1111
|
let themeColors = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
1105
1112
|
let theme = arguments.length > 1 ? arguments[1] : undefined;
|
|
1106
1113
|
// dark->custom->light
|
|
1107
|
-
if (theme === THEME_NAME_MAP.DARK) {
|
|
1108
|
-
themeColors = CHART_THEME_COLOR.dark;
|
|
1114
|
+
if (theme === _constants.THEME_NAME_MAP.DARK) {
|
|
1115
|
+
themeColors = _constants.CHART_THEME_COLOR.dark;
|
|
1109
1116
|
}
|
|
1110
|
-
return themeColors || CHART_THEME_COLOR[THEME_NAME_MAP.LIGHT];
|
|
1117
|
+
return themeColors || _constants.CHART_THEME_COLOR[_constants.THEME_NAME_MAP.LIGHT];
|
|
1111
1118
|
};
|
|
1112
1119
|
this.setDispalyGoalLine = (goal_label, goal_value, insertPadding, yScale) => {
|
|
1113
1120
|
const {
|
|
@@ -1128,7 +1135,7 @@ export default class ChartComponent extends Component {
|
|
|
1128
1135
|
label_font_size,
|
|
1129
1136
|
text
|
|
1130
1137
|
} = _ref6;
|
|
1131
|
-
d3.select(container).append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('y', Number(y) - 10).attr('fill', theme.labelColor).attr('font-size', BaseUtils.getLabelFontSize(label_font_size)).text(text).call(g => {
|
|
1138
|
+
d3.select(container).append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('y', Number(y) - 10).attr('fill', theme.labelColor).attr('font-size', _utils.BaseUtils.getLabelFontSize(label_font_size)).text(text).call(g => {
|
|
1132
1139
|
if (!g.node()) return;
|
|
1133
1140
|
const {
|
|
1134
1141
|
width
|
|
@@ -1147,7 +1154,7 @@ export default class ChartComponent extends Component {
|
|
|
1147
1154
|
label_font_size,
|
|
1148
1155
|
text
|
|
1149
1156
|
} = _ref7;
|
|
1150
|
-
d3.select(container).append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('x', Number(x) + Number(xWidth) + 10).attr('y', Number(y)).attr('fill', theme.labelColor).attr('dominant-baseline', 'hanging').attr('font-size', BaseUtils.getLabelFontSize(label_font_size)).text(text).call(g => {
|
|
1157
|
+
d3.select(container).append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('x', Number(x) + Number(xWidth) + 10).attr('y', Number(y)).attr('fill', theme.labelColor).attr('dominant-baseline', 'hanging').attr('font-size', _utils.BaseUtils.getLabelFontSize(label_font_size)).text(text).call(g => {
|
|
1151
1158
|
if (g.node()) {
|
|
1152
1159
|
var _g$node;
|
|
1153
1160
|
const {
|
|
@@ -1169,7 +1176,7 @@ export default class ChartComponent extends Component {
|
|
|
1169
1176
|
label_font_size,
|
|
1170
1177
|
text
|
|
1171
1178
|
} = _ref8;
|
|
1172
|
-
d3.select(container).append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('fill', theme.labelColor).attr('font-size', BaseUtils.getLabelFontSize(label_font_size)).text(text).call(g => {
|
|
1179
|
+
d3.select(container).append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('fill', theme.labelColor).attr('font-size', _utils.BaseUtils.getLabelFontSize(label_font_size)).text(text).call(g => {
|
|
1173
1180
|
if (!g.node()) return;
|
|
1174
1181
|
const {
|
|
1175
1182
|
width,
|
|
@@ -1177,7 +1184,7 @@ export default class ChartComponent extends Component {
|
|
|
1177
1184
|
} = g.node().getBoundingClientRect();
|
|
1178
1185
|
const translateX = Number(x) + xWidth / 2 - width / 2;
|
|
1179
1186
|
let translateY = Number(y) + Number(yheight / 2) + height / 2;
|
|
1180
|
-
if (chartType === CHART_TYPE.BAR_STACK) {
|
|
1187
|
+
if (chartType === _constants.CHART_TYPE.BAR_STACK) {
|
|
1181
1188
|
translateY = translateY;
|
|
1182
1189
|
}
|
|
1183
1190
|
g.attr('transform', `translate(${translateX}, ${translateY})`);
|
|
@@ -1189,7 +1196,7 @@ export default class ChartComponent extends Component {
|
|
|
1189
1196
|
const rects = Array.from(g.children).filter(item => item.tagName !== 'text');
|
|
1190
1197
|
rects.forEach(item => {
|
|
1191
1198
|
d3.select(item).transition().duration(this.interactionDuration).attr('opacity', 1);
|
|
1192
|
-
if ([CHART_TYPE.PIE, CHART_TYPE.RING].includes(chartType)) {
|
|
1199
|
+
if ([_constants.CHART_TYPE.PIE, _constants.CHART_TYPE.RING].includes(chartType)) {
|
|
1193
1200
|
d3.select(item).attr('stroke-width', 2);
|
|
1194
1201
|
}
|
|
1195
1202
|
});
|
|
@@ -1202,7 +1209,7 @@ export default class ChartComponent extends Component {
|
|
|
1202
1209
|
if (item.getAttribute('data-groupName') !== curGroupName) {
|
|
1203
1210
|
d3.selectAll([item]).transition().duration(this.interactionDuration).attr('opacity', 0.3);
|
|
1204
1211
|
} else {
|
|
1205
|
-
if ([CHART_TYPE.PIE, CHART_TYPE.RING].includes(chartType)) {
|
|
1212
|
+
if ([_constants.CHART_TYPE.PIE, _constants.CHART_TYPE.RING].includes(chartType)) {
|
|
1206
1213
|
d3.select(item).attr('stroke-width', 0.5);
|
|
1207
1214
|
}
|
|
1208
1215
|
}
|
|
@@ -1468,13 +1475,13 @@ export default class ChartComponent extends Component {
|
|
|
1468
1475
|
}).filter(Boolean).sort((a, b) => a.top - b.top);
|
|
1469
1476
|
const keptTicks = [];
|
|
1470
1477
|
let prevBottom = -Infinity;
|
|
1471
|
-
visibleTicks.forEach(
|
|
1478
|
+
visibleTicks.forEach(_ref0 => {
|
|
1472
1479
|
let {
|
|
1473
1480
|
tick,
|
|
1474
1481
|
index,
|
|
1475
1482
|
top,
|
|
1476
1483
|
bottom
|
|
1477
|
-
} =
|
|
1484
|
+
} = _ref0;
|
|
1478
1485
|
const shouldKeepFirstTick = index === 0;
|
|
1479
1486
|
const shouldKeepLastTick = index === ticks.length - 1;
|
|
1480
1487
|
const hasEnoughSpace = top > prevBottom + this.yAxisTickLabelGap;
|
|
@@ -1676,11 +1683,11 @@ export default class ChartComponent extends Component {
|
|
|
1676
1683
|
const annotationWrapper = contentWrapper.insert('g', ':first-child').attr('class', 'vertical-annotation-wrapper');
|
|
1677
1684
|
annotationWrapper.append('line').attr('x1', x).attr('y1', insertPadding + marginTop).attr('x2', x).attr('y2', chartHeight - insertPadding).attr('stroke', theme.XAxisColor);
|
|
1678
1685
|
};
|
|
1679
|
-
this.setLegendForHeatMap =
|
|
1686
|
+
this.setLegendForHeatMap = _ref1 => {
|
|
1680
1687
|
let {
|
|
1681
1688
|
exampleColors,
|
|
1682
1689
|
themeColors
|
|
1683
|
-
} =
|
|
1690
|
+
} = _ref1;
|
|
1684
1691
|
const legendOffsetY = 3;
|
|
1685
1692
|
const legendItemTextWidth = 32;
|
|
1686
1693
|
const legendItemWidth = 12;
|
|
@@ -1688,13 +1695,13 @@ export default class ChartComponent extends Component {
|
|
|
1688
1695
|
const legendItemGap = 3;
|
|
1689
1696
|
const legendItemRadius = 2;
|
|
1690
1697
|
const legendWrapper = this.chart.append('g').attr('class', 'legend-heat-map-wrapper').attr('transform', `translate(0, ${legendOffsetY})`);
|
|
1691
|
-
legendWrapper.append('text').attr('y', 10).attr('fill', themeColors.textColor).attr('font-size', 12).attr('font-weight', 'bold').text(
|
|
1698
|
+
legendWrapper.append('text').attr('y', 10).attr('fill', themeColors.textColor).attr('font-size', 12).attr('font-weight', 'bold').text(_intl.default.get('Less'));
|
|
1692
1699
|
exampleColors.forEach((color, index) => {
|
|
1693
|
-
legendWrapper.append('rect').attr('x', legendItemTextWidth + index * legendItemWidth + index * legendItemGap).attr('width', legendItemWidth).attr('height', legendItemHeight).attr('rx', legendItemRadius).attr('fill', color).attr('stroke', FILL_BORDER_COLOR_MAP[color]).attr('stroke-width', 1);
|
|
1700
|
+
legendWrapper.append('rect').attr('x', legendItemTextWidth + index * legendItemWidth + index * legendItemGap).attr('width', legendItemWidth).attr('height', legendItemHeight).attr('rx', legendItemRadius).attr('fill', color).attr('stroke', _style.FILL_BORDER_COLOR_MAP[color]).attr('stroke-width', 1);
|
|
1694
1701
|
});
|
|
1695
|
-
legendWrapper.append('text').attr('x', 182).attr('y', 10).attr('fill', themeColors.textColor).attr('font-size', 12).attr('font-weight', 'bold').text(
|
|
1702
|
+
legendWrapper.append('text').attr('x', 182).attr('y', 10).attr('fill', themeColors.textColor).attr('font-size', 12).attr('font-weight', 'bold').text(_intl.default.get('More'));
|
|
1696
1703
|
};
|
|
1697
|
-
this.setContinuousLegend =
|
|
1704
|
+
this.setContinuousLegend = _ref10 => {
|
|
1698
1705
|
var _this$chart$node2;
|
|
1699
1706
|
let {
|
|
1700
1707
|
previewType,
|
|
@@ -1705,7 +1712,7 @@ export default class ChartComponent extends Component {
|
|
|
1705
1712
|
legendTextRange,
|
|
1706
1713
|
bubbleColor,
|
|
1707
1714
|
type
|
|
1708
|
-
} =
|
|
1715
|
+
} = _ref10;
|
|
1709
1716
|
const {
|
|
1710
1717
|
width: chartWidth,
|
|
1711
1718
|
height: chartHeight,
|
|
@@ -1715,7 +1722,7 @@ export default class ChartComponent extends Component {
|
|
|
1715
1722
|
const legendRectHeight = legendDirection === 'vertical' ? Math.min(legendSize * 100, chartHeight - insertPadding * 2) : 12;
|
|
1716
1723
|
const legendTextOffset = 2;
|
|
1717
1724
|
const legendTextHeightSpace = legendDirection === 'vertical' ? 0 : 14 + legendTextOffset;
|
|
1718
|
-
if (![CHART_TYPE.MAP_BUBBLE, CHART_TYPE.WORLD_MAP_BUBBLE].includes(type)) {
|
|
1725
|
+
if (![_constants.CHART_TYPE.MAP_BUBBLE, _constants.CHART_TYPE.WORLD_MAP_BUBBLE].includes(type)) {
|
|
1719
1726
|
var _this$chart$node;
|
|
1720
1727
|
const gradient = this.chart.append('defs').attr('class', 'linear-gradient-wrapper').append('linearGradient').attr("id", `gradient-${(_this$chart$node = this.chart.node()) === null || _this$chart$node === void 0 ? void 0 : _this$chart$node.id}-${previewType}`).attr("x1", '0%').attr("y1", '0%').attr("x2", legendDirection === 'vertical' ? '0%' : '100%').attr("y2", legendDirection === 'vertical' ? '100%' : '0%');
|
|
1721
1728
|
gradient.append('stop').attr('offset', '0%').attr('stop-color', `${colorRange[0]}`);
|
|
@@ -1723,8 +1730,8 @@ export default class ChartComponent extends Component {
|
|
|
1723
1730
|
gradient.append('stop').attr('offset', '100%').attr('stop-color', `${colorRange[8]}`);
|
|
1724
1731
|
}
|
|
1725
1732
|
const continuousLegendWrapper = this.chart.append('g').attr('class', 'legend-continuous-wrapper').attr('transform', `translate(0, ${chartHeight - legendRectHeight - legendTextHeightSpace})`);
|
|
1726
|
-
continuousLegendWrapper.append('rect').attr('width', legendRectWidth).attr('height', legendRectHeight).attr('fill', [CHART_TYPE.MAP_BUBBLE, CHART_TYPE.WORLD_MAP_BUBBLE].includes(type) ? bubbleColor : `url(#gradient-${(_this$chart$node2 = this.chart.node()) === null || _this$chart$node2 === void 0 ? void 0 : _this$chart$node2.id}-${previewType})`).call(g => {
|
|
1727
|
-
if ([CHART_TYPE.MAP_BUBBLE, CHART_TYPE.WORLD_MAP_BUBBLE].includes(type)) {
|
|
1733
|
+
continuousLegendWrapper.append('rect').attr('width', legendRectWidth).attr('height', legendRectHeight).attr('fill', [_constants.CHART_TYPE.MAP_BUBBLE, _constants.CHART_TYPE.WORLD_MAP_BUBBLE].includes(type) ? bubbleColor : `url(#gradient-${(_this$chart$node2 = this.chart.node()) === null || _this$chart$node2 === void 0 ? void 0 : _this$chart$node2.id}-${previewType})`).call(g => {
|
|
1734
|
+
if ([_constants.CHART_TYPE.MAP_BUBBLE, _constants.CHART_TYPE.WORLD_MAP_BUBBLE].includes(type)) {
|
|
1728
1735
|
continuousLegendWrapper.append('polygon').attr('points', `0,0 ${legendRectWidth - 0.5},0 0,${legendRectHeight - 0.5}`).attr('fill', '#fff').attr('stroke', '#fff');
|
|
1729
1736
|
}
|
|
1730
1737
|
});
|
|
@@ -1767,4 +1774,5 @@ export default class ChartComponent extends Component {
|
|
|
1767
1774
|
componentWillUnmount() {
|
|
1768
1775
|
window.removeEventListener('resize', this.handleResize);
|
|
1769
1776
|
}
|
|
1770
|
-
}
|
|
1777
|
+
}
|
|
1778
|
+
exports.default = ChartComponent;
|