sea-chart 2.0.37 → 2.0.38
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 +20 -69
- package/dist/assets/css/sea-chart-d3-tooltip.css +0 -1
- package/dist/components/cell-factory/FormatterConfig.js +55 -62
- package/dist/components/cell-factory/SimpleCellFormatter.js +5 -12
- 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 +30 -38
- 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 +12 -19
- package/dist/components/color-popover/color-rules/color-rule.js +26 -34
- package/dist/components/color-popover/color-rules/index.js +7 -15
- 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 +9 -17
- package/dist/components/color-popover/color-rules-popover.js +31 -37
- package/dist/components/color-popover/color-selector-popover.js +12 -20
- package/dist/components/color-setting/color-group-selector.js +13 -21
- package/dist/components/common-add-tool/index.js +8 -15
- package/dist/components/data-process-setter/data-setting-header.js +7 -14
- package/dist/components/data-process-setter/hide-column-setter.js +13 -20
- package/dist/components/data-process-setter/index.js +4 -27
- package/dist/components/data-process-setter/sort-setter.js +18 -26
- package/dist/components/draggable/Draggable.js +7 -13
- package/dist/components/drill-down-settings/drill-down-fields-popover/index.js +41 -48
- 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 +12 -23
- package/dist/components/index.js +7 -48
- package/dist/components/loading/index.js +6 -13
- package/dist/components/number-input/index.js +11 -24
- package/dist/components/pixel-editor/index.js +15 -23
- package/dist/components/popover/hide-column-popover/hide-column-popover-widgets/hide-column-item.js +13 -16
- package/dist/components/popover/hide-column-popover/hide-column-popover.css +5 -1
- package/dist/components/popover/hide-column-popover/hide-column-popover.js +28 -38
- package/dist/components/popover/sort-popover/sort-popover-widgets/sort-utils.js +9 -18
- package/dist/components/popover/sort-popover/sort-popover.js +58 -69
- package/dist/components/resize-handle/ResizeHandle.js +6 -13
- package/dist/components/row-card/row-card-header-cell.js +17 -24
- package/dist/components/row-card/row-card-header.js +15 -22
- package/dist/components/row-card/row-card-item.js +35 -43
- package/dist/components/row-card/row-card.js +17 -25
- package/dist/components/statistic-record-dialog/index.js +61 -68
- package/dist/components/tooltip/index.js +39 -28
- package/dist/components/types-dialog/index.js +62 -70
- 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 +142 -271
- 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 +13 -20
- package/dist/editor/index.js +13 -16
- 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 +2 -7
- package/dist/locale/lang/en.js +2 -7
- package/dist/locale/lang/es.js +2 -7
- package/dist/locale/lang/fr.js +2 -7
- package/dist/locale/lang/pt.js +2 -7
- package/dist/locale/lang/ru.js +2 -7
- package/dist/locale/lang/zh_CN.js +2 -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 +4 -11
- package/dist/model/basic-number-card.js +13 -20
- package/dist/model/chart.js +7 -13
- package/dist/model/combination.js +15 -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 +11 -18
- package/dist/model/horizontal-group-bar.js +10 -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 +14 -17
- 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 +11 -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 +14 -17
- 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 +66 -73
- 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 +51 -59
- package/dist/settings/basic-number-card/data-settings.js +50 -57
- package/dist/settings/basic-number-card/index.js +3 -20
- package/dist/settings/basic-number-card/style-settings.js +19 -27
- package/dist/settings/combination-settings/data-settings.js +55 -64
- package/dist/settings/combination-settings/index.js +3 -20
- package/dist/settings/combination-settings/style-settings.js +67 -75
- 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 +44 -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 +22 -30
- 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 +57 -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 +27 -35
- 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 +65 -73
- package/dist/settings/table-element-settings/components/data-filter.js +49 -58
- package/dist/settings/table-element-settings/data-settings.js +21 -29
- package/dist/settings/table-element-settings/index.css +1 -31
- package/dist/settings/table-element-settings/index.js +2 -13
- package/dist/settings/table-settings/data-settings.js +113 -120
- 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 +44 -52
- 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 +19 -27
- package/dist/settings/widgets/basic-summary/index.js +59 -66
- 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 +27 -34
- package/dist/settings/widgets/data-filter/index.js +59 -59
- package/dist/settings/widgets/data-sort.js +16 -24
- package/dist/settings/widgets/date-summary-item.js +26 -34
- 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 +52 -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 +25 -33
- 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 +75 -82
- package/dist/settings/widgets/switch/index.js +9 -16
- 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 +65 -72
- package/dist/utils/cell-format-utils.js +25 -33
- package/dist/utils/cell-value-utils.js +4 -11
- package/dist/utils/chart-utils/base-utils.js +467 -367
- package/dist/utils/chart-utils/index.js +29 -40
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +78 -85
- package/dist/utils/chart-utils/original-data-utils/card-calculator.js +20 -21
- 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 +21 -28
- package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +33 -40
- package/dist/utils/chart-utils/original-data-utils/dashboard-calculator.js +28 -26
- package/dist/utils/chart-utils/original-data-utils/index.js +50 -57
- package/dist/utils/chart-utils/original-data-utils/mirror-calculator.js +19 -26
- package/dist/utils/chart-utils/original-data-utils/pivot-table-calculator.js +94 -97
- package/dist/utils/chart-utils/original-data-utils/scatter-calculator.js +19 -25
- package/dist/utils/chart-utils/original-data-utils/trend-calculator.js +50 -36
- package/dist/utils/chart-utils/sql-statistics-utils.js +385 -388
- package/dist/utils/chart.js +9 -17
- package/dist/utils/collaborator-manager.js +3 -9
- package/dist/utils/collaborator-utils.js +19 -31
- package/dist/utils/collaborator.js +6 -15
- package/dist/utils/color-utils.js +18 -29
- package/dist/utils/column-utils.js +88 -102
- package/dist/utils/common-utils.js +28 -53
- package/dist/utils/concurrency-manager.js +1 -7
- package/dist/utils/contexts.js +7 -11
- package/dist/utils/date-translate.js +12 -20
- 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 +73 -219
- package/dist/utils/key-generator.js +2 -9
- package/dist/utils/map.js +22 -31
- package/dist/utils/object-utils.js +2 -8
- package/dist/utils/options-utils.js +10 -18
- package/dist/utils/row-record-utils.js +251 -183
- package/dist/utils/row-utils.js +27 -38
- package/dist/utils/search.js +24 -32
- package/dist/utils/sql/chart-data-sql.js +106 -112
- package/dist/utils/sql/column-2-sql-column.js +162 -172
- package/dist/utils/sql/index.js +3 -27
- package/dist/utils/trend-utils.js +50 -45
- package/dist/view/index.css +2 -8
- package/dist/view/index.js +102 -103
- package/dist/view/title/index.js +16 -24
- package/dist/view/wrapper/area-group.js +57 -57
- package/dist/view/wrapper/area.js +43 -51
- package/dist/view/wrapper/bar-compare.js +56 -48
- package/dist/view/wrapper/bar-custom-stack.js +73 -55
- package/dist/view/wrapper/bar-group.js +94 -73
- package/dist/view/wrapper/bar-stack.js +49 -57
- package/dist/view/wrapper/bar.js +40 -48
- package/dist/view/wrapper/basic-number-card.js +50 -34
- package/dist/view/wrapper/chart-component.js +164 -569
- package/dist/view/wrapper/combination.js +55 -63
- package/dist/view/wrapper/completeness-group.js +140 -93
- package/dist/view/wrapper/completeness.js +36 -44
- package/dist/view/wrapper/dashboard.js +104 -59
- package/dist/view/wrapper/funnel.js +40 -43
- package/dist/view/wrapper/heat-map.js +62 -70
- package/dist/view/wrapper/horizontal-bar-group.js +70 -58
- package/dist/view/wrapper/horizontal-bar-stack.js +48 -56
- package/dist/view/wrapper/horizontal-bar.js +41 -49
- package/dist/view/wrapper/index.js +107 -115
- package/dist/view/wrapper/line-group.js +49 -52
- package/dist/view/wrapper/line.js +42 -50
- package/dist/view/wrapper/map-bubble.js +40 -48
- package/dist/view/wrapper/map-world-bubble.js +40 -47
- package/dist/view/wrapper/map-world.js +42 -49
- package/dist/view/wrapper/map.js +42 -50
- package/dist/view/wrapper/mirror.js +41 -49
- package/dist/view/wrapper/pie.js +45 -53
- package/dist/view/wrapper/ring.js +50 -58
- package/dist/view/wrapper/scatter.js +50 -56
- package/dist/view/wrapper/table/index.js +14 -22
- 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 +53 -61
- package/dist/view/wrapper/table/pivot-table-display-name.js +82 -90
- package/dist/view/wrapper/table/two-dimension-table.js +85 -92
- package/dist/view/wrapper/table-element/components/dataset-utils.js +23 -36
- package/dist/view/wrapper/table-element/components/formatter.js +90 -99
- package/dist/view/wrapper/table-element/components/formatters/FileFormatter/index.js +23 -32
- package/dist/view/wrapper/table-element/components/formatters/formula-formatter.js +9 -16
- package/dist/view/wrapper/table-element/components/formatters/link-formatter.js +90 -97
- package/dist/view/wrapper/table-element/components/formula-formatter.js +9 -16
- package/dist/view/wrapper/table-element/components/link-formatter.js +90 -97
- package/dist/view/wrapper/table-element/components/record.js +13 -20
- package/dist/view/wrapper/table-element/components/records-body.js +9 -17
- package/dist/view/wrapper/table-element/components/records-header/index.js +7 -16
- package/dist/view/wrapper/table-element/components/records-header/records-header-cell.js +8 -16
- package/dist/view/wrapper/table-element/components/records.js +25 -33
- package/dist/view/wrapper/table-element/components/resize-column-handle/resize-column-handle.js +8 -13
- package/dist/view/wrapper/table-element/components/utils.js +6 -16
- 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 +30 -43
- package/dist/view/wrapper/treemap.js +38 -46
- package/dist/view/wrapper/trend.js +80 -65
- package/package.json +15 -12
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var _style = require("../../constants/style");
|
|
18
|
-
var _constants = require("../../constants");
|
|
19
|
-
var _utils = require("../../utils");
|
|
20
|
-
var _intl = _interopRequireDefault(require("../../intl"));
|
|
21
|
-
var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
|
|
22
|
-
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
23
|
-
_dayjs.default.extend(_dayOfYear.default);
|
|
24
|
-
class HeatMap extends _chartComponent.default {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { debounce } from 'lodash-es';
|
|
4
|
+
import * as d3 from 'd3';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import dayjs from 'dayjs';
|
|
7
|
+
import { getTableById, getTableColumnByKey, getNumberDisplayString } from 'dtable-utils';
|
|
8
|
+
import dayOfYear from 'dayjs/plugin/dayOfYear';
|
|
9
|
+
import { FILL_BORDER_COLOR_MAP, COLOR_OPTIONS } from '../../constants/style';
|
|
10
|
+
import { DEFAULT_GRID_SIZE, DEFAULT_GRID_DISTANCE, DEFAULT_NUMBER_FORMAT_OBJECT, CHART_SUMMARY_TYPE, TITLE_AMOUNT } from '../../constants';
|
|
11
|
+
import { BaseUtils } from '../../utils';
|
|
12
|
+
import intl from '../../intl';
|
|
13
|
+
import ToolTip from '../../components/tooltip';
|
|
14
|
+
import ChartComponent from './chart-component';
|
|
15
|
+
dayjs.extend(dayOfYear);
|
|
16
|
+
class HeatMap extends ChartComponent {
|
|
25
17
|
constructor(props) {
|
|
26
18
|
super(props);
|
|
27
19
|
this.handleResize = () => {
|
|
@@ -65,8 +57,8 @@ class HeatMap extends _chartComponent.default {
|
|
|
65
57
|
grid_size,
|
|
66
58
|
grid_distance
|
|
67
59
|
} = chartConfig;
|
|
68
|
-
grid_size = grid_size ||
|
|
69
|
-
grid_distance = grid_distance ||
|
|
60
|
+
grid_size = grid_size || DEFAULT_GRID_SIZE;
|
|
61
|
+
grid_distance = grid_distance || DEFAULT_GRID_DISTANCE;
|
|
70
62
|
const yearHeight = grid_size * 7 + grid_distance * 6; // height for 1 year
|
|
71
63
|
const height = (yearHeight + monthAxisHeight) * count + (insertPadding + insertPadding); // monthAxisHeight is axis height, insertPadding is top and bottm height
|
|
72
64
|
const width = grid_size * 53 + grid_distance * 52 + (insertPadding + insertPadding); // insertPadding is left and right width
|
|
@@ -84,8 +76,8 @@ class HeatMap extends _chartComponent.default {
|
|
|
84
76
|
title: data.name,
|
|
85
77
|
items: [{
|
|
86
78
|
color: '',
|
|
87
|
-
name:
|
|
88
|
-
value:
|
|
79
|
+
name: intl.get(TITLE_AMOUNT),
|
|
80
|
+
value: getNumberDisplayString(data.value, columnData)
|
|
89
81
|
}]
|
|
90
82
|
};
|
|
91
83
|
this.setState({
|
|
@@ -138,17 +130,17 @@ class HeatMap extends _chartComponent.default {
|
|
|
138
130
|
summary_type,
|
|
139
131
|
summary_column
|
|
140
132
|
} = chart.config;
|
|
141
|
-
grid_size = grid_size ? grid_size :
|
|
142
|
-
const currentColorOption =
|
|
133
|
+
grid_size = grid_size ? grid_size : DEFAULT_GRID_SIZE;
|
|
134
|
+
const currentColorOption = COLOR_OPTIONS.filter(item => item.name === data_color)[0] || COLOR_OPTIONS[0];
|
|
143
135
|
const {
|
|
144
136
|
exampleColors
|
|
145
137
|
} = currentColorOption;
|
|
146
138
|
const themeColors = this.getThemeColors();
|
|
147
|
-
let columnData =
|
|
148
|
-
if (summary_type ===
|
|
149
|
-
const table =
|
|
150
|
-
const summaryColumn =
|
|
151
|
-
columnData = summaryColumn.data ||
|
|
139
|
+
let columnData = DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
140
|
+
if (summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
141
|
+
const table = getTableById(tables, table_id);
|
|
142
|
+
const summaryColumn = getTableColumnByKey(table, summary_column) || {};
|
|
143
|
+
columnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
152
144
|
}
|
|
153
145
|
const yAxisWrapper = this.chart.append('g').attr('class', 'y-axis-wrapper');
|
|
154
146
|
const xAxisWrapper = this.chart.append('g').attr('class', 'x-axis-wrapper');
|
|
@@ -161,7 +153,7 @@ class HeatMap extends _chartComponent.default {
|
|
|
161
153
|
Array.from(fyDomain).forEach((year, index) => {
|
|
162
154
|
// Y axis
|
|
163
155
|
const y = d3.scaleBand().domain(this.weeks).range([fy(year), fy(year) + (fy.bandwidth() - monthAxisHeight)]).paddingInner(0).paddingOuter(0);
|
|
164
|
-
yAxisWrapper.append('g').attr('class',
|
|
156
|
+
yAxisWrapper.append('g').attr('class', `y-axis-${year}`).attr('transform', `translate(${insertPadding}, 0)`).call(d3.axisLeft(y).tickSizeInner(0).tickSizeOuter(0).tickFormat(d => intl.get(d))).call(g => {
|
|
165
157
|
g.select('.domain').remove();
|
|
166
158
|
g.selectAll('text').attr('font-size', 12);
|
|
167
159
|
g.selectAll('text').attr('fill', themeColors.textColor);
|
|
@@ -176,15 +168,15 @@ class HeatMap extends _chartComponent.default {
|
|
|
176
168
|
const weekScale = d3.scaleBand().domain(weekDomain).range([insertPadding, chartWidth - insertPadding]).paddingInner(0).paddingOuter(0);
|
|
177
169
|
|
|
178
170
|
// year
|
|
179
|
-
const yearWrapper = contentWrapper.append('g').attr('class',
|
|
171
|
+
const yearWrapper = contentWrapper.append('g').attr('class', `year-wrapper-${year}`);
|
|
180
172
|
dates.forEach(_ref => {
|
|
181
173
|
let [monthIndex, days] = _ref;
|
|
182
174
|
// month
|
|
183
|
-
const monthWrapper = yearWrapper.append('g').attr('class',
|
|
175
|
+
const monthWrapper = yearWrapper.append('g').attr('class', `month-${this.months[monthIndex]}`);
|
|
184
176
|
// day
|
|
185
177
|
days.forEach((d, index) => {
|
|
186
|
-
monthWrapper.append('rect').attr('class', () =>
|
|
187
|
-
let curWeek = (
|
|
178
|
+
monthWrapper.append('rect').attr('class', () => `day-${dayjs(d).dayOfYear()}`).attr('x', () => {
|
|
179
|
+
let curWeek = dayjs(d).week();
|
|
188
180
|
// The last few days are the first week of the next year
|
|
189
181
|
if (monthIndex === 11 && curWeek === 1) {
|
|
190
182
|
curWeek = weekCount;
|
|
@@ -194,20 +186,20 @@ class HeatMap extends _chartComponent.default {
|
|
|
194
186
|
} // Record the x position of the first day of each month
|
|
195
187
|
return weekScale(curWeek);
|
|
196
188
|
}).attr('y', () => {
|
|
197
|
-
const curWeek = this.weeks[(
|
|
189
|
+
const curWeek = this.weeks[dayjs(d).day()];
|
|
198
190
|
return y(curWeek);
|
|
199
191
|
}).attr('width', grid_size).attr('height', grid_size).attr('rx', grid_size * borderRadius).attr('fill', () => this.getRectColor(d, data, 'fill', exampleColors)).attr('stroke', () => this.getRectColor(d, data, 'stroke', exampleColors)).attr('stroke-width', 1).on('click', () => {
|
|
200
|
-
const curDate = data.find(item => item.name === (
|
|
192
|
+
const curDate = data.find(item => item.name === dayjs(d).format('YYYY-MM-DD'));
|
|
201
193
|
if (curDate) {
|
|
202
194
|
this.props.toggleRecords(curDate);
|
|
203
195
|
}
|
|
204
196
|
}).on('mouseover', event => {
|
|
205
|
-
const curDate = data.find(item => item.name === (
|
|
197
|
+
const curDate = data.find(item => item.name === dayjs(d).format('YYYY-MM-DD'));
|
|
206
198
|
if (curDate) {
|
|
207
199
|
this.showTooltip(event, curDate, columnData);
|
|
208
200
|
}
|
|
209
201
|
}).on('mousemove', event => {
|
|
210
|
-
const curDate = data.find(item => item.name === (
|
|
202
|
+
const curDate = data.find(item => item.name === dayjs(d).format('YYYY-MM-DD'));
|
|
211
203
|
if (curDate) {
|
|
212
204
|
this.moveTooltip(event);
|
|
213
205
|
}
|
|
@@ -219,18 +211,18 @@ class HeatMap extends _chartComponent.default {
|
|
|
219
211
|
|
|
220
212
|
// X axis
|
|
221
213
|
const x = d3.scalePoint().domain(this.months).range([insertPadding, chartWidth - insertPadding]);
|
|
222
|
-
xAxisWrapper.append('g').attr('class',
|
|
214
|
+
xAxisWrapper.append('g').attr('class', `x-axis-${year}`).attr('transform', `translate(0, ${fy(year) + fy.bandwidth() - monthAxisHeight})`).call(d3.axisBottom(x).tickSizeInner(0).tickSizeOuter(0).tickFormat(d => intl.get(d))).call(g => {
|
|
223
215
|
g.select('.domain').remove();
|
|
224
216
|
g.selectAll('.tick').nodes().forEach((item, index) => {
|
|
225
217
|
const curTranslateX = monthTranslateX[index] + weekScale.bandwidth() / 2;
|
|
226
|
-
d3.select(item).attr('transform',
|
|
218
|
+
d3.select(item).attr('transform', `translate(${curTranslateX}, 0)`);
|
|
227
219
|
});
|
|
228
220
|
g.selectAll('text').attr('font-size', 12);
|
|
229
221
|
g.selectAll('text').attr('fill', themeColors.textColor);
|
|
230
222
|
});
|
|
231
223
|
|
|
232
224
|
// Title
|
|
233
|
-
titleWrapper.append('text').attr('class',
|
|
225
|
+
titleWrapper.append('text').attr('class', `text-${year}`).attr('x', 0).attr('y', fy(year) + fy.bandwidth()).attr('fill', '#000').attr('font-size', 12).attr('font-weight', 500).text(year);
|
|
234
226
|
});
|
|
235
227
|
this.setLegendForHeatMap({
|
|
236
228
|
exampleColors: ['#EBEDF0', ...exampleColors],
|
|
@@ -239,27 +231,27 @@ class HeatMap extends _chartComponent.default {
|
|
|
239
231
|
};
|
|
240
232
|
this.generateYearDates = year => {
|
|
241
233
|
const dates = [];
|
|
242
|
-
let current = (
|
|
234
|
+
let current = dayjs(`${year}-01-01`);
|
|
243
235
|
while (current.year() === year) {
|
|
244
236
|
dates.push(current);
|
|
245
237
|
current = current.add(1, 'day');
|
|
246
238
|
}
|
|
247
239
|
const weekCount = Math.ceil(dates.length / 7);
|
|
248
|
-
return [d3.groups(dates, d => (
|
|
240
|
+
return [d3.groups(dates, d => dayjs(d).month()), weekCount];
|
|
249
241
|
};
|
|
250
242
|
this.getRectColor = (d, data, type, exampleColors) => {
|
|
251
243
|
const maxVal = d3.max(data, d => d.value);
|
|
252
244
|
const defaultColor = type === 'stroke' ? '#E1E3E6' : '#EBEDF0';
|
|
253
|
-
const curDate = data.find(item => item.name === (
|
|
245
|
+
const curDate = data.find(item => item.name === dayjs(d).format('YYYY-MM-DD'));
|
|
254
246
|
if (curDate) {
|
|
255
247
|
if (curDate.value <= 0) return defaultColor;
|
|
256
|
-
if (curDate.value === maxVal) return type === 'stroke' ?
|
|
248
|
+
if (curDate.value === maxVal) return type === 'stroke' ? FILL_BORDER_COLOR_MAP[exampleColors[8]] : exampleColors[8];
|
|
257
249
|
const curColor = Math.floor(curDate.value / (maxVal / 9));
|
|
258
|
-
return type === 'stroke' ?
|
|
250
|
+
return type === 'stroke' ? FILL_BORDER_COLOR_MAP[exampleColors[curColor]] : exampleColors[curColor];
|
|
259
251
|
}
|
|
260
252
|
return defaultColor;
|
|
261
253
|
};
|
|
262
|
-
|
|
254
|
+
dayjs.locale('en');
|
|
263
255
|
this.weeks = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
264
256
|
this.months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
265
257
|
this.chart = null;
|
|
@@ -271,12 +263,12 @@ class HeatMap extends _chartComponent.default {
|
|
|
271
263
|
componentDidMount() {
|
|
272
264
|
this.createChart();
|
|
273
265
|
this.drawChart();
|
|
274
|
-
this.debouncedHandleResize =
|
|
266
|
+
this.debouncedHandleResize = debounce(this.handleResize, 300);
|
|
275
267
|
window.addEventListener('resize', this.debouncedHandleResize);
|
|
276
268
|
}
|
|
277
269
|
componentDidUpdate(prevProps) {
|
|
278
270
|
super.componentDidUpdate(prevProps);
|
|
279
|
-
if (
|
|
271
|
+
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
280
272
|
this.destroyChart();
|
|
281
273
|
this.createChart();
|
|
282
274
|
this.drawChart();
|
|
@@ -294,13 +286,13 @@ class HeatMap extends _chartComponent.default {
|
|
|
294
286
|
tooltipData,
|
|
295
287
|
toolTipPosition
|
|
296
288
|
} = this.state;
|
|
297
|
-
return /*#__PURE__*/
|
|
289
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
298
290
|
ref: ref => this.container = ref,
|
|
299
|
-
className: (
|
|
291
|
+
className: classNames('sea-chart-container', {
|
|
300
292
|
'show-x-axis-label': this.isShowXAxisLabel(chart),
|
|
301
293
|
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
302
294
|
})
|
|
303
|
-
}, /*#__PURE__*/
|
|
295
|
+
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
304
296
|
tooltipData: tooltipData,
|
|
305
297
|
toolTipPosition: toolTipPosition,
|
|
306
298
|
chart: this.chart
|
|
@@ -308,16 +300,16 @@ class HeatMap extends _chartComponent.default {
|
|
|
308
300
|
}
|
|
309
301
|
}
|
|
310
302
|
HeatMap.propTypes = {
|
|
311
|
-
canvasStyle:
|
|
312
|
-
chart:
|
|
313
|
-
groupbyColumn:
|
|
314
|
-
columnGroupbyColumn:
|
|
315
|
-
summaryColumn:
|
|
316
|
-
result:
|
|
317
|
-
tables:
|
|
318
|
-
globalTheme:
|
|
319
|
-
chartColorTheme:
|
|
320
|
-
toggleRecords:
|
|
321
|
-
customRender:
|
|
303
|
+
canvasStyle: PropTypes.object,
|
|
304
|
+
chart: PropTypes.object,
|
|
305
|
+
groupbyColumn: PropTypes.object,
|
|
306
|
+
columnGroupbyColumn: PropTypes.object,
|
|
307
|
+
summaryColumn: PropTypes.object,
|
|
308
|
+
result: PropTypes.object,
|
|
309
|
+
tables: PropTypes.array,
|
|
310
|
+
globalTheme: PropTypes.string,
|
|
311
|
+
chartColorTheme: PropTypes.string,
|
|
312
|
+
toggleRecords: PropTypes.func,
|
|
313
|
+
customRender: PropTypes.func
|
|
322
314
|
};
|
|
323
|
-
|
|
315
|
+
export default HeatMap;
|
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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 HorizontalBarGroup extends _chartComponent.default {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { debounce, cloneDeep } from 'lodash-es';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import * as d3 from 'd3';
|
|
6
|
+
import { CellType } from 'dtable-utils';
|
|
7
|
+
import dayjs from 'dayjs';
|
|
8
|
+
import { CHART_TYPE, EMPTY_NAME, CHART_THEME_COLOR, CHART_STYLE_COLORS } from '../../constants';
|
|
9
|
+
import { BaseUtils, isFunction } from '../../utils';
|
|
10
|
+
import intl from '../../intl';
|
|
11
|
+
import { SUPPORT_SINGLE_SELECT_THEMES_OPTIONS } from '../../constants/color-rules';
|
|
12
|
+
import { sortDataByGroupSum } from '../../utils/column-utils';
|
|
13
|
+
import ToolTip from '../../components/tooltip';
|
|
14
|
+
import ChartComponent from './chart-component';
|
|
15
|
+
class HorizontalBarGroup extends ChartComponent {
|
|
23
16
|
constructor(props) {
|
|
24
17
|
super(props);
|
|
25
|
-
this.handleResize =
|
|
18
|
+
this.handleResize = debounce(() => {
|
|
26
19
|
this.destroyChart();
|
|
27
20
|
this.createChart();
|
|
28
21
|
this.drawChart();
|
|
@@ -51,17 +44,20 @@ class HorizontalBarGroup extends _chartComponent.default {
|
|
|
51
44
|
customRender,
|
|
52
45
|
chart
|
|
53
46
|
} = this.props;
|
|
54
|
-
|
|
47
|
+
const {
|
|
48
|
+
column_groupby_column_key
|
|
49
|
+
} = chart.config || {};
|
|
50
|
+
data = BaseUtils.formatEmptyName(data, column_groupby_column_key, intl.get(EMPTY_NAME));
|
|
55
51
|
if (!Array.isArray(data)) return;
|
|
56
52
|
const {
|
|
57
53
|
sort_type,
|
|
58
54
|
type
|
|
59
55
|
} = chart.config;
|
|
60
|
-
if (type ===
|
|
61
|
-
data =
|
|
56
|
+
if (type === CHART_TYPE.STACKED_HORIZONTAL_BAR && sort_type) {
|
|
57
|
+
data = sortDataByGroupSum(data, sort_type);
|
|
62
58
|
}
|
|
63
59
|
this.draw(data);
|
|
64
|
-
|
|
60
|
+
isFunction(customRender) && customRender(this.chart);
|
|
65
61
|
this.renderHorizontalLabel(this.props.chart, this.props.tables, this.container);
|
|
66
62
|
};
|
|
67
63
|
this.draw = data => {
|
|
@@ -73,7 +69,7 @@ class HorizontalBarGroup extends _chartComponent.default {
|
|
|
73
69
|
columnGroupbyColumn,
|
|
74
70
|
summaryColumn
|
|
75
71
|
} = this.props;
|
|
76
|
-
const theme =
|
|
72
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
77
73
|
const {
|
|
78
74
|
display_data,
|
|
79
75
|
label_font_size,
|
|
@@ -92,10 +88,25 @@ class HorizontalBarGroup extends _chartComponent.default {
|
|
|
92
88
|
marginRight
|
|
93
89
|
} = this.chartBoundingClientRect;
|
|
94
90
|
const groupByColumn = this.getColumn(tables, table_id, column_groupby_column_key);
|
|
95
|
-
const
|
|
91
|
+
const isGroupByDate = [CellType.DATE, CellType.CTIME, CellType.MTIME].includes(groupByColumn === null || groupByColumn === void 0 ? void 0 : groupByColumn.type);
|
|
92
|
+
if (isGroupByDate) {
|
|
93
|
+
const emptyName = intl.get(EMPTY_NAME);
|
|
94
|
+
data = data.map(item => {
|
|
95
|
+
const rawGroupName = item.group_name;
|
|
96
|
+
if (rawGroupName === null || rawGroupName === undefined || rawGroupName === '') return item;
|
|
97
|
+
if (rawGroupName === emptyName) return item;
|
|
98
|
+
const dateValue = dayjs(rawGroupName);
|
|
99
|
+
if (!dateValue.isValid()) return item;
|
|
100
|
+
return {
|
|
101
|
+
...item,
|
|
102
|
+
group_name: dateValue.format('YYYY-MM-DD')
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
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;
|
|
96
107
|
useSingleSelectColumnColor ? this.setSingleSelectColorMap(data) : this.setColorMap(data, chartColorTheme);
|
|
97
|
-
const fy = d3.scaleBand().domain(new Set(data.map(d => d.name))).range([chartHeight - insertPadding, insertPadding]).paddingInner(0.
|
|
98
|
-
const sortedData =
|
|
108
|
+
const fy = d3.scaleBand().domain(new Set(data.map(d => d.name))).range([chartHeight - insertPadding, insertPadding]).paddingInner(0.3).paddingOuter(0.1);
|
|
109
|
+
const sortedData = BaseUtils.sortDataByGroupName(cloneDeep(data), 'group_name', columnGroupbyColumn, chart);
|
|
99
110
|
const y = d3.scaleBand().domain(new Set(sortedData.map(d => d.group_name))).range([0, fy.bandwidth()]).paddingInner(0).paddingOuter(0);
|
|
100
111
|
|
|
101
112
|
// Y axis
|
|
@@ -108,14 +119,14 @@ class HorizontalBarGroup extends _chartComponent.default {
|
|
|
108
119
|
const {
|
|
109
120
|
width: axisWidth
|
|
110
121
|
} = g.node().getBoundingClientRect();
|
|
111
|
-
g.attr('transform',
|
|
122
|
+
g.attr('transform', `translate(${axisWidth}, 0)`).attr('data-axisWidth', axisWidth);
|
|
112
123
|
this.checkTickOverlap(g, 'yAxis');
|
|
113
124
|
});
|
|
114
125
|
const niceEnd = d3.nice(0, d3.max(data, d => d.value), 5)[1];
|
|
115
126
|
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]);
|
|
116
127
|
|
|
117
128
|
// X axis
|
|
118
|
-
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform',
|
|
129
|
+
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 => {
|
|
119
130
|
g.selectAll('.domain').remove();
|
|
120
131
|
g.selectAll('.tick line').node() && g.selectAll('.tick line').node().remove(); // delete the first line
|
|
121
132
|
g.selectAll('.tick line').attr('y2', -(chartHeight - insertPadding * 2)).attr('stroke', theme.gridColor).attr('stroke-dasharray', '8,3');
|
|
@@ -124,18 +135,18 @@ class HorizontalBarGroup extends _chartComponent.default {
|
|
|
124
135
|
});
|
|
125
136
|
|
|
126
137
|
// Rect group
|
|
127
|
-
const contentWrapper = this.chart.append('g').attr('class', 'content-wrapper').attr('transform',
|
|
138
|
+
const contentWrapper = this.chart.append('g').attr('class', 'content-wrapper').attr('transform', `translate(${Number(yAxis.node().getAttribute('data-axisWidth'))}, 0)`);
|
|
128
139
|
contentWrapper.selectAll().data(d3.group(sortedData, d => d.name)).join('g').attr('transform', _ref => {
|
|
129
140
|
let [name, dum] = _ref;
|
|
130
141
|
const offset = (fy.bandwidth() - dum.length * y.bandwidth()) / 2;
|
|
131
|
-
return
|
|
142
|
+
return `translate(0, ${fy(name) + offset})`;
|
|
132
143
|
})
|
|
133
144
|
// rect item
|
|
134
145
|
.selectAll().data(_ref2 => {
|
|
135
146
|
let [_, d] = _ref2;
|
|
136
147
|
return d;
|
|
137
148
|
}).join('rect').attr('opacity', 1).attr('x', 0).attr('y', (d, index) => index * y.bandwidth()).attr('width', d => x(d.value) - x(0)).attr('height', y.bandwidth()).attr('fill', d => {
|
|
138
|
-
return this.colorMap[d.group_name] ||
|
|
149
|
+
return this.colorMap[d.group_name] || CHART_STYLE_COLORS[0];
|
|
139
150
|
}).attr('value', d => d.value).attr('data-slugid', d => d.slugId).attr('data-groupName', d => d.name).call(g => {
|
|
140
151
|
// add rect borderRadius
|
|
141
152
|
g.nodes().forEach(rect => {
|
|
@@ -158,7 +169,7 @@ class HorizontalBarGroup extends _chartComponent.default {
|
|
|
158
169
|
y: Number(rect.getAttribute('y')),
|
|
159
170
|
theme,
|
|
160
171
|
label_font_size,
|
|
161
|
-
text:
|
|
172
|
+
text: BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(rect.getAttribute('value')), horizontal_axis_summary_method)
|
|
162
173
|
});
|
|
163
174
|
}
|
|
164
175
|
});
|
|
@@ -176,7 +187,7 @@ class HorizontalBarGroup extends _chartComponent.default {
|
|
|
176
187
|
this.setLegend({
|
|
177
188
|
legendName: 'group_name',
|
|
178
189
|
theme,
|
|
179
|
-
legendPosition: 'top-
|
|
190
|
+
legendPosition: 'top-right',
|
|
180
191
|
data,
|
|
181
192
|
groupColumn: this.props.columnGroupbyColumn,
|
|
182
193
|
chart
|
|
@@ -202,13 +213,14 @@ class HorizontalBarGroup extends _chartComponent.default {
|
|
|
202
213
|
const title = event.currentTarget.getAttribute('data-groupName');
|
|
203
214
|
const children = Array.from(event.currentTarget.parentNode.children).filter(item => item.tagName === 'rect');
|
|
204
215
|
const newTooltipData = {
|
|
205
|
-
title: !title && typeof title !== 'number' ?
|
|
216
|
+
title: !title && typeof title !== 'number' ? intl.get(EMPTY_NAME) : title,
|
|
206
217
|
items: children.map(child => {
|
|
207
218
|
const data = child.__data__;
|
|
219
|
+
const groupName = data.group_name === null || data.group_name === undefined || data.group_name === '' ? intl.get(EMPTY_NAME) : data.group_name;
|
|
208
220
|
return {
|
|
209
|
-
color: this.colorMap[
|
|
210
|
-
name:
|
|
211
|
-
value:
|
|
221
|
+
color: this.colorMap[groupName] || CHART_STYLE_COLORS[0],
|
|
222
|
+
name: groupName,
|
|
223
|
+
value: BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(child.getAttribute('value')), horizontal_axis_summary_method)
|
|
212
224
|
};
|
|
213
225
|
})
|
|
214
226
|
};
|
|
@@ -252,7 +264,7 @@ class HorizontalBarGroup extends _chartComponent.default {
|
|
|
252
264
|
}
|
|
253
265
|
componentDidUpdate(prevProps) {
|
|
254
266
|
super.componentDidUpdate(prevProps);
|
|
255
|
-
if (
|
|
267
|
+
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
256
268
|
this.destroyChart();
|
|
257
269
|
this.createChart();
|
|
258
270
|
this.drawChart();
|
|
@@ -270,13 +282,13 @@ class HorizontalBarGroup extends _chartComponent.default {
|
|
|
270
282
|
tooltipData,
|
|
271
283
|
toolTipPosition
|
|
272
284
|
} = this.state;
|
|
273
|
-
return /*#__PURE__*/
|
|
285
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
274
286
|
ref: ref => this.container = ref,
|
|
275
|
-
className: (
|
|
287
|
+
className: classNames('sea-chart-container', {
|
|
276
288
|
'show-x-axis-label': this.isShowHorizontalAxisLabel(chart),
|
|
277
289
|
'show-y-axis-label': this.isShowVerticalAxisLabel(chart)
|
|
278
290
|
})
|
|
279
|
-
}, /*#__PURE__*/
|
|
291
|
+
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
280
292
|
tooltipData: tooltipData,
|
|
281
293
|
toolTipPosition: toolTipPosition,
|
|
282
294
|
chart: this.chart
|
|
@@ -284,16 +296,16 @@ class HorizontalBarGroup extends _chartComponent.default {
|
|
|
284
296
|
}
|
|
285
297
|
}
|
|
286
298
|
HorizontalBarGroup.propTypes = {
|
|
287
|
-
canvasStyle:
|
|
288
|
-
chart:
|
|
289
|
-
groupbyColumn:
|
|
290
|
-
columnGroupbyColumn:
|
|
291
|
-
summaryColumn:
|
|
292
|
-
result:
|
|
293
|
-
tables:
|
|
294
|
-
globalTheme:
|
|
295
|
-
chartColorTheme:
|
|
296
|
-
toggleRecords:
|
|
297
|
-
customRender:
|
|
299
|
+
canvasStyle: PropTypes.object,
|
|
300
|
+
chart: PropTypes.object,
|
|
301
|
+
groupbyColumn: PropTypes.object,
|
|
302
|
+
columnGroupbyColumn: PropTypes.object,
|
|
303
|
+
summaryColumn: PropTypes.object,
|
|
304
|
+
result: PropTypes.array,
|
|
305
|
+
tables: PropTypes.array,
|
|
306
|
+
globalTheme: PropTypes.string,
|
|
307
|
+
chartColorTheme: PropTypes.string,
|
|
308
|
+
toggleRecords: PropTypes.func,
|
|
309
|
+
customRender: PropTypes.func
|
|
298
310
|
};
|
|
299
|
-
|
|
311
|
+
export default HorizontalBarGroup;
|