sea-chart 1.1.65 → 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
|
@@ -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 _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _utils = require("../../utils");
|
|
12
|
+
var _intl = _interopRequireDefault(require("../../intl"));
|
|
13
|
+
var _constants = require("../../constants");
|
|
14
|
+
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
15
|
+
class Line extends _chartComponent.default {
|
|
9
16
|
constructor(props) {
|
|
10
17
|
super(props);
|
|
11
18
|
this.createChart = () => {
|
|
@@ -34,12 +41,12 @@ class Line extends ChartComponent {
|
|
|
34
41
|
summaryColumn,
|
|
35
42
|
customRender
|
|
36
43
|
} = this.props;
|
|
37
|
-
data = BaseUtils.formatEmptyName(data, '',
|
|
44
|
+
data = _utils.BaseUtils.formatEmptyName(data, '', _intl.default.get('Empty'));
|
|
38
45
|
if (!Array.isArray(data)) return;
|
|
39
46
|
this.loadData(data);
|
|
40
47
|
this.draw(data);
|
|
41
48
|
this.autoAdjustDataOptions(chart, data, summaryColumn);
|
|
42
|
-
isFunction(customRender) && customRender(this.chart);
|
|
49
|
+
(0, _utils.isFunction)(customRender) && customRender(this.chart);
|
|
43
50
|
requestAnimationFrame(() => {
|
|
44
51
|
this.chart.render();
|
|
45
52
|
});
|
|
@@ -52,7 +59,7 @@ class Line extends ChartComponent {
|
|
|
52
59
|
summaryColumn,
|
|
53
60
|
tables
|
|
54
61
|
} = this.props;
|
|
55
|
-
const theme = CHART_THEME_COLOR[globalTheme];
|
|
62
|
+
const theme = _constants.CHART_THEME_COLOR[globalTheme];
|
|
56
63
|
const {
|
|
57
64
|
table_id,
|
|
58
65
|
y_axis_column_key,
|
|
@@ -74,26 +81,26 @@ class Line extends ChartComponent {
|
|
|
74
81
|
} = chart.style_config || {};
|
|
75
82
|
let chartBarColor;
|
|
76
83
|
// default color
|
|
77
|
-
chartBarColor = CHART_STYLE_COLORS[0];
|
|
84
|
+
chartBarColor = _constants.CHART_STYLE_COLORS[0];
|
|
78
85
|
// use theme color has higher priority
|
|
79
86
|
if (chartColorTheme) {
|
|
80
|
-
chartBarColor = BaseUtils.getCurrentTheme(chartColorTheme).colors[0];
|
|
87
|
+
chartBarColor = _utils.BaseUtils.getCurrentTheme(chartColorTheme).colors[0];
|
|
81
88
|
}
|
|
82
89
|
// use specific color has higher priority then theme color
|
|
83
|
-
if (color_option === TYPE_COLOR_USING.USE_SPECIFIC_COLORS && y_axis_label_color) {
|
|
90
|
+
if (color_option === _constants.TYPE_COLOR_USING.USE_SPECIFIC_COLORS && y_axis_label_color) {
|
|
84
91
|
chartBarColor = y_axis_label_color;
|
|
85
92
|
}
|
|
86
93
|
this.drawLabels(data);
|
|
87
94
|
|
|
88
95
|
// y axis label
|
|
89
96
|
const title = this.getTitle(tables, table_id, y_axis_summary_type, y_axis_column_key || y_axis_summary_column_key);
|
|
90
|
-
const isSmooth = line_type === CHART_LINE_TYPES[1];
|
|
97
|
+
const isSmooth = line_type === _constants.CHART_LINE_TYPES[1];
|
|
91
98
|
|
|
92
99
|
// set Coord type
|
|
93
100
|
this.chart.coordinate('rect');
|
|
94
101
|
this.chart.line().label(y_axis_show_value ? 'value' : false, {
|
|
95
102
|
style: {
|
|
96
|
-
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
103
|
+
fontSize: _utils.BaseUtils.getLabelFontSize(label_font_size),
|
|
97
104
|
fill: theme.labelColor,
|
|
98
105
|
stroke: '#fff',
|
|
99
106
|
lineWidth: 1
|
|
@@ -112,7 +119,7 @@ class Line extends ChartComponent {
|
|
|
112
119
|
}).tooltip('name*value', (name, value) => {
|
|
113
120
|
return {
|
|
114
121
|
title,
|
|
115
|
-
value: BaseUtils.getSummaryValueDisplayString(summaryColumn, value, y_axis_summary_method),
|
|
122
|
+
value: _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, value, y_axis_summary_method),
|
|
116
123
|
name
|
|
117
124
|
};
|
|
118
125
|
});
|
|
@@ -173,7 +180,7 @@ class Line extends ChartComponent {
|
|
|
173
180
|
}
|
|
174
181
|
componentDidUpdate(prevProps) {
|
|
175
182
|
super.componentDidUpdate(prevProps);
|
|
176
|
-
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
183
|
+
if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
177
184
|
var _this$chart;
|
|
178
185
|
((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
|
|
179
186
|
this.createChart();
|
|
@@ -190,8 +197,8 @@ class Line extends ChartComponent {
|
|
|
190
197
|
const {
|
|
191
198
|
chart
|
|
192
199
|
} = this.props;
|
|
193
|
-
return /*#__PURE__*/
|
|
194
|
-
className:
|
|
200
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
201
|
+
className: (0, _classnames.default)('sea-chart-container ', {
|
|
195
202
|
'show-x-axis-label': this.isShowXAxisLabel(chart),
|
|
196
203
|
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
197
204
|
}),
|
|
@@ -200,16 +207,16 @@ class Line extends ChartComponent {
|
|
|
200
207
|
}
|
|
201
208
|
}
|
|
202
209
|
Line.propTypes = {
|
|
203
|
-
canvasStyle:
|
|
204
|
-
chart:
|
|
205
|
-
groupbyColumn:
|
|
206
|
-
columnGroupbyColumn:
|
|
207
|
-
summaryColumn:
|
|
208
|
-
result:
|
|
209
|
-
tables:
|
|
210
|
-
globalTheme:
|
|
211
|
-
chartColorTheme:
|
|
212
|
-
toggleRecords:
|
|
213
|
-
customRender:
|
|
210
|
+
canvasStyle: _propTypes.default.object,
|
|
211
|
+
chart: _propTypes.default.object,
|
|
212
|
+
groupbyColumn: _propTypes.default.object,
|
|
213
|
+
columnGroupbyColumn: _propTypes.default.object,
|
|
214
|
+
summaryColumn: _propTypes.default.object,
|
|
215
|
+
result: _propTypes.default.array,
|
|
216
|
+
tables: _propTypes.default.array,
|
|
217
|
+
globalTheme: _propTypes.default.string,
|
|
218
|
+
chartColorTheme: _propTypes.default.string,
|
|
219
|
+
toggleRecords: _propTypes.default.func,
|
|
220
|
+
customRender: _propTypes.default.func
|
|
214
221
|
};
|
|
215
|
-
|
|
222
|
+
var _default = exports.default = Line;
|
package/dist/view/wrapper/map.js
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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.default = Map;
|
|
9
|
+
var _Loading2 = _interopRequireDefault(require("dtable-ui-component/lib/Loading"));
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _dtableUtils = require("dtable-utils");
|
|
13
|
+
var _dataSet = require("@antv/data-set");
|
|
14
|
+
var _constants = require("../../constants");
|
|
15
|
+
var _customG = require("../../utils/custom-g2");
|
|
16
|
+
var _mapJson = _interopRequireDefault(require("../../services/map-json"));
|
|
17
|
+
var _colorRules = require("../../constants/color-rules");
|
|
18
|
+
var _context = _interopRequireDefault(require("../../context"));
|
|
19
|
+
var _utils = require("../../utils");
|
|
12
20
|
const CHART_STYLE_CONFIG = {
|
|
13
21
|
'g2-tooltip': {
|
|
14
22
|
borderRadius: '2px',
|
|
@@ -27,13 +35,13 @@ function createChart(container) {
|
|
|
27
35
|
const {
|
|
28
36
|
width,
|
|
29
37
|
height
|
|
30
|
-
} = getMapCanvasStyle(container, 1.5);
|
|
38
|
+
} = (0, _utils.getMapCanvasStyle)(container, 1.5);
|
|
31
39
|
let config = {
|
|
32
40
|
container: container,
|
|
33
41
|
width,
|
|
34
42
|
height
|
|
35
43
|
};
|
|
36
|
-
return new Chart(config);
|
|
44
|
+
return new _customG.Chart(config);
|
|
37
45
|
}
|
|
38
46
|
function initChart(currentChart, props) {
|
|
39
47
|
const {
|
|
@@ -69,10 +77,10 @@ function initChart(currentChart, props) {
|
|
|
69
77
|
currentChart.axis(false);
|
|
70
78
|
}
|
|
71
79
|
function mapGetNumberDisplayString(value, columnData, summaryMethod) {
|
|
72
|
-
if (summaryMethod === CHART_SUMMARY_TYPE.Distinct_values) {
|
|
80
|
+
if (summaryMethod === _constants.CHART_SUMMARY_TYPE.Distinct_values) {
|
|
73
81
|
return value;
|
|
74
82
|
}
|
|
75
|
-
return getNumberDisplayString(value, columnData);
|
|
83
|
+
return (0, _dtableUtils.getNumberDisplayString)(value, columnData);
|
|
76
84
|
}
|
|
77
85
|
const formatStatisticData = (statisticData, mapData, type) => {
|
|
78
86
|
if (!statisticData) return [];
|
|
@@ -97,7 +105,7 @@ const formatStatisticData = (statisticData, mapData, type) => {
|
|
|
97
105
|
}
|
|
98
106
|
return statisticNewData;
|
|
99
107
|
};
|
|
100
|
-
|
|
108
|
+
function Map(props) {
|
|
101
109
|
const {
|
|
102
110
|
result: statisticData,
|
|
103
111
|
chart
|
|
@@ -106,7 +114,7 @@ export default function Map(props) {
|
|
|
106
114
|
// mapLocation is initially set to null, in this case mapLevel is country, so doesn't here
|
|
107
115
|
const {
|
|
108
116
|
map_location: mapLocation,
|
|
109
|
-
map_level: mapLevel = MAP_LEVEL.COUNTRY,
|
|
117
|
+
map_level: mapLevel = _constants.MAP_LEVEL.COUNTRY,
|
|
110
118
|
type,
|
|
111
119
|
data_color,
|
|
112
120
|
bubble_color,
|
|
@@ -117,12 +125,12 @@ export default function Map(props) {
|
|
|
117
125
|
summary_method,
|
|
118
126
|
table_id
|
|
119
127
|
} = chart.config;
|
|
120
|
-
const chartRef = useRef(null);
|
|
121
|
-
const chartContainerRef = useRef(null);
|
|
122
|
-
const dataSetRef = useRef(null);
|
|
123
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
124
|
-
const [mapData, setMapData] = useState(null);
|
|
125
|
-
const renderCommonChart = useCallback(function (statisticNewData) {
|
|
128
|
+
const chartRef = (0, _react.useRef)(null);
|
|
129
|
+
const chartContainerRef = (0, _react.useRef)(null);
|
|
130
|
+
const dataSetRef = (0, _react.useRef)(null);
|
|
131
|
+
const [isLoading, setIsLoading] = (0, _react.useState)(true);
|
|
132
|
+
const [mapData, setMapData] = (0, _react.useState)(null);
|
|
133
|
+
const renderCommonChart = (0, _react.useCallback)(function (statisticNewData) {
|
|
126
134
|
const currentDataSet = dataSetRef.current;
|
|
127
135
|
const currentChart = chartRef.current;
|
|
128
136
|
const userDataView = currentDataSet.getView('statisticViewModel').source(statisticNewData).transform({
|
|
@@ -131,16 +139,16 @@ export default function Map(props) {
|
|
|
131
139
|
type: 'geo.region',
|
|
132
140
|
as: ['longitude', 'latitude']
|
|
133
141
|
});
|
|
134
|
-
const currentColorOption = COLOR_OPTIONS.filter(item => item.name === data_color)[0] || COLOR_OPTIONS[0];
|
|
142
|
+
const currentColorOption = _colorRules.COLOR_OPTIONS.filter(item => item.name === data_color)[0] || _colorRules.COLOR_OPTIONS[0];
|
|
135
143
|
const {
|
|
136
144
|
exampleColors,
|
|
137
145
|
highlightedBorderColor
|
|
138
146
|
} = currentColorOption;
|
|
139
|
-
let columnData = DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
140
|
-
if (summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
141
|
-
const table = getTableById(table_id);
|
|
142
|
-
const summaryColumn = getTableColumnByKey(table, summary_column_key) || {};
|
|
143
|
-
columnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
147
|
+
let columnData = _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
148
|
+
if (summary_type === _constants.CHART_SUMMARY_TYPE.ADVANCED) {
|
|
149
|
+
const table = (0, _dtableUtils.getTableById)(table_id);
|
|
150
|
+
const summaryColumn = (0, _dtableUtils.getTableColumnByKey)(table, summary_column_key) || {};
|
|
151
|
+
columnData = summaryColumn.data || _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
144
152
|
}
|
|
145
153
|
const statisticView = currentChart.createView();
|
|
146
154
|
statisticView.data(userDataView.rows);
|
|
@@ -193,7 +201,7 @@ export default function Map(props) {
|
|
|
193
201
|
statisticView.render();
|
|
194
202
|
return statisticView;
|
|
195
203
|
}, [data_color, legend_direction, legend_size, summary_column_key, summary_method, summary_type, table_id]);
|
|
196
|
-
const renderBubbleChart = useCallback(function (statisticNewData) {
|
|
204
|
+
const renderBubbleChart = (0, _react.useCallback)(function (statisticNewData) {
|
|
197
205
|
const currentDataSet = dataSetRef.current;
|
|
198
206
|
const currentChart = chartRef.current;
|
|
199
207
|
const userDv = currentDataSet.createView().source(statisticNewData).transform({
|
|
@@ -202,11 +210,11 @@ export default function Map(props) {
|
|
|
202
210
|
type: 'geo.centroid',
|
|
203
211
|
as: ['longitude', 'latitude']
|
|
204
212
|
});
|
|
205
|
-
let columnData = DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
206
|
-
if (summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
207
|
-
const table = getTableById(table_id);
|
|
208
|
-
const summaryColumn = getTableColumnByKey(table, summary_column_key) || {};
|
|
209
|
-
columnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
213
|
+
let columnData = _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
214
|
+
if (summary_type === _constants.CHART_SUMMARY_TYPE.ADVANCED) {
|
|
215
|
+
const table = (0, _dtableUtils.getTableById)(table_id);
|
|
216
|
+
const summaryColumn = (0, _dtableUtils.getTableColumnByKey)(table, summary_column_key) || {};
|
|
217
|
+
columnData = summaryColumn.data || _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
210
218
|
}
|
|
211
219
|
const statisticView = currentChart.createView();
|
|
212
220
|
statisticView.data(userDv.rows);
|
|
@@ -262,13 +270,13 @@ export default function Map(props) {
|
|
|
262
270
|
statisticView.render();
|
|
263
271
|
return statisticView;
|
|
264
272
|
}, [bubble_color, data_color, legend_direction, legend_size, summary_column_key, summary_method, summary_type, table_id]);
|
|
265
|
-
useEffect(() => {
|
|
273
|
+
(0, _react.useEffect)(() => {
|
|
266
274
|
const handleResize = () => {
|
|
267
275
|
const container = chartContainerRef.current;
|
|
268
276
|
const {
|
|
269
277
|
width,
|
|
270
278
|
height
|
|
271
|
-
} = getMapCanvasStyle(container, 1.5);
|
|
279
|
+
} = (0, _utils.getMapCanvasStyle)(container, 1.5);
|
|
272
280
|
chartRef.current.changeSize(width, height);
|
|
273
281
|
};
|
|
274
282
|
window.addEventListener('resize', handleResize);
|
|
@@ -278,11 +286,11 @@ export default function Map(props) {
|
|
|
278
286
|
}, []);
|
|
279
287
|
|
|
280
288
|
// used to fetch mapJson data
|
|
281
|
-
useEffect(() => {
|
|
289
|
+
(0, _react.useEffect)(() => {
|
|
282
290
|
(async () => {
|
|
283
291
|
try {
|
|
284
|
-
const mediaUrl =
|
|
285
|
-
const mapJson = await
|
|
292
|
+
const mediaUrl = _context.default.getSetting('mediaUrl');
|
|
293
|
+
const mapJson = await (0, _mapJson.default)(mapLevel, mapLocation, mediaUrl);
|
|
286
294
|
setMapData(mapJson);
|
|
287
295
|
setIsLoading(false);
|
|
288
296
|
} catch (error) {
|
|
@@ -294,7 +302,7 @@ export default function Map(props) {
|
|
|
294
302
|
|
|
295
303
|
// used to init map background
|
|
296
304
|
// if no statistics data, then render empty map
|
|
297
|
-
useEffect(() => {
|
|
305
|
+
(0, _react.useEffect)(() => {
|
|
298
306
|
if (!chartRef.current) {
|
|
299
307
|
chartRef.current = createChart(chartContainerRef.current);
|
|
300
308
|
}
|
|
@@ -302,7 +310,7 @@ export default function Map(props) {
|
|
|
302
310
|
if (!mapData) return;
|
|
303
311
|
const currentChart = chartRef.current;
|
|
304
312
|
initChart(currentChart, props);
|
|
305
|
-
const dataSet = new DataSet();
|
|
313
|
+
const dataSet = new _dataSet.DataSet();
|
|
306
314
|
dataSetRef.current = dataSet;
|
|
307
315
|
// transform map data
|
|
308
316
|
const data = dataSet.createView('mapDataModel').source(mapData, {
|
|
@@ -325,7 +333,7 @@ export default function Map(props) {
|
|
|
325
333
|
},
|
|
326
334
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
327
335
|
[mapData]);
|
|
328
|
-
useEffect(() => {
|
|
336
|
+
(0, _react.useEffect)(() => {
|
|
329
337
|
const currentChart = chartRef.current;
|
|
330
338
|
// need mapData and statisticData to render
|
|
331
339
|
if (!Array.isArray(statisticData) || !mapData) return;
|
|
@@ -346,10 +354,10 @@ export default function Map(props) {
|
|
|
346
354
|
currentView && currentView.destroy();
|
|
347
355
|
};
|
|
348
356
|
}, [statisticData, mapData, type, renderCommonChart, renderBubbleChart]);
|
|
349
|
-
return /*#__PURE__*/
|
|
357
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isLoading && /*#__PURE__*/_react.default.createElement("div", {
|
|
350
358
|
className: 'statistic-chart-loading-container'
|
|
351
|
-
}, /*#__PURE__*/
|
|
352
|
-
className:
|
|
359
|
+
}, /*#__PURE__*/_react.default.createElement(_Loading2.default, null)), /*#__PURE__*/_react.default.createElement("div", {
|
|
360
|
+
className: (0, _classnames.default)('sea-chart-container '),
|
|
353
361
|
style: {
|
|
354
362
|
display: 'flex',
|
|
355
363
|
justifyContent: 'center',
|
|
@@ -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 _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _dtableUtils = require("dtable-utils");
|
|
12
|
+
var _intl = _interopRequireDefault(require("../../intl"));
|
|
13
|
+
var _utils = require("../../utils");
|
|
14
|
+
var _constants = require("../../constants");
|
|
15
|
+
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
16
|
+
class Mirror extends _chartComponent.default {
|
|
10
17
|
constructor(props) {
|
|
11
18
|
super(props);
|
|
12
19
|
this.createChart = () => {
|
|
@@ -33,7 +40,7 @@ class Mirror extends ChartComponent {
|
|
|
33
40
|
let {
|
|
34
41
|
result
|
|
35
42
|
} = this.props;
|
|
36
|
-
const data = BaseUtils.formatEmptyName(result.data, '',
|
|
43
|
+
const data = _utils.BaseUtils.formatEmptyName(result.data, '', _intl.default.get('Empty'));
|
|
37
44
|
if (!Array.isArray(data)) return;
|
|
38
45
|
this.draw({
|
|
39
46
|
data,
|
|
@@ -58,11 +65,11 @@ class Mirror extends ChartComponent {
|
|
|
58
65
|
is_transpose
|
|
59
66
|
} = chart.config;
|
|
60
67
|
const themeColors = this.getThemeColors();
|
|
61
|
-
let columnData = DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
62
|
-
if (summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
63
|
-
const table = getTableById(tables, table_id);
|
|
64
|
-
const summaryColumn = getTableColumnByKey(table, summary_column) || {};
|
|
65
|
-
columnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
68
|
+
let columnData = _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
69
|
+
if (summary_type === _constants.CHART_SUMMARY_TYPE.ADVANCED) {
|
|
70
|
+
const table = (0, _dtableUtils.getTableById)(tables, table_id);
|
|
71
|
+
const summaryColumn = (0, _dtableUtils.getTableColumnByKey)(table, summary_column) || {};
|
|
72
|
+
columnData = summaryColumn.data || _constants.DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
66
73
|
}
|
|
67
74
|
this.chart.data(data);
|
|
68
75
|
this.chart.axis('name', {
|
|
@@ -104,7 +111,7 @@ class Mirror extends ChartComponent {
|
|
|
104
111
|
value: {
|
|
105
112
|
sync: true,
|
|
106
113
|
formatter: value => {
|
|
107
|
-
return getNumberDisplayString(value, columnData);
|
|
114
|
+
return (0, _dtableUtils.getNumberDisplayString)(value, columnData);
|
|
108
115
|
}
|
|
109
116
|
},
|
|
110
117
|
group_name: {
|
|
@@ -145,7 +152,7 @@ class Mirror extends ChartComponent {
|
|
|
145
152
|
}
|
|
146
153
|
view.interval().position('name*value').color('group_name', colorSet).tooltip('name*formatted_value', (name, value) => {
|
|
147
154
|
return {
|
|
148
|
-
title: summary_type === 'count' ?
|
|
155
|
+
title: summary_type === 'count' ? _intl.default.get(_constants.TITLE_AMOUNT) : _intl.default.get(_constants.CHART_SUMMARY_SHOW[summary_method]),
|
|
149
156
|
name,
|
|
150
157
|
value
|
|
151
158
|
};
|
|
@@ -178,7 +185,7 @@ class Mirror extends ChartComponent {
|
|
|
178
185
|
}
|
|
179
186
|
componentDidUpdate(prevProps) {
|
|
180
187
|
super.componentDidUpdate(prevProps);
|
|
181
|
-
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
188
|
+
if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
182
189
|
var _this$chart;
|
|
183
190
|
((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
|
|
184
191
|
this.createChart();
|
|
@@ -190,22 +197,22 @@ class Mirror extends ChartComponent {
|
|
|
190
197
|
((_this$chart2 = this.chart) === null || _this$chart2 === void 0 ? void 0 : _this$chart2.autoPadding) && this.chart.destroy();
|
|
191
198
|
}
|
|
192
199
|
render() {
|
|
193
|
-
return /*#__PURE__*/
|
|
194
|
-
className:
|
|
200
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
201
|
+
className: (0, _classnames.default)('sea-chart-container w-100'),
|
|
195
202
|
ref: ref => this.container = ref
|
|
196
203
|
});
|
|
197
204
|
}
|
|
198
205
|
}
|
|
199
206
|
Mirror.propTypes = {
|
|
200
|
-
canvasStyle:
|
|
201
|
-
chart:
|
|
202
|
-
groupbyColumn:
|
|
203
|
-
columnGroupbyColumn:
|
|
204
|
-
summaryColumn:
|
|
205
|
-
result:
|
|
206
|
-
tables:
|
|
207
|
-
theme:
|
|
208
|
-
toggleRecords:
|
|
209
|
-
customRender:
|
|
207
|
+
canvasStyle: _propTypes.default.object,
|
|
208
|
+
chart: _propTypes.default.object,
|
|
209
|
+
groupbyColumn: _propTypes.default.object,
|
|
210
|
+
columnGroupbyColumn: _propTypes.default.object,
|
|
211
|
+
summaryColumn: _propTypes.default.object,
|
|
212
|
+
result: _propTypes.default.object,
|
|
213
|
+
tables: _propTypes.default.array,
|
|
214
|
+
theme: _propTypes.default.object,
|
|
215
|
+
toggleRecords: _propTypes.default.func,
|
|
216
|
+
customRender: _propTypes.default.func
|
|
210
217
|
};
|
|
211
|
-
|
|
218
|
+
var _default = exports.default = Mirror;
|