sea-chart 2.0.43 → 2.0.44
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 +4 -11
- package/dist/components/cell-factory/FormatterConfig.js +55 -62
- package/dist/components/cell-factory/SimpleCellFormatter.js +4 -11
- package/dist/components/cell-factory/SingleSelectOption.js +11 -18
- package/dist/components/cell-factory/cell-editor-factory.js +5 -12
- package/dist/components/cell-factory/cell-formatter-factory.js +4 -11
- package/dist/components/cell-factory/link-content.js +27 -35
- package/dist/components/chart-color-selector/color-selector.js +11 -18
- package/dist/components/collaborator/index.js +7 -14
- package/dist/components/color-picker/index.js +11 -18
- package/dist/components/color-popover/color-rules/color-rule.js +25 -33
- package/dist/components/color-popover/color-rules/index.js +6 -14
- package/dist/components/color-popover/color-rules/rule-filters/filter.js +27 -34
- package/dist/components/color-popover/color-rules/rule-filters/index.js +17 -25
- package/dist/components/color-popover/color-rules/rule-filters/number-input.js +10 -18
- package/dist/components/color-popover/color-rules-popover.js +26 -34
- package/dist/components/color-popover/color-selector-popover.js +10 -18
- package/dist/components/color-setting/color-group-selector.js +12 -20
- package/dist/components/common-add-tool/index.js +6 -13
- package/dist/components/data-process-setter/data-setting-header.js +7 -14
- package/dist/components/data-process-setter/hide-column-setter.js +12 -19
- package/dist/components/data-process-setter/index.js +4 -27
- package/dist/components/data-process-setter/sort-setter.js +16 -24
- package/dist/components/draggable/Draggable.js +7 -13
- package/dist/components/drill-down-settings/drill-down-fields-popover/index.js +42 -50
- package/dist/components/drill-down-settings/drill-down-fields-settings/index.js +10 -18
- package/dist/components/drill-down-settings/index.js +11 -18
- package/dist/components/dtable-popover/index.js +13 -20
- package/dist/components/dtable-search-input/index.js +13 -21
- package/dist/components/font-settings/index.js +14 -22
- package/dist/components/goal-line-setting/goal-setting-item.js +6 -14
- package/dist/components/goal-line-setting/index.js +12 -19
- package/dist/components/highlighter/highlighter.js +7 -14
- package/dist/components/icon/index.js +4 -11
- package/dist/components/index.js +7 -48
- package/dist/components/loading/index.js +6 -13
- package/dist/components/number-input/index.js +4 -11
- package/dist/components/pixel-editor/index.js +15 -23
- package/dist/components/popover/hide-column-popover/hide-column-popover-widgets/hide-column-item.js +8 -15
- package/dist/components/popover/hide-column-popover/hide-column-popover.js +25 -33
- package/dist/components/popover/sort-popover/sort-popover-widgets/sort-utils.js +9 -18
- package/dist/components/popover/sort-popover/sort-popover.js +54 -64
- package/dist/components/resize-handle/ResizeHandle.js +6 -13
- package/dist/components/row-card/row-card-header-cell.js +15 -22
- package/dist/components/row-card/row-card-header.js +14 -21
- package/dist/components/row-card/row-card-item.js +33 -41
- package/dist/components/row-card/row-card.js +15 -23
- package/dist/components/statistic-record-dialog/index.js +56 -64
- package/dist/components/tooltip/index.js +21 -21
- package/dist/components/types-dialog/index.js +56 -64
- package/dist/components/types-dialog/use-force-update.js +4 -10
- package/dist/constants/color-rules.js +8 -14
- package/dist/constants/common-constants.js +8 -14
- package/dist/constants/error.js +2 -8
- package/dist/constants/geolocation.js +9 -15
- package/dist/constants/index.js +149 -273
- package/dist/constants/key-codes.js +0 -2
- package/dist/constants/model.js +3 -9
- package/dist/constants/regions.js +3 -8
- package/dist/constants/style.js +6 -12
- package/dist/constants/table.js +1 -7
- package/dist/constants/type-image.js +33 -39
- package/dist/constants/type.js +3 -9
- package/dist/context.js +20 -24
- package/dist/editor/index.js +8 -15
- package/dist/index.js +13 -104
- package/dist/intl.js +10 -17
- package/dist/locale/index.js +16 -23
- package/dist/locale/lang/de.js +1 -7
- package/dist/locale/lang/en.js +1 -7
- package/dist/locale/lang/es.js +1 -7
- package/dist/locale/lang/fr.js +1 -7
- package/dist/locale/lang/pt.js +1 -7
- package/dist/locale/lang/ru.js +1 -7
- package/dist/locale/lang/zh_CN.js +1 -7
- package/dist/model/area-group.js +12 -19
- package/dist/model/area.js +12 -19
- package/dist/model/bar-custom.js +11 -18
- package/dist/model/bar-group.js +12 -19
- package/dist/model/bar-stack.js +10 -17
- package/dist/model/bar.js +11 -18
- package/dist/model/base-model.js +8 -11
- package/dist/model/basic-number-card.js +13 -20
- package/dist/model/chart.js +7 -13
- package/dist/model/combination.js +19 -22
- package/dist/model/compare-bar.js +14 -21
- package/dist/model/completeness-group.js +11 -18
- package/dist/model/completeness.js +10 -17
- package/dist/model/dashboard.js +7 -14
- package/dist/model/funnel.js +14 -21
- package/dist/model/generic-model.js +135 -143
- package/dist/model/heat-map.js +9 -16
- package/dist/model/horizontal-bar.js +15 -18
- package/dist/model/horizontal-group-bar.js +14 -17
- package/dist/model/index.js +69 -93
- package/dist/model/line-group.js +13 -20
- package/dist/model/line.js +12 -19
- package/dist/model/map-bubble.js +12 -19
- package/dist/model/map.js +12 -19
- package/dist/model/mirror.js +13 -20
- package/dist/model/pie.js +12 -19
- package/dist/model/ring.js +12 -19
- package/dist/model/scatter.js +10 -17
- package/dist/model/stacked-horizontal-bar.js +15 -18
- package/dist/model/table-element.js +5 -12
- package/dist/model/table.js +7 -14
- package/dist/model/tree-map.js +7 -14
- package/dist/model/trend.js +11 -18
- package/dist/model/user.js +1 -7
- package/dist/model/world-map-bubble.js +12 -19
- package/dist/model/world-map.js +12 -19
- package/dist/services/map-json.js +7 -13
- package/dist/settings/advance-bar-settings/data-settings.js +36 -44
- package/dist/settings/advance-bar-settings/index.js +3 -20
- package/dist/settings/advance-bar-settings/style-settings.js +83 -74
- package/dist/settings/bar-settings/data-settings.js +39 -47
- package/dist/settings/bar-settings/index.js +3 -20
- package/dist/settings/bar-settings/style-settings.js +69 -60
- package/dist/settings/basic-number-card/data-settings.js +49 -57
- package/dist/settings/basic-number-card/index.js +3 -20
- package/dist/settings/basic-number-card/style-settings.js +18 -26
- package/dist/settings/combination-settings/data-settings.js +55 -63
- package/dist/settings/combination-settings/index.js +3 -20
- package/dist/settings/combination-settings/style-settings.js +94 -77
- package/dist/settings/completeness-settings/callbacks/callbacks.js +16 -27
- package/dist/settings/completeness-settings/data-settings/completion-settings.js +21 -28
- package/dist/settings/completeness-settings/data-settings/data-settings.js +25 -32
- package/dist/settings/completeness-settings/index.js +3 -20
- package/dist/settings/completeness-settings/style-settings.js +19 -26
- package/dist/settings/dashboard-settings/data-settings.js +43 -51
- package/dist/settings/dashboard-settings/index.js +2 -13
- package/dist/settings/data-settings.js +72 -79
- package/dist/settings/funnel-settings/components/dnd-item/dnd-item.js +12 -19
- package/dist/settings/funnel-settings/components/dnd-list.js +15 -23
- package/dist/settings/funnel-settings/components/funnel-label-setting.js +32 -40
- package/dist/settings/funnel-settings/components/funnel-layer-setting.js +20 -28
- package/dist/settings/funnel-settings/data-settings.js +23 -31
- package/dist/settings/funnel-settings/index.js +3 -20
- package/dist/settings/funnel-settings/style-settings.js +11 -19
- package/dist/settings/heat-map-settings/data-settings.js +18 -26
- package/dist/settings/heat-map-settings/index.js +3 -20
- package/dist/settings/heat-map-settings/style-settings.js +18 -26
- package/dist/settings/horizontal-bar-settings/data-settings.js +12 -19
- package/dist/settings/horizontal-bar-settings/index.js +3 -20
- package/dist/settings/horizontal-bar-settings/style-settings.js +12 -19
- package/dist/settings/index.js +52 -70
- package/dist/settings/map-settings/components/location-field-selector.js +10 -17
- package/dist/settings/map-settings/components/map-level-selector.js +11 -18
- package/dist/settings/map-settings/components/map-province-city-selector.js +19 -26
- package/dist/settings/map-settings/index.js +3 -20
- package/dist/settings/map-settings/map-data-settings.js +23 -30
- package/dist/settings/map-settings/map-style-settings.js +26 -34
- package/dist/settings/mirror-settings/data-settings.js +26 -34
- package/dist/settings/mirror-settings/index.js +2 -13
- package/dist/settings/pie-settings/data-settings.js +33 -41
- package/dist/settings/pie-settings/index.js +3 -20
- package/dist/settings/pie-settings/style-settings.js +47 -55
- package/dist/settings/scatter/data-settings.js +27 -34
- package/dist/settings/scatter/index.js +3 -12
- package/dist/settings/stacks-settings/index.js +19 -27
- package/dist/settings/stacks-settings/stack-item-settings.js +19 -27
- package/dist/settings/style-settings.js +64 -72
- package/dist/settings/table-element-settings/components/data-filter.js +30 -38
- package/dist/settings/table-element-settings/data-settings.js +21 -29
- package/dist/settings/table-element-settings/index.js +2 -13
- package/dist/settings/table-settings/data-settings.js +111 -119
- package/dist/settings/table-settings/index.js +2 -13
- package/dist/settings/time-comparison-settings/data-settings.js +43 -51
- package/dist/settings/time-comparison-settings/index.js +3 -20
- package/dist/settings/time-comparison-settings/style-settings.js +62 -53
- package/dist/settings/trend-settings/data-settings.js +24 -32
- package/dist/settings/trend-settings/index.js +3 -20
- package/dist/settings/trend-settings/style-setting.js +17 -25
- package/dist/settings/widgets/axis-title-font-settings/index.js +39 -0
- package/dist/settings/widgets/basic-summary/index.js +55 -63
- package/dist/settings/widgets/chart-type/index.js +18 -26
- package/dist/settings/widgets/color-settings/index.js +72 -80
- package/dist/settings/widgets/common-data-settings.js +21 -29
- package/dist/settings/widgets/data-filter/index.js +35 -43
- package/dist/settings/widgets/data-sort.js +16 -24
- package/dist/settings/widgets/date-summary-item.js +24 -32
- package/dist/settings/widgets/display-values-settings/index.js +14 -22
- package/dist/settings/widgets/divider/index.js +8 -16
- package/dist/settings/widgets/font-settings/font-color-settings.js +11 -19
- package/dist/settings/widgets/font-settings/font-size-settings.js +14 -22
- package/dist/settings/widgets/font-settings/font-weight-settings.js +17 -25
- package/dist/settings/widgets/font-settings/index.js +4 -27
- package/dist/settings/widgets/group-by.js +51 -59
- package/dist/settings/widgets/min-max-setting.js +10 -18
- package/dist/settings/widgets/mininum-slice-percent.js +10 -18
- package/dist/settings/widgets/numeric-summary-item.js +23 -31
- package/dist/settings/widgets/select-line-type/index.js +10 -17
- package/dist/settings/widgets/select-table/index.js +9 -16
- package/dist/settings/widgets/select-view/index.js +20 -28
- package/dist/settings/widgets/stack.js +14 -22
- package/dist/settings/widgets/summary-method-setting.js +17 -25
- package/dist/settings/widgets/summary-settings.js +72 -80
- package/dist/settings/widgets/switch/index.js +8 -15
- package/dist/settings/widgets/text-horizontal-settings.js +15 -23
- package/dist/settings/widgets/time-picker.js +29 -37
- package/dist/settings/widgets/title-settings/index.js +29 -37
- package/dist/settings/widgets/title-settings/title-text.js +5 -12
- package/dist/settings/widgets/x-axios.js +0 -1
- package/dist/settings/widgets/y-axis-group-settings.js +63 -71
- package/dist/utils/cell-format-utils.js +18 -28
- package/dist/utils/cell-value-utils.js +5 -12
- package/dist/utils/chart-utils/base-utils.js +362 -334
- package/dist/utils/chart-utils/index.js +28 -41
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +80 -86
- package/dist/utils/chart-utils/original-data-utils/card-calculator.js +13 -20
- package/dist/utils/chart-utils/original-data-utils/combination-calculator.js +45 -52
- package/dist/utils/chart-utils/original-data-utils/compare-bar-chart-calculator.js +19 -26
- package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +32 -39
- package/dist/utils/chart-utils/original-data-utils/dashboard-calculator.js +16 -23
- package/dist/utils/chart-utils/original-data-utils/index.js +50 -57
- package/dist/utils/chart-utils/original-data-utils/mirror-calculator.js +21 -28
- package/dist/utils/chart-utils/original-data-utils/pivot-table-calculator.js +91 -97
- package/dist/utils/chart-utils/original-data-utils/scatter-calculator.js +19 -26
- package/dist/utils/chart-utils/original-data-utils/trend-calculator.js +31 -38
- package/dist/utils/chart-utils/sql-statistics-utils.js +284 -246
- package/dist/utils/chart.js +9 -17
- package/dist/utils/collaborator-manager.js +3 -9
- package/dist/utils/collaborator-utils.js +18 -30
- package/dist/utils/collaborator.js +4 -13
- package/dist/utils/color-utils.js +18 -29
- package/dist/utils/column-utils.js +65 -92
- package/dist/utils/common-utils.js +27 -52
- package/dist/utils/concurrency-manager.js +1 -7
- package/dist/utils/contexts.js +5 -12
- package/dist/utils/date-translate.js +11 -19
- package/dist/utils/digital-sign-utils.js +7 -14
- package/dist/utils/event-bus.js +1 -7
- package/dist/utils/hotkey.js +5 -11
- package/dist/utils/index.js +54 -221
- package/dist/utils/key-generator.js +2 -9
- package/dist/utils/map.js +22 -31
- package/dist/utils/object-utils.js +1 -7
- package/dist/utils/options-utils.js +8 -16
- package/dist/utils/row-record-utils.js +182 -178
- package/dist/utils/row-utils.js +27 -38
- package/dist/utils/search.js +24 -32
- package/dist/utils/sql/chart-data-sql.js +49 -55
- package/dist/utils/sql/column-2-sql-column.js +146 -154
- package/dist/utils/sql/index.js +3 -27
- package/dist/utils/trend-utils.js +39 -47
- package/dist/view/index.css +0 -17
- package/dist/view/index.js +89 -95
- package/dist/view/title/index.js +15 -23
- package/dist/view/wrapper/area-group.js +53 -72
- package/dist/view/wrapper/area.js +51 -72
- package/dist/view/wrapper/bar-compare.js +43 -56
- package/dist/view/wrapper/bar-custom-stack.js +50 -120
- package/dist/view/wrapper/bar-group.js +51 -94
- package/dist/view/wrapper/bar-stack.js +54 -90
- package/dist/view/wrapper/bar.js +45 -66
- package/dist/view/wrapper/basic-number-card.js +25 -26
- package/dist/view/wrapper/chart-component.js +539 -162
- package/dist/view/wrapper/combination.js +63 -83
- package/dist/view/wrapper/completeness-group.js +42 -96
- package/dist/view/wrapper/completeness.js +42 -96
- package/dist/view/wrapper/dashboard.js +33 -47
- package/dist/view/wrapper/funnel.js +36 -56
- package/dist/view/wrapper/heat-map.js +126 -104
- package/dist/view/wrapper/horizontal-bar-group.js +57 -76
- package/dist/view/wrapper/horizontal-bar-stack.js +56 -109
- package/dist/view/wrapper/horizontal-bar.js +45 -68
- package/dist/view/wrapper/index.js +110 -115
- package/dist/view/wrapper/line-group.js +48 -66
- package/dist/view/wrapper/line.js +47 -67
- package/dist/view/wrapper/map-bubble.js +46 -59
- package/dist/view/wrapper/map-world-bubble.js +45 -58
- package/dist/view/wrapper/map-world.js +47 -60
- package/dist/view/wrapper/map.js +48 -60
- package/dist/view/wrapper/mirror.js +40 -61
- package/dist/view/wrapper/pie.js +48 -59
- package/dist/view/wrapper/ring.js +52 -63
- package/dist/view/wrapper/scatter.js +49 -67
- package/dist/view/wrapper/table/index.js +13 -21
- package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +49 -57
- package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +50 -58
- package/dist/view/wrapper/table/pivot-table-display-name.js +83 -91
- package/dist/view/wrapper/table/two-dimension-table.js +76 -84
- package/dist/view/wrapper/table-element/components/dataset-utils.js +23 -36
- package/dist/view/wrapper/table-element/components/formatter.js +96 -105
- package/dist/view/wrapper/table-element/components/formatters/FileFormatter/index.js +22 -31
- package/dist/view/wrapper/table-element/components/formatters/formula-formatter.js +9 -16
- package/dist/view/wrapper/table-element/components/formatters/link-formatter.js +73 -80
- package/dist/view/wrapper/table-element/components/formula-formatter.js +9 -16
- package/dist/view/wrapper/table-element/components/link-formatter.js +73 -80
- package/dist/view/wrapper/table-element/components/record.js +10 -17
- package/dist/view/wrapper/table-element/components/records-body.js +17 -19
- package/dist/view/wrapper/table-element/components/records-header/index.js +7 -15
- package/dist/view/wrapper/table-element/components/records-header/records-header-cell.js +8 -16
- package/dist/view/wrapper/table-element/components/records.js +23 -33
- package/dist/view/wrapper/table-element/components/resize-column-handle/resize-column-handle.js +5 -12
- package/dist/view/wrapper/table-element/components/utils.js +5 -15
- package/dist/view/wrapper/table-element/components/value-display-utils.js +4 -11
- package/dist/view/wrapper/table-element/components/vertical-scrollbar/index.js +6 -13
- package/dist/view/wrapper/table-element/index.js +18 -26
- package/dist/view/wrapper/treemap.js +39 -57
- package/dist/view/wrapper/trend.js +41 -48
- package/package.json +1 -1
|
@@ -1,30 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _dtableUtils = require("dtable-utils");
|
|
12
|
-
var _lodashEs = require("lodash-es");
|
|
13
|
-
var d3 = _interopRequireWildcard(require("d3"));
|
|
14
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
var _intl = _interopRequireDefault(require("../../intl"));
|
|
16
|
-
var _constants = require("../../constants");
|
|
17
|
-
var _utils = require("../../utils");
|
|
18
|
-
var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
|
|
19
|
-
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
20
|
-
class Combination extends _chartComponent.default {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { getTableColumnByKey, getTableById } from 'dtable-utils';
|
|
4
|
+
import * as d3 from 'd3';
|
|
5
|
+
import intl from '../../intl';
|
|
6
|
+
import { EMPTY_NAME, CHART_THEME_COLOR, CHART_LINE_TYPES } from '../../constants';
|
|
7
|
+
import { BaseUtils, isFunction } from '../../utils';
|
|
8
|
+
import ToolTip from '../../components/tooltip';
|
|
9
|
+
import ChartComponent from './chart-component';
|
|
10
|
+
class Combination extends ChartComponent {
|
|
21
11
|
constructor(props) {
|
|
22
12
|
super(props);
|
|
23
|
-
this.handleResize = () => {
|
|
24
|
-
this.destroyChart();
|
|
25
|
-
this.createChart();
|
|
26
|
-
this.drawChart();
|
|
27
|
-
};
|
|
28
13
|
this.createChart = () => {
|
|
29
14
|
const {
|
|
30
15
|
chart
|
|
@@ -38,9 +23,9 @@ class Combination extends _chartComponent.default {
|
|
|
38
23
|
const initConfig = {
|
|
39
24
|
insertPadding: 30,
|
|
40
25
|
borderRadius: 0.2,
|
|
41
|
-
marginLeft: show_y_axis_left_label ?
|
|
42
|
-
marginRight: show_y_axis_right_label ?
|
|
43
|
-
marginBottom: x_axis_show_label ?
|
|
26
|
+
marginLeft: show_y_axis_left_label ? this.getAxisTitleHeight(chart.config.y_axis_left_label_font_size) : 0,
|
|
27
|
+
marginRight: show_y_axis_right_label ? this.getAxisTitleHeight(chart.config.y_axis_right_label_font_size) : 0,
|
|
28
|
+
marginBottom: x_axis_show_label ? this.getAxisTitleHeight(chart.config.x_axis_label_font_size) : 0,
|
|
44
29
|
marginTop: display_data ? 15 : 0
|
|
45
30
|
};
|
|
46
31
|
this.initChart(this.container, chart === null || chart === void 0 ? void 0 : chart.id, initConfig);
|
|
@@ -52,11 +37,11 @@ class Combination extends _chartComponent.default {
|
|
|
52
37
|
let {
|
|
53
38
|
result: data
|
|
54
39
|
} = this.props;
|
|
55
|
-
data =
|
|
40
|
+
data = BaseUtils.formatEmptyName(data, '', intl.get('Empty'));
|
|
56
41
|
if (!Array.isArray(data)) return;
|
|
57
42
|
this.draw(data);
|
|
58
43
|
this.renderAxisLabel(this.props.chart, this.props.tables, this.container);
|
|
59
|
-
|
|
44
|
+
isFunction(customRender) && customRender(this.chart);
|
|
60
45
|
};
|
|
61
46
|
this.draw = data => {
|
|
62
47
|
const {
|
|
@@ -65,8 +50,8 @@ class Combination extends _chartComponent.default {
|
|
|
65
50
|
tables,
|
|
66
51
|
chartColorTheme
|
|
67
52
|
} = this.props;
|
|
68
|
-
const theme =
|
|
69
|
-
const currentTheme =
|
|
53
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
54
|
+
const currentTheme = BaseUtils.getCurrentTheme(chartColorTheme);
|
|
70
55
|
const {
|
|
71
56
|
display_goal_line,
|
|
72
57
|
goal_value,
|
|
@@ -96,9 +81,9 @@ class Combination extends _chartComponent.default {
|
|
|
96
81
|
display_data_field,
|
|
97
82
|
label_font_size
|
|
98
83
|
} = chart.config;
|
|
99
|
-
const table =
|
|
100
|
-
const leftSummaryColumn =
|
|
101
|
-
const rightSummaryColumn =
|
|
84
|
+
const table = getTableById(tables, table_id);
|
|
85
|
+
const leftSummaryColumn = getTableColumnByKey(table, y_axis_left_summary_column) || {};
|
|
86
|
+
const rightSummaryColumn = getTableColumnByKey(table, y_axis_right_summary_column) || {};
|
|
102
87
|
const leftTitle = this.getTitle(tables, table_id, y_axis_left_summary_type, y_axis_left_summary_column);
|
|
103
88
|
const rightTitle = this.getTitle(tables, table_id, y_axis_right_summary_type, y_axis_right_summary_column);
|
|
104
89
|
const showLeftValue = display_data && this.valueFieldMap['value_left'].includes(display_data_field);
|
|
@@ -108,11 +93,11 @@ class Combination extends _chartComponent.default {
|
|
|
108
93
|
showRightValue = true;
|
|
109
94
|
}
|
|
110
95
|
this.setCombinationColorMap(data, leftSummaryColumn, rightSummaryColumn);
|
|
111
|
-
const rightNiceEnd = d3.nice(0, d3.max(data, d => d.value_right), 5)[1];
|
|
96
|
+
const rightNiceEnd = d3.nice(0, d3.max(data, d => d.value_right) || 0, 5)[1];
|
|
112
97
|
const rightY = d3.scaleLinear().domain(y_axis_auto_range_right ? [d3.min(data, d => d.value_right), rightNiceEnd] : [y_axis_min_right, y_axis_max_right]).range([chartHeight - insertPadding, insertPadding + marginTop]);
|
|
113
98
|
|
|
114
99
|
// Y axis (right)
|
|
115
|
-
const rightAxisWrapper = this.chart.append('g').attr('class', 'y-axis-wrapper-right').attr('transform', `translate(${chartWidth - insertPadding},0)`).call(d3.axisRight(rightY).tickSizeInner(0).ticks(5).tickFormat(d =>
|
|
100
|
+
const rightAxisWrapper = this.chart.append('g').attr('class', 'y-axis-wrapper-right').attr('transform', `translate(${chartWidth - insertPadding},0)`).call(d3.axisRight(rightY).tickSizeInner(0).ticks(5).tickFormat(d => BaseUtils.getSummaryValueDisplayString(rightSummaryColumn, d, y_axis_right_summary_column))).call(g => {
|
|
116
101
|
g.select('.domain').remove();
|
|
117
102
|
g.selectAll('text').attr('font-size', theme.fontSize);
|
|
118
103
|
g.selectAll('text').attr('fill', theme.textColor);
|
|
@@ -122,7 +107,7 @@ class Combination extends _chartComponent.default {
|
|
|
122
107
|
const leftY = d3.scaleLinear().domain(y_axis_auto_range_left ? [0, leftNiceEnd] : [y_axis_min_left, y_axis_max_left]).range([chartHeight - insertPadding, insertPadding + marginTop]);
|
|
123
108
|
|
|
124
109
|
// Y axis (left)
|
|
125
|
-
this.chart.append('g').attr('class', 'y-axis-wrapper-left').attr('transform', `translate(${insertPadding},0)`).call(d3.axisLeft(leftY).tickSizeInner(0).ticks(5).tickFormat(d =>
|
|
110
|
+
this.chart.append('g').attr('class', 'y-axis-wrapper-left').attr('transform', `translate(${insertPadding},0)`).call(d3.axisLeft(leftY).tickSizeInner(0).ticks(5).tickFormat(d => BaseUtils.getSummaryValueDisplayString(leftSummaryColumn, d, y_axis_left_summary_method))).call(g => this.drawYaxis(g, theme, rightAxisOffset));
|
|
126
111
|
const fx = d3.scaleBand().domain(new Set(data.map(d => d.name))).range([insertPadding + this.horizontalOverflowOffset, chartWidth - insertPadding - rightAxisOffset]).paddingInner(0.5).paddingOuter(0.1);
|
|
127
112
|
const x = d3.scaleBand().domain(y_axis_left_group_by_multiple_numeric_column ? new Set(data.map(d => d.group_name)) : new Set([data[0]])).range([0, fx.bandwidth()]).paddingInner(y_axis_left_group_by_multiple_numeric_column ? 0.2 : 0).paddingOuter(0);
|
|
128
113
|
|
|
@@ -154,14 +139,12 @@ class Combination extends _chartComponent.default {
|
|
|
154
139
|
return currentTheme.colors[0];
|
|
155
140
|
}
|
|
156
141
|
return d.color;
|
|
157
|
-
}).attr('data-value', d =>
|
|
142
|
+
}).attr('data-value', d => BaseUtils.getSummaryValueDisplayString(leftSummaryColumn, d.value_left, y_axis_left_summary_method)).attr('data-groupName', d => d.name).call(g => {
|
|
158
143
|
g.nodes().forEach(rect => {
|
|
159
144
|
const parentNode = rect.parentNode;
|
|
160
145
|
// add rect borderRadius
|
|
161
146
|
this.addClipPath({
|
|
162
|
-
rect
|
|
163
|
-
parentNode,
|
|
164
|
-
rectId: rect.getAttribute('data-slugid')
|
|
147
|
+
rect
|
|
165
148
|
});
|
|
166
149
|
|
|
167
150
|
// Add label
|
|
@@ -193,6 +176,9 @@ class Combination extends _chartComponent.default {
|
|
|
193
176
|
}).on('mouseleave', (event, data) => {
|
|
194
177
|
this.hiddenTooltip();
|
|
195
178
|
this.handleAcitveAndInActiveState('active', event);
|
|
179
|
+
}).call(g => {
|
|
180
|
+
this.animateRectGrowInY(g);
|
|
181
|
+
this.animateFadeIn(this.chart.select('.content-wrapper').selectAll('text'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
196
182
|
});
|
|
197
183
|
|
|
198
184
|
// Line group
|
|
@@ -244,14 +230,14 @@ class Combination extends _chartComponent.default {
|
|
|
244
230
|
});
|
|
245
231
|
});
|
|
246
232
|
} else {
|
|
247
|
-
if (leftSummaryColumn
|
|
233
|
+
if (leftSummaryColumn === null || leftSummaryColumn === void 0 ? void 0 : leftSummaryColumn.name) {
|
|
248
234
|
newData.push({
|
|
249
235
|
group_name: leftSummaryColumn.name
|
|
250
236
|
});
|
|
251
237
|
}
|
|
252
238
|
}
|
|
253
239
|
// right legend item
|
|
254
|
-
if (rightSummaryColumn
|
|
240
|
+
if (rightSummaryColumn === null || rightSummaryColumn === void 0 ? void 0 : rightSummaryColumn.name) {
|
|
255
241
|
newData.push({
|
|
256
242
|
group_name: String(rightSummaryColumn.name) + ' '
|
|
257
243
|
}); // Add a space character to avoid merging with the previous left legend
|
|
@@ -266,7 +252,7 @@ class Combination extends _chartComponent.default {
|
|
|
266
252
|
const {
|
|
267
253
|
y_axis_left_group_by_multiple_numeric_column
|
|
268
254
|
} = chart.config;
|
|
269
|
-
const currentTheme =
|
|
255
|
+
const currentTheme = BaseUtils.getCurrentTheme(chartColorTheme);
|
|
270
256
|
|
|
271
257
|
// left color map
|
|
272
258
|
if (y_axis_left_group_by_multiple_numeric_column) {
|
|
@@ -292,8 +278,8 @@ class Combination extends _chartComponent.default {
|
|
|
292
278
|
chartColorTheme,
|
|
293
279
|
globalTheme
|
|
294
280
|
} = this.props;
|
|
295
|
-
const theme =
|
|
296
|
-
const currentTheme =
|
|
281
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
282
|
+
const currentTheme = BaseUtils.getCurrentTheme(chartColorTheme);
|
|
297
283
|
const {
|
|
298
284
|
line_type,
|
|
299
285
|
label_font_size,
|
|
@@ -310,11 +296,11 @@ class Combination extends _chartComponent.default {
|
|
|
310
296
|
circleData[index]['y'] = y;
|
|
311
297
|
circleData[index]['value'] = d.value_right;
|
|
312
298
|
return y;
|
|
313
|
-
}).curve(line_type ===
|
|
299
|
+
}).curve(line_type === CHART_LINE_TYPES[1] ? d3.curveBumpX : d3.curveLinear);
|
|
314
300
|
const rightContentWrapper = this.chart.append('g').attr('class', 'lines-wrapper');
|
|
315
301
|
|
|
316
302
|
// line
|
|
317
|
-
rightContentWrapper.append('path').attr('fill', 'none').attr('stroke', currentTheme.colors[1]).attr('stroke-width', 2).attr('d', () => line(data));
|
|
303
|
+
rightContentWrapper.append('path').attr('fill', 'none').attr('stroke', currentTheme.colors[1]).attr('stroke-width', 2).attr('d', () => line(data)).call(g => this.animateFadeIn(g));
|
|
318
304
|
|
|
319
305
|
// circle
|
|
320
306
|
circleData.forEach(item => {
|
|
@@ -322,7 +308,7 @@ class Combination extends _chartComponent.default {
|
|
|
322
308
|
// circle label
|
|
323
309
|
if (showRightValue) {
|
|
324
310
|
const curCircleEl = g.node();
|
|
325
|
-
rightContentWrapper.append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('fill', theme.labelColor).attr('font-size',
|
|
311
|
+
rightContentWrapper.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(BaseUtils.getSummaryValueDisplayString(rightSummaryColumn, Number(curCircleEl.getAttribute('data-text')), y_axis_right_summary_column)).call(g => {
|
|
326
312
|
const {
|
|
327
313
|
width
|
|
328
314
|
} = g.node().getBoundingClientRect();
|
|
@@ -345,6 +331,8 @@ class Combination extends _chartComponent.default {
|
|
|
345
331
|
this.updateCombinationCircleStyle(event, 'zoomOut');
|
|
346
332
|
});
|
|
347
333
|
});
|
|
334
|
+
this.animateFadeIn(rightContentWrapper.selectAll('circle'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
335
|
+
this.animateFadeIn(rightContentWrapper.selectAll('text'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
348
336
|
};
|
|
349
337
|
this.showTooltip = (event, _ref4) => {
|
|
350
338
|
let {
|
|
@@ -363,28 +351,28 @@ class Combination extends _chartComponent.default {
|
|
|
363
351
|
y_axis_left_group_by_multiple_numeric_column,
|
|
364
352
|
y_axis_right_summary_method
|
|
365
353
|
} = chart.config;
|
|
366
|
-
const currentTheme =
|
|
354
|
+
const currentTheme = BaseUtils.getCurrentTheme(chartColorTheme);
|
|
367
355
|
const {
|
|
368
356
|
offsetX,
|
|
369
357
|
offsetY
|
|
370
358
|
} = event;
|
|
371
359
|
const newTooltipData = {};
|
|
372
360
|
if (isCircle) {
|
|
373
|
-
newTooltipData['title'] = !rightTitle && typeof rightTitle !== 'number' ?
|
|
361
|
+
newTooltipData['title'] = !rightTitle && typeof rightTitle !== 'number' ? intl.get(EMPTY_NAME) : rightTitle;
|
|
374
362
|
newTooltipData['items'] = [{
|
|
375
363
|
color: currentTheme.colors[1],
|
|
376
364
|
name: event.target.getAttribute('data-name'),
|
|
377
|
-
value:
|
|
365
|
+
value: BaseUtils.getSummaryValueDisplayString(rightSummaryColumn, Number(event.target.getAttribute('data-text')), y_axis_right_summary_method)
|
|
378
366
|
}];
|
|
379
367
|
} else {
|
|
380
368
|
const curGroup = event.target.parentNode;
|
|
381
369
|
const [curGroupName, data] = curGroup.__data__;
|
|
382
|
-
newTooltipData['title'] = !curGroupName && typeof curGroupName !== 'number' ?
|
|
370
|
+
newTooltipData['title'] = !curGroupName && typeof curGroupName !== 'number' ? intl.get(EMPTY_NAME) : curGroupName;
|
|
383
371
|
newTooltipData['items'] = data.map(item => {
|
|
384
372
|
return {
|
|
385
373
|
color: y_axis_left_group_by_multiple_numeric_column ? this.colorMap[item.group_name] : currentTheme.colors[0],
|
|
386
374
|
name: y_axis_left_group_by_multiple_numeric_column ? item.group_name : leftTitle,
|
|
387
|
-
value:
|
|
375
|
+
value: BaseUtils.getSummaryValueDisplayString(leftSummaryColumn, Number(item.value_left), y_axis_left_summary_method)
|
|
388
376
|
};
|
|
389
377
|
});
|
|
390
378
|
}
|
|
@@ -423,11 +411,11 @@ class Combination extends _chartComponent.default {
|
|
|
423
411
|
};
|
|
424
412
|
this.updateCombinationCircleStyle = (event, state) => {
|
|
425
413
|
if (state === 'zoomIn') {
|
|
426
|
-
d3.select(event.currentTarget).transition().duration(this.
|
|
414
|
+
d3.select(event.currentTarget).transition().duration(this.interactionDuration).attr('r', 5);
|
|
427
415
|
return;
|
|
428
416
|
}
|
|
429
417
|
const circles = d3.select(event.currentTarget.parentNode).selectAll('circle').nodes();
|
|
430
|
-
circles.forEach(circle => d3.select(circle).transition().duration(this.
|
|
418
|
+
circles.forEach(circle => d3.select(circle).transition().duration(this.interactionDuration).attr('r', 3));
|
|
431
419
|
};
|
|
432
420
|
this.updateLastLegendToCircle = () => {
|
|
433
421
|
const legendWrapper = this.chart.select('.legend-wrapper').node();
|
|
@@ -452,12 +440,11 @@ class Combination extends _chartComponent.default {
|
|
|
452
440
|
componentDidMount() {
|
|
453
441
|
this.createChart();
|
|
454
442
|
this.drawChart();
|
|
455
|
-
|
|
456
|
-
window.addEventListener('resize', this.debouncedHandleResize);
|
|
443
|
+
super.componentDidMount();
|
|
457
444
|
}
|
|
458
445
|
componentDidUpdate(prevProps) {
|
|
459
446
|
super.componentDidUpdate(prevProps);
|
|
460
|
-
if (
|
|
447
|
+
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
461
448
|
this.destroyChart();
|
|
462
449
|
this.createChart();
|
|
463
450
|
this.drawChart();
|
|
@@ -465,24 +452,17 @@ class Combination extends _chartComponent.default {
|
|
|
465
452
|
}
|
|
466
453
|
componentWillUnmount() {
|
|
467
454
|
this.destroyChart();
|
|
468
|
-
|
|
455
|
+
super.componentWillUnmount();
|
|
469
456
|
}
|
|
470
457
|
render() {
|
|
471
|
-
const {
|
|
472
|
-
chart
|
|
473
|
-
} = this.props;
|
|
474
458
|
const {
|
|
475
459
|
tooltipData,
|
|
476
460
|
toolTipPosition
|
|
477
461
|
} = this.state;
|
|
478
|
-
return /*#__PURE__*/
|
|
462
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
479
463
|
ref: ref => this.container = ref,
|
|
480
|
-
className:
|
|
481
|
-
|
|
482
|
-
'show-y-axis-left-label': this.isShowYAxisLeftLabel(chart),
|
|
483
|
-
'show-y-axis-right-label': this.isShowYAxisRightLabel(chart)
|
|
484
|
-
})
|
|
485
|
-
}, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
464
|
+
className: "sea-chart-container"
|
|
465
|
+
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
486
466
|
tooltipData: tooltipData,
|
|
487
467
|
toolTipPosition: toolTipPosition,
|
|
488
468
|
chart: this.chart
|
|
@@ -490,16 +470,16 @@ class Combination extends _chartComponent.default {
|
|
|
490
470
|
}
|
|
491
471
|
}
|
|
492
472
|
Combination.propTypes = {
|
|
493
|
-
canvasStyle:
|
|
494
|
-
chart:
|
|
495
|
-
groupbyColumn:
|
|
496
|
-
columnGroupbyColumn:
|
|
497
|
-
summaryColumn:
|
|
498
|
-
result:
|
|
499
|
-
tables:
|
|
500
|
-
globalTheme:
|
|
501
|
-
chartColorTheme:
|
|
502
|
-
toggleRecords:
|
|
503
|
-
customRender:
|
|
473
|
+
canvasStyle: PropTypes.object,
|
|
474
|
+
chart: PropTypes.object,
|
|
475
|
+
groupbyColumn: PropTypes.object,
|
|
476
|
+
columnGroupbyColumn: PropTypes.object,
|
|
477
|
+
summaryColumn: PropTypes.object,
|
|
478
|
+
result: PropTypes.array,
|
|
479
|
+
tables: PropTypes.array,
|
|
480
|
+
globalTheme: PropTypes.string,
|
|
481
|
+
chartColorTheme: PropTypes.string,
|
|
482
|
+
toggleRecords: PropTypes.func,
|
|
483
|
+
customRender: PropTypes.func
|
|
504
484
|
};
|
|
505
|
-
|
|
485
|
+
export default Combination;
|
|
@@ -1,29 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _lodashEs = require("lodash-es");
|
|
12
|
-
var d3 = _interopRequireWildcard(require("d3"));
|
|
13
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
|
-
var _constants = require("../../constants");
|
|
15
|
-
var _utils = require("../../utils");
|
|
16
|
-
var _intl = _interopRequireDefault(require("../../intl"));
|
|
17
|
-
var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
|
|
18
|
-
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
19
|
-
class Completeness extends _chartComponent.default {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { cloneDeep } from 'lodash-es';
|
|
4
|
+
import * as d3 from 'd3';
|
|
5
|
+
import { CHART_THEME_COLOR } from '../../constants';
|
|
6
|
+
import { BaseUtils } from '../../utils';
|
|
7
|
+
import intl from '../../intl';
|
|
8
|
+
import ToolTip from '../../components/tooltip';
|
|
9
|
+
import ChartComponent from './chart-component';
|
|
10
|
+
class Completeness extends ChartComponent {
|
|
20
11
|
constructor(props) {
|
|
21
12
|
super(props);
|
|
22
|
-
this.handleResize = () => {
|
|
23
|
-
this.destroyChart();
|
|
24
|
-
this.createChart();
|
|
25
|
-
this.drawChart();
|
|
26
|
-
};
|
|
27
13
|
this.createChart = () => {
|
|
28
14
|
const {
|
|
29
15
|
chart
|
|
@@ -43,7 +29,7 @@ class Completeness extends _chartComponent.default {
|
|
|
43
29
|
let {
|
|
44
30
|
result: data
|
|
45
31
|
} = this.props;
|
|
46
|
-
data =
|
|
32
|
+
data = BaseUtils.formatEmptyName(data, (_this$props$chart = this.props.chart) === null || _this$props$chart === void 0 ? void 0 : (_this$props$chart$con = _this$props$chart.config) === null || _this$props$chart$con === void 0 ? void 0 : _this$props$chart$con.column_groupby_column_key, intl.get('Empty'));
|
|
47
33
|
if (!Array.isArray(data)) return;
|
|
48
34
|
this.draw(data);
|
|
49
35
|
};
|
|
@@ -54,7 +40,7 @@ class Completeness extends _chartComponent.default {
|
|
|
54
40
|
chartColorTheme,
|
|
55
41
|
columnGroupbyColumn
|
|
56
42
|
} = this.props;
|
|
57
|
-
const theme =
|
|
43
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
58
44
|
const {
|
|
59
45
|
y_axis_auto_range,
|
|
60
46
|
y_axis_min,
|
|
@@ -70,7 +56,7 @@ class Completeness extends _chartComponent.default {
|
|
|
70
56
|
marginRight
|
|
71
57
|
} = this.chartBoundingClientRect;
|
|
72
58
|
this.markLastForCompleteness(data);
|
|
73
|
-
const colors =
|
|
59
|
+
const colors = BaseUtils.getCurrentTheme(chartColorTheme).colors;
|
|
74
60
|
// Normalize groupby to string before setColorMap to ensure consistent keys
|
|
75
61
|
data.forEach(item => {
|
|
76
62
|
if (Array.isArray(item.groupby)) {
|
|
@@ -147,7 +133,7 @@ class Completeness extends _chartComponent.default {
|
|
|
147
133
|
}).selectAll().data(_ref6 => {
|
|
148
134
|
let [_, d] = _ref6;
|
|
149
135
|
return d;
|
|
150
|
-
}).join('rect').attr('class', 'rect').attr('opacity', 1).attr('x', d => x(d[0]) - Number(yAxis.node().getAttribute('data-axisWidth'))).attr('y', d => localY(d.groupby)).attr('
|
|
136
|
+
}).join('rect').attr('class', 'rect').attr('opacity', 1).attr('x', d => x(d[0]) - Number(yAxis.node().getAttribute('data-axisWidth'))).attr('y', d => localY(d.groupby)).attr('width', d => x(d[1]) - x(d[0])).attr('height', localY.bandwidth()).attr('fill', d => {
|
|
151
137
|
const key = d.key;
|
|
152
138
|
const groupby = d.groupby;
|
|
153
139
|
if (key === 'rest') {
|
|
@@ -158,7 +144,7 @@ class Completeness extends _chartComponent.default {
|
|
|
158
144
|
}
|
|
159
145
|
return colors[0];
|
|
160
146
|
}).attr('data-value', d => d.rawData.value).attr('data-groupName', d => d.rawData.slugId).attr('data-tooltipTitle', d => d.rawData.name).attr('data-tooltipName', d => d.key).attr('data-groupBy', d => d.groupby).on('click', (event, data) => {
|
|
161
|
-
self.
|
|
147
|
+
self.toggleRecords(data.rawData);
|
|
162
148
|
}).on('mouseover', event => {
|
|
163
149
|
self.showTooltip(event);
|
|
164
150
|
self.handleAcitveAndInActiveState('inActive', event);
|
|
@@ -199,6 +185,8 @@ class Completeness extends _chartComponent.default {
|
|
|
199
185
|
});
|
|
200
186
|
}
|
|
201
187
|
});
|
|
188
|
+
this.animateStackGrowInX(contentWrapper.selectAll('rect'));
|
|
189
|
+
this.animateFadeIn(contentWrapper.selectAll('text'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
202
190
|
this.setLegend({
|
|
203
191
|
legendName: 'groupby',
|
|
204
192
|
theme,
|
|
@@ -225,23 +213,17 @@ class Completeness extends _chartComponent.default {
|
|
|
225
213
|
const curGroupName = event.currentTarget.getAttribute('data-groupName');
|
|
226
214
|
this.setActiveAndInActiveState(state, allGroup, curGroupName);
|
|
227
215
|
};
|
|
228
|
-
this.showTooltip =
|
|
229
|
-
|
|
216
|
+
this.showTooltip = event => {
|
|
217
|
+
const {
|
|
230
218
|
offsetX,
|
|
231
219
|
offsetY
|
|
232
220
|
} = event;
|
|
233
|
-
if (isDiv) {
|
|
234
|
-
const initX = Number(event.currentTarget.getAttribute('data-x'));
|
|
235
|
-
const initY = Number(event.currentTarget.getAttribute('data-y'));
|
|
236
|
-
offsetX = offsetX + initX;
|
|
237
|
-
offsetY = offsetY + initY;
|
|
238
|
-
}
|
|
239
221
|
const groupby = event.currentTarget.getAttribute('data-groupBy');
|
|
240
222
|
const newTooltipData = {
|
|
241
223
|
title: event.currentTarget.getAttribute('data-tooltipTitle'),
|
|
242
224
|
items: [{
|
|
243
225
|
color: event.currentTarget.getAttribute('data-tooltipName') === 'rest' ? '#bdbdbd' : this.colorMap[groupby],
|
|
244
|
-
name:
|
|
226
|
+
name: intl.get(event.currentTarget.getAttribute('data-tooltipName')),
|
|
245
227
|
value: event.currentTarget.getAttribute('data-value')
|
|
246
228
|
}]
|
|
247
229
|
};
|
|
@@ -255,17 +237,11 @@ class Completeness extends _chartComponent.default {
|
|
|
255
237
|
}
|
|
256
238
|
});
|
|
257
239
|
};
|
|
258
|
-
this.moveTooltip =
|
|
259
|
-
|
|
240
|
+
this.moveTooltip = event => {
|
|
241
|
+
const {
|
|
260
242
|
offsetX,
|
|
261
243
|
offsetY
|
|
262
244
|
} = event;
|
|
263
|
-
if (isDiv) {
|
|
264
|
-
const initX = Number(event.currentTarget.getAttribute('data-x'));
|
|
265
|
-
const initY = Number(event.currentTarget.getAttribute('data-y'));
|
|
266
|
-
offsetX = offsetX + initX;
|
|
267
|
-
offsetY = offsetY + initY;
|
|
268
|
-
}
|
|
269
245
|
this.setState({
|
|
270
246
|
toolTipPosition: {
|
|
271
247
|
offsetX,
|
|
@@ -279,7 +255,7 @@ class Completeness extends _chartComponent.default {
|
|
|
279
255
|
});
|
|
280
256
|
};
|
|
281
257
|
this.getGroupSeries = (data, columnGroupbyColumn, chart) => {
|
|
282
|
-
const sortedData =
|
|
258
|
+
const sortedData = BaseUtils.sortDataByGroupName(cloneDeep(data), 'groupby', columnGroupbyColumn, chart);
|
|
283
259
|
sortedData.forEach(item => {
|
|
284
260
|
if (Array.isArray(item.groupby)) {
|
|
285
261
|
item.groupby = item.groupby.join(', ');
|
|
@@ -289,7 +265,7 @@ class Completeness extends _chartComponent.default {
|
|
|
289
265
|
// Sort main groups by name for stable order
|
|
290
266
|
groups.sort((a, b) => String(a[0]).localeCompare(String(b[0])));
|
|
291
267
|
groups.forEach((item, index) => {
|
|
292
|
-
const itemData =
|
|
268
|
+
const itemData = cloneDeep(item[1]);
|
|
293
269
|
const valueMap = d3.rollup(itemData, v => d3.sum(v, d => d.value), d => d.groupby, d => d.group_name);
|
|
294
270
|
const rawDataMap = d3.rollup(itemData, v => v[0], d => d.groupby, d => d.group_name);
|
|
295
271
|
|
|
@@ -373,28 +349,7 @@ class Completeness extends _chartComponent.default {
|
|
|
373
349
|
return allGroup;
|
|
374
350
|
};
|
|
375
351
|
this.addMaskRect = (topG, rect, yAxis) => {
|
|
376
|
-
|
|
377
|
-
const {
|
|
378
|
-
borderRadius
|
|
379
|
-
} = this.chartBoundingClientRect;
|
|
380
|
-
// Add mask rect
|
|
381
|
-
d3.select(topG).append('foreignObject').attr('class', rect.getAttribute('class')).attr('opacity', rect.getAttribute('opacity')).attr('x', rect.getAttribute('x')).attr('y', rect.getAttribute('y')).attr('data-y', rect.parentNode.parentNode.getAttribute('data-transform')).attr('width', rect.getAttribute('width')).attr('height', rect.getAttribute('height')).attr('data-groupName', rect.getAttribute('data-groupName')).attr('data-value', rect.getAttribute('data-value')).attr('data-tooltipTitle', rect.getAttribute('data-tooltipTitle')).attr('data-tooltipName', rect.getAttribute('data-tooltipName')).attr('data-groupBy', rect.getAttribute('data-groupBy')).attr('data-x', () => {
|
|
382
|
-
const x = Number(rect.getAttribute('x'));
|
|
383
|
-
return x + Number(yAxis.node().getAttribute('data-axisWidth'));
|
|
384
|
-
}).on('click', (event, data) => {
|
|
385
|
-
this.props.toggleRecords(data);
|
|
386
|
-
}).on('mouseover', event => {
|
|
387
|
-
this.showTooltip(event, true);
|
|
388
|
-
this.handleAcitveAndInActiveState('inActive', event);
|
|
389
|
-
}).on('mousemove', event => {
|
|
390
|
-
this.moveTooltip(event, true);
|
|
391
|
-
}).on('mouseleave', event => {
|
|
392
|
-
this.hiddenTooltip();
|
|
393
|
-
this.handleAcitveAndInActiveState('active', event);
|
|
394
|
-
}).append('xhtml:div').attr('style', `width: 100%; height: 100%; background-color: ${rect.getAttribute('fill')}; border-radius: 0px ${xWidth * borderRadius}px ${xWidth * borderRadius}px 0px`);
|
|
395
|
-
|
|
396
|
-
// Remove old rect
|
|
397
|
-
d3.select(rect).remove();
|
|
352
|
+
return this.addRoundedClip(rect, 'x');
|
|
398
353
|
};
|
|
399
354
|
this.chart = null;
|
|
400
355
|
this.state = {
|
|
@@ -403,40 +358,31 @@ class Completeness extends _chartComponent.default {
|
|
|
403
358
|
};
|
|
404
359
|
}
|
|
405
360
|
componentDidMount() {
|
|
406
|
-
super.componentDidMount();
|
|
407
361
|
this.createChart();
|
|
408
362
|
this.drawChart();
|
|
409
|
-
|
|
410
|
-
window.addEventListener('resize', this.debouncedHandleResize);
|
|
363
|
+
super.componentDidMount();
|
|
411
364
|
}
|
|
412
365
|
componentDidUpdate(prevProps) {
|
|
413
366
|
super.componentDidUpdate(prevProps);
|
|
414
|
-
if (
|
|
367
|
+
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
415
368
|
this.destroyChart();
|
|
416
369
|
this.createChart();
|
|
417
370
|
this.drawChart();
|
|
418
371
|
}
|
|
419
372
|
}
|
|
420
373
|
componentWillUnmount() {
|
|
421
|
-
super.componentWillUnmount();
|
|
422
374
|
this.destroyChart();
|
|
423
|
-
|
|
375
|
+
super.componentWillUnmount();
|
|
424
376
|
}
|
|
425
377
|
render() {
|
|
426
|
-
const {
|
|
427
|
-
chart
|
|
428
|
-
} = this.props;
|
|
429
378
|
const {
|
|
430
379
|
tooltipData,
|
|
431
380
|
toolTipPosition
|
|
432
381
|
} = this.state;
|
|
433
|
-
return /*#__PURE__*/
|
|
382
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
434
383
|
ref: ref => this.container = ref,
|
|
435
|
-
className:
|
|
436
|
-
|
|
437
|
-
'show-y-axis-label': this.isShowVerticalAxisLabel(chart)
|
|
438
|
-
})
|
|
439
|
-
}, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
384
|
+
className: "sea-chart-container"
|
|
385
|
+
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
440
386
|
tooltipData: tooltipData,
|
|
441
387
|
toolTipPosition: toolTipPosition,
|
|
442
388
|
chart: this.chart
|
|
@@ -444,15 +390,15 @@ class Completeness extends _chartComponent.default {
|
|
|
444
390
|
}
|
|
445
391
|
}
|
|
446
392
|
Completeness.propTypes = {
|
|
447
|
-
canvasStyle:
|
|
448
|
-
chart:
|
|
449
|
-
groupbyColumn:
|
|
450
|
-
columnGroupbyColumn:
|
|
451
|
-
summaryColumn:
|
|
452
|
-
result:
|
|
453
|
-
tables:
|
|
454
|
-
globalTheme:
|
|
455
|
-
chartColorTheme:
|
|
456
|
-
toggleRecords:
|
|
393
|
+
canvasStyle: PropTypes.object,
|
|
394
|
+
chart: PropTypes.object,
|
|
395
|
+
groupbyColumn: PropTypes.object,
|
|
396
|
+
columnGroupbyColumn: PropTypes.object,
|
|
397
|
+
summaryColumn: PropTypes.object,
|
|
398
|
+
result: PropTypes.array,
|
|
399
|
+
tables: PropTypes.array,
|
|
400
|
+
globalTheme: PropTypes.string,
|
|
401
|
+
chartColorTheme: PropTypes.string,
|
|
402
|
+
toggleRecords: PropTypes.func
|
|
457
403
|
};
|
|
458
|
-
|
|
404
|
+
export default Completeness;
|