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
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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 _lodashEs = require("lodash-es");
|
|
11
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
+
var _constants = require("dtable-ui-component/lib/constants");
|
|
13
|
+
var _constants2 = require("../../constants");
|
|
14
|
+
var _utils = require("../../utils");
|
|
15
|
+
var _intl = _interopRequireDefault(require("../../intl"));
|
|
16
|
+
var _colorRules = require("../../constants/color-rules");
|
|
17
|
+
var _columnUtils = require("../../utils/column-utils");
|
|
18
|
+
var _horizontalComponent = _interopRequireDefault(require("./horizontal-component"));
|
|
19
|
+
class HorizontalBarGroup extends _horizontalComponent.default {
|
|
13
20
|
constructor(props) {
|
|
14
21
|
super(props);
|
|
15
|
-
this.handleResize = debounce(() => {
|
|
22
|
+
this.handleResize = (0, _lodashEs.debounce)(() => {
|
|
16
23
|
var _this$chart;
|
|
17
24
|
((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
|
|
18
25
|
this.createChart();
|
|
@@ -45,7 +52,7 @@ class HorizontalBarGroup extends HorizontalComponent {
|
|
|
45
52
|
customRender,
|
|
46
53
|
chart
|
|
47
54
|
} = this.props;
|
|
48
|
-
data = BaseUtils.formatEmptyName(data, '',
|
|
55
|
+
data = _utils.BaseUtils.formatEmptyName(data, '', _intl.default.get('Empty'));
|
|
49
56
|
if (!Array.isArray(data)) return;
|
|
50
57
|
this.chart.scale(this.groupName, {
|
|
51
58
|
type: 'cat'
|
|
@@ -54,12 +61,12 @@ class HorizontalBarGroup extends HorizontalComponent {
|
|
|
54
61
|
sort_type,
|
|
55
62
|
type
|
|
56
63
|
} = chart.config;
|
|
57
|
-
if (type === CHART_TYPE.STACKED_HORIZONTAL_BAR && sort_type) {
|
|
58
|
-
data = sortDataByGroupSum(data, sort_type);
|
|
64
|
+
if (type === _constants2.CHART_TYPE.STACKED_HORIZONTAL_BAR && sort_type) {
|
|
65
|
+
data = (0, _columnUtils.sortDataByGroupSum)(data, sort_type);
|
|
59
66
|
}
|
|
60
67
|
this.loadData(data);
|
|
61
68
|
this.draw(data);
|
|
62
|
-
isFunction(customRender) && customRender(this.chart);
|
|
69
|
+
(0, _utils.isFunction)(customRender) && customRender(this.chart);
|
|
63
70
|
requestAnimationFrame(() => {
|
|
64
71
|
this.chart.render();
|
|
65
72
|
});
|
|
@@ -72,7 +79,7 @@ class HorizontalBarGroup extends HorizontalComponent {
|
|
|
72
79
|
chartColorTheme,
|
|
73
80
|
tables
|
|
74
81
|
} = this.props;
|
|
75
|
-
const theme = CHART_THEME_COLOR[globalTheme];
|
|
82
|
+
const theme = _constants2.CHART_THEME_COLOR[globalTheme];
|
|
76
83
|
const {
|
|
77
84
|
horizontal_axis_summary_method,
|
|
78
85
|
display_data,
|
|
@@ -82,9 +89,9 @@ class HorizontalBarGroup extends HorizontalComponent {
|
|
|
82
89
|
table_id,
|
|
83
90
|
color_theme
|
|
84
91
|
} = chart.config;
|
|
85
|
-
const isGroup = type === CHART_TYPE.HORIZONTAL_GROUP_BAR;
|
|
92
|
+
const isGroup = type === _constants2.CHART_TYPE.HORIZONTAL_GROUP_BAR;
|
|
86
93
|
const groupByColumn = this.getColumn(tables, table_id, column_groupby_column_key);
|
|
87
|
-
const useSingleSelectColumnColor = (groupByColumn === null || groupByColumn === void 0 ? void 0 : groupByColumn.type) === CellType.SINGLE_SELECT && color_theme === SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.SINGLE_SELECT_COLUMN_COLORS;
|
|
94
|
+
const useSingleSelectColumnColor = (groupByColumn === null || groupByColumn === void 0 ? void 0 : groupByColumn.type) === _constants.CellType.SINGLE_SELECT && color_theme === _colorRules.SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.SINGLE_SELECT_COLUMN_COLORS;
|
|
88
95
|
const newData = this.getChartGroupData(data);
|
|
89
96
|
let singleBarWidth, singleBarRadius;
|
|
90
97
|
// y-axis label width:(6 + 10)
|
|
@@ -95,7 +102,7 @@ class HorizontalBarGroup extends HorizontalComponent {
|
|
|
95
102
|
this.markFirstOrLast(data, 'last');
|
|
96
103
|
} else {
|
|
97
104
|
// stacked chart
|
|
98
|
-
const maxCountGroup = maxBy(newData, 'currentGroupCount');
|
|
105
|
+
const maxCountGroup = (0, _lodashEs.maxBy)(newData, 'currentGroupCount');
|
|
99
106
|
// calculate the width of each bar in a mostCommonCountGroup
|
|
100
107
|
singleBarWidth = Math.round(chartHeight / (2 * newData.length * maxCountGroup.currentGroupCount));
|
|
101
108
|
}
|
|
@@ -122,17 +129,17 @@ class HorizontalBarGroup extends HorizontalComponent {
|
|
|
122
129
|
}
|
|
123
130
|
}).label(display_data ? 'value' : false, {
|
|
124
131
|
style: {
|
|
125
|
-
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
132
|
+
fontSize: _utils.BaseUtils.getLabelFontSize(label_font_size),
|
|
126
133
|
fill: theme.labelColor,
|
|
127
134
|
...this.labelStroke
|
|
128
135
|
}
|
|
129
136
|
}).position('name*value').size(singleBarWidth).color('group_name', group_name => {
|
|
130
|
-
return this.colorMap[group_name] || CHART_STYLE_COLORS[0];
|
|
137
|
+
return this.colorMap[group_name] || _constants2.CHART_STYLE_COLORS[0];
|
|
131
138
|
}).tooltip('name*value*group_name*raw_name', (name, value, group_name, raw_name) => {
|
|
132
139
|
return {
|
|
133
|
-
title: !name && typeof name !== 'number' ?
|
|
134
|
-
value: BaseUtils.getSummaryValueDisplayString(summaryColumn, value, horizontal_axis_summary_method),
|
|
135
|
-
name: !group_name && typeof group_name !== 'number' ?
|
|
140
|
+
title: !name && typeof name !== 'number' ? _intl.default.get(_constants2.EMPTY_NAME) : name,
|
|
141
|
+
value: _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, value, horizontal_axis_summary_method),
|
|
142
|
+
name: !group_name && typeof group_name !== 'number' ? _intl.default.get(_constants2.EMPTY_NAME) : group_name
|
|
136
143
|
};
|
|
137
144
|
}).adjust([adjust]).state({
|
|
138
145
|
active: {
|
|
@@ -177,7 +184,7 @@ class HorizontalBarGroup extends HorizontalComponent {
|
|
|
177
184
|
}
|
|
178
185
|
componentDidUpdate(prevProps) {
|
|
179
186
|
super.componentDidUpdate(prevProps);
|
|
180
|
-
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
187
|
+
if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
181
188
|
var _this$chart2;
|
|
182
189
|
((_this$chart2 = this.chart) === null || _this$chart2 === void 0 ? void 0 : _this$chart2.autoPadding) && this.chart.destroy();
|
|
183
190
|
this.createChart();
|
|
@@ -194,8 +201,8 @@ class HorizontalBarGroup extends HorizontalComponent {
|
|
|
194
201
|
const {
|
|
195
202
|
chart
|
|
196
203
|
} = this.props;
|
|
197
|
-
return /*#__PURE__*/
|
|
198
|
-
className:
|
|
204
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
205
|
+
className: (0, _classnames.default)('sea-chart-container', {
|
|
199
206
|
'show-x-axis-label': this.isShowXAxisLabel(chart),
|
|
200
207
|
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
201
208
|
}),
|
|
@@ -204,16 +211,16 @@ class HorizontalBarGroup extends HorizontalComponent {
|
|
|
204
211
|
}
|
|
205
212
|
}
|
|
206
213
|
HorizontalBarGroup.propTypes = {
|
|
207
|
-
canvasStyle:
|
|
208
|
-
chart:
|
|
209
|
-
groupbyColumn:
|
|
210
|
-
columnGroupbyColumn:
|
|
211
|
-
summaryColumn:
|
|
212
|
-
result:
|
|
213
|
-
tables:
|
|
214
|
-
globalTheme:
|
|
215
|
-
chartColorTheme:
|
|
216
|
-
toggleRecords:
|
|
217
|
-
customRender:
|
|
214
|
+
canvasStyle: _propTypes.default.object,
|
|
215
|
+
chart: _propTypes.default.object,
|
|
216
|
+
groupbyColumn: _propTypes.default.object,
|
|
217
|
+
columnGroupbyColumn: _propTypes.default.object,
|
|
218
|
+
summaryColumn: _propTypes.default.object,
|
|
219
|
+
result: _propTypes.default.array,
|
|
220
|
+
tables: _propTypes.default.array,
|
|
221
|
+
globalTheme: _propTypes.default.string,
|
|
222
|
+
chartColorTheme: _propTypes.default.string,
|
|
223
|
+
toggleRecords: _propTypes.default.func,
|
|
224
|
+
customRender: _propTypes.default.func
|
|
218
225
|
};
|
|
219
|
-
|
|
226
|
+
var _default = exports.default = HorizontalBarGroup;
|
|
@@ -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 _constants = require("../../constants");
|
|
12
|
+
var _utils = require("../../utils");
|
|
13
|
+
var _colorUtils = require("../../utils/color-utils");
|
|
14
|
+
var _intl = _interopRequireDefault(require("../../intl"));
|
|
15
|
+
var _horizontalComponent = _interopRequireDefault(require("./horizontal-component"));
|
|
16
|
+
class HorizontalBar extends _horizontalComponent.default {
|
|
10
17
|
constructor(props) {
|
|
11
18
|
super(props);
|
|
12
19
|
this.createChart = () => {
|
|
@@ -33,11 +40,11 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
33
40
|
result: data,
|
|
34
41
|
customRender
|
|
35
42
|
} = this.props;
|
|
36
|
-
data = BaseUtils.formatEmptyName(data, '',
|
|
43
|
+
data = _utils.BaseUtils.formatEmptyName(data, '', _intl.default.get('Empty'));
|
|
37
44
|
if (!Array.isArray(data)) return;
|
|
38
45
|
this.loadData(data);
|
|
39
46
|
this.draw(data);
|
|
40
|
-
isFunction(customRender) && customRender(this.chart);
|
|
47
|
+
(0, _utils.isFunction)(customRender) && customRender(this.chart);
|
|
41
48
|
requestAnimationFrame(() => {
|
|
42
49
|
this.chart.render();
|
|
43
50
|
this.renderHorizontalLabel(this.props.chart, this.props.tables);
|
|
@@ -51,7 +58,7 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
51
58
|
chartColorTheme,
|
|
52
59
|
tables
|
|
53
60
|
} = this.props;
|
|
54
|
-
const theme = CHART_THEME_COLOR[globalTheme];
|
|
61
|
+
const theme = _constants.CHART_THEME_COLOR[globalTheme];
|
|
55
62
|
const {
|
|
56
63
|
table_id,
|
|
57
64
|
horizontal_axis_summary_type,
|
|
@@ -70,11 +77,11 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
70
77
|
const chartHeight = this.chart.height - 6 - 10;
|
|
71
78
|
const singleBarWidth = Math.round(chartHeight / (2 * data.length));
|
|
72
79
|
const singleBarRadius = Math.min(singleBarWidth / 5, 10);
|
|
73
|
-
let chartBarColor = horizontal_axis_label_color || CHART_STYLE_COLORS[0];
|
|
80
|
+
let chartBarColor = horizontal_axis_label_color || _constants.CHART_STYLE_COLORS[0];
|
|
74
81
|
if (chartColorTheme) {
|
|
75
|
-
chartBarColor = BaseUtils.getCurrentTheme(chartColorTheme).colors[0];
|
|
82
|
+
chartBarColor = _utils.BaseUtils.getCurrentTheme(chartColorTheme).colors[0];
|
|
76
83
|
}
|
|
77
|
-
const colorRules = color_option === TYPE_COLOR_USING.USE_RULES && horizontal_axis_label_color_rules && getConvertedColorRules(horizontal_axis_label_color_rules);
|
|
84
|
+
const colorRules = color_option === _constants.TYPE_COLOR_USING.USE_RULES && horizontal_axis_label_color_rules && (0, _colorUtils.getConvertedColorRules)(horizontal_axis_label_color_rules);
|
|
78
85
|
const title = this.getTitle(tables, table_id, y_axis_summary_type, y_axis_column_key || y_axis_summary_column_key);
|
|
79
86
|
data.reverse();
|
|
80
87
|
this.drawLabels(data);
|
|
@@ -84,12 +91,12 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
84
91
|
this.autoAdjustDataOptions(chart, data, summaryColumn);
|
|
85
92
|
this.chart.interval().label(display_data ? 'value' : false, {
|
|
86
93
|
style: {
|
|
87
|
-
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
94
|
+
fontSize: _utils.BaseUtils.getLabelFontSize(label_font_size),
|
|
88
95
|
fill: theme.labelColor,
|
|
89
96
|
...this.labelStroke
|
|
90
97
|
}
|
|
91
98
|
}).position('name*value').color('value', value => {
|
|
92
|
-
const color = getLabelColor({
|
|
99
|
+
const color = (0, _colorUtils.getLabelColor)({
|
|
93
100
|
chart: chart.config,
|
|
94
101
|
colorRules,
|
|
95
102
|
value
|
|
@@ -98,7 +105,7 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
98
105
|
}).size(singleBarWidth).tooltip('name*value', (name, value) => {
|
|
99
106
|
return {
|
|
100
107
|
title,
|
|
101
|
-
value: BaseUtils.getSummaryValueDisplayString(summaryColumn, value, horizontal_axis_summary_method),
|
|
108
|
+
value: _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, value, horizontal_axis_summary_method),
|
|
102
109
|
name
|
|
103
110
|
};
|
|
104
111
|
}).state({
|
|
@@ -128,7 +135,7 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
128
135
|
}
|
|
129
136
|
componentDidUpdate(prevProps) {
|
|
130
137
|
super.componentDidUpdate(prevProps);
|
|
131
|
-
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
138
|
+
if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
132
139
|
var _this$chart;
|
|
133
140
|
((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
|
|
134
141
|
this.createChart();
|
|
@@ -144,8 +151,8 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
144
151
|
const {
|
|
145
152
|
chart
|
|
146
153
|
} = this.props;
|
|
147
|
-
return /*#__PURE__*/
|
|
148
|
-
className:
|
|
154
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
155
|
+
className: (0, _classnames.default)('sea-chart-container', {
|
|
149
156
|
'show-x-axis-label': this.isShowXAxisLabel(chart),
|
|
150
157
|
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
151
158
|
}),
|
|
@@ -154,15 +161,15 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
154
161
|
}
|
|
155
162
|
}
|
|
156
163
|
HorizontalBar.propTypes = {
|
|
157
|
-
canvasStyle:
|
|
158
|
-
chart:
|
|
159
|
-
groupbyColumn:
|
|
160
|
-
columnGroupbyColumn:
|
|
161
|
-
summaryColumn:
|
|
162
|
-
result:
|
|
163
|
-
tables:
|
|
164
|
-
globalTheme:
|
|
165
|
-
chartColorTheme:
|
|
166
|
-
toggleRecords:
|
|
164
|
+
canvasStyle: _propTypes.default.object,
|
|
165
|
+
chart: _propTypes.default.object,
|
|
166
|
+
groupbyColumn: _propTypes.default.object,
|
|
167
|
+
columnGroupbyColumn: _propTypes.default.object,
|
|
168
|
+
summaryColumn: _propTypes.default.object,
|
|
169
|
+
result: _propTypes.default.array,
|
|
170
|
+
tables: _propTypes.default.array,
|
|
171
|
+
globalTheme: _propTypes.default.string,
|
|
172
|
+
chartColorTheme: _propTypes.default.string,
|
|
173
|
+
toggleRecords: _propTypes.default.func
|
|
167
174
|
};
|
|
168
|
-
|
|
175
|
+
var _default = exports.default = HorizontalBar;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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 _dtableUtils = require("dtable-utils");
|
|
9
|
+
var _constants = require("../../constants");
|
|
10
|
+
var _intl = _interopRequireDefault(require("../../intl"));
|
|
11
|
+
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
12
|
+
class HorizontalComponent extends _chartComponent.default {
|
|
6
13
|
constructor() {
|
|
7
14
|
super(...arguments);
|
|
8
15
|
this.renderHorizontalLabel = (chart, tables) => {
|
|
@@ -18,7 +25,7 @@ export default class HorizontalComponent extends ChartComponent {
|
|
|
18
25
|
show_vertical_axis_label,
|
|
19
26
|
show_horizontal_axis_label
|
|
20
27
|
} = chart.config;
|
|
21
|
-
const table = getTableById(tables, table_id);
|
|
28
|
+
const table = (0, _dtableUtils.getTableById)(tables, table_id);
|
|
22
29
|
const autoPadding = ((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) || {
|
|
23
30
|
bottom: 0
|
|
24
31
|
};
|
|
@@ -30,10 +37,10 @@ export default class HorizontalComponent extends ChartComponent {
|
|
|
30
37
|
const div = document.createElement('div');
|
|
31
38
|
div.id = xAxisID;
|
|
32
39
|
div.className = 'chart-axis-label';
|
|
33
|
-
if (y_axis_summary_type === CHART_SUMMARY_TYPE.COUNT) {
|
|
34
|
-
div.innerHTML =
|
|
40
|
+
if (y_axis_summary_type === _constants.CHART_SUMMARY_TYPE.COUNT) {
|
|
41
|
+
div.innerHTML = _intl.default.get('Amount');
|
|
35
42
|
} else {
|
|
36
|
-
const column = getTableColumnByKey(table, y_axis_summary_column_key);
|
|
43
|
+
const column = (0, _dtableUtils.getTableColumnByKey)(table, y_axis_summary_column_key);
|
|
37
44
|
div.innerHTML = "".concat(column ? column.name : '');
|
|
38
45
|
}
|
|
39
46
|
div.setAttribute('style', "color:".concat(textColor, "; width: 100%; text-align: ").concat(horizontal_axis_label_position, "; bottom: -20px; position: absolute"));
|
|
@@ -51,20 +58,20 @@ export default class HorizontalComponent extends ChartComponent {
|
|
|
51
58
|
const div = document.createElement('div');
|
|
52
59
|
div.id = yAxisID;
|
|
53
60
|
div.className = 'chart-axis-label';
|
|
54
|
-
const column = getTableColumnByKey(table, x_axis_column_key) || {};
|
|
61
|
+
const column = (0, _dtableUtils.getTableColumnByKey)(table, x_axis_column_key) || {};
|
|
55
62
|
div.innerHTML = column.name || '';
|
|
56
63
|
const containerHeight = chartContainer.offsetHeight;
|
|
57
64
|
let textAlign = 'center';
|
|
58
|
-
if (vertical_axis_label_position === LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
59
|
-
if (vertical_axis_label_position === LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
65
|
+
if (vertical_axis_label_position === _constants.LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
66
|
+
if (vertical_axis_label_position === _constants.LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
60
67
|
div.setAttribute('style', "color:".concat(textColor, "; position: absolute; width: ").concat(containerHeight, "px; text-align: ").concat(textAlign, "; top: 0; left: 0; transform: translate(-").concat(containerHeight / 2 + 12, "px, ").concat((containerHeight - autoPadding.bottom) / 2, "px) rotate(-90deg)"));
|
|
61
68
|
chartContainer.appendChild(div);
|
|
62
69
|
}
|
|
63
70
|
if (yLabel && show_horizontal_axis_label) {
|
|
64
71
|
const containerHeight = chartContainer.offsetHeight;
|
|
65
72
|
let textAlign = 'center';
|
|
66
|
-
if (vertical_axis_label_position === LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
67
|
-
if (vertical_axis_label_position === LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
73
|
+
if (vertical_axis_label_position === _constants.LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
74
|
+
if (vertical_axis_label_position === _constants.LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
68
75
|
yLabel.setAttribute('style', "color:".concat(textColor, "; position: absolute; width: ").concat(containerHeight, "px; text-align: ").concat(textAlign, "; top: 0; left: 0; transform: translate(-").concat(containerHeight / 2 + 12, "px, ").concat((containerHeight - autoPadding.bottom) / 2 + autoPadding.bottom / 4, "px) rotate(-90deg)"));
|
|
69
76
|
}
|
|
70
77
|
if (yLabel && !show_horizontal_axis_label) {
|
|
@@ -78,4 +85,5 @@ export default class HorizontalComponent extends ChartComponent {
|
|
|
78
85
|
return !!(chart && chart.config && chart.config.show_horizontal_axis_label);
|
|
79
86
|
};
|
|
80
87
|
}
|
|
81
|
-
}
|
|
88
|
+
}
|
|
89
|
+
exports.default = HorizontalComponent;
|