sea-chart 2.0.43 → 2.0.45
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 +57 -74
- package/dist/view/wrapper/area.js +51 -72
- package/dist/view/wrapper/bar-compare.js +47 -58
- package/dist/view/wrapper/bar-custom-stack.js +53 -121
- package/dist/view/wrapper/bar-group.js +55 -96
- package/dist/view/wrapper/bar-stack.js +58 -92
- 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 +600 -166
- package/dist/view/wrapper/combination.js +79 -87
- package/dist/view/wrapper/completeness-group.js +46 -98
- package/dist/view/wrapper/completeness.js +45 -97
- package/dist/view/wrapper/dashboard.js +33 -47
- package/dist/view/wrapper/funnel.js +65 -64
- package/dist/view/wrapper/heat-map.js +126 -104
- package/dist/view/wrapper/horizontal-bar-group.js +61 -78
- package/dist/view/wrapper/horizontal-bar-stack.js +60 -111
- package/dist/view/wrapper/horizontal-bar.js +45 -68
- package/dist/view/wrapper/index.js +110 -115
- package/dist/view/wrapper/line-group.js +52 -68
- 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 +45 -64
- package/dist/view/wrapper/pie.js +51 -59
- package/dist/view/wrapper/ring.js +57 -64
- package/dist/view/wrapper/scatter.js +53 -69
- 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,32 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var _dtableUtils = require("dtable-utils");
|
|
15
|
-
var _constants = require("../../constants");
|
|
16
|
-
var _utils = require("../../utils");
|
|
17
|
-
var _intl = _interopRequireDefault(require("../../intl"));
|
|
18
|
-
var _colorRules = require("../../constants/color-rules");
|
|
19
|
-
var _columnUtils = require("../../utils/column-utils");
|
|
20
|
-
var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
|
|
21
|
-
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
22
|
-
class HorizontalBarStack 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 { CellType } from 'dtable-utils';
|
|
6
|
+
import { CHART_TYPE, EMPTY_NAME, CHART_THEME_COLOR, CHART_STYLE_COLORS } from '../../constants';
|
|
7
|
+
import { BaseUtils, isFunction } from '../../utils';
|
|
8
|
+
import intl from '../../intl';
|
|
9
|
+
import { SUPPORT_SINGLE_SELECT_THEMES_OPTIONS } from '../../constants/color-rules';
|
|
10
|
+
import { sortDataByGroupSum } from '../../utils/column-utils';
|
|
11
|
+
import ToolTip from '../../components/tooltip';
|
|
12
|
+
import ChartComponent from './chart-component';
|
|
13
|
+
class HorizontalBarStack extends ChartComponent {
|
|
23
14
|
constructor(props) {
|
|
24
15
|
super(props);
|
|
25
|
-
this.handleResize = (0, _lodashEs.debounce)(() => {
|
|
26
|
-
this.destroyChart();
|
|
27
|
-
this.createChart();
|
|
28
|
-
this.drawChart();
|
|
29
|
-
}, 300);
|
|
30
16
|
this.createChart = () => {
|
|
31
17
|
const {
|
|
32
18
|
chart
|
|
@@ -38,8 +24,8 @@ class HorizontalBarStack extends _chartComponent.default {
|
|
|
38
24
|
const initConfig = {
|
|
39
25
|
insertPadding: 30,
|
|
40
26
|
borderRadius: 0.2,
|
|
41
|
-
marginLeft: show_vertical_axis_label ?
|
|
42
|
-
marginBottom: show_horizontal_axis_label ?
|
|
27
|
+
marginLeft: show_vertical_axis_label ? this.getAxisTitleHeight(chart.config.vertical_axis_label_font_size) : 0,
|
|
28
|
+
marginBottom: show_horizontal_axis_label ? this.getAxisTitleHeight(chart.config.horizontal_axis_label_font_size) : 0
|
|
43
29
|
};
|
|
44
30
|
this.initChart(this.container, chart === null || chart === void 0 ? void 0 : chart.id, initConfig);
|
|
45
31
|
};
|
|
@@ -49,20 +35,22 @@ class HorizontalBarStack extends _chartComponent.default {
|
|
|
49
35
|
customRender,
|
|
50
36
|
chart
|
|
51
37
|
} = this.props;
|
|
52
|
-
data =
|
|
38
|
+
data = BaseUtils.formatEmptyName(data, chart.config.column_groupby_column_key, intl.get('Empty'));
|
|
53
39
|
if (!Array.isArray(data)) return;
|
|
54
40
|
const {
|
|
55
41
|
sort_type,
|
|
56
42
|
type
|
|
57
43
|
} = chart.config;
|
|
58
|
-
if (type ===
|
|
59
|
-
data =
|
|
44
|
+
if (type === CHART_TYPE.STACKED_HORIZONTAL_BAR && sort_type) {
|
|
45
|
+
data = sortDataByGroupSum(data, sort_type);
|
|
60
46
|
}
|
|
61
47
|
this.draw(data);
|
|
62
|
-
|
|
48
|
+
isFunction(customRender) && customRender(this.chart);
|
|
63
49
|
this.renderHorizontalLabel(this.props.chart, this.props.tables, this.container);
|
|
64
50
|
};
|
|
65
51
|
this.draw = data => {
|
|
52
|
+
const fullData = data;
|
|
53
|
+
data = this.getVisibleLegendData(data, 'group_name');
|
|
66
54
|
const {
|
|
67
55
|
chart,
|
|
68
56
|
globalTheme,
|
|
@@ -72,7 +60,7 @@ class HorizontalBarStack extends _chartComponent.default {
|
|
|
72
60
|
summaryColumn,
|
|
73
61
|
horizontal_axis_summary_method
|
|
74
62
|
} = this.props;
|
|
75
|
-
const theme =
|
|
63
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
76
64
|
const {
|
|
77
65
|
display_data,
|
|
78
66
|
label_font_size,
|
|
@@ -89,9 +77,9 @@ class HorizontalBarStack extends _chartComponent.default {
|
|
|
89
77
|
insertPadding
|
|
90
78
|
} = this.chartBoundingClientRect;
|
|
91
79
|
const groupByColumn = this.getColumn(tables, table_id, column_groupby_column_key);
|
|
92
|
-
const useSingleSelectColumnColor = (groupByColumn === null || groupByColumn === void 0 ? void 0 : groupByColumn.type) ===
|
|
93
|
-
useSingleSelectColumnColor ? this.setSingleSelectColorMap(
|
|
94
|
-
const sortedData =
|
|
80
|
+
const useSingleSelectColumnColor = (groupByColumn === null || groupByColumn === void 0 ? void 0 : groupByColumn.type) === CellType.SINGLE_SELECT && color_theme === SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.SINGLE_SELECT_COLUMN_COLORS;
|
|
81
|
+
useSingleSelectColumnColor ? this.setSingleSelectColorMap(fullData) : this.setColorMap(fullData, chartColorTheme, 'group_name', columnGroupbyColumn, chart);
|
|
82
|
+
const sortedData = BaseUtils.sortDataByGroupName(cloneDeep(data), 'group_name', columnGroupbyColumn, chart);
|
|
95
83
|
const series = d3.stack().keys(d3.union(sortedData.map(d => d.group_name))).value((_ref, key) => {
|
|
96
84
|
var _group$get;
|
|
97
85
|
let [_, group] = _ref;
|
|
@@ -117,7 +105,7 @@ class HorizontalBarStack extends _chartComponent.default {
|
|
|
117
105
|
// X axis
|
|
118
106
|
const niceEnd = d3.nice(0, d3.max(newSeries, d => d[1].sumValue), 5)[1];
|
|
119
107
|
const x = d3.scaleLinear().domain(horizontal_axis_auto_range ? [0, niceEnd] : [horizontal_axis_min || 0, horizontal_axis_max || niceEnd]).range([Number(yAxis.node().getAttribute('data-axisWidth')), chartWidth - insertPadding]);
|
|
120
|
-
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform', `translate(0, ${chartHeight - insertPadding})`).call(d3.axisBottom(x).tickSizeInner(0).ticks(5).tickFormat(d =>
|
|
108
|
+
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform', `translate(0, ${chartHeight - insertPadding})`).call(d3.axisBottom(x).tickSizeInner(0).ticks(5).tickFormat(d => BaseUtils.getSummaryValueDisplayString(summaryColumn, d, horizontal_axis_summary_method))).call(g => {
|
|
121
109
|
g.selectAll('.domain').remove();
|
|
122
110
|
g.selectAll('.tick line').node() && g.selectAll('.tick line').node().remove(); // delete the first line
|
|
123
111
|
g.selectAll('.tick line').attr('y2', -(chartHeight - insertPadding * 2)).attr('stroke', theme.gridColor).attr('stroke-dasharray', '8,3');
|
|
@@ -136,9 +124,8 @@ class HorizontalBarStack extends _chartComponent.default {
|
|
|
136
124
|
}).join('rect').attr('opacity', 1).attr('x', (d, index) => {
|
|
137
125
|
return x(d[0]) - Number(yAxis.node().getAttribute('data-axisWidth'));
|
|
138
126
|
}).attr('y', (d, index) => y(d.groupKey)).attr('width', d => x(d[1]) - x(d[0])).attr('height', y.bandwidth()).attr('fill', d => {
|
|
139
|
-
return this.colorMap[d.data.group_name] ||
|
|
140
|
-
}).attr('data-value', d => d.data.value).attr('data-
|
|
141
|
-
// add rect borderRadius
|
|
127
|
+
return this.colorMap[d.data.group_name] || CHART_STYLE_COLORS[0];
|
|
128
|
+
}).attr('data-value', d => d.data.value).attr('data-groupName', d => d.data.name).attr('data-stackKey', d => d.key).call(g => {
|
|
142
129
|
const allGroup = this.getAllGroup(contentWrapper);
|
|
143
130
|
allGroup.forEach(group => {
|
|
144
131
|
const firstEl = group[0];
|
|
@@ -158,13 +145,15 @@ class HorizontalBarStack extends _chartComponent.default {
|
|
|
158
145
|
yheight: Number(rect.getAttribute('height')),
|
|
159
146
|
theme,
|
|
160
147
|
label_font_size,
|
|
161
|
-
text:
|
|
148
|
+
text: BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(rect.getAttribute('data-value')), horizontal_axis_summary_method)
|
|
162
149
|
});
|
|
163
150
|
});
|
|
164
151
|
});
|
|
165
152
|
}
|
|
153
|
+
this.animateFadeIn(contentWrapper.selectAll('text'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
154
|
+
this.animateStackGrowInX(g);
|
|
166
155
|
}).on('click', (event, data) => {
|
|
167
|
-
this.
|
|
156
|
+
this.toggleRecords(data.data);
|
|
168
157
|
}).on('mouseover', event => {
|
|
169
158
|
this.showTooltip(event);
|
|
170
159
|
this.handleAcitveAndInActiveState('inActive', event);
|
|
@@ -178,7 +167,7 @@ class HorizontalBarStack extends _chartComponent.default {
|
|
|
178
167
|
legendName: 'group_name',
|
|
179
168
|
theme,
|
|
180
169
|
legendPosition: 'top-right',
|
|
181
|
-
data,
|
|
170
|
+
data: fullData,
|
|
182
171
|
groupColumn: this.props.columnGroupbyColumn,
|
|
183
172
|
chart
|
|
184
173
|
});
|
|
@@ -188,7 +177,7 @@ class HorizontalBarStack extends _chartComponent.default {
|
|
|
188
177
|
const curGroupName = event.currentTarget.getAttribute('data-groupName');
|
|
189
178
|
this.setActiveAndInActiveState(state, allGroup, curGroupName);
|
|
190
179
|
};
|
|
191
|
-
this.showTooltip =
|
|
180
|
+
this.showTooltip = event => {
|
|
192
181
|
const {
|
|
193
182
|
summaryColumn,
|
|
194
183
|
chart
|
|
@@ -196,25 +185,19 @@ class HorizontalBarStack extends _chartComponent.default {
|
|
|
196
185
|
const {
|
|
197
186
|
horizontal_axis_summary_method
|
|
198
187
|
} = chart.config;
|
|
199
|
-
|
|
188
|
+
const {
|
|
200
189
|
offsetX,
|
|
201
190
|
offsetY
|
|
202
191
|
} = event;
|
|
203
|
-
if (isDiv) {
|
|
204
|
-
const initX = Number(event.currentTarget.getAttribute('data-x'));
|
|
205
|
-
const initY = Number(event.currentTarget.getAttribute('y'));
|
|
206
|
-
offsetX = offsetX + initX;
|
|
207
|
-
offsetY = offsetY + initY;
|
|
208
|
-
}
|
|
209
192
|
const title = event.currentTarget.getAttribute('data-groupName');
|
|
210
193
|
const stackName = event.currentTarget.getAttribute('data-stackKey');
|
|
211
194
|
const stackValue = event.currentTarget.getAttribute('data-value');
|
|
212
195
|
const newTooltipData = {
|
|
213
|
-
title: !title && typeof title !== 'number' ?
|
|
196
|
+
title: !title && typeof title !== 'number' ? intl.get(EMPTY_NAME) : title,
|
|
214
197
|
items: [{
|
|
215
|
-
color: this.colorMap[stackName] ||
|
|
198
|
+
color: this.colorMap[stackName] || CHART_STYLE_COLORS[0],
|
|
216
199
|
name: stackName,
|
|
217
|
-
value:
|
|
200
|
+
value: BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(stackValue), horizontal_axis_summary_method)
|
|
218
201
|
}]
|
|
219
202
|
};
|
|
220
203
|
this.setState({
|
|
@@ -227,17 +210,11 @@ class HorizontalBarStack extends _chartComponent.default {
|
|
|
227
210
|
}
|
|
228
211
|
});
|
|
229
212
|
};
|
|
230
|
-
this.moveTooltip =
|
|
231
|
-
|
|
213
|
+
this.moveTooltip = event => {
|
|
214
|
+
const {
|
|
232
215
|
offsetX,
|
|
233
216
|
offsetY
|
|
234
217
|
} = event;
|
|
235
|
-
if (isDiv) {
|
|
236
|
-
const initX = Number(event.currentTarget.getAttribute('data-x'));
|
|
237
|
-
const initY = Number(event.currentTarget.getAttribute('y'));
|
|
238
|
-
offsetX = offsetX + initX;
|
|
239
|
-
offsetY = offsetY + initY;
|
|
240
|
-
}
|
|
241
218
|
this.setState({
|
|
242
219
|
toolTipPosition: {
|
|
243
220
|
offsetX,
|
|
@@ -290,28 +267,7 @@ class HorizontalBarStack extends _chartComponent.default {
|
|
|
290
267
|
return allGroup;
|
|
291
268
|
};
|
|
292
269
|
this.addMaskRect = (topG, rect, yAxis) => {
|
|
293
|
-
|
|
294
|
-
const {
|
|
295
|
-
borderRadius
|
|
296
|
-
} = this.chartBoundingClientRect;
|
|
297
|
-
// Add mask rect
|
|
298
|
-
d3.select(topG).append('foreignObject').attr('opacity', rect.getAttribute('opacity')).attr('x', rect.getAttribute('x')).attr('y', rect.getAttribute('y')).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-stackKey', rect.getAttribute('data-stackKey')).attr('data-x', () => {
|
|
299
|
-
const x = Number(rect.getAttribute('x'));
|
|
300
|
-
return x + Number(yAxis.node().getAttribute('data-axisWidth'));
|
|
301
|
-
}).on('click', (event, data) => {
|
|
302
|
-
this.props.toggleRecords(data);
|
|
303
|
-
}).on('mouseover', event => {
|
|
304
|
-
this.showTooltip(event, true);
|
|
305
|
-
this.handleAcitveAndInActiveState('inActive', event);
|
|
306
|
-
}).on('mousemove', event => {
|
|
307
|
-
this.moveTooltip(event, true);
|
|
308
|
-
}).on('mouseleave', event => {
|
|
309
|
-
this.hiddenTooltip();
|
|
310
|
-
this.handleAcitveAndInActiveState('active', event);
|
|
311
|
-
}).append('xhtml:div').attr('style', `width: 100%; height: 100%; background-color: ${rect.getAttribute('fill')}; border-radius: 0px ${xWidth * borderRadius}px ${xWidth * borderRadius}px 0px`);
|
|
312
|
-
|
|
313
|
-
// Remove old rect
|
|
314
|
-
d3.select(rect).remove();
|
|
270
|
+
return this.addRoundedClip(rect, 'x');
|
|
315
271
|
};
|
|
316
272
|
this.chart = null;
|
|
317
273
|
this.state = {
|
|
@@ -322,36 +278,29 @@ class HorizontalBarStack extends _chartComponent.default {
|
|
|
322
278
|
componentDidMount() {
|
|
323
279
|
this.createChart();
|
|
324
280
|
this.drawChart();
|
|
325
|
-
|
|
281
|
+
super.componentDidMount();
|
|
326
282
|
}
|
|
327
283
|
componentDidUpdate(prevProps) {
|
|
328
284
|
super.componentDidUpdate(prevProps);
|
|
329
|
-
if (
|
|
285
|
+
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
330
286
|
this.destroyChart();
|
|
331
287
|
this.createChart();
|
|
332
288
|
this.drawChart();
|
|
333
289
|
}
|
|
334
290
|
}
|
|
335
291
|
componentWillUnmount() {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
window.removeEventListener('resize', this.handleResize);
|
|
292
|
+
this.destroyChart();
|
|
293
|
+
super.componentWillUnmount();
|
|
339
294
|
}
|
|
340
295
|
render() {
|
|
341
|
-
const {
|
|
342
|
-
chart
|
|
343
|
-
} = this.props;
|
|
344
296
|
const {
|
|
345
297
|
tooltipData,
|
|
346
298
|
toolTipPosition
|
|
347
299
|
} = this.state;
|
|
348
|
-
return /*#__PURE__*/
|
|
300
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
349
301
|
ref: ref => this.container = ref,
|
|
350
|
-
className:
|
|
351
|
-
|
|
352
|
-
'show-y-axis-label': this.isShowVerticalAxisLabel(chart)
|
|
353
|
-
})
|
|
354
|
-
}, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
302
|
+
className: "sea-chart-container"
|
|
303
|
+
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
355
304
|
tooltipData: tooltipData,
|
|
356
305
|
toolTipPosition: toolTipPosition,
|
|
357
306
|
chart: this.chart
|
|
@@ -359,16 +308,16 @@ class HorizontalBarStack extends _chartComponent.default {
|
|
|
359
308
|
}
|
|
360
309
|
}
|
|
361
310
|
HorizontalBarStack.propTypes = {
|
|
362
|
-
canvasStyle:
|
|
363
|
-
chart:
|
|
364
|
-
groupbyColumn:
|
|
365
|
-
columnGroupbyColumn:
|
|
366
|
-
summaryColumn:
|
|
367
|
-
result:
|
|
368
|
-
tables:
|
|
369
|
-
globalTheme:
|
|
370
|
-
chartColorTheme:
|
|
371
|
-
toggleRecords:
|
|
372
|
-
customRender:
|
|
311
|
+
canvasStyle: PropTypes.object,
|
|
312
|
+
chart: PropTypes.object,
|
|
313
|
+
groupbyColumn: PropTypes.object,
|
|
314
|
+
columnGroupbyColumn: PropTypes.object,
|
|
315
|
+
summaryColumn: PropTypes.object,
|
|
316
|
+
result: PropTypes.array,
|
|
317
|
+
tables: PropTypes.array,
|
|
318
|
+
globalTheme: PropTypes.string,
|
|
319
|
+
chartColorTheme: PropTypes.string,
|
|
320
|
+
toggleRecords: PropTypes.func,
|
|
321
|
+
customRender: PropTypes.func
|
|
373
322
|
};
|
|
374
|
-
|
|
323
|
+
export default HorizontalBarStack;
|
|
@@ -1,30 +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 _colorUtils = require("../../utils/color-utils");
|
|
17
|
-
var _intl = _interopRequireDefault(require("../../intl"));
|
|
18
|
-
var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
|
|
19
|
-
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
20
|
-
class HorizontalBar extends _chartComponent.default {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import * as d3 from 'd3';
|
|
4
|
+
import { TYPE_COLOR_USING, CHART_STYLE_COLORS, CHART_THEME_COLOR } from '../../constants';
|
|
5
|
+
import { BaseUtils, isFunction } from '../../utils';
|
|
6
|
+
import { getLabelColor, getConvertedColorRules } from '../../utils/color-utils';
|
|
7
|
+
import intl from '../../intl';
|
|
8
|
+
import ToolTip from '../../components/tooltip';
|
|
9
|
+
import ChartComponent from './chart-component';
|
|
10
|
+
class HorizontalBar 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
|
|
@@ -37,8 +22,8 @@ class HorizontalBar extends _chartComponent.default {
|
|
|
37
22
|
const initConfig = {
|
|
38
23
|
insertPadding: 30,
|
|
39
24
|
borderRadius: 0.2,
|
|
40
|
-
marginLeft: show_vertical_axis_label ?
|
|
41
|
-
marginBottom: show_horizontal_axis_label ?
|
|
25
|
+
marginLeft: show_vertical_axis_label ? this.getAxisTitleHeight(chart.config.vertical_axis_label_font_size) : 0,
|
|
26
|
+
marginBottom: show_horizontal_axis_label ? this.getAxisTitleHeight(chart.config.horizontal_axis_label_font_size) : 0,
|
|
42
27
|
marginRight: display_data ? 15 : 0
|
|
43
28
|
};
|
|
44
29
|
this.initChart(this.container, chart === null || chart === void 0 ? void 0 : chart.id, initConfig);
|
|
@@ -48,10 +33,10 @@ class HorizontalBar extends _chartComponent.default {
|
|
|
48
33
|
result: data,
|
|
49
34
|
customRender
|
|
50
35
|
} = this.props;
|
|
51
|
-
data =
|
|
36
|
+
data = BaseUtils.formatEmptyName(data, '', intl.get('Empty'));
|
|
52
37
|
if (!Array.isArray(data)) return;
|
|
53
38
|
this.draw(data);
|
|
54
|
-
|
|
39
|
+
isFunction(customRender) && customRender(this.chart);
|
|
55
40
|
this.renderHorizontalLabel(this.props.chart, this.props.tables, this.container);
|
|
56
41
|
};
|
|
57
42
|
this.draw = data => {
|
|
@@ -62,7 +47,7 @@ class HorizontalBar extends _chartComponent.default {
|
|
|
62
47
|
tables,
|
|
63
48
|
summaryColumn
|
|
64
49
|
} = this.props;
|
|
65
|
-
const theme =
|
|
50
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
66
51
|
const {
|
|
67
52
|
table_id,
|
|
68
53
|
horizontal_axis_summary_type,
|
|
@@ -83,11 +68,11 @@ class HorizontalBar extends _chartComponent.default {
|
|
|
83
68
|
insertPadding,
|
|
84
69
|
marginRight
|
|
85
70
|
} = this.chartBoundingClientRect;
|
|
86
|
-
let chartBarColor = horizontal_axis_label_color ||
|
|
71
|
+
let chartBarColor = horizontal_axis_label_color || CHART_STYLE_COLORS[0];
|
|
87
72
|
if (chartColorTheme) {
|
|
88
|
-
chartBarColor =
|
|
73
|
+
chartBarColor = BaseUtils.getCurrentTheme(chartColorTheme).colors[0];
|
|
89
74
|
}
|
|
90
|
-
const colorRules = color_option ===
|
|
75
|
+
const colorRules = color_option === TYPE_COLOR_USING.USE_RULES && horizontal_axis_label_color_rules && getConvertedColorRules(horizontal_axis_label_color_rules);
|
|
91
76
|
const tooltipTitle = this.getTitle(tables, table_id, horizontal_axis_summary_type, horizontal_axis_column_key);
|
|
92
77
|
data.reverse();
|
|
93
78
|
const y = d3.scaleBand().domain(data.map(item => item.name)).range([chartHeight - insertPadding, insertPadding]).paddingInner(0.5).paddingOuter(0.1);
|
|
@@ -109,7 +94,7 @@ class HorizontalBar extends _chartComponent.default {
|
|
|
109
94
|
const x = d3.scaleLinear().domain(horizontal_axis_auto_range ? [0, niceEnd] : [horizontal_axis_min || 0, horizontal_axis_max || niceEnd]).range([Number(yAxis.node().getAttribute('data-axisWidth')), chartWidth - insertPadding - marginRight]);
|
|
110
95
|
|
|
111
96
|
// X axis
|
|
112
|
-
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform', `translate(0, ${chartHeight - insertPadding})`).call(d3.axisBottom(x).tickSizeInner(0).ticks(5).tickFormat(d =>
|
|
97
|
+
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform', `translate(0, ${chartHeight - insertPadding})`).call(d3.axisBottom(x).tickSizeInner(0).ticks(5).tickFormat(d => BaseUtils.getSummaryValueDisplayString(summaryColumn, d, horizontal_axis_summary_method))).call(g => {
|
|
113
98
|
g.selectAll('.domain').remove();
|
|
114
99
|
g.selectAll('.tick line').node() && g.selectAll('.tick line').node().remove(); // delete the first line
|
|
115
100
|
g.selectAll('.tick line').attr('y2', -(chartHeight - insertPadding * 2)).attr('stroke', theme.gridColor).attr('stroke-dasharray', '8,3');
|
|
@@ -118,20 +103,18 @@ class HorizontalBar extends _chartComponent.default {
|
|
|
118
103
|
});
|
|
119
104
|
const contentWrapper = this.chart.append('g').attr('class', 'content-wrapper').attr('transform', `translate(${Number(yAxis.node().getAttribute('data-axisWidth'))}, 0)`);
|
|
120
105
|
contentWrapper.selectAll().data(data).join('rect').attr('opacity', 1).attr('x', 0).attr('y', d => y(d.name)).attr('width', d => x(d.value) - x(0)).attr('height', y.bandwidth()).attr('fill', d => {
|
|
121
|
-
const color =
|
|
106
|
+
const color = getLabelColor({
|
|
122
107
|
chart: chart.config,
|
|
123
108
|
colorRules,
|
|
124
109
|
value: d.value
|
|
125
110
|
});
|
|
126
111
|
return color || chartBarColor;
|
|
127
|
-
}).attr('value', d => d.value).attr('data-
|
|
112
|
+
}).attr('value', d => d.value).attr('data-groupName', d => d.name).call(g => {
|
|
128
113
|
// add rect borderRadius
|
|
129
114
|
g.nodes().forEach(rect => {
|
|
130
115
|
this.addClipPath({
|
|
131
116
|
rect,
|
|
132
|
-
|
|
133
|
-
attr: 'x',
|
|
134
|
-
rectId: rect.getAttribute('data-slugid')
|
|
117
|
+
attr: 'x'
|
|
135
118
|
});
|
|
136
119
|
});
|
|
137
120
|
|
|
@@ -146,7 +129,7 @@ class HorizontalBar extends _chartComponent.default {
|
|
|
146
129
|
y: Number(rect.getAttribute('y')),
|
|
147
130
|
theme,
|
|
148
131
|
label_font_size,
|
|
149
|
-
text:
|
|
132
|
+
text: BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(rect.getAttribute('value')), horizontal_axis_summary_method)
|
|
150
133
|
});
|
|
151
134
|
}
|
|
152
135
|
});
|
|
@@ -160,6 +143,9 @@ class HorizontalBar extends _chartComponent.default {
|
|
|
160
143
|
}).on('mouseleave', (event, data) => {
|
|
161
144
|
this.hiddenTooltip();
|
|
162
145
|
this.handleAcitveAndInActiveState('active', event);
|
|
146
|
+
}).call(g => {
|
|
147
|
+
this.animateRectGrowInX(g);
|
|
148
|
+
this.animateFadeIn(contentWrapper.selectAll('text'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
163
149
|
});
|
|
164
150
|
};
|
|
165
151
|
this.handleAcitveAndInActiveState = (state, event) => {
|
|
@@ -182,13 +168,13 @@ class HorizontalBar extends _chartComponent.default {
|
|
|
182
168
|
const newTooltipData = {
|
|
183
169
|
title: title,
|
|
184
170
|
items: [{
|
|
185
|
-
color:
|
|
171
|
+
color: getLabelColor({
|
|
186
172
|
chart: chart.config,
|
|
187
173
|
colorRules,
|
|
188
174
|
value: data.value
|
|
189
175
|
}) || chartBarColor,
|
|
190
176
|
name: data.name,
|
|
191
|
-
value:
|
|
177
|
+
value: BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(data.value), horizontal_axis_summary_method)
|
|
192
178
|
}]
|
|
193
179
|
};
|
|
194
180
|
this.setState({
|
|
@@ -225,40 +211,31 @@ class HorizontalBar extends _chartComponent.default {
|
|
|
225
211
|
};
|
|
226
212
|
}
|
|
227
213
|
componentDidMount() {
|
|
228
|
-
super.componentDidMount();
|
|
229
214
|
this.createChart();
|
|
230
215
|
this.drawChart();
|
|
231
|
-
|
|
232
|
-
window.addEventListener('resize', this.debouncedHandleResize);
|
|
216
|
+
super.componentDidMount();
|
|
233
217
|
}
|
|
234
218
|
componentDidUpdate(prevProps) {
|
|
235
219
|
super.componentDidUpdate(prevProps);
|
|
236
|
-
if (
|
|
220
|
+
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
237
221
|
this.destroyChart();
|
|
238
222
|
this.createChart();
|
|
239
223
|
this.drawChart();
|
|
240
224
|
}
|
|
241
225
|
}
|
|
242
226
|
componentWillUnmount() {
|
|
243
|
-
super.componentWillUnmount();
|
|
244
227
|
this.destroyChart();
|
|
245
|
-
|
|
228
|
+
super.componentWillUnmount();
|
|
246
229
|
}
|
|
247
230
|
render() {
|
|
248
|
-
const {
|
|
249
|
-
chart
|
|
250
|
-
} = this.props;
|
|
251
231
|
const {
|
|
252
232
|
tooltipData,
|
|
253
233
|
toolTipPosition
|
|
254
234
|
} = this.state;
|
|
255
|
-
return /*#__PURE__*/
|
|
235
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
256
236
|
ref: ref => this.container = ref,
|
|
257
|
-
className:
|
|
258
|
-
|
|
259
|
-
'show-y-axis-label': this.isShowVerticalAxisLabel(chart)
|
|
260
|
-
})
|
|
261
|
-
}, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
237
|
+
className: "sea-chart-container"
|
|
238
|
+
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
262
239
|
tooltipData: tooltipData,
|
|
263
240
|
toolTipPosition: toolTipPosition,
|
|
264
241
|
chart: this.chart
|
|
@@ -266,15 +243,15 @@ class HorizontalBar extends _chartComponent.default {
|
|
|
266
243
|
}
|
|
267
244
|
}
|
|
268
245
|
HorizontalBar.propTypes = {
|
|
269
|
-
canvasStyle:
|
|
270
|
-
chart:
|
|
271
|
-
groupbyColumn:
|
|
272
|
-
columnGroupbyColumn:
|
|
273
|
-
summaryColumn:
|
|
274
|
-
result:
|
|
275
|
-
tables:
|
|
276
|
-
globalTheme:
|
|
277
|
-
chartColorTheme:
|
|
278
|
-
toggleRecords:
|
|
246
|
+
canvasStyle: PropTypes.object,
|
|
247
|
+
chart: PropTypes.object,
|
|
248
|
+
groupbyColumn: PropTypes.object,
|
|
249
|
+
columnGroupbyColumn: PropTypes.object,
|
|
250
|
+
summaryColumn: PropTypes.object,
|
|
251
|
+
result: PropTypes.array,
|
|
252
|
+
tables: PropTypes.array,
|
|
253
|
+
globalTheme: PropTypes.string,
|
|
254
|
+
chartColorTheme: PropTypes.string,
|
|
255
|
+
toggleRecords: PropTypes.func
|
|
279
256
|
};
|
|
280
|
-
|
|
257
|
+
export default HorizontalBar;
|