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,31 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _lodashEs = require("lodash-es");
|
|
13
|
-
var _dtableUtils = require("dtable-utils");
|
|
14
|
-
var d3 = _interopRequireWildcard(require("d3"));
|
|
15
|
-
var _constants = require("../../constants");
|
|
16
|
-
var _colorRules = require("../../constants/color-rules");
|
|
17
|
-
var _intl = _interopRequireDefault(require("../../intl"));
|
|
18
|
-
var _utils = require("../../utils");
|
|
19
|
-
var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
|
|
20
|
-
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
21
|
-
class AreaGroup extends _chartComponent.default {
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { CellType } from 'dtable-utils';
|
|
4
|
+
import * as d3 from 'd3';
|
|
5
|
+
import { CHART_LINE_TYPES, CHART_THEME_COLOR } from '../../constants';
|
|
6
|
+
import { SUPPORT_SINGLE_SELECT_THEMES_OPTIONS } from '../../constants/color-rules';
|
|
7
|
+
import intl from '../../intl';
|
|
8
|
+
import { BaseUtils, isFunction } from '../../utils';
|
|
9
|
+
import ToolTip from '../../components/tooltip';
|
|
10
|
+
import ChartComponent from './chart-component';
|
|
11
|
+
class AreaGroup extends ChartComponent {
|
|
22
12
|
constructor(props) {
|
|
23
13
|
super(props);
|
|
24
|
-
this.handleResize = () => {
|
|
25
|
-
this.destroyChart();
|
|
26
|
-
this.createChart();
|
|
27
|
-
this.drawChart();
|
|
28
|
-
};
|
|
29
14
|
this.createChart = () => {
|
|
30
15
|
const {
|
|
31
16
|
chart
|
|
@@ -37,8 +22,8 @@ class AreaGroup extends _chartComponent.default {
|
|
|
37
22
|
} = chart.config;
|
|
38
23
|
const initConfig = {
|
|
39
24
|
insertPadding: 30,
|
|
40
|
-
marginLeft: y_axis_show_label ?
|
|
41
|
-
marginBottom: x_axis_show_label ?
|
|
25
|
+
marginLeft: y_axis_show_label ? this.getAxisTitleHeight(chart.config.y_axis_label_font_size) : 0,
|
|
26
|
+
marginBottom: x_axis_show_label ? this.getAxisTitleHeight(chart.config.x_axis_label_font_size) : 0,
|
|
42
27
|
marginTop: y_axis_show_value ? 15 : 0
|
|
43
28
|
};
|
|
44
29
|
this.initChart(this.container, chart === null || chart === void 0 ? void 0 : chart.id, initConfig);
|
|
@@ -48,13 +33,15 @@ class AreaGroup extends _chartComponent.default {
|
|
|
48
33
|
result: data,
|
|
49
34
|
customRender
|
|
50
35
|
} = this.props;
|
|
51
|
-
data =
|
|
36
|
+
data = BaseUtils.formatEmptyName(data, 'group_name', 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.renderAxisLabel(this.props.chart, this.props.tables, this.container);
|
|
56
41
|
};
|
|
57
42
|
this.draw = data => {
|
|
43
|
+
const fullData = data;
|
|
44
|
+
data = this.getVisibleLegendData(data, 'group_name');
|
|
58
45
|
const {
|
|
59
46
|
chart,
|
|
60
47
|
globalTheme,
|
|
@@ -63,7 +50,7 @@ class AreaGroup extends _chartComponent.default {
|
|
|
63
50
|
chartColorTheme,
|
|
64
51
|
summaryColumn
|
|
65
52
|
} = this.props;
|
|
66
|
-
const theme =
|
|
53
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
67
54
|
const {
|
|
68
55
|
display_goal_line,
|
|
69
56
|
goal_label,
|
|
@@ -89,14 +76,14 @@ class AreaGroup extends _chartComponent.default {
|
|
|
89
76
|
insertPadding,
|
|
90
77
|
marginTop
|
|
91
78
|
} = this.chartBoundingClientRect;
|
|
92
|
-
const useSingleSelectColumnColor = (columnGroupbyColumn === null || columnGroupbyColumn === void 0 ? void 0 : columnGroupbyColumn.type) ===
|
|
93
|
-
useSingleSelectColumnColor ? this.setSingleSelectColorMap(
|
|
79
|
+
const useSingleSelectColumnColor = (columnGroupbyColumn === null || columnGroupbyColumn === void 0 ? void 0 : columnGroupbyColumn.type) === CellType.SINGLE_SELECT && color_theme === SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.SINGLE_SELECT_COLUMN_COLORS;
|
|
80
|
+
useSingleSelectColumnColor ? this.setSingleSelectColorMap(fullData) : this.setColorMap(fullData, chartColorTheme, 'group_name', columnGroupbyColumn, chart);
|
|
94
81
|
const tooltipTitle = this.getTitle(tables, table_id, y_axis_summary_type, y_axis_column_key || y_axis_summary_column_key);
|
|
95
82
|
|
|
96
83
|
// Y axis
|
|
97
84
|
const niceEnd = d3.nice(0, d3.max(data, d => d.value), 5)[1];
|
|
98
85
|
const y = d3.scaleLinear().domain(y_axis_auto_range ? [0, niceEnd] : [y_axis_min || 0, y_axis_max || niceEnd]).range([chartHeight - insertPadding, insertPadding + marginTop]);
|
|
99
|
-
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform', `translate(${insertPadding}, 0)`).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d =>
|
|
86
|
+
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform', `translate(${insertPadding}, 0)`).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d => BaseUtils.getSummaryValueDisplayString(summaryColumn, d, y_axis_summary_method))).call(g => this.drawYaxis(g, theme));
|
|
100
87
|
|
|
101
88
|
// X axis
|
|
102
89
|
const xDomain = data.map(item => item.name);
|
|
@@ -122,13 +109,14 @@ class AreaGroup extends _chartComponent.default {
|
|
|
122
109
|
circleData[index]['x'] = xVal;
|
|
123
110
|
circleData[index]['name'] = d.name;
|
|
124
111
|
circleData[index]['group_name'] = group_name;
|
|
112
|
+
circleData[index]['originalData'] = d;
|
|
125
113
|
return xVal;
|
|
126
114
|
}).y((d, index) => {
|
|
127
115
|
const yVal = y(d.value);
|
|
128
116
|
circleData[index]['y'] = yVal;
|
|
129
117
|
circleData[index]['value'] = d.value;
|
|
130
118
|
return yVal;
|
|
131
|
-
}).curve(line_type ===
|
|
119
|
+
}).curve(line_type === CHART_LINE_TYPES[1] ? d3.curveBumpX : d3.curveLinear);
|
|
132
120
|
contentWrapper.append('path').attr('opacity', 1).attr('fill', 'none').attr('class', 'line').attr('stroke', this.colorMap[group_name]).attr('stroke-width', 2).attr('d', () => line(data));
|
|
133
121
|
circleDatas.push({
|
|
134
122
|
group_name,
|
|
@@ -142,7 +130,7 @@ class AreaGroup extends _chartComponent.default {
|
|
|
142
130
|
const area = d3.area().x(d => {
|
|
143
131
|
const xVal = x(d.name) + x.bandwidth() / 2;
|
|
144
132
|
return xVal;
|
|
145
|
-
}).y0(y(0)).y1(d => y(d.value)).curve(line_type ===
|
|
133
|
+
}).y0(y(0)).y1(d => y(d.value)).curve(line_type === CHART_LINE_TYPES[1] ? d3.curveBumpX : d3.curveLinear);
|
|
146
134
|
contentWrapper.append('path').attr('class', 'area').attr('fill', this.colorMap[group_name]).attr('d', () => area(data)).attr('opacity', '0.3');
|
|
147
135
|
});
|
|
148
136
|
|
|
@@ -154,11 +142,11 @@ class AreaGroup extends _chartComponent.default {
|
|
|
154
142
|
} = _ref3;
|
|
155
143
|
circleData.forEach(item => {
|
|
156
144
|
if (Object.keys(item).length !== 0) {
|
|
157
|
-
contentWrapper.append('circle').attr('cx', item.x).attr('cy', item.y).attr('r', 3).attr('fill', this.colorMap[group_name]).attr('opacity', y_axis_show_value ? 1 : 0).attr('data-text', item.value).attr('data-name', item.name).call(g => {
|
|
145
|
+
contentWrapper.append('circle').datum(item).attr('cx', item.x).attr('cy', item.y).attr('r', 3).attr('fill', this.colorMap[group_name]).attr('opacity', y_axis_show_value ? 1 : 0).attr('data-text', item.value).attr('data-name', item.name).call(g => {
|
|
158
146
|
// circle label
|
|
159
147
|
if (y_axis_show_value) {
|
|
160
148
|
const curCircleEl = g.node();
|
|
161
|
-
contentWrapper.append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('fill', theme.labelColor).attr('font-size',
|
|
149
|
+
contentWrapper.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(summaryColumn, Number(curCircleEl.getAttribute('data-text')), y_axis_summary_method)).call(g => {
|
|
162
150
|
const {
|
|
163
151
|
width
|
|
164
152
|
} = g.node().getBoundingClientRect();
|
|
@@ -168,11 +156,15 @@ class AreaGroup extends _chartComponent.default {
|
|
|
168
156
|
});
|
|
169
157
|
}
|
|
170
158
|
}).on('click', (event, data) => {
|
|
171
|
-
this.props.toggleRecords(data);
|
|
159
|
+
this.props.toggleRecords(data.originalData || data);
|
|
172
160
|
});
|
|
173
161
|
}
|
|
174
162
|
});
|
|
175
163
|
});
|
|
164
|
+
this.animateFadeIn(contentWrapper.selectAll('.line'));
|
|
165
|
+
this.animateFadeIn(contentWrapper.selectAll('.area'));
|
|
166
|
+
this.animateFadeIn(contentWrapper.selectAll('circle'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
167
|
+
this.animateFadeIn(contentWrapper.selectAll('text'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
176
168
|
this.chart.on('mouseover', event => {
|
|
177
169
|
this.updateCircleAndTickStyle({
|
|
178
170
|
event,
|
|
@@ -208,7 +200,7 @@ class AreaGroup extends _chartComponent.default {
|
|
|
208
200
|
legendName: 'group_name',
|
|
209
201
|
theme,
|
|
210
202
|
legendPosition: 'top-right',
|
|
211
|
-
data,
|
|
203
|
+
data: fullData,
|
|
212
204
|
groupColumn: this.props.columnGroupbyColumn,
|
|
213
205
|
chart
|
|
214
206
|
});
|
|
@@ -252,10 +244,10 @@ class AreaGroup extends _chartComponent.default {
|
|
|
252
244
|
d3.select(circle).attr('r', 3);
|
|
253
245
|
}
|
|
254
246
|
});
|
|
255
|
-
contentWrapper.selectAll('.area').transition().duration(this.
|
|
256
|
-
contentWrapper.selectAll('.line').transition().duration(this.
|
|
247
|
+
contentWrapper.selectAll('.area').transition().duration(this.interactionDuration).attr('opacity', 0.1);
|
|
248
|
+
contentWrapper.selectAll('.line').transition().duration(this.interactionDuration).attr('opacity', 0.3);
|
|
257
249
|
// line
|
|
258
|
-
const theme =
|
|
250
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
259
251
|
this.clearOldVerticalAnnotation(contentWrapper);
|
|
260
252
|
this.addVerticalAnnotation(contentWrapper, minDistanceItem, theme);
|
|
261
253
|
} else {
|
|
@@ -268,8 +260,8 @@ class AreaGroup extends _chartComponent.default {
|
|
|
268
260
|
}
|
|
269
261
|
d3.select(circle).attr('r', 3);
|
|
270
262
|
});
|
|
271
|
-
contentWrapper.selectAll('.area').transition().duration(this.
|
|
272
|
-
contentWrapper.selectAll('.line').transition().duration(this.
|
|
263
|
+
contentWrapper.selectAll('.area').transition().duration(this.interactionDuration).attr('opacity', 0.3);
|
|
264
|
+
contentWrapper.selectAll('.line').transition().duration(this.interactionDuration).attr('opacity', 1);
|
|
273
265
|
// line
|
|
274
266
|
this.clearOldVerticalAnnotation(contentWrapper);
|
|
275
267
|
}
|
|
@@ -300,11 +292,11 @@ class AreaGroup extends _chartComponent.default {
|
|
|
300
292
|
const newTooltipData = {
|
|
301
293
|
title: title,
|
|
302
294
|
items: data.map(item => {
|
|
303
|
-
const groupName = item.group_name ||
|
|
295
|
+
const groupName = item.group_name || intl.get('Empty');
|
|
304
296
|
return {
|
|
305
297
|
color: this.colorMap[groupName],
|
|
306
298
|
name: groupName,
|
|
307
|
-
value:
|
|
299
|
+
value: BaseUtils.getSummaryValueDisplayString(summaryColumn, item.value, y_axis_summary_method)
|
|
308
300
|
};
|
|
309
301
|
}).sort((a, b) => String(a.name).localeCompare(String(b.name), undefined, {
|
|
310
302
|
numeric: true,
|
|
@@ -336,11 +328,11 @@ class AreaGroup extends _chartComponent.default {
|
|
|
336
328
|
const newTooltipData = {
|
|
337
329
|
title: title,
|
|
338
330
|
items: data.map(item => {
|
|
339
|
-
const groupName = item.group_name ||
|
|
331
|
+
const groupName = item.group_name || intl.get('Empty');
|
|
340
332
|
return {
|
|
341
333
|
color: this.colorMap[groupName],
|
|
342
334
|
name: groupName,
|
|
343
|
-
value:
|
|
335
|
+
value: BaseUtils.getSummaryValueDisplayString(summaryColumn, item.value, y_axis_summary_method)
|
|
344
336
|
};
|
|
345
337
|
}).sort((a, b) => String(a.name).localeCompare(String(b.name), undefined, {
|
|
346
338
|
numeric: true,
|
|
@@ -371,13 +363,11 @@ class AreaGroup extends _chartComponent.default {
|
|
|
371
363
|
componentDidMount() {
|
|
372
364
|
this.createChart();
|
|
373
365
|
this.drawChart();
|
|
374
|
-
this.debouncedHandleResize = (0, _lodashEs.debounce)(this.handleResize, 300);
|
|
375
|
-
window.addEventListener('resize', this.debouncedHandleResize);
|
|
376
366
|
super.componentDidMount();
|
|
377
367
|
}
|
|
378
368
|
componentDidUpdate(prevProps) {
|
|
379
369
|
super.componentDidUpdate(prevProps);
|
|
380
|
-
if (
|
|
370
|
+
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
381
371
|
this.destroyChart();
|
|
382
372
|
this.createChart();
|
|
383
373
|
this.drawChart();
|
|
@@ -385,24 +375,17 @@ class AreaGroup extends _chartComponent.default {
|
|
|
385
375
|
}
|
|
386
376
|
componentWillUnmount() {
|
|
387
377
|
this.destroyChart();
|
|
388
|
-
window.removeEventListener('resize', this.debouncedHandleResize);
|
|
389
378
|
super.componentWillUnmount();
|
|
390
379
|
}
|
|
391
380
|
render() {
|
|
392
|
-
const {
|
|
393
|
-
chart
|
|
394
|
-
} = this.props;
|
|
395
381
|
const {
|
|
396
382
|
tooltipData,
|
|
397
383
|
toolTipPosition
|
|
398
384
|
} = this.state;
|
|
399
|
-
return /*#__PURE__*/
|
|
385
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
400
386
|
ref: ref => this.container = ref,
|
|
401
|
-
className:
|
|
402
|
-
|
|
403
|
-
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
404
|
-
})
|
|
405
|
-
}, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
387
|
+
className: "sea-chart-container"
|
|
388
|
+
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
406
389
|
tooltipData: tooltipData,
|
|
407
390
|
toolTipPosition: toolTipPosition,
|
|
408
391
|
chart: this.chart
|
|
@@ -410,16 +393,16 @@ class AreaGroup extends _chartComponent.default {
|
|
|
410
393
|
}
|
|
411
394
|
}
|
|
412
395
|
AreaGroup.propTypes = {
|
|
413
|
-
canvasStyle:
|
|
414
|
-
chart:
|
|
415
|
-
groupbyColumn:
|
|
416
|
-
columnGroupbyColumn:
|
|
417
|
-
summaryColumn:
|
|
418
|
-
result:
|
|
419
|
-
tables:
|
|
420
|
-
globalTheme:
|
|
421
|
-
chartColorTheme:
|
|
422
|
-
toggleRecords:
|
|
423
|
-
customRender:
|
|
396
|
+
canvasStyle: PropTypes.object,
|
|
397
|
+
chart: PropTypes.object,
|
|
398
|
+
groupbyColumn: PropTypes.object,
|
|
399
|
+
columnGroupbyColumn: PropTypes.object,
|
|
400
|
+
summaryColumn: PropTypes.object,
|
|
401
|
+
result: PropTypes.array,
|
|
402
|
+
tables: PropTypes.array,
|
|
403
|
+
globalTheme: PropTypes.string,
|
|
404
|
+
chartColorTheme: PropTypes.string,
|
|
405
|
+
toggleRecords: PropTypes.func,
|
|
406
|
+
customRender: PropTypes.func
|
|
424
407
|
};
|
|
425
|
-
|
|
408
|
+
export default AreaGroup;
|
|
@@ -1,29 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
-
var _lodashEs = require("lodash-es");
|
|
13
|
-
var d3 = _interopRequireWildcard(require("d3"));
|
|
14
|
-
var _constants = require("../../constants");
|
|
15
|
-
var _intl = _interopRequireDefault(require("../../intl"));
|
|
16
|
-
var _utils = require("../../utils");
|
|
17
|
-
var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
|
|
18
|
-
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
19
|
-
class Area extends _chartComponent.default {
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import * as d3 from 'd3';
|
|
4
|
+
import { CHART_LINE_TYPES, CHART_STYLE_COLORS, CHART_THEME_COLOR, TYPE_COLOR_USING } from '../../constants';
|
|
5
|
+
import intl from '../../intl';
|
|
6
|
+
import { BaseUtils, isFunction } from '../../utils';
|
|
7
|
+
import ToolTip from '../../components/tooltip';
|
|
8
|
+
import ChartComponent from './chart-component';
|
|
9
|
+
class Area extends ChartComponent {
|
|
20
10
|
constructor(props) {
|
|
21
11
|
super(props);
|
|
22
|
-
this.handleResize = () => {
|
|
23
|
-
this.destroyChart();
|
|
24
|
-
this.createChart();
|
|
25
|
-
this.drawChart();
|
|
26
|
-
};
|
|
27
12
|
this.createChart = () => {
|
|
28
13
|
const {
|
|
29
14
|
chart
|
|
@@ -35,8 +20,8 @@ class Area extends _chartComponent.default {
|
|
|
35
20
|
} = chart.config;
|
|
36
21
|
const initConfig = {
|
|
37
22
|
insertPadding: 30,
|
|
38
|
-
marginLeft: y_axis_show_label ?
|
|
39
|
-
marginBottom: x_axis_show_label ?
|
|
23
|
+
marginLeft: y_axis_show_label ? this.getAxisTitleHeight(chart.config.y_axis_label_font_size) : 0,
|
|
24
|
+
marginBottom: x_axis_show_label ? this.getAxisTitleHeight(chart.config.x_axis_label_font_size) : 0,
|
|
40
25
|
marginTop: y_axis_show_value ? 15 : 0
|
|
41
26
|
};
|
|
42
27
|
this.initChart(this.container, chart === null || chart === void 0 ? void 0 : chart.id, initConfig);
|
|
@@ -47,10 +32,10 @@ class Area extends _chartComponent.default {
|
|
|
47
32
|
customRender,
|
|
48
33
|
chart
|
|
49
34
|
} = this.props;
|
|
50
|
-
data =
|
|
35
|
+
data = BaseUtils.formatEmptyName(data, chart.config.column_groupby_column_key, intl.get('Empty'));
|
|
51
36
|
if (!Array.isArray(data)) return;
|
|
52
37
|
this.draw(data);
|
|
53
|
-
|
|
38
|
+
isFunction(customRender) && customRender(this.chart);
|
|
54
39
|
this.renderAxisLabel(this.props.chart, this.props.tables, this.container);
|
|
55
40
|
};
|
|
56
41
|
this.draw = data => {
|
|
@@ -60,7 +45,7 @@ class Area extends _chartComponent.default {
|
|
|
60
45
|
tables,
|
|
61
46
|
summaryColumn
|
|
62
47
|
} = this.props;
|
|
63
|
-
const theme =
|
|
48
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
64
49
|
const {
|
|
65
50
|
display_goal_line,
|
|
66
51
|
goal_label,
|
|
@@ -90,7 +75,7 @@ class Area extends _chartComponent.default {
|
|
|
90
75
|
// Y axis
|
|
91
76
|
const niceEnd = d3.nice(0, d3.max(data, d => d.value), 5)[1];
|
|
92
77
|
const y = d3.scaleLinear().domain(y_axis_auto_range ? [0, niceEnd] : [y_axis_min || 0, y_axis_max || niceEnd]).range([chartHeight - insertPadding, insertPadding + marginTop]);
|
|
93
|
-
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform', `translate(${insertPadding}, 0)`).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d =>
|
|
78
|
+
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform', `translate(${insertPadding}, 0)`).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d => BaseUtils.getSummaryValueDisplayString(summaryColumn, d, y_axis_summary_method))).call(g => this.drawYaxis(g, theme));
|
|
94
79
|
|
|
95
80
|
// X axis
|
|
96
81
|
const xDomain = data.map(item => item.name);
|
|
@@ -111,29 +96,30 @@ class Area extends _chartComponent.default {
|
|
|
111
96
|
const xVal = x(d.name) + x.bandwidth() / 2;
|
|
112
97
|
circleData[index]['x'] = xVal;
|
|
113
98
|
circleData[index]['name'] = d.name;
|
|
99
|
+
circleData[index]['originalData'] = d;
|
|
114
100
|
return xVal;
|
|
115
101
|
}).y((d, index) => {
|
|
116
102
|
const yVal = y(d.value);
|
|
117
103
|
circleData[index]['y'] = yVal;
|
|
118
104
|
circleData[index]['value'] = d.value;
|
|
119
105
|
return yVal;
|
|
120
|
-
}).curve(line_type ===
|
|
121
|
-
this.Line = contentWrapper.append('path').attr('opacity', 1).attr('fill', 'none').attr('stroke', this.getAreaColor()).attr('stroke-width', 2).attr('d', () => line(data));
|
|
106
|
+
}).curve(line_type === CHART_LINE_TYPES[1] ? d3.curveBumpX : d3.curveLinear);
|
|
107
|
+
this.Line = contentWrapper.append('path').attr('opacity', 1).attr('fill', 'none').attr('stroke', this.getAreaColor()).attr('stroke-width', 2).attr('d', () => line(data)).call(g => this.animateFadeIn(g, this.transitionDuration));
|
|
122
108
|
|
|
123
109
|
// Area
|
|
124
110
|
const area = d3.area().x(d => {
|
|
125
111
|
const xVal = x(d.name) + x.bandwidth() / 2;
|
|
126
112
|
return xVal;
|
|
127
|
-
}).y0(y(0)).y1(d => y(d.value)).curve(line_type ===
|
|
128
|
-
this.Area = contentWrapper.append('path').attr('fill', this.getAreaColor()).attr('d', () => area(data)).attr('opacity', '0.3');
|
|
113
|
+
}).y0(y(0)).y1(d => y(d.value)).curve(line_type === CHART_LINE_TYPES[1] ? d3.curveBumpX : d3.curveLinear);
|
|
114
|
+
this.Area = contentWrapper.append('path').attr('fill', this.getAreaColor()).attr('d', () => area(data)).attr('opacity', '0.3').call(g => this.animateFadeIn(g, this.transitionDuration));
|
|
129
115
|
|
|
130
116
|
// circle
|
|
131
117
|
circleData.forEach(item => {
|
|
132
|
-
contentWrapper.append('circle').attr('cx', item.x).attr('cy', item.y).attr('r', 3).attr('fill', this.getAreaColor()).attr('opacity', y_axis_show_value ? 1 : 0).attr('data-text', item.value).attr('data-name', item.name).call(g => {
|
|
118
|
+
contentWrapper.append('circle').datum(item).attr('cx', item.x).attr('cy', item.y).attr('r', 3).attr('fill', this.getAreaColor()).attr('opacity', y_axis_show_value ? 1 : 0).attr('data-text', item.value).attr('data-name', item.name).call(g => {
|
|
133
119
|
// circle label
|
|
134
120
|
if (y_axis_show_value) {
|
|
135
121
|
const curCircleEl = g.node();
|
|
136
|
-
contentWrapper.append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('fill', theme.labelColor).attr('font-size',
|
|
122
|
+
contentWrapper.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(summaryColumn, Number(curCircleEl.getAttribute('data-text')), y_axis_summary_method)).call(g => {
|
|
137
123
|
const {
|
|
138
124
|
width
|
|
139
125
|
} = g.node().getBoundingClientRect();
|
|
@@ -143,9 +129,11 @@ class Area extends _chartComponent.default {
|
|
|
143
129
|
});
|
|
144
130
|
}
|
|
145
131
|
}).on('click', (event, data) => {
|
|
146
|
-
this.props.toggleRecords(data);
|
|
132
|
+
this.props.toggleRecords(data.originalData || data);
|
|
147
133
|
});
|
|
148
134
|
});
|
|
135
|
+
this.animateFadeIn(contentWrapper.selectAll('circle'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
136
|
+
this.animateFadeIn(contentWrapper.selectAll('text'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
149
137
|
this.chart.on('mouseover', event => {
|
|
150
138
|
this.updateCircleAndTickStyle({
|
|
151
139
|
event,
|
|
@@ -212,10 +200,10 @@ class Area extends _chartComponent.default {
|
|
|
212
200
|
d3.select(circle).attr('r', 3);
|
|
213
201
|
}
|
|
214
202
|
});
|
|
215
|
-
this.Area.transition().duration(this.
|
|
216
|
-
this.Line.transition().duration(this.
|
|
203
|
+
this.Area.transition().duration(this.interactionDuration).attr('opacity', 0.1);
|
|
204
|
+
this.Line.transition().duration(this.interactionDuration).attr('opacity', 0.3);
|
|
217
205
|
// line
|
|
218
|
-
const theme =
|
|
206
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
219
207
|
this.clearOldVerticalAnnotation(contentWrapper);
|
|
220
208
|
this.addVerticalAnnotation(contentWrapper, minDistanceItem, theme);
|
|
221
209
|
} else {
|
|
@@ -228,8 +216,8 @@ class Area extends _chartComponent.default {
|
|
|
228
216
|
}
|
|
229
217
|
d3.select(circle).attr('r', 3);
|
|
230
218
|
});
|
|
231
|
-
this.Area.transition().duration(this.
|
|
232
|
-
this.Line.transition().duration(this.
|
|
219
|
+
this.Area.transition().duration(this.interactionDuration).attr('opacity', 0.3);
|
|
220
|
+
this.Line.transition().duration(this.interactionDuration).attr('opacity', 1);
|
|
233
221
|
// line
|
|
234
222
|
this.clearOldVerticalAnnotation(contentWrapper);
|
|
235
223
|
}
|
|
@@ -262,7 +250,7 @@ class Area extends _chartComponent.default {
|
|
|
262
250
|
items: [{
|
|
263
251
|
color: this.getAreaColor(),
|
|
264
252
|
name: data.name,
|
|
265
|
-
value:
|
|
253
|
+
value: BaseUtils.getSummaryValueDisplayString(summaryColumn, data.value, y_axis_summary_method)
|
|
266
254
|
}]
|
|
267
255
|
};
|
|
268
256
|
this.setState({
|
|
@@ -292,7 +280,7 @@ class Area extends _chartComponent.default {
|
|
|
292
280
|
items: [{
|
|
293
281
|
color: this.getAreaColor(),
|
|
294
282
|
name: data.name,
|
|
295
|
-
value:
|
|
283
|
+
value: BaseUtils.getSummaryValueDisplayString(summaryColumn, data.value, y_axis_summary_method)
|
|
296
284
|
}]
|
|
297
285
|
};
|
|
298
286
|
this.setState({
|
|
@@ -319,11 +307,11 @@ class Area extends _chartComponent.default {
|
|
|
319
307
|
y_axis_label_color,
|
|
320
308
|
color_option
|
|
321
309
|
} = chart.config;
|
|
322
|
-
let chartBarColor =
|
|
310
|
+
let chartBarColor = CHART_STYLE_COLORS[0];
|
|
323
311
|
if (chartColorTheme) {
|
|
324
|
-
chartBarColor =
|
|
312
|
+
chartBarColor = BaseUtils.getCurrentTheme(chartColorTheme).colors[0];
|
|
325
313
|
}
|
|
326
|
-
if (color_option ===
|
|
314
|
+
if (color_option === TYPE_COLOR_USING.USE_SPECIFIC_COLORS && y_axis_label_color) {
|
|
327
315
|
chartBarColor = y_axis_label_color;
|
|
328
316
|
}
|
|
329
317
|
return chartBarColor;
|
|
@@ -337,13 +325,11 @@ class Area extends _chartComponent.default {
|
|
|
337
325
|
componentDidMount() {
|
|
338
326
|
this.createChart();
|
|
339
327
|
this.drawChart();
|
|
340
|
-
this.debouncedHandleResize = (0, _lodashEs.debounce)(this.handleResize, 300);
|
|
341
|
-
window.addEventListener('resize', this.debouncedHandleResize);
|
|
342
328
|
super.componentDidMount();
|
|
343
329
|
}
|
|
344
330
|
componentDidUpdate(prevProps) {
|
|
345
331
|
super.componentDidUpdate(prevProps);
|
|
346
|
-
if (
|
|
332
|
+
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
347
333
|
this.destroyChart();
|
|
348
334
|
this.createChart();
|
|
349
335
|
this.drawChart();
|
|
@@ -351,24 +337,17 @@ class Area extends _chartComponent.default {
|
|
|
351
337
|
}
|
|
352
338
|
componentWillUnmount() {
|
|
353
339
|
this.destroyChart();
|
|
354
|
-
window.removeEventListener('resize', this.debouncedHandleResize);
|
|
355
340
|
super.componentWillUnmount();
|
|
356
341
|
}
|
|
357
342
|
render() {
|
|
358
|
-
const {
|
|
359
|
-
chart
|
|
360
|
-
} = this.props;
|
|
361
343
|
const {
|
|
362
344
|
tooltipData,
|
|
363
345
|
toolTipPosition
|
|
364
346
|
} = this.state;
|
|
365
|
-
return /*#__PURE__*/
|
|
347
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
366
348
|
ref: ref => this.container = ref,
|
|
367
|
-
className:
|
|
368
|
-
|
|
369
|
-
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
370
|
-
})
|
|
371
|
-
}, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
349
|
+
className: "sea-chart-container"
|
|
350
|
+
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
372
351
|
tooltipData: tooltipData,
|
|
373
352
|
toolTipPosition: toolTipPosition,
|
|
374
353
|
chart: this.chart
|
|
@@ -376,16 +355,16 @@ class Area extends _chartComponent.default {
|
|
|
376
355
|
}
|
|
377
356
|
}
|
|
378
357
|
Area.propTypes = {
|
|
379
|
-
canvasStyle:
|
|
380
|
-
chart:
|
|
381
|
-
groupbyColumn:
|
|
382
|
-
columnGroupbyColumn:
|
|
383
|
-
summaryColumn:
|
|
384
|
-
result:
|
|
385
|
-
tables:
|
|
386
|
-
globalTheme:
|
|
387
|
-
chartColorTheme:
|
|
388
|
-
toggleRecords:
|
|
389
|
-
customRender:
|
|
358
|
+
canvasStyle: PropTypes.object,
|
|
359
|
+
chart: PropTypes.object,
|
|
360
|
+
groupbyColumn: PropTypes.object,
|
|
361
|
+
columnGroupbyColumn: PropTypes.object,
|
|
362
|
+
summaryColumn: PropTypes.object,
|
|
363
|
+
result: PropTypes.array,
|
|
364
|
+
tables: PropTypes.array,
|
|
365
|
+
globalTheme: PropTypes.string,
|
|
366
|
+
chartColorTheme: PropTypes.string,
|
|
367
|
+
toggleRecords: PropTypes.func,
|
|
368
|
+
customRender: PropTypes.func
|
|
390
369
|
};
|
|
391
|
-
|
|
370
|
+
export default Area;
|