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,29 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _lodashEs = require("lodash-es");
|
|
12
|
-
var d3 = _interopRequireWildcard(require("d3"));
|
|
13
|
-
var _constants = require("../../constants");
|
|
14
|
-
var _utils = require("../../utils");
|
|
15
|
-
var _intl = _interopRequireDefault(require("../../intl"));
|
|
16
|
-
var _colorRules = require("../../constants/color-rules");
|
|
17
|
-
var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
|
|
18
|
-
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
19
|
-
class Ring extends _chartComponent.default {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import * as d3 from 'd3';
|
|
4
|
+
import { CHART_LABEL_POSITIONS, CHART_LABEL_FORMATS, CHART_THEME_COLOR, CHART_TYPE } from '../../constants';
|
|
5
|
+
import { BaseUtils, isFunction } from '../../utils';
|
|
6
|
+
import intl from '../../intl';
|
|
7
|
+
import { SUPPORT_SINGLE_SELECT_THEMES_OPTIONS } from '../../constants/color-rules';
|
|
8
|
+
import ToolTip from '../../components/tooltip';
|
|
9
|
+
import ChartComponent from './chart-component';
|
|
10
|
+
class Ring extends ChartComponent {
|
|
20
11
|
constructor(props) {
|
|
21
12
|
super(props);
|
|
22
|
-
this.handleResize = () => {
|
|
23
|
-
this.destroyChart();
|
|
24
|
-
this.createChart();
|
|
25
|
-
this.drawChart();
|
|
26
|
-
};
|
|
27
13
|
this.createChart = () => {
|
|
28
14
|
const {
|
|
29
15
|
chart
|
|
@@ -43,7 +29,7 @@ class Ring extends _chartComponent.default {
|
|
|
43
29
|
customRender
|
|
44
30
|
} = this.props;
|
|
45
31
|
this.draw(data);
|
|
46
|
-
|
|
32
|
+
isFunction(customRender) && customRender(this.chart);
|
|
47
33
|
};
|
|
48
34
|
this.draw = data => {
|
|
49
35
|
const {
|
|
@@ -52,7 +38,7 @@ class Ring extends _chartComponent.default {
|
|
|
52
38
|
globalTheme,
|
|
53
39
|
chartColorTheme
|
|
54
40
|
} = this.props;
|
|
55
|
-
const theme =
|
|
41
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
56
42
|
const {
|
|
57
43
|
show_legend,
|
|
58
44
|
display_label,
|
|
@@ -66,25 +52,29 @@ class Ring extends _chartComponent.default {
|
|
|
66
52
|
insertPadding,
|
|
67
53
|
rightLegendSpace
|
|
68
54
|
} = this.chartBoundingClientRect;
|
|
69
|
-
this.isInnerLabel = !label_position || label_position ===
|
|
70
|
-
const currentTheme =
|
|
71
|
-
const useSingleSelectColumnColor = color_theme ===
|
|
55
|
+
this.isInnerLabel = !label_position || label_position === CHART_LABEL_POSITIONS[0];
|
|
56
|
+
const currentTheme = BaseUtils.getCurrentTheme(chartColorTheme);
|
|
57
|
+
const useSingleSelectColumnColor = color_theme === SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.SINGLE_SELECT_COLUMN_COLORS;
|
|
72
58
|
const {
|
|
73
59
|
data: newData,
|
|
74
60
|
colorMap,
|
|
75
|
-
total
|
|
76
|
-
} =
|
|
61
|
+
total: fullTotal
|
|
62
|
+
} = BaseUtils.formatPieChartData(data, chart, tables, currentTheme, useSingleSelectColumnColor);
|
|
77
63
|
if (!Array.isArray(newData) || newData.length === 0) return;
|
|
78
64
|
|
|
65
|
+
// Only the visible categories are laid out; the legend still shows every category.
|
|
66
|
+
const visibleData = this.getVisibleLegendData(newData, 'name');
|
|
67
|
+
const total = visibleData === newData ? fullTotal : d3.sum(visibleData, d => Number(d.value) || 0);
|
|
68
|
+
|
|
79
69
|
// Color
|
|
80
|
-
const colorDomain = new Set(
|
|
70
|
+
const colorDomain = new Set(newData.map(d => d.name));
|
|
81
71
|
const colorRange = Array.from(colorDomain).map(name => colorMap[name === null || name === void 0 ? void 0 : name.trim()]);
|
|
82
72
|
const color = d3.scaleOrdinal().domain(colorDomain).range(colorRange);
|
|
83
73
|
|
|
84
74
|
// Ring and Arc
|
|
85
75
|
const pie = d3.pie().sort(null).value(d => d.value);
|
|
86
|
-
const arcs = pie(
|
|
87
|
-
const arc = d3.arc().innerRadius(Math.min(chartWidth, chartHeight) / 2 * 0.
|
|
76
|
+
const arcs = pie(visibleData);
|
|
77
|
+
const arc = d3.arc().innerRadius(Math.min(chartWidth, chartHeight) / 2 * 0.5).outerRadius(Math.min(chartWidth, chartHeight) / 2 * 0.7);
|
|
88
78
|
|
|
89
79
|
// Draw Ring
|
|
90
80
|
this.chart.append('g').attr('class', 'content-wrapper').selectAll().data(arcs).join('path').attr('stroke', 'white').attr('stroke-width', 2).attr('opacity', 1).attr('fill', d => color(d.data.name)).attr('d', arc).attr('data-groupName', d => d.data.name).call(g => {
|
|
@@ -114,13 +104,13 @@ class Ring extends _chartComponent.default {
|
|
|
114
104
|
percent
|
|
115
105
|
} = d.data;
|
|
116
106
|
return this.getLabel(value, percent);
|
|
117
|
-
}).attr('fill', theme.labelColor).attr('font-size',
|
|
107
|
+
}).attr('fill', theme.labelColor).attr('font-size', BaseUtils.getLabelFontSize(label_font_size));
|
|
118
108
|
|
|
119
109
|
// Line
|
|
120
110
|
if (!this.isInnerLabel) {
|
|
121
111
|
const lineRadius = arc.outerRadius()() * 0.7;
|
|
122
112
|
const arcLine = d3.arc().innerRadius(lineRadius).outerRadius(lineRadius);
|
|
123
|
-
this.chart.append('g').attr('transform', `translate(${left + offsetX}, ${top + offsetY})`).selectAll().data(arcs).join('line').attr('transform', d => `translate(${arcLine.centroid(d)})`).attr('x1', d => arcLine.centroid(d)[0]).attr('y1', d => arcLine.centroid(d)[1]).attr('x2', d => arcLine.centroid(d)[0] * 1.2).attr('y2', d => arcLine.centroid(d)[1] * 1.2).attr('stroke', d => color(d.data.name)).attr('font-size',
|
|
113
|
+
this.chart.append('g').attr('transform', `translate(${left + offsetX}, ${top + offsetY})`).selectAll().data(arcs).join('line').attr('transform', d => `translate(${arcLine.centroid(d)})`).attr('x1', d => arcLine.centroid(d)[0]).attr('y1', d => arcLine.centroid(d)[1]).attr('x2', d => arcLine.centroid(d)[0] * 1.2).attr('y2', d => arcLine.centroid(d)[1] * 1.2).attr('stroke', d => color(d.data.name)).attr('font-size', BaseUtils.getLabelFontSize(label_font_size));
|
|
124
114
|
}
|
|
125
115
|
}
|
|
126
116
|
}).on('click', (event, rowData) => {
|
|
@@ -141,13 +131,17 @@ class Ring extends _chartComponent.default {
|
|
|
141
131
|
this.setAnnotationTotal(event.currentTarget.parentNode, {
|
|
142
132
|
value: total
|
|
143
133
|
});
|
|
134
|
+
}).call(g => {
|
|
135
|
+
this.animateArcGrowIn(g, arc);
|
|
136
|
+
this.animateFadeIn(this.chart.selectAll('text'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
137
|
+
this.animateFadeIn(this.chart.selectAll('line'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
144
138
|
});
|
|
145
139
|
if (show_legend) {
|
|
146
140
|
this.setLegend({
|
|
147
141
|
legendName: 'name',
|
|
148
142
|
theme,
|
|
149
143
|
legendPosition: 'center-right',
|
|
150
|
-
data,
|
|
144
|
+
data: newData,
|
|
151
145
|
colorScale: color
|
|
152
146
|
});
|
|
153
147
|
}
|
|
@@ -199,7 +193,7 @@ class Ring extends _chartComponent.default {
|
|
|
199
193
|
this.handleAcitveAndInActiveState = (state, event) => {
|
|
200
194
|
const allGroup = [event.currentTarget.parentNode];
|
|
201
195
|
const curGroupName = event.currentTarget.getAttribute('data-groupName');
|
|
202
|
-
this.setActiveAndInActiveState(state, allGroup, curGroupName,
|
|
196
|
+
this.setActiveAndInActiveState(state, allGroup, curGroupName, CHART_TYPE.RING);
|
|
203
197
|
};
|
|
204
198
|
this.getLabel = (val, percent) => {
|
|
205
199
|
const {
|
|
@@ -211,16 +205,16 @@ class Ring extends _chartComponent.default {
|
|
|
211
205
|
display_label,
|
|
212
206
|
label_format
|
|
213
207
|
} = chart.config;
|
|
214
|
-
const value =
|
|
208
|
+
const value = BaseUtils.getSummaryValueDisplayString(summaryColumn, val, summary_method);
|
|
215
209
|
if (!display_label || !value || !percent) {
|
|
216
210
|
return '';
|
|
217
211
|
}
|
|
218
212
|
switch (label_format) {
|
|
219
|
-
case
|
|
213
|
+
case CHART_LABEL_FORMATS[0]:
|
|
220
214
|
return percent;
|
|
221
|
-
case
|
|
215
|
+
case CHART_LABEL_FORMATS[1]:
|
|
222
216
|
return value;
|
|
223
|
-
case
|
|
217
|
+
case CHART_LABEL_FORMATS[2]:
|
|
224
218
|
return `${value} (${percent})`;
|
|
225
219
|
default:
|
|
226
220
|
return percent;
|
|
@@ -229,9 +223,9 @@ class Ring extends _chartComponent.default {
|
|
|
229
223
|
this.getTooltipName = name => {
|
|
230
224
|
let title = name;
|
|
231
225
|
if (!name || name.trim() === 'undefined' || name.trim() === 'null') {
|
|
232
|
-
title =
|
|
226
|
+
title = intl.get('Empty');
|
|
233
227
|
} else if (name === '_Others') {
|
|
234
|
-
title =
|
|
228
|
+
title = intl.get('Others');
|
|
235
229
|
}
|
|
236
230
|
return title;
|
|
237
231
|
};
|
|
@@ -249,7 +243,7 @@ class Ring extends _chartComponent.default {
|
|
|
249
243
|
const {
|
|
250
244
|
summary_method
|
|
251
245
|
} = chart.config;
|
|
252
|
-
const theme =
|
|
246
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
253
247
|
// Clear old annotation
|
|
254
248
|
const oldTitle = (_d3$select$select = d3.select(wrapper).select('.title')) === null || _d3$select$select === void 0 ? void 0 : _d3$select$select.node();
|
|
255
249
|
const oldText = (_d3$select$select2 = d3.select(wrapper).select('.text')) === null || _d3$select$select2 === void 0 ? void 0 : _d3$select$select2.node();
|
|
@@ -257,7 +251,7 @@ class Ring extends _chartComponent.default {
|
|
|
257
251
|
oldText && oldText.remove();
|
|
258
252
|
|
|
259
253
|
// Title
|
|
260
|
-
d3.select(wrapper).append('text').attr('class', 'title').text(name ? name :
|
|
254
|
+
d3.select(wrapper).append('text').attr('class', 'title').text(name ? name : intl.get('Total')).attr('fill', theme.annotationTitleFontColor).attr('font-size', theme.annotationFontSize).attr('font-weight', 300).attr('pointer-events', 'none').call(g => {
|
|
261
255
|
var _g$node;
|
|
262
256
|
const {
|
|
263
257
|
width
|
|
@@ -266,7 +260,7 @@ class Ring extends _chartComponent.default {
|
|
|
266
260
|
});
|
|
267
261
|
|
|
268
262
|
// Text this.getLabel(value, percent)
|
|
269
|
-
d3.select(wrapper).append('text').attr('class', 'text').text(summaryColumn ?
|
|
263
|
+
d3.select(wrapper).append('text').attr('class', 'text').text(summaryColumn ? BaseUtils.getSummaryValueDisplayString(summaryColumn, value, summary_method) : value).attr('fill', theme.annotationValueFontColor).attr('font-size', theme.annotationFontSize).call(g => {
|
|
270
264
|
var _g$node2;
|
|
271
265
|
const {
|
|
272
266
|
width
|
|
@@ -283,12 +277,11 @@ class Ring extends _chartComponent.default {
|
|
|
283
277
|
componentDidMount() {
|
|
284
278
|
this.createChart();
|
|
285
279
|
this.drawChart();
|
|
286
|
-
|
|
287
|
-
window.addEventListener('resize', this.debouncedHandleResize);
|
|
280
|
+
super.componentDidMount();
|
|
288
281
|
}
|
|
289
282
|
componentDidUpdate(prevProps) {
|
|
290
283
|
super.componentDidUpdate(prevProps);
|
|
291
|
-
if (
|
|
284
|
+
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
292
285
|
this.destroyChart();
|
|
293
286
|
this.createChart();
|
|
294
287
|
this.drawChart();
|
|
@@ -296,17 +289,17 @@ class Ring extends _chartComponent.default {
|
|
|
296
289
|
}
|
|
297
290
|
componentWillUnmount() {
|
|
298
291
|
this.destroyChart();
|
|
299
|
-
|
|
292
|
+
super.componentWillUnmount();
|
|
300
293
|
}
|
|
301
294
|
render() {
|
|
302
295
|
const {
|
|
303
296
|
tooltipData,
|
|
304
297
|
toolTipPosition
|
|
305
298
|
} = this.state;
|
|
306
|
-
return /*#__PURE__*/
|
|
299
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
307
300
|
ref: ref => this.container = ref,
|
|
308
301
|
className: "sea-chart-container"
|
|
309
|
-
}, /*#__PURE__*/
|
|
302
|
+
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
310
303
|
tooltipData: tooltipData,
|
|
311
304
|
toolTipPosition: toolTipPosition,
|
|
312
305
|
chart: this.chart
|
|
@@ -314,15 +307,15 @@ class Ring extends _chartComponent.default {
|
|
|
314
307
|
}
|
|
315
308
|
}
|
|
316
309
|
Ring.propTypes = {
|
|
317
|
-
canvasStyle:
|
|
318
|
-
chart:
|
|
319
|
-
groupbyColumn:
|
|
320
|
-
summaryColumn:
|
|
321
|
-
result:
|
|
322
|
-
tables:
|
|
323
|
-
globalTheme:
|
|
324
|
-
chartColorTheme:
|
|
325
|
-
toggleRecords:
|
|
326
|
-
customRender:
|
|
310
|
+
canvasStyle: PropTypes.object,
|
|
311
|
+
chart: PropTypes.object,
|
|
312
|
+
groupbyColumn: PropTypes.object,
|
|
313
|
+
summaryColumn: PropTypes.object,
|
|
314
|
+
result: PropTypes.array,
|
|
315
|
+
tables: PropTypes.array,
|
|
316
|
+
globalTheme: PropTypes.string,
|
|
317
|
+
chartColorTheme: PropTypes.string,
|
|
318
|
+
toggleRecords: PropTypes.func,
|
|
319
|
+
customRender: PropTypes.func
|
|
327
320
|
};
|
|
328
|
-
|
|
321
|
+
export default Ring;
|
|
@@ -1,30 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var d3 = _interopRequireWildcard(require("d3"));
|
|
13
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
|
-
var _dtableUtils = require("dtable-utils");
|
|
15
|
-
var _constants = require("../../constants");
|
|
16
|
-
var _utils = require("../../utils");
|
|
17
|
-
var _intl = _interopRequireDefault(require("../../intl"));
|
|
18
|
-
var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
|
|
19
|
-
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
20
|
-
class Scatter 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 { getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
6
|
+
import { CHART_THEME_COLOR } from '../../constants';
|
|
7
|
+
import { BaseUtils, isFunction } from '../../utils';
|
|
8
|
+
import intl from '../../intl';
|
|
9
|
+
import ToolTip from '../../components/tooltip';
|
|
10
|
+
import ChartComponent from './chart-component';
|
|
11
|
+
class Scatter extends ChartComponent {
|
|
21
12
|
constructor(props) {
|
|
22
13
|
super(props);
|
|
23
|
-
this.handleResize = () => {
|
|
24
|
-
this.destroyChart();
|
|
25
|
-
this.createChart();
|
|
26
|
-
this.drawChart();
|
|
27
|
-
};
|
|
28
14
|
this.createChart = () => {
|
|
29
15
|
const {
|
|
30
16
|
chart
|
|
@@ -36,8 +22,8 @@ class Scatter extends _chartComponent.default {
|
|
|
36
22
|
} = chart.config;
|
|
37
23
|
const initConfig = {
|
|
38
24
|
insertPadding: 30,
|
|
39
|
-
marginLeft: y_axis_show_label ?
|
|
40
|
-
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,
|
|
41
27
|
marginTop: y_axis_show_value ? 15 : 0,
|
|
42
28
|
bottomLegendSpace: 0
|
|
43
29
|
};
|
|
@@ -50,15 +36,15 @@ class Scatter extends _chartComponent.default {
|
|
|
50
36
|
let {
|
|
51
37
|
result: data
|
|
52
38
|
} = this.props;
|
|
53
|
-
data =
|
|
39
|
+
data = BaseUtils.formatEmptyName(data, '', intl.get('Empty'));
|
|
54
40
|
if (!Array.isArray(data)) return;
|
|
55
41
|
data = this.transformStringToNumber(data);
|
|
56
42
|
this.draw(data);
|
|
57
43
|
this.renderAxisLabel(this.props.chart, this.props.tables, this.container);
|
|
58
|
-
|
|
44
|
+
isFunction(customRender) && customRender(this.chart);
|
|
59
45
|
};
|
|
60
46
|
this.transformStringToNumber = data => {
|
|
61
|
-
const newData =
|
|
47
|
+
const newData = cloneDeep(data);
|
|
62
48
|
newData.forEach(item => {
|
|
63
49
|
if (item.original_value) {
|
|
64
50
|
var _item$original_value, _item$original_value2;
|
|
@@ -73,7 +59,7 @@ class Scatter extends _chartComponent.default {
|
|
|
73
59
|
chartColorTheme
|
|
74
60
|
} = this.props;
|
|
75
61
|
let currentIdx = 0;
|
|
76
|
-
let colors =
|
|
62
|
+
let colors = BaseUtils.getCurrentTheme(chartColorTheme).colors;
|
|
77
63
|
const colorMap = data.reduce((acc, cur) => {
|
|
78
64
|
if (cur.groupby && !acc[cur.groupby]) {
|
|
79
65
|
acc[cur.groupby] = colors[currentIdx++ % colors.length];
|
|
@@ -94,12 +80,12 @@ class Scatter extends _chartComponent.default {
|
|
|
94
80
|
} = event;
|
|
95
81
|
const newTooltipData = {
|
|
96
82
|
titleMarkColor: event.currentTarget.getAttribute('fill'),
|
|
97
|
-
title: groupby || groupby === 0 ? groupby :
|
|
83
|
+
title: groupby || groupby === 0 ? groupby : intl.get('Empty'),
|
|
98
84
|
items: [{
|
|
99
|
-
name: selectedXAxisColumn.name,
|
|
85
|
+
name: selectedXAxisColumn === null || selectedXAxisColumn === void 0 ? void 0 : selectedXAxisColumn.name,
|
|
100
86
|
value: name
|
|
101
87
|
}, {
|
|
102
|
-
name: selectedYAxisColumn.name,
|
|
88
|
+
name: selectedYAxisColumn === null || selectedYAxisColumn === void 0 ? void 0 : selectedYAxisColumn.name,
|
|
103
89
|
value: value
|
|
104
90
|
}]
|
|
105
91
|
};
|
|
@@ -134,7 +120,7 @@ class Scatter extends _chartComponent.default {
|
|
|
134
120
|
const {
|
|
135
121
|
globalTheme
|
|
136
122
|
} = this.props;
|
|
137
|
-
const theme =
|
|
123
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
138
124
|
const contentWrapper = event.currentTarget.parentNode;
|
|
139
125
|
|
|
140
126
|
// Remove old mark line wrapper
|
|
@@ -142,7 +128,7 @@ class Scatter extends _chartComponent.default {
|
|
|
142
128
|
markLineWrapper.node() && markLineWrapper.node().remove();
|
|
143
129
|
if (state === 'inActive') {
|
|
144
130
|
// Remove stroke
|
|
145
|
-
d3.select(event.currentTarget).attr('stroke', '').attr('
|
|
131
|
+
d3.select(event.currentTarget).attr('stroke', '').attr('stroke-width', '');
|
|
146
132
|
return;
|
|
147
133
|
}
|
|
148
134
|
if (state === 'active') {
|
|
@@ -181,13 +167,15 @@ class Scatter extends _chartComponent.default {
|
|
|
181
167
|
}
|
|
182
168
|
};
|
|
183
169
|
this.draw = data => {
|
|
170
|
+
const fullData = data;
|
|
171
|
+
data = this.getVisibleLegendData(data, 'groupby');
|
|
184
172
|
const {
|
|
185
173
|
chart,
|
|
186
174
|
globalTheme,
|
|
187
175
|
tables,
|
|
188
176
|
chartColorTheme
|
|
189
177
|
} = this.props;
|
|
190
|
-
const theme =
|
|
178
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
191
179
|
const {
|
|
192
180
|
label_font_size,
|
|
193
181
|
x_axis_column_key,
|
|
@@ -205,10 +193,10 @@ class Scatter extends _chartComponent.default {
|
|
|
205
193
|
marginTop,
|
|
206
194
|
bottomLegendSpace
|
|
207
195
|
} = this.chartBoundingClientRect;
|
|
208
|
-
const colorMap = this.getFillColor(
|
|
209
|
-
const selectedTable =
|
|
210
|
-
const selectedXAxisColumn =
|
|
211
|
-
const selectedYAxisColumn =
|
|
196
|
+
const colorMap = this.getFillColor(fullData);
|
|
197
|
+
const selectedTable = getTableById(tables, table_id);
|
|
198
|
+
const selectedXAxisColumn = getTableColumnByKey(selectedTable, x_axis_column_key);
|
|
199
|
+
const selectedYAxisColumn = getTableColumnByKey(selectedTable, y_axis_column_key);
|
|
212
200
|
|
|
213
201
|
// Y axis
|
|
214
202
|
const y = d3.scaleLinear().domain(y_axis_auto_range ? [0, d3.max(data, d => d.value)] : [y_axis_min, y_axis_max]).range([chartHeight - insertPadding - bottomLegendSpace, insertPadding + marginTop]);
|
|
@@ -237,8 +225,8 @@ class Scatter extends _chartComponent.default {
|
|
|
237
225
|
const {
|
|
238
226
|
groupby
|
|
239
227
|
} = d;
|
|
240
|
-
if (groupby
|
|
241
|
-
return
|
|
228
|
+
if (!groupby) {
|
|
229
|
+
return BaseUtils.getCurrentTheme(chartColorTheme).colors[0];
|
|
242
230
|
}
|
|
243
231
|
return colorMap[d.groupby];
|
|
244
232
|
}).attr('data-x', d => x(d.name)).attr('data-y', d => y(d.value)).attr('data-value', d => d.value).attr('data-width', 3.5).attr('data-groupName', d => d.name).attr('cx', d => x(d.name)).attr('cy', d => y(d.value)).attr('r', 3.5).attr('opacity', 0.85).call(g => {
|
|
@@ -266,12 +254,15 @@ class Scatter extends _chartComponent.default {
|
|
|
266
254
|
}).on('mouseleave', (event, data) => {
|
|
267
255
|
this.hiddenTooltip();
|
|
268
256
|
this.handleAcitveAndInActiveState('inActive', event);
|
|
257
|
+
}).call(g => {
|
|
258
|
+
this.animateCircleZoomIn(g);
|
|
259
|
+
this.animateFadeIn(contentWrapper.selectAll('text'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
269
260
|
});
|
|
270
261
|
this.setLegend({
|
|
271
262
|
legendName: 'groupby',
|
|
272
263
|
theme,
|
|
273
264
|
legendPosition: 'top-right',
|
|
274
|
-
data,
|
|
265
|
+
data: fullData,
|
|
275
266
|
groupColumn: this.props.columnGroupbyColumn,
|
|
276
267
|
chart,
|
|
277
268
|
colorScale: key => colorMap[key]
|
|
@@ -286,12 +277,11 @@ class Scatter extends _chartComponent.default {
|
|
|
286
277
|
componentDidMount() {
|
|
287
278
|
this.createChart();
|
|
288
279
|
this.drawChart();
|
|
289
|
-
|
|
290
|
-
window.addEventListener('resize', this.debouncedHandleResize);
|
|
280
|
+
super.componentDidMount();
|
|
291
281
|
}
|
|
292
282
|
componentDidUpdate(prevProps) {
|
|
293
283
|
super.componentDidUpdate(prevProps);
|
|
294
|
-
if (
|
|
284
|
+
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
295
285
|
this.destroyChart();
|
|
296
286
|
this.createChart();
|
|
297
287
|
this.drawChart();
|
|
@@ -299,23 +289,17 @@ class Scatter extends _chartComponent.default {
|
|
|
299
289
|
}
|
|
300
290
|
componentWillUnmount() {
|
|
301
291
|
this.destroyChart();
|
|
302
|
-
|
|
292
|
+
super.componentWillUnmount();
|
|
303
293
|
}
|
|
304
294
|
render() {
|
|
305
|
-
const {
|
|
306
|
-
chart
|
|
307
|
-
} = this.props;
|
|
308
295
|
const {
|
|
309
296
|
tooltipData,
|
|
310
297
|
toolTipPosition
|
|
311
298
|
} = this.state;
|
|
312
|
-
return /*#__PURE__*/
|
|
299
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
313
300
|
ref: ref => this.container = ref,
|
|
314
|
-
className:
|
|
315
|
-
|
|
316
|
-
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
317
|
-
})
|
|
318
|
-
}, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
301
|
+
className: "sea-chart-container"
|
|
302
|
+
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
319
303
|
tooltipData: tooltipData,
|
|
320
304
|
toolTipPosition: toolTipPosition,
|
|
321
305
|
chart: this.chart
|
|
@@ -323,16 +307,16 @@ class Scatter extends _chartComponent.default {
|
|
|
323
307
|
}
|
|
324
308
|
}
|
|
325
309
|
Scatter.propTypes = {
|
|
326
|
-
canvasStyle:
|
|
327
|
-
chart:
|
|
328
|
-
groupbyColumn:
|
|
329
|
-
columnGroupbyColumn:
|
|
330
|
-
summaryColumn:
|
|
331
|
-
result:
|
|
332
|
-
tables:
|
|
333
|
-
globalTheme:
|
|
334
|
-
chartColorTheme:
|
|
335
|
-
toggleRecords:
|
|
336
|
-
customRender:
|
|
310
|
+
canvasStyle: PropTypes.object,
|
|
311
|
+
chart: PropTypes.object,
|
|
312
|
+
groupbyColumn: PropTypes.object,
|
|
313
|
+
columnGroupbyColumn: PropTypes.object,
|
|
314
|
+
summaryColumn: PropTypes.object,
|
|
315
|
+
result: PropTypes.array,
|
|
316
|
+
tables: PropTypes.array,
|
|
317
|
+
globalTheme: PropTypes.string,
|
|
318
|
+
chartColorTheme: PropTypes.string,
|
|
319
|
+
toggleRecords: PropTypes.func,
|
|
320
|
+
customRender: PropTypes.func
|
|
337
321
|
};
|
|
338
|
-
|
|
322
|
+
export default Scatter;
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _intl = _interopRequireDefault(require("../../../intl"));
|
|
11
|
-
var _twoDimensionTable = _interopRequireDefault(require("./two-dimension-table"));
|
|
12
|
-
var _oneDimensionTableNoNumericColumns = _interopRequireDefault(require("./one-dimension-table-no-numeric-columns"));
|
|
13
|
-
var _oneDimensionTableWithNumericColumns = _interopRequireDefault(require("./one-dimension-table-with-numeric-columns"));
|
|
14
|
-
require("./index.css");
|
|
15
|
-
class Table extends _react.PureComponent {
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
|
+
import intl from '../../../intl';
|
|
3
|
+
import TwoDimensionTable from './two-dimension-table';
|
|
4
|
+
import OneDimensionTableNoNumericColumns from './one-dimension-table-no-numeric-columns';
|
|
5
|
+
import OneDimensionTableWithNumericColumns from './one-dimension-table-with-numeric-columns';
|
|
6
|
+
import './index.css';
|
|
7
|
+
class Table extends PureComponent {
|
|
16
8
|
constructor() {
|
|
17
9
|
super(...arguments);
|
|
18
10
|
this.toggleRecords = (cell, selectedCell) => {
|
|
@@ -31,20 +23,20 @@ class Table extends _react.PureComponent {
|
|
|
31
23
|
} = result;
|
|
32
24
|
if (!groupbyColumn) return null;
|
|
33
25
|
if (Array.isArray(pivot_columns) && pivot_columns.length > 100) {
|
|
34
|
-
return /*#__PURE__*/
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", null, intl.get('There_are_too_many_statistics_entries_to_display'));
|
|
35
27
|
}
|
|
36
28
|
if (columnGroupbyColumn) {
|
|
37
|
-
return /*#__PURE__*/
|
|
29
|
+
return /*#__PURE__*/React.createElement(TwoDimensionTable, Object.assign({}, this.props, {
|
|
38
30
|
toggleRecords: this.toggleRecords
|
|
39
31
|
}));
|
|
40
32
|
}
|
|
41
33
|
if (!Array.isArray(pivot_columns)) return null;
|
|
42
34
|
if (pivot_columns.length < 2) {
|
|
43
|
-
return /*#__PURE__*/
|
|
35
|
+
return /*#__PURE__*/React.createElement(OneDimensionTableNoNumericColumns, Object.assign({}, this.props, {
|
|
44
36
|
toggleRecords: this.toggleRecords
|
|
45
37
|
}));
|
|
46
38
|
}
|
|
47
|
-
return /*#__PURE__*/
|
|
39
|
+
return /*#__PURE__*/React.createElement(OneDimensionTableWithNumericColumns, Object.assign({}, this.props, {
|
|
48
40
|
toggleRecords: this.toggleRecords
|
|
49
41
|
}));
|
|
50
42
|
};
|
|
@@ -53,9 +45,9 @@ class Table extends _react.PureComponent {
|
|
|
53
45
|
const {
|
|
54
46
|
result
|
|
55
47
|
} = this.props;
|
|
56
|
-
return /*#__PURE__*/
|
|
48
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
57
49
|
className: `sea-chart-table-wrapper sea-chart-${result.dimensions}-table-wrapper`
|
|
58
50
|
}, this.renderContainer());
|
|
59
51
|
}
|
|
60
52
|
}
|
|
61
|
-
|
|
53
|
+
export default Table;
|