sea-chart 1.1.64 → 2.0.0
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 +13 -6
- package/dist/assets/css/sea-chart-d3-tooltip.css +64 -0
- package/dist/components/cell-factory/FormatterConfig.js +62 -55
- package/dist/components/cell-factory/SimpleCellFormatter.js +11 -4
- package/dist/components/cell-factory/SingleSelectOption.js +18 -11
- package/dist/components/cell-factory/cell-editor-factory.js +12 -5
- package/dist/components/cell-factory/cell-formatter-factory.js +11 -4
- package/dist/components/cell-factory/link-content.js +35 -27
- package/dist/components/chart-color-selector/color-selector.js +18 -11
- package/dist/components/collaborator/index.js +14 -7
- package/dist/components/color-picker/index.js +18 -11
- package/dist/components/color-popover/color-rules/color-rule.js +33 -25
- package/dist/components/color-popover/color-rules/index.js +14 -6
- package/dist/components/color-popover/color-rules/rule-filters/filter.js +34 -27
- package/dist/components/color-popover/color-rules/rule-filters/index.js +25 -17
- package/dist/components/color-popover/color-rules/rule-filters/number-input.js +17 -9
- package/dist/components/color-popover/color-rules-popover.js +33 -25
- package/dist/components/color-popover/color-selector-popover.js +18 -10
- package/dist/components/color-setting/color-group-selector.js +20 -12
- package/dist/components/common-add-tool/index.js +13 -6
- package/dist/components/data-process-setter/data-setting-header.js +14 -7
- package/dist/components/data-process-setter/hide-column-setter.js +19 -12
- package/dist/components/data-process-setter/index.js +27 -4
- package/dist/components/data-process-setter/sort-setter.js +24 -16
- package/dist/components/draggable/Draggable.js +13 -7
- package/dist/components/drill-down-settings/drill-down-fields-popover/index.js +48 -40
- package/dist/components/drill-down-settings/drill-down-fields-settings/index.js +18 -10
- package/dist/components/drill-down-settings/index.js +18 -11
- package/dist/components/dtable-popover/index.js +20 -13
- package/dist/components/dtable-search-input/index.js +21 -13
- package/dist/components/font-settings/index.js +22 -14
- package/dist/components/goal-line-setting/goal-setting-item.js +14 -6
- package/dist/components/goal-line-setting/index.js +19 -12
- package/dist/components/highlighter/highlighter.js +14 -7
- package/dist/components/icon/index.js +12 -5
- package/dist/components/index.js +48 -7
- package/dist/components/loading/index.js +13 -6
- package/dist/components/number-input/index.js +11 -4
- package/dist/components/pixel-editor/index.js +23 -15
- package/dist/components/popover/hide-column-popover/hide-column-popover-widgets/hide-column-item.js +14 -7
- package/dist/components/popover/hide-column-popover/hide-column-popover.js +35 -27
- package/dist/components/popover/sort-popover/sort-popover-widgets/sort-utils.js +18 -9
- package/dist/components/popover/sort-popover/sort-popover.js +65 -55
- package/dist/components/resize-handle/ResizeHandle.js +13 -6
- package/dist/components/row-card/row-card-header-cell.js +22 -15
- package/dist/components/row-card/row-card-header.js +21 -14
- package/dist/components/row-card/row-card-item.js +41 -33
- package/dist/components/row-card/row-card.js +23 -15
- package/dist/components/statistic-record-dialog/index.js +63 -55
- package/dist/components/types-dialog/index.js +63 -55
- package/dist/components/types-dialog/use-force-update.js +10 -4
- package/dist/constants/color-rules.js +14 -8
- package/dist/constants/common-constants.js +14 -8
- package/dist/constants/error.js +8 -2
- package/dist/constants/geolocation.js +15 -9
- package/dist/constants/index.js +271 -142
- package/dist/constants/key-codes.js +2 -0
- package/dist/constants/model.js +9 -3
- package/dist/constants/regions.js +8 -3
- package/dist/constants/style.js +12 -6
- package/dist/constants/table.js +7 -1
- package/dist/constants/type-image.js +39 -33
- package/dist/constants/type.js +9 -3
- package/dist/context.js +19 -12
- package/dist/editor/index.js +15 -12
- package/dist/index.js +104 -13
- package/dist/intl.js +17 -10
- package/dist/locale/index.js +23 -16
- package/dist/locale/lang/de.js +7 -1
- package/dist/locale/lang/en.js +7 -1
- package/dist/locale/lang/es.js +7 -1
- package/dist/locale/lang/fr.js +7 -1
- package/dist/locale/lang/pt.js +7 -1
- package/dist/locale/lang/ru.js +7 -1
- package/dist/locale/lang/zh_CN.js +7 -1
- package/dist/model/area-group.js +19 -12
- package/dist/model/area.js +19 -12
- package/dist/model/bar-custom.js +18 -11
- package/dist/model/bar-group.js +19 -12
- package/dist/model/bar-stack.js +17 -10
- package/dist/model/bar.js +18 -11
- package/dist/model/base-model.js +11 -4
- package/dist/model/basic-number-card.js +20 -13
- package/dist/model/chart.js +13 -7
- package/dist/model/combination.js +22 -15
- package/dist/model/compare-bar.js +21 -14
- package/dist/model/completeness-group.js +18 -11
- package/dist/model/completeness.js +17 -10
- package/dist/model/dashboard.js +14 -7
- package/dist/model/funnel.js +21 -14
- package/dist/model/generic-model.js +143 -135
- package/dist/model/heat-map.js +16 -9
- package/dist/model/horizontal-bar.js +18 -11
- package/dist/model/horizontal-group-bar.js +17 -10
- package/dist/model/index.js +93 -69
- package/dist/model/line-group.js +20 -13
- package/dist/model/line.js +19 -12
- package/dist/model/map-bubble.js +17 -10
- package/dist/model/map.js +19 -12
- package/dist/model/mirror.js +20 -13
- package/dist/model/pie.js +19 -12
- package/dist/model/ring.js +19 -12
- package/dist/model/scatter.js +17 -10
- package/dist/model/stacked-horizontal-bar.js +18 -11
- package/dist/model/table-element.js +12 -5
- package/dist/model/table.js +14 -7
- package/dist/model/tree-map.js +14 -7
- package/dist/model/trend.js +18 -11
- package/dist/model/user.js +7 -1
- package/dist/model/world-map-bubble.js +19 -12
- package/dist/model/world-map.js +19 -12
- package/dist/services/map-json.js +13 -7
- package/dist/settings/advance-bar-settings/data-settings.js +46 -42
- package/dist/settings/advance-bar-settings/index.js +20 -3
- package/dist/settings/advance-bar-settings/style-settings.js +73 -69
- package/dist/settings/bar-settings/data-settings.js +49 -45
- package/dist/settings/bar-settings/index.js +20 -3
- package/dist/settings/bar-settings/style-settings.js +59 -55
- package/dist/settings/basic-number-card/data-settings.js +57 -49
- package/dist/settings/basic-number-card/index.js +20 -3
- package/dist/settings/basic-number-card/style-settings.js +26 -18
- package/dist/settings/combination-settings/data-settings.js +65 -60
- package/dist/settings/combination-settings/index.js +20 -3
- package/dist/settings/combination-settings/style-settings.js +74 -69
- package/dist/settings/completeness-settings/callbacks/callbacks.js +27 -16
- package/dist/settings/completeness-settings/data-settings/completion-settings.js +28 -21
- package/dist/settings/completeness-settings/data-settings/data-settings.js +32 -25
- package/dist/settings/completeness-settings/index.js +20 -3
- package/dist/settings/completeness-settings/style-settings.js +26 -19
- package/dist/settings/dashboard-settings/data-settings.js +51 -43
- package/dist/settings/dashboard-settings/index.js +13 -2
- package/dist/settings/data-settings.js +79 -72
- package/dist/settings/funnel-settings/components/dnd-item/dnd-item.js +19 -12
- package/dist/settings/funnel-settings/components/dnd-list.js +23 -15
- package/dist/settings/funnel-settings/components/funnel-label-setting.js +40 -32
- package/dist/settings/funnel-settings/components/funnel-layer-setting.js +30 -22
- package/dist/settings/funnel-settings/data-settings.js +31 -23
- package/dist/settings/funnel-settings/index.js +20 -3
- package/dist/settings/funnel-settings/style-settings.js +19 -11
- package/dist/settings/heat-map-settings/data-settings.js +26 -18
- package/dist/settings/heat-map-settings/index.js +20 -3
- package/dist/settings/heat-map-settings/style-settings.js +26 -18
- package/dist/settings/horizontal-bar-settings/data-settings.js +19 -12
- package/dist/settings/horizontal-bar-settings/index.js +20 -3
- package/dist/settings/horizontal-bar-settings/style-settings.js +19 -12
- package/dist/settings/index.js +75 -58
- package/dist/settings/map-settings/components/location-field-selector.js +17 -10
- package/dist/settings/map-settings/components/map-level-selector.js +18 -11
- package/dist/settings/map-settings/components/map-province-city-selector.js +26 -19
- package/dist/settings/map-settings/index.js +20 -3
- package/dist/settings/map-settings/map-data-settings.js +30 -23
- package/dist/settings/map-settings/map-style-settings.js +34 -26
- package/dist/settings/mirror-settings/data-settings.js +34 -26
- package/dist/settings/mirror-settings/index.js +13 -2
- package/dist/settings/pie-settings/data-settings.js +41 -33
- package/dist/settings/pie-settings/index.js +20 -3
- package/dist/settings/pie-settings/style-settings.js +55 -47
- package/dist/settings/scatter/data-settings.js +34 -27
- package/dist/settings/scatter/index.js +12 -3
- package/dist/settings/stacks-settings/index.js +27 -19
- package/dist/settings/stacks-settings/stack-item-settings.js +27 -19
- package/dist/settings/style-settings.js +72 -64
- package/dist/settings/table-element-settings/components/data-filter.js +37 -29
- package/dist/settings/table-element-settings/data-settings.js +29 -21
- package/dist/settings/table-element-settings/index.js +13 -2
- package/dist/settings/table-settings/data-settings.js +119 -111
- package/dist/settings/table-settings/index.js +13 -2
- package/dist/settings/time-comparison-settings/data-settings.js +51 -43
- package/dist/settings/time-comparison-settings/index.js +20 -3
- package/dist/settings/time-comparison-settings/style-settings.js +50 -42
- package/dist/settings/trend-settings/data-settings.js +32 -24
- package/dist/settings/trend-settings/index.js +20 -3
- package/dist/settings/trend-settings/style-setting.js +25 -17
- package/dist/settings/widgets/basic-summary/index.js +66 -66
- package/dist/settings/widgets/chart-type/index.js +34 -19
- package/dist/settings/widgets/color-settings/index.js +80 -72
- package/dist/settings/widgets/common-data-settings.js +30 -25
- package/dist/settings/widgets/data-filter/index.js +40 -32
- package/dist/settings/widgets/data-sort.js +24 -16
- package/dist/settings/widgets/date-summary-item.js +32 -24
- package/dist/settings/widgets/display-values-settings/index.js +22 -14
- package/dist/settings/widgets/divider/index.js +16 -8
- package/dist/settings/widgets/font-settings/font-color-settings.js +19 -11
- package/dist/settings/widgets/font-settings/font-size-settings.js +22 -14
- package/dist/settings/widgets/font-settings/font-weight-settings.js +25 -17
- package/dist/settings/widgets/font-settings/index.js +27 -4
- package/dist/settings/widgets/group-by.js +59 -51
- package/dist/settings/widgets/min-max-setting.js +18 -10
- package/dist/settings/widgets/mininum-slice-percent.js +18 -10
- package/dist/settings/widgets/numeric-summary-item.js +31 -23
- package/dist/settings/widgets/select-line-type/index.js +17 -10
- package/dist/settings/widgets/select-table/index.js +16 -9
- package/dist/settings/widgets/select-view/index.js +28 -20
- package/dist/settings/widgets/stack.js +22 -14
- package/dist/settings/widgets/summary-method-setting.js +25 -17
- package/dist/settings/widgets/summary-settings.js +80 -72
- package/dist/settings/widgets/switch/index.js +15 -8
- package/dist/settings/widgets/text-horizontal-settings.js +23 -15
- package/dist/settings/widgets/time-picker.js +37 -29
- package/dist/settings/widgets/title-settings/index.js +37 -29
- package/dist/settings/widgets/title-settings/title-text.js +12 -5
- package/dist/settings/widgets/x-axios.js +1 -0
- package/dist/settings/widgets/y-axis-group-settings.js +71 -63
- package/dist/utils/cell-format-utils.js +29 -19
- package/dist/utils/cell-value-utils.js +11 -4
- package/dist/utils/chart-utils/base-utils.js +290 -279
- package/dist/utils/chart-utils/index.js +39 -26
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +84 -77
- package/dist/utils/chart-utils/original-data-utils/card-calculator.js +20 -13
- package/dist/utils/chart-utils/original-data-utils/combination-calculator.js +52 -45
- package/dist/utils/chart-utils/original-data-utils/compare-bar-chart-calculator.js +26 -19
- package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +39 -32
- package/dist/utils/chart-utils/original-data-utils/dashboard-calculator.js +23 -16
- package/dist/utils/chart-utils/original-data-utils/index.js +57 -50
- package/dist/utils/chart-utils/original-data-utils/mirror-calculator.js +26 -19
- package/dist/utils/chart-utils/original-data-utils/pivot-table-calculator.js +96 -90
- package/dist/utils/chart-utils/original-data-utils/scatter-calculator.js +25 -18
- package/dist/utils/chart-utils/original-data-utils/trend-calculator.js +34 -27
- package/dist/utils/chart-utils/sql-statistics-utils.js +237 -229
- package/dist/utils/chart.js +17 -9
- package/dist/utils/collaborator-manager.js +9 -3
- package/dist/utils/collaborator-utils.js +30 -18
- package/dist/utils/collaborator.js +13 -4
- package/dist/utils/color-utils.js +29 -18
- package/dist/utils/column-utils.js +88 -63
- package/dist/utils/common-utils.js +52 -27
- package/dist/utils/concurrency-manager.js +7 -1
- package/dist/utils/contexts.js +11 -4
- package/dist/utils/custom-g2.js +241 -212
- package/dist/utils/date-translate.js +19 -11
- package/dist/utils/digital-sign-utils.js +14 -7
- package/dist/utils/event-bus.js +7 -1
- package/dist/utils/hotkey.js +11 -5
- package/dist/utils/index.js +219 -53
- package/dist/utils/key-generator.js +9 -2
- package/dist/utils/map.js +31 -22
- package/dist/utils/object-utils.js +7 -1
- package/dist/utils/options-utils.js +16 -8
- package/dist/utils/row-record-utils.js +164 -152
- package/dist/utils/row-utils.js +38 -27
- package/dist/utils/search.js +32 -24
- package/dist/utils/sql/chart-data-sql.js +55 -49
- package/dist/utils/sql/column-2-sql-column.js +153 -143
- package/dist/utils/sql/index.js +27 -3
- package/dist/utils/trend-utils.js +45 -37
- package/dist/view/index.js +96 -87
- package/dist/view/title/index.js +23 -15
- package/dist/view/wrapper/area.js +46 -39
- package/dist/view/wrapper/bar-custom.js +40 -33
- package/dist/view/wrapper/bar-group.js +58 -51
- package/dist/view/wrapper/bar.js +42 -35
- package/dist/view/wrapper/basic-number-card.js +25 -17
- package/dist/view/wrapper/chart-component.js +116 -54
- package/dist/view/wrapper/combination.js +82 -75
- package/dist/view/wrapper/compare.js +57 -50
- package/dist/view/wrapper/completeness.js +32 -24
- package/dist/view/wrapper/dashboard.js +21 -14
- package/dist/view/wrapper/funnel.js +26 -19
- package/dist/view/wrapper/heat-map.js +60 -53
- package/dist/view/wrapper/horizontal-bar-group.js +48 -41
- package/dist/view/wrapper/horizontal-bar.js +39 -32
- package/dist/view/wrapper/horizontal-component.js +23 -15
- package/dist/view/wrapper/index.js +148 -96
- package/dist/view/wrapper/line-group.js +41 -34
- package/dist/view/wrapper/line.js +39 -32
- package/dist/view/wrapper/map.js +54 -46
- package/dist/view/wrapper/mirror.js +38 -31
- package/dist/view/wrapper/pie.js +50 -43
- package/dist/view/wrapper/ring.js +59 -52
- package/dist/view/wrapper/scatter.js +30 -22
- package/dist/view/wrapper/table/index.js +21 -13
- package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +57 -49
- package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +58 -50
- package/dist/view/wrapper/table/pivot-table-display-name.js +90 -82
- package/dist/view/wrapper/table/two-dimension-table.js +84 -76
- package/dist/view/wrapper/table-element/components/dataset-utils.js +36 -23
- package/dist/view/wrapper/table-element/components/formatter.js +98 -89
- package/dist/view/wrapper/table-element/components/formatters/FileFormatter/index.js +31 -22
- package/dist/view/wrapper/table-element/components/formatters/formula-formatter.js +16 -9
- package/dist/view/wrapper/table-element/components/formatters/link-formatter.js +80 -73
- package/dist/view/wrapper/table-element/components/formula-formatter.js +16 -9
- package/dist/view/wrapper/table-element/components/link-formatter.js +80 -73
- package/dist/view/wrapper/table-element/components/record.js +17 -10
- package/dist/view/wrapper/table-element/components/records-body.js +17 -9
- package/dist/view/wrapper/table-element/components/records-header/index.js +16 -8
- package/dist/view/wrapper/table-element/components/records-header/records-header-cell.js +16 -8
- package/dist/view/wrapper/table-element/components/records.js +29 -21
- package/dist/view/wrapper/table-element/components/resize-column-handle/resize-column-handle.js +13 -6
- package/dist/view/wrapper/table-element/components/utils.js +15 -5
- package/dist/view/wrapper/table-element/components/value-display-utils.js +11 -4
- package/dist/view/wrapper/table-element/components/vertical-scrollbar/index.js +13 -6
- package/dist/view/wrapper/table-element/index.js +24 -16
- package/dist/view/wrapper/treemap.js +43 -36
- package/dist/view/wrapper/trend.js +47 -39
- package/dist/view/wrapper/world-map.js +60 -52
- package/dist/view/wrapper/wrappers-d3/bar.js +262 -0
- package/package.json +15 -17
package/dist/view/wrapper/pie.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _constants = require("dtable-ui-component/lib/constants");
|
|
11
|
+
var _constants2 = require("../../constants");
|
|
12
|
+
var _utils = require("../../utils");
|
|
13
|
+
var _intl = _interopRequireDefault(require("../../intl"));
|
|
14
|
+
var _colorRules = require("../../constants/color-rules");
|
|
15
|
+
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
16
|
+
class Pie extends _chartComponent.default {
|
|
10
17
|
constructor(props) {
|
|
11
18
|
super(props);
|
|
12
19
|
this.createChart = () => {
|
|
@@ -17,7 +24,7 @@ class Pie extends ChartComponent {
|
|
|
17
24
|
label_position
|
|
18
25
|
} = chart.config;
|
|
19
26
|
this.initChart(this.container, {
|
|
20
|
-
appendPadding: label_position === CHART_LABEL_POSITIONS[1] ? [10, 0, 10, 0] : null
|
|
27
|
+
appendPadding: label_position === _constants2.CHART_LABEL_POSITIONS[1] ? [10, 0, 10, 0] : null
|
|
21
28
|
});
|
|
22
29
|
};
|
|
23
30
|
this.destroyChart = () => {
|
|
@@ -38,7 +45,7 @@ class Pie extends ChartComponent {
|
|
|
38
45
|
summaryColumn,
|
|
39
46
|
customRender
|
|
40
47
|
} = this.props;
|
|
41
|
-
const theme = CHART_THEME_COLOR[globalTheme];
|
|
48
|
+
const theme = _constants2.CHART_THEME_COLOR[globalTheme];
|
|
42
49
|
if (data.length === 0) return;
|
|
43
50
|
this.chart.coordinate('theta', {
|
|
44
51
|
radius: 0.7
|
|
@@ -51,12 +58,12 @@ class Pie extends ChartComponent {
|
|
|
51
58
|
summary_method,
|
|
52
59
|
color_theme
|
|
53
60
|
} = chart.config;
|
|
54
|
-
const currentTheme = BaseUtils.getCurrentTheme(chartColorTheme);
|
|
55
|
-
const useSingleSelectColumnColor = color_theme === SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.SINGLE_SELECT_COLUMN_COLORS;
|
|
61
|
+
const currentTheme = _utils.BaseUtils.getCurrentTheme(chartColorTheme);
|
|
62
|
+
const useSingleSelectColumnColor = color_theme === _colorRules.SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.SINGLE_SELECT_COLUMN_COLORS;
|
|
56
63
|
const {
|
|
57
64
|
data: newData,
|
|
58
65
|
colorMap
|
|
59
|
-
} = BaseUtils.formatPieChartData(data, chart, tables, currentTheme, useSingleSelectColumnColor);
|
|
66
|
+
} = _utils.BaseUtils.formatPieChartData(data, chart, tables, currentTheme, useSingleSelectColumnColor);
|
|
60
67
|
if (!Array.isArray(newData)) return;
|
|
61
68
|
this.loadData(newData);
|
|
62
69
|
this.chart.on('interval:click', e => {
|
|
@@ -74,13 +81,13 @@ class Pie extends ChartComponent {
|
|
|
74
81
|
nice: false
|
|
75
82
|
}
|
|
76
83
|
});
|
|
77
|
-
this.isInnerLabel = !label_position || label_position === CHART_LABEL_POSITIONS[0];
|
|
84
|
+
this.isInnerLabel = !label_position || label_position === _constants2.CHART_LABEL_POSITIONS[0];
|
|
78
85
|
this.innerLabelOffset = '-25%';
|
|
79
86
|
this.outerLabelOffset = 20;
|
|
80
87
|
this.currentChart = this.chart.interval().adjust('stack').position('value').color('name', name => {
|
|
81
88
|
return colorMap[name.trim()];
|
|
82
89
|
}).label('value*percent', (value, percent) => {
|
|
83
|
-
const displayValue = BaseUtils.getSummaryValueDisplayString(summaryColumn, value, summary_method);
|
|
90
|
+
const displayValue = _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, value, summary_method);
|
|
84
91
|
return {
|
|
85
92
|
content: this.getLabel(displayValue, percent)
|
|
86
93
|
};
|
|
@@ -88,17 +95,17 @@ class Pie extends ChartComponent {
|
|
|
88
95
|
offset: this.isInnerLabel ? this.innerLabelOffset : this.outerLabelOffset,
|
|
89
96
|
style: {
|
|
90
97
|
fill: theme.labelColor,
|
|
91
|
-
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
98
|
+
fontSize: _utils.BaseUtils.getLabelFontSize(label_font_size),
|
|
92
99
|
...this.labelStroke
|
|
93
100
|
}
|
|
94
101
|
}).tooltip('name*value*percent', (name, value, percent) => {
|
|
95
102
|
let title = name;
|
|
96
103
|
if (!name || name.trim() === 'undefined' || name.trim() === 'null') {
|
|
97
|
-
title =
|
|
104
|
+
title = _intl.default.get('Empty');
|
|
98
105
|
} else if (name === '_Others') {
|
|
99
|
-
title =
|
|
106
|
+
title = _intl.default.get('Others');
|
|
100
107
|
}
|
|
101
|
-
const displayValue = BaseUtils.getSummaryValueDisplayString(summaryColumn, value, summary_method);
|
|
108
|
+
const displayValue = _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, value, summary_method);
|
|
102
109
|
return {
|
|
103
110
|
name: title,
|
|
104
111
|
value: display_label ? this.getLabel(displayValue, percent) : displayValue
|
|
@@ -127,7 +134,7 @@ class Pie extends ChartComponent {
|
|
|
127
134
|
summaryColumn,
|
|
128
135
|
summaryMethod: summary_method
|
|
129
136
|
}));
|
|
130
|
-
isFunction(customRender) && customRender(this.chart);
|
|
137
|
+
(0, _utils.isFunction)(customRender) && customRender(this.chart);
|
|
131
138
|
requestAnimationFrame(() => {
|
|
132
139
|
this.chart.render();
|
|
133
140
|
});
|
|
@@ -143,10 +150,10 @@ class Pie extends ChartComponent {
|
|
|
143
150
|
const {
|
|
144
151
|
globalTheme
|
|
145
152
|
} = this.props;
|
|
146
|
-
const theme = CHART_THEME_COLOR[globalTheme];
|
|
153
|
+
const theme = _constants2.CHART_THEME_COLOR[globalTheme];
|
|
147
154
|
this.currentChart.label('name*value*percent', (name, value, percent) => {
|
|
148
155
|
let displayValue;
|
|
149
|
-
displayValue = BaseUtils.getSummaryValueDisplayString(summaryColumn, value, summaryMethod);
|
|
156
|
+
displayValue = _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, value, summaryMethod);
|
|
150
157
|
return {
|
|
151
158
|
content: this.getLabel(displayValue, percent)
|
|
152
159
|
};
|
|
@@ -154,7 +161,7 @@ class Pie extends ChartComponent {
|
|
|
154
161
|
offset: this.isInnerLabel ? this.innerLabelOffset : this.outerLabelOffset,
|
|
155
162
|
style: {
|
|
156
163
|
fill: theme.labelColor,
|
|
157
|
-
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
164
|
+
fontSize: _utils.BaseUtils.getLabelFontSize(label_font_size),
|
|
158
165
|
...this.labelStroke
|
|
159
166
|
}
|
|
160
167
|
});
|
|
@@ -172,9 +179,9 @@ class Pie extends ChartComponent {
|
|
|
172
179
|
const {
|
|
173
180
|
globalTheme
|
|
174
181
|
} = this.props;
|
|
175
|
-
const theme = CHART_THEME_COLOR[globalTheme];
|
|
182
|
+
const theme = _constants2.CHART_THEME_COLOR[globalTheme];
|
|
176
183
|
this.currentChart.label('value*percent', (value, percent) => {
|
|
177
|
-
let displayValue = BaseUtils.getSummaryValueDisplayString(summaryColumn, value, summary_method);
|
|
184
|
+
let displayValue = _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, value, summary_method);
|
|
178
185
|
return {
|
|
179
186
|
content: this.getLabel(displayValue, percent)
|
|
180
187
|
};
|
|
@@ -182,7 +189,7 @@ class Pie extends ChartComponent {
|
|
|
182
189
|
offset: this.isInnerLabel ? this.innerLabelOffset : this.outerLabelOffset,
|
|
183
190
|
style: {
|
|
184
191
|
fill: theme.labelColor,
|
|
185
|
-
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
192
|
+
fontSize: _utils.BaseUtils.getLabelFontSize(label_font_size),
|
|
186
193
|
...this.labelStroke
|
|
187
194
|
}
|
|
188
195
|
});
|
|
@@ -197,11 +204,11 @@ class Pie extends ChartComponent {
|
|
|
197
204
|
return '';
|
|
198
205
|
}
|
|
199
206
|
switch (label_format) {
|
|
200
|
-
case CHART_LABEL_FORMATS[0]:
|
|
207
|
+
case _constants2.CHART_LABEL_FORMATS[0]:
|
|
201
208
|
return percent;
|
|
202
|
-
case CHART_LABEL_FORMATS[1]:
|
|
209
|
+
case _constants2.CHART_LABEL_FORMATS[1]:
|
|
203
210
|
return value;
|
|
204
|
-
case CHART_LABEL_FORMATS[2]:
|
|
211
|
+
case _constants2.CHART_LABEL_FORMATS[2]:
|
|
205
212
|
return "".concat(value, " (").concat(percent, ")");
|
|
206
213
|
default:
|
|
207
214
|
return percent;
|
|
@@ -215,7 +222,7 @@ class Pie extends ChartComponent {
|
|
|
215
222
|
}
|
|
216
223
|
componentDidUpdate(prevProps) {
|
|
217
224
|
super.componentDidUpdate(prevProps);
|
|
218
|
-
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
225
|
+
if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
219
226
|
this.chart && this.destroyChart();
|
|
220
227
|
this.createChart();
|
|
221
228
|
this.drawChart();
|
|
@@ -225,22 +232,22 @@ class Pie extends ChartComponent {
|
|
|
225
232
|
this.chart && this.destroyChart();
|
|
226
233
|
}
|
|
227
234
|
render() {
|
|
228
|
-
return /*#__PURE__*/
|
|
235
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
229
236
|
className: "sea-chart-container ",
|
|
230
237
|
ref: ref => this.container = ref
|
|
231
238
|
});
|
|
232
239
|
}
|
|
233
240
|
}
|
|
234
241
|
Pie.propTypes = {
|
|
235
|
-
canvasStyle:
|
|
236
|
-
chart:
|
|
237
|
-
groupbyColumn:
|
|
238
|
-
summaryColumn:
|
|
239
|
-
result:
|
|
240
|
-
tables:
|
|
241
|
-
globalTheme:
|
|
242
|
-
chartColorTheme:
|
|
243
|
-
toggleRecords:
|
|
244
|
-
customRender:
|
|
242
|
+
canvasStyle: _propTypes.default.object,
|
|
243
|
+
chart: _propTypes.default.object,
|
|
244
|
+
groupbyColumn: _propTypes.default.object,
|
|
245
|
+
summaryColumn: _propTypes.default.object,
|
|
246
|
+
result: _propTypes.default.array,
|
|
247
|
+
tables: _propTypes.default.array,
|
|
248
|
+
globalTheme: _propTypes.default.string,
|
|
249
|
+
chartColorTheme: _propTypes.default.string,
|
|
250
|
+
toggleRecords: _propTypes.default.func,
|
|
251
|
+
customRender: _propTypes.default.func
|
|
245
252
|
};
|
|
246
|
-
|
|
253
|
+
var _default = exports.default = Pie;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _constants = require("../../constants");
|
|
11
|
+
var _utils = require("../../utils");
|
|
12
|
+
var _intl = _interopRequireDefault(require("../../intl"));
|
|
13
|
+
var _colorRules = require("../../constants/color-rules");
|
|
14
|
+
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
15
|
+
class Ring extends _chartComponent.default {
|
|
9
16
|
constructor(props) {
|
|
10
17
|
var _this;
|
|
11
18
|
super(props);
|
|
@@ -34,7 +41,7 @@ class Ring extends ChartComponent {
|
|
|
34
41
|
summaryColumn,
|
|
35
42
|
customRender
|
|
36
43
|
} = this.props;
|
|
37
|
-
const theme = CHART_THEME_COLOR[globalTheme];
|
|
44
|
+
const theme = _constants.CHART_THEME_COLOR[globalTheme];
|
|
38
45
|
const radius = 0.7;
|
|
39
46
|
const innerRadius = 0.8;
|
|
40
47
|
if (data.length === 0) return;
|
|
@@ -52,13 +59,13 @@ class Ring extends ChartComponent {
|
|
|
52
59
|
label_format,
|
|
53
60
|
color_theme
|
|
54
61
|
} = chart.config;
|
|
55
|
-
const colorTheme = BaseUtils.getCurrentTheme(chartColorTheme);
|
|
56
|
-
const useSingleSelectColumnColor = color_theme === SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.SINGLE_SELECT_COLUMN_COLORS;
|
|
62
|
+
const colorTheme = _utils.BaseUtils.getCurrentTheme(chartColorTheme);
|
|
63
|
+
const useSingleSelectColumnColor = color_theme === _colorRules.SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.SINGLE_SELECT_COLUMN_COLORS;
|
|
57
64
|
const {
|
|
58
65
|
data: newData,
|
|
59
66
|
colorMap,
|
|
60
67
|
total
|
|
61
|
-
} = BaseUtils.formatPieChartData(data, chart, tables, colorTheme, useSingleSelectColumnColor);
|
|
68
|
+
} = _utils.BaseUtils.formatPieChartData(data, chart, tables, colorTheme, useSingleSelectColumnColor);
|
|
62
69
|
if (!Array.isArray(newData)) return;
|
|
63
70
|
this.sum = total;
|
|
64
71
|
this.loadData(newData);
|
|
@@ -78,13 +85,13 @@ class Ring extends ChartComponent {
|
|
|
78
85
|
}
|
|
79
86
|
});
|
|
80
87
|
const labelWidthMap = {
|
|
81
|
-
[CHART_LABEL_FORMATS[0]]: 30,
|
|
82
|
-
[CHART_LABEL_FORMATS[1]]: 20,
|
|
83
|
-
[CHART_LABEL_FORMATS[2]]: 40
|
|
88
|
+
[_constants.CHART_LABEL_FORMATS[0]]: 30,
|
|
89
|
+
[_constants.CHART_LABEL_FORMATS[1]]: 20,
|
|
90
|
+
[_constants.CHART_LABEL_FORMATS[2]]: 40
|
|
84
91
|
};
|
|
85
92
|
const currntLabelWidth = labelWidthMap[label_format];
|
|
86
93
|
let elementWidth = this.chart.height * radius * (1 - innerRadius) / 2;
|
|
87
|
-
const isInnerLabel = !label_position || label_position === CHART_LABEL_POSITIONS[0];
|
|
94
|
+
const isInnerLabel = !label_position || label_position === _constants.CHART_LABEL_POSITIONS[0];
|
|
88
95
|
this.isInnerLabel = isInnerLabel;
|
|
89
96
|
let innerLabelOffset;
|
|
90
97
|
let outerLabelOffset = 20;
|
|
@@ -99,7 +106,7 @@ class Ring extends ChartComponent {
|
|
|
99
106
|
this.currentChart = this.chart.interval().adjust('stack').position('value').color('name', name => {
|
|
100
107
|
return colorMap[name.trim()];
|
|
101
108
|
}).label('value*percent', (value, percent) => {
|
|
102
|
-
const displayValue = BaseUtils.getSummaryValueDisplayString(summaryColumn, value, summary_method);
|
|
109
|
+
const displayValue = _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, value, summary_method);
|
|
103
110
|
return {
|
|
104
111
|
content: this.getLabel(displayValue, percent)
|
|
105
112
|
};
|
|
@@ -107,17 +114,17 @@ class Ring extends ChartComponent {
|
|
|
107
114
|
offset: isInnerLabel ? innerLabelOffset : 20,
|
|
108
115
|
style: {
|
|
109
116
|
fill: theme.ringLabelColor,
|
|
110
|
-
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
117
|
+
fontSize: _utils.BaseUtils.getLabelFontSize(label_font_size),
|
|
111
118
|
...this.labelStroke
|
|
112
119
|
}
|
|
113
120
|
}).tooltip('name*value*percent', (name, value, percent) => {
|
|
114
121
|
let title = name;
|
|
115
122
|
if (!name || name === 'undefined' || name.trim() === 'undefined' || name.trim() === 'null') {
|
|
116
|
-
title =
|
|
123
|
+
title = _intl.default.get('Empty');
|
|
117
124
|
} else if (name === '_Others') {
|
|
118
|
-
title =
|
|
125
|
+
title = _intl.default.get('Others');
|
|
119
126
|
}
|
|
120
|
-
const displayValue = BaseUtils.getSummaryValueDisplayString(summaryColumn, value, summary_method);
|
|
127
|
+
const displayValue = _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, value, summary_method);
|
|
121
128
|
return {
|
|
122
129
|
name: title,
|
|
123
130
|
value: display_label ? this.getLabel(displayValue, percent) : displayValue
|
|
@@ -140,8 +147,8 @@ class Ring extends ChartComponent {
|
|
|
140
147
|
});
|
|
141
148
|
this.setToolTipForTheta();
|
|
142
149
|
this.setAnnotation({
|
|
143
|
-
name:
|
|
144
|
-
value: BaseUtils.getSummaryValueDisplayString(summaryColumn, this.sum, summary_method)
|
|
150
|
+
name: _intl.default.get('Total'),
|
|
151
|
+
value: _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, this.sum, summary_method)
|
|
145
152
|
}, '', theme);
|
|
146
153
|
this.chart.on('interval:mouseenter', evt => this.onEnterRingChart(evt, {
|
|
147
154
|
summaryColumn,
|
|
@@ -152,7 +159,7 @@ class Ring extends ChartComponent {
|
|
|
152
159
|
summaryMethod: summary_method
|
|
153
160
|
}));
|
|
154
161
|
this.chart.interaction('element-highlight');
|
|
155
|
-
isFunction(customRender) && customRender(this.chart);
|
|
162
|
+
(0, _utils.isFunction)(customRender) && customRender(this.chart);
|
|
156
163
|
requestAnimationFrame(() => {
|
|
157
164
|
this.chart.render();
|
|
158
165
|
});
|
|
@@ -166,11 +173,11 @@ class Ring extends ChartComponent {
|
|
|
166
173
|
return '';
|
|
167
174
|
}
|
|
168
175
|
switch (label_format) {
|
|
169
|
-
case CHART_LABEL_FORMATS[0]:
|
|
176
|
+
case _constants.CHART_LABEL_FORMATS[0]:
|
|
170
177
|
return percent;
|
|
171
|
-
case CHART_LABEL_FORMATS[1]:
|
|
178
|
+
case _constants.CHART_LABEL_FORMATS[1]:
|
|
172
179
|
return value;
|
|
173
|
-
case CHART_LABEL_FORMATS[2]:
|
|
180
|
+
case _constants.CHART_LABEL_FORMATS[2]:
|
|
174
181
|
return "".concat(value, " (").concat(percent, ")");
|
|
175
182
|
default:
|
|
176
183
|
return percent;
|
|
@@ -181,12 +188,12 @@ class Ring extends ChartComponent {
|
|
|
181
188
|
summaryColumn,
|
|
182
189
|
summaryMethod
|
|
183
190
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
184
|
-
let theme = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : CHART_THEME_COLOR['light'];
|
|
191
|
+
let theme = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _constants.CHART_THEME_COLOR['light'];
|
|
185
192
|
let name = content.name;
|
|
186
193
|
if (!name || name === 'undefined') {
|
|
187
|
-
name =
|
|
194
|
+
name = _intl.default.get('Empty');
|
|
188
195
|
} else if (name === '_Others') {
|
|
189
|
-
name =
|
|
196
|
+
name = _intl.default.get('Others');
|
|
190
197
|
}
|
|
191
198
|
_this.chart.annotation().text({
|
|
192
199
|
content: name,
|
|
@@ -200,7 +207,7 @@ class Ring extends ChartComponent {
|
|
|
200
207
|
offsetY: -10
|
|
201
208
|
}).text({
|
|
202
209
|
position: ['50%', '50%'],
|
|
203
|
-
content: summaryColumn ? BaseUtils.getSummaryValueDisplayString(summaryColumn, content.value, summaryMethod) : content.value,
|
|
210
|
+
content: summaryColumn ? _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, content.value, summaryMethod) : content.value,
|
|
204
211
|
style: {
|
|
205
212
|
fontSize: theme.annotationFontSize,
|
|
206
213
|
fill: theme.annotationValueFontColor,
|
|
@@ -220,12 +227,12 @@ class Ring extends ChartComponent {
|
|
|
220
227
|
const {
|
|
221
228
|
globalTheme
|
|
222
229
|
} = this.props;
|
|
223
|
-
const theme = CHART_THEME_COLOR[globalTheme];
|
|
230
|
+
const theme = _constants.CHART_THEME_COLOR[globalTheme];
|
|
224
231
|
const item = evt.data.data;
|
|
225
232
|
this.chart.annotation().clear(true);
|
|
226
233
|
this.currentChart.label('name*value*percent', (name, value, percent) => {
|
|
227
234
|
let displayValue;
|
|
228
|
-
displayValue = BaseUtils.getSummaryValueDisplayString(summaryColumn, value, summaryMethod);
|
|
235
|
+
displayValue = _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, value, summaryMethod);
|
|
229
236
|
return {
|
|
230
237
|
content: this.getLabel(displayValue, percent)
|
|
231
238
|
};
|
|
@@ -233,7 +240,7 @@ class Ring extends ChartComponent {
|
|
|
233
240
|
offset: this.isInnerLabel ? this.innerLabelOffset : this.outerLabelOffset,
|
|
234
241
|
style: {
|
|
235
242
|
fill: theme.ringLabelColor,
|
|
236
|
-
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
243
|
+
fontSize: _utils.BaseUtils.getLabelFontSize(label_font_size),
|
|
237
244
|
...this.labelStroke
|
|
238
245
|
}
|
|
239
246
|
});
|
|
@@ -255,10 +262,10 @@ class Ring extends ChartComponent {
|
|
|
255
262
|
const {
|
|
256
263
|
globalTheme
|
|
257
264
|
} = this.props;
|
|
258
|
-
const theme = CHART_THEME_COLOR[globalTheme];
|
|
265
|
+
const theme = _constants.CHART_THEME_COLOR[globalTheme];
|
|
259
266
|
this.chart.annotation().clear(true);
|
|
260
267
|
this.currentChart.label('value*percent', (value, percent) => {
|
|
261
|
-
let displayValue = BaseUtils.getSummaryValueDisplayString(summaryColumn, value, summary_method);
|
|
268
|
+
let displayValue = _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, value, summary_method);
|
|
262
269
|
return {
|
|
263
270
|
content: this.getLabel(displayValue, percent)
|
|
264
271
|
};
|
|
@@ -266,12 +273,12 @@ class Ring extends ChartComponent {
|
|
|
266
273
|
offset: this.isInnerLabel ? this.innerLabelOffset : this.outerLabelOffset,
|
|
267
274
|
style: {
|
|
268
275
|
fill: theme.ringLabelColor,
|
|
269
|
-
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
276
|
+
fontSize: _utils.BaseUtils.getLabelFontSize(label_font_size),
|
|
270
277
|
...this.labelStroke
|
|
271
278
|
}
|
|
272
279
|
});
|
|
273
280
|
this.setAnnotation({
|
|
274
|
-
name:
|
|
281
|
+
name: _intl.default.get('Total'),
|
|
275
282
|
value: this.sum
|
|
276
283
|
}, {
|
|
277
284
|
summaryColumn,
|
|
@@ -288,7 +295,7 @@ class Ring extends ChartComponent {
|
|
|
288
295
|
}
|
|
289
296
|
componentDidUpdate(prevProps) {
|
|
290
297
|
super.componentDidUpdate(prevProps);
|
|
291
|
-
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
298
|
+
if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
292
299
|
this.chart && this.destroyChart();
|
|
293
300
|
this.sum = 0;
|
|
294
301
|
this.createChart();
|
|
@@ -299,23 +306,23 @@ class Ring extends ChartComponent {
|
|
|
299
306
|
this.chart && this.destroyChart();
|
|
300
307
|
}
|
|
301
308
|
render() {
|
|
302
|
-
return /*#__PURE__*/
|
|
309
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
303
310
|
className: "sea-chart-container",
|
|
304
311
|
ref: ref => this.container = ref
|
|
305
312
|
});
|
|
306
313
|
}
|
|
307
314
|
}
|
|
308
315
|
Ring.propTypes = {
|
|
309
|
-
canvasStyle:
|
|
310
|
-
chart:
|
|
311
|
-
groupbyColumn:
|
|
312
|
-
columnGroupbyColumn:
|
|
313
|
-
summaryColumn:
|
|
314
|
-
result:
|
|
315
|
-
tables:
|
|
316
|
-
globalTheme:
|
|
317
|
-
chartColorTheme:
|
|
318
|
-
toggleRecords:
|
|
319
|
-
customRender:
|
|
316
|
+
canvasStyle: _propTypes.default.object,
|
|
317
|
+
chart: _propTypes.default.object,
|
|
318
|
+
groupbyColumn: _propTypes.default.object,
|
|
319
|
+
columnGroupbyColumn: _propTypes.default.object,
|
|
320
|
+
summaryColumn: _propTypes.default.object,
|
|
321
|
+
result: _propTypes.default.array,
|
|
322
|
+
tables: _propTypes.default.array,
|
|
323
|
+
globalTheme: _propTypes.default.string,
|
|
324
|
+
chartColorTheme: _propTypes.default.string,
|
|
325
|
+
toggleRecords: _propTypes.default.func,
|
|
326
|
+
customRender: _propTypes.default.func
|
|
320
327
|
};
|
|
321
|
-
|
|
328
|
+
var _default = exports.default = Ring;
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.Scatter = Scatter;
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _dtableUtils = require("dtable-utils");
|
|
12
|
+
var _utils = require("../../utils");
|
|
13
|
+
var _intl = _interopRequireDefault(require("../../intl"));
|
|
14
|
+
var _constants = require("../../constants");
|
|
15
|
+
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
16
|
+
const chartComponent = new _chartComponent.default({});
|
|
17
|
+
function Scatter(_ref) {
|
|
10
18
|
let {
|
|
11
19
|
toggleRecords,
|
|
12
20
|
result: data,
|
|
@@ -15,10 +23,10 @@ export function Scatter(_ref) {
|
|
|
15
23
|
globalTheme,
|
|
16
24
|
chartColorTheme
|
|
17
25
|
} = _ref;
|
|
18
|
-
const chartRef = useRef(chartComponent);
|
|
26
|
+
const chartRef = (0, _react.useRef)(chartComponent);
|
|
19
27
|
chartRef.current.initLabelStroke(globalTheme);
|
|
20
|
-
const chartContainerRef = useRef(null);
|
|
21
|
-
useEffect(() => {
|
|
28
|
+
const chartContainerRef = (0, _react.useRef)(null);
|
|
29
|
+
(0, _react.useEffect)(() => {
|
|
22
30
|
const currentChart = chartRef.current;
|
|
23
31
|
currentChart.isDestoryed = false;
|
|
24
32
|
|
|
@@ -33,7 +41,7 @@ export function Scatter(_ref) {
|
|
|
33
41
|
});
|
|
34
42
|
}
|
|
35
43
|
function drawChart() {
|
|
36
|
-
const newData = BaseUtils.formatEmptyName(data, '',
|
|
44
|
+
const newData = _utils.BaseUtils.formatEmptyName(data, '', _intl.default.get('Empty'));
|
|
37
45
|
if (!Array.isArray(newData)) return;
|
|
38
46
|
currentChart.loadData(newData);
|
|
39
47
|
draw(newData);
|
|
@@ -41,7 +49,7 @@ export function Scatter(_ref) {
|
|
|
41
49
|
currentChart.renderAxisLabel(chart, tables);
|
|
42
50
|
}
|
|
43
51
|
function draw(data) {
|
|
44
|
-
const theme = CHART_THEME_COLOR[globalTheme];
|
|
52
|
+
const theme = _constants.CHART_THEME_COLOR[globalTheme];
|
|
45
53
|
const {
|
|
46
54
|
label_font_size,
|
|
47
55
|
x_axis_column_key,
|
|
@@ -49,12 +57,12 @@ export function Scatter(_ref) {
|
|
|
49
57
|
table_id,
|
|
50
58
|
y_axis_show_value
|
|
51
59
|
} = chart.config;
|
|
52
|
-
const selectedTable = getTableById(tables, table_id);
|
|
53
|
-
const selectedXAxisColumn = getTableColumnByKey(selectedTable, x_axis_column_key);
|
|
54
|
-
const selectedYAxisColumn = getTableColumnByKey(selectedTable, y_axis_column_key);
|
|
60
|
+
const selectedTable = (0, _dtableUtils.getTableById)(tables, table_id);
|
|
61
|
+
const selectedXAxisColumn = (0, _dtableUtils.getTableColumnByKey)(selectedTable, x_axis_column_key);
|
|
62
|
+
const selectedYAxisColumn = (0, _dtableUtils.getTableColumnByKey)(selectedTable, y_axis_column_key);
|
|
55
63
|
currentChart.drawLabels(data);
|
|
56
64
|
let currentIdx = 0;
|
|
57
|
-
let colors = BaseUtils.getCurrentTheme(chartColorTheme).colors;
|
|
65
|
+
let colors = _utils.BaseUtils.getCurrentTheme(chartColorTheme).colors;
|
|
58
66
|
const colorMap = data.reduce((acc, cur) => {
|
|
59
67
|
if (cur.groupby && !acc[cur.groupby]) {
|
|
60
68
|
acc[cur.groupby] = colors[currentIdx++ % colors.length];
|
|
@@ -84,7 +92,7 @@ export function Scatter(_ref) {
|
|
|
84
92
|
});
|
|
85
93
|
currentChart.chart.point().position('name*value').label(y_axis_show_value ? 'value' : false, {
|
|
86
94
|
style: {
|
|
87
|
-
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
95
|
+
fontSize: _utils.BaseUtils.getLabelFontSize(label_font_size),
|
|
88
96
|
fill: theme.labelColor,
|
|
89
97
|
...currentChart.labelStroke
|
|
90
98
|
}
|
|
@@ -95,7 +103,7 @@ export function Scatter(_ref) {
|
|
|
95
103
|
return colorMap[groupby];
|
|
96
104
|
}).shape('circle').tooltip('groupby*name*value', (groupby, name, value) => {
|
|
97
105
|
return {
|
|
98
|
-
name: groupby || groupby === 0 ? groupby :
|
|
106
|
+
name: groupby || groupby === 0 ? groupby : _intl.default.get('Empty'),
|
|
99
107
|
valueX: "".concat(selectedXAxisColumn === null || selectedXAxisColumn === void 0 ? void 0 : selectedXAxisColumn.name, ": ").concat(name),
|
|
100
108
|
valueY: "".concat(selectedYAxisColumn === null || selectedYAxisColumn === void 0 ? void 0 : selectedYAxisColumn.name, ": ").concat(value)
|
|
101
109
|
};
|
|
@@ -122,8 +130,8 @@ export function Scatter(_ref) {
|
|
|
122
130
|
}, [chart, chartColorTheme, data, globalTheme, tables, toggleRecords]);
|
|
123
131
|
const showXLabel = chartRef.current.isShowXAxisLabel(chart);
|
|
124
132
|
const showYLabel = chartRef.current.isShowYAxisLabel(chart);
|
|
125
|
-
return /*#__PURE__*/
|
|
126
|
-
className:
|
|
133
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
134
|
+
className: (0, _classnames.default)('sea-chart-container', {
|
|
127
135
|
'show-x-axis-label': showXLabel,
|
|
128
136
|
'show-y-axis-label': showYLabel
|
|
129
137
|
}),
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
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 {
|
|
8
16
|
constructor() {
|
|
9
17
|
super(...arguments);
|
|
10
18
|
this.toggleRecords = (cell, selectedCell) => {
|
|
@@ -23,20 +31,20 @@ class Table extends PureComponent {
|
|
|
23
31
|
} = result;
|
|
24
32
|
if (!groupbyColumn) return null;
|
|
25
33
|
if (Array.isArray(pivot_columns) && pivot_columns.length > 100) {
|
|
26
|
-
return /*#__PURE__*/
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement("div", null, _intl.default.get('There_are_too_many_statistics_entries_to_display'));
|
|
27
35
|
}
|
|
28
36
|
if (columnGroupbyColumn) {
|
|
29
|
-
return /*#__PURE__*/
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement(_twoDimensionTable.default, Object.assign({}, this.props, {
|
|
30
38
|
toggleRecords: this.toggleRecords
|
|
31
39
|
}));
|
|
32
40
|
}
|
|
33
41
|
if (!Array.isArray(pivot_columns)) return null;
|
|
34
42
|
if (pivot_columns.length < 2) {
|
|
35
|
-
return /*#__PURE__*/
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement(_oneDimensionTableNoNumericColumns.default, Object.assign({}, this.props, {
|
|
36
44
|
toggleRecords: this.toggleRecords
|
|
37
45
|
}));
|
|
38
46
|
}
|
|
39
|
-
return /*#__PURE__*/
|
|
47
|
+
return /*#__PURE__*/_react.default.createElement(_oneDimensionTableWithNumericColumns.default, Object.assign({}, this.props, {
|
|
40
48
|
toggleRecords: this.toggleRecords
|
|
41
49
|
}));
|
|
42
50
|
};
|
|
@@ -45,9 +53,9 @@ class Table extends PureComponent {
|
|
|
45
53
|
const {
|
|
46
54
|
result
|
|
47
55
|
} = this.props;
|
|
48
|
-
return /*#__PURE__*/
|
|
56
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
49
57
|
className: "sea-chart-table-wrapper sea-chart-".concat(result.dimensions, "-table-wrapper")
|
|
50
58
|
}, this.renderContainer());
|
|
51
59
|
}
|
|
52
60
|
}
|
|
53
|
-
|
|
61
|
+
var _default = exports.default = Table;
|