sea-chart 2.0.43 → 2.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.js +4 -11
- package/dist/components/cell-factory/FormatterConfig.js +55 -62
- package/dist/components/cell-factory/SimpleCellFormatter.js +4 -11
- package/dist/components/cell-factory/SingleSelectOption.js +11 -18
- package/dist/components/cell-factory/cell-editor-factory.js +5 -12
- package/dist/components/cell-factory/cell-formatter-factory.js +4 -11
- package/dist/components/cell-factory/link-content.js +27 -35
- package/dist/components/chart-color-selector/color-selector.js +11 -18
- package/dist/components/collaborator/index.js +7 -14
- package/dist/components/color-picker/index.js +11 -18
- package/dist/components/color-popover/color-rules/color-rule.js +25 -33
- package/dist/components/color-popover/color-rules/index.js +6 -14
- package/dist/components/color-popover/color-rules/rule-filters/filter.js +27 -34
- package/dist/components/color-popover/color-rules/rule-filters/index.js +17 -25
- package/dist/components/color-popover/color-rules/rule-filters/number-input.js +10 -18
- package/dist/components/color-popover/color-rules-popover.js +26 -34
- package/dist/components/color-popover/color-selector-popover.js +10 -18
- package/dist/components/color-setting/color-group-selector.js +12 -20
- package/dist/components/common-add-tool/index.js +6 -13
- package/dist/components/data-process-setter/data-setting-header.js +7 -14
- package/dist/components/data-process-setter/hide-column-setter.js +12 -19
- package/dist/components/data-process-setter/index.js +4 -27
- package/dist/components/data-process-setter/sort-setter.js +16 -24
- package/dist/components/draggable/Draggable.js +7 -13
- package/dist/components/drill-down-settings/drill-down-fields-popover/index.js +42 -50
- package/dist/components/drill-down-settings/drill-down-fields-settings/index.js +10 -18
- package/dist/components/drill-down-settings/index.js +11 -18
- package/dist/components/dtable-popover/index.js +13 -20
- package/dist/components/dtable-search-input/index.js +13 -21
- package/dist/components/font-settings/index.js +14 -22
- package/dist/components/goal-line-setting/goal-setting-item.js +6 -14
- package/dist/components/goal-line-setting/index.js +12 -19
- package/dist/components/highlighter/highlighter.js +7 -14
- package/dist/components/icon/index.js +4 -11
- package/dist/components/index.js +7 -48
- package/dist/components/loading/index.js +6 -13
- package/dist/components/number-input/index.js +4 -11
- package/dist/components/pixel-editor/index.js +15 -23
- package/dist/components/popover/hide-column-popover/hide-column-popover-widgets/hide-column-item.js +8 -15
- package/dist/components/popover/hide-column-popover/hide-column-popover.js +25 -33
- package/dist/components/popover/sort-popover/sort-popover-widgets/sort-utils.js +9 -18
- package/dist/components/popover/sort-popover/sort-popover.js +54 -64
- package/dist/components/resize-handle/ResizeHandle.js +6 -13
- package/dist/components/row-card/row-card-header-cell.js +15 -22
- package/dist/components/row-card/row-card-header.js +14 -21
- package/dist/components/row-card/row-card-item.js +33 -41
- package/dist/components/row-card/row-card.js +15 -23
- package/dist/components/statistic-record-dialog/index.js +56 -64
- package/dist/components/tooltip/index.js +21 -21
- package/dist/components/types-dialog/index.js +56 -64
- package/dist/components/types-dialog/use-force-update.js +4 -10
- package/dist/constants/color-rules.js +8 -14
- package/dist/constants/common-constants.js +8 -14
- package/dist/constants/error.js +2 -8
- package/dist/constants/geolocation.js +9 -15
- package/dist/constants/index.js +149 -273
- package/dist/constants/key-codes.js +0 -2
- package/dist/constants/model.js +3 -9
- package/dist/constants/regions.js +3 -8
- package/dist/constants/style.js +6 -12
- package/dist/constants/table.js +1 -7
- package/dist/constants/type-image.js +33 -39
- package/dist/constants/type.js +3 -9
- package/dist/context.js +20 -24
- package/dist/editor/index.js +8 -15
- package/dist/index.js +13 -104
- package/dist/intl.js +10 -17
- package/dist/locale/index.js +16 -23
- package/dist/locale/lang/de.js +1 -7
- package/dist/locale/lang/en.js +1 -7
- package/dist/locale/lang/es.js +1 -7
- package/dist/locale/lang/fr.js +1 -7
- package/dist/locale/lang/pt.js +1 -7
- package/dist/locale/lang/ru.js +1 -7
- package/dist/locale/lang/zh_CN.js +1 -7
- package/dist/model/area-group.js +12 -19
- package/dist/model/area.js +12 -19
- package/dist/model/bar-custom.js +11 -18
- package/dist/model/bar-group.js +12 -19
- package/dist/model/bar-stack.js +10 -17
- package/dist/model/bar.js +11 -18
- package/dist/model/base-model.js +8 -11
- package/dist/model/basic-number-card.js +13 -20
- package/dist/model/chart.js +7 -13
- package/dist/model/combination.js +19 -22
- package/dist/model/compare-bar.js +14 -21
- package/dist/model/completeness-group.js +11 -18
- package/dist/model/completeness.js +10 -17
- package/dist/model/dashboard.js +7 -14
- package/dist/model/funnel.js +14 -21
- package/dist/model/generic-model.js +135 -143
- package/dist/model/heat-map.js +9 -16
- package/dist/model/horizontal-bar.js +15 -18
- package/dist/model/horizontal-group-bar.js +14 -17
- package/dist/model/index.js +69 -93
- package/dist/model/line-group.js +13 -20
- package/dist/model/line.js +12 -19
- package/dist/model/map-bubble.js +12 -19
- package/dist/model/map.js +12 -19
- package/dist/model/mirror.js +13 -20
- package/dist/model/pie.js +12 -19
- package/dist/model/ring.js +12 -19
- package/dist/model/scatter.js +10 -17
- package/dist/model/stacked-horizontal-bar.js +15 -18
- package/dist/model/table-element.js +5 -12
- package/dist/model/table.js +7 -14
- package/dist/model/tree-map.js +7 -14
- package/dist/model/trend.js +11 -18
- package/dist/model/user.js +1 -7
- package/dist/model/world-map-bubble.js +12 -19
- package/dist/model/world-map.js +12 -19
- package/dist/services/map-json.js +7 -13
- package/dist/settings/advance-bar-settings/data-settings.js +36 -44
- package/dist/settings/advance-bar-settings/index.js +3 -20
- package/dist/settings/advance-bar-settings/style-settings.js +83 -74
- package/dist/settings/bar-settings/data-settings.js +39 -47
- package/dist/settings/bar-settings/index.js +3 -20
- package/dist/settings/bar-settings/style-settings.js +69 -60
- package/dist/settings/basic-number-card/data-settings.js +49 -57
- package/dist/settings/basic-number-card/index.js +3 -20
- package/dist/settings/basic-number-card/style-settings.js +18 -26
- package/dist/settings/combination-settings/data-settings.js +55 -63
- package/dist/settings/combination-settings/index.js +3 -20
- package/dist/settings/combination-settings/style-settings.js +94 -77
- package/dist/settings/completeness-settings/callbacks/callbacks.js +16 -27
- package/dist/settings/completeness-settings/data-settings/completion-settings.js +21 -28
- package/dist/settings/completeness-settings/data-settings/data-settings.js +25 -32
- package/dist/settings/completeness-settings/index.js +3 -20
- package/dist/settings/completeness-settings/style-settings.js +19 -26
- package/dist/settings/dashboard-settings/data-settings.js +43 -51
- package/dist/settings/dashboard-settings/index.js +2 -13
- package/dist/settings/data-settings.js +72 -79
- package/dist/settings/funnel-settings/components/dnd-item/dnd-item.js +12 -19
- package/dist/settings/funnel-settings/components/dnd-list.js +15 -23
- package/dist/settings/funnel-settings/components/funnel-label-setting.js +32 -40
- package/dist/settings/funnel-settings/components/funnel-layer-setting.js +20 -28
- package/dist/settings/funnel-settings/data-settings.js +23 -31
- package/dist/settings/funnel-settings/index.js +3 -20
- package/dist/settings/funnel-settings/style-settings.js +11 -19
- package/dist/settings/heat-map-settings/data-settings.js +18 -26
- package/dist/settings/heat-map-settings/index.js +3 -20
- package/dist/settings/heat-map-settings/style-settings.js +18 -26
- package/dist/settings/horizontal-bar-settings/data-settings.js +12 -19
- package/dist/settings/horizontal-bar-settings/index.js +3 -20
- package/dist/settings/horizontal-bar-settings/style-settings.js +12 -19
- package/dist/settings/index.js +52 -70
- package/dist/settings/map-settings/components/location-field-selector.js +10 -17
- package/dist/settings/map-settings/components/map-level-selector.js +11 -18
- package/dist/settings/map-settings/components/map-province-city-selector.js +19 -26
- package/dist/settings/map-settings/index.js +3 -20
- package/dist/settings/map-settings/map-data-settings.js +23 -30
- package/dist/settings/map-settings/map-style-settings.js +26 -34
- package/dist/settings/mirror-settings/data-settings.js +26 -34
- package/dist/settings/mirror-settings/index.js +2 -13
- package/dist/settings/pie-settings/data-settings.js +33 -41
- package/dist/settings/pie-settings/index.js +3 -20
- package/dist/settings/pie-settings/style-settings.js +47 -55
- package/dist/settings/scatter/data-settings.js +27 -34
- package/dist/settings/scatter/index.js +3 -12
- package/dist/settings/stacks-settings/index.js +19 -27
- package/dist/settings/stacks-settings/stack-item-settings.js +19 -27
- package/dist/settings/style-settings.js +64 -72
- package/dist/settings/table-element-settings/components/data-filter.js +30 -38
- package/dist/settings/table-element-settings/data-settings.js +21 -29
- package/dist/settings/table-element-settings/index.js +2 -13
- package/dist/settings/table-settings/data-settings.js +111 -119
- package/dist/settings/table-settings/index.js +2 -13
- package/dist/settings/time-comparison-settings/data-settings.js +43 -51
- package/dist/settings/time-comparison-settings/index.js +3 -20
- package/dist/settings/time-comparison-settings/style-settings.js +62 -53
- package/dist/settings/trend-settings/data-settings.js +24 -32
- package/dist/settings/trend-settings/index.js +3 -20
- package/dist/settings/trend-settings/style-setting.js +17 -25
- package/dist/settings/widgets/axis-title-font-settings/index.js +39 -0
- package/dist/settings/widgets/basic-summary/index.js +55 -63
- package/dist/settings/widgets/chart-type/index.js +18 -26
- package/dist/settings/widgets/color-settings/index.js +72 -80
- package/dist/settings/widgets/common-data-settings.js +21 -29
- package/dist/settings/widgets/data-filter/index.js +35 -43
- package/dist/settings/widgets/data-sort.js +16 -24
- package/dist/settings/widgets/date-summary-item.js +24 -32
- package/dist/settings/widgets/display-values-settings/index.js +14 -22
- package/dist/settings/widgets/divider/index.js +8 -16
- package/dist/settings/widgets/font-settings/font-color-settings.js +11 -19
- package/dist/settings/widgets/font-settings/font-size-settings.js +14 -22
- package/dist/settings/widgets/font-settings/font-weight-settings.js +17 -25
- package/dist/settings/widgets/font-settings/index.js +4 -27
- package/dist/settings/widgets/group-by.js +51 -59
- package/dist/settings/widgets/min-max-setting.js +10 -18
- package/dist/settings/widgets/mininum-slice-percent.js +10 -18
- package/dist/settings/widgets/numeric-summary-item.js +23 -31
- package/dist/settings/widgets/select-line-type/index.js +10 -17
- package/dist/settings/widgets/select-table/index.js +9 -16
- package/dist/settings/widgets/select-view/index.js +20 -28
- package/dist/settings/widgets/stack.js +14 -22
- package/dist/settings/widgets/summary-method-setting.js +17 -25
- package/dist/settings/widgets/summary-settings.js +72 -80
- package/dist/settings/widgets/switch/index.js +8 -15
- package/dist/settings/widgets/text-horizontal-settings.js +15 -23
- package/dist/settings/widgets/time-picker.js +29 -37
- package/dist/settings/widgets/title-settings/index.js +29 -37
- package/dist/settings/widgets/title-settings/title-text.js +5 -12
- package/dist/settings/widgets/x-axios.js +0 -1
- package/dist/settings/widgets/y-axis-group-settings.js +63 -71
- package/dist/utils/cell-format-utils.js +18 -28
- package/dist/utils/cell-value-utils.js +5 -12
- package/dist/utils/chart-utils/base-utils.js +362 -334
- package/dist/utils/chart-utils/index.js +28 -41
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +80 -86
- package/dist/utils/chart-utils/original-data-utils/card-calculator.js +13 -20
- package/dist/utils/chart-utils/original-data-utils/combination-calculator.js +45 -52
- package/dist/utils/chart-utils/original-data-utils/compare-bar-chart-calculator.js +19 -26
- package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +32 -39
- package/dist/utils/chart-utils/original-data-utils/dashboard-calculator.js +16 -23
- package/dist/utils/chart-utils/original-data-utils/index.js +50 -57
- package/dist/utils/chart-utils/original-data-utils/mirror-calculator.js +21 -28
- package/dist/utils/chart-utils/original-data-utils/pivot-table-calculator.js +91 -97
- package/dist/utils/chart-utils/original-data-utils/scatter-calculator.js +19 -26
- package/dist/utils/chart-utils/original-data-utils/trend-calculator.js +31 -38
- package/dist/utils/chart-utils/sql-statistics-utils.js +284 -246
- package/dist/utils/chart.js +9 -17
- package/dist/utils/collaborator-manager.js +3 -9
- package/dist/utils/collaborator-utils.js +18 -30
- package/dist/utils/collaborator.js +4 -13
- package/dist/utils/color-utils.js +18 -29
- package/dist/utils/column-utils.js +65 -92
- package/dist/utils/common-utils.js +27 -52
- package/dist/utils/concurrency-manager.js +1 -7
- package/dist/utils/contexts.js +5 -12
- package/dist/utils/date-translate.js +11 -19
- package/dist/utils/digital-sign-utils.js +7 -14
- package/dist/utils/event-bus.js +1 -7
- package/dist/utils/hotkey.js +5 -11
- package/dist/utils/index.js +54 -221
- package/dist/utils/key-generator.js +2 -9
- package/dist/utils/map.js +22 -31
- package/dist/utils/object-utils.js +1 -7
- package/dist/utils/options-utils.js +8 -16
- package/dist/utils/row-record-utils.js +182 -178
- package/dist/utils/row-utils.js +27 -38
- package/dist/utils/search.js +24 -32
- package/dist/utils/sql/chart-data-sql.js +49 -55
- package/dist/utils/sql/column-2-sql-column.js +146 -154
- package/dist/utils/sql/index.js +3 -27
- package/dist/utils/trend-utils.js +39 -47
- package/dist/view/index.css +0 -17
- package/dist/view/index.js +89 -95
- package/dist/view/title/index.js +15 -23
- package/dist/view/wrapper/area-group.js +53 -72
- package/dist/view/wrapper/area.js +51 -72
- package/dist/view/wrapper/bar-compare.js +43 -56
- package/dist/view/wrapper/bar-custom-stack.js +50 -120
- package/dist/view/wrapper/bar-group.js +51 -94
- package/dist/view/wrapper/bar-stack.js +54 -90
- package/dist/view/wrapper/bar.js +45 -66
- package/dist/view/wrapper/basic-number-card.js +25 -26
- package/dist/view/wrapper/chart-component.js +539 -162
- package/dist/view/wrapper/combination.js +63 -83
- package/dist/view/wrapper/completeness-group.js +42 -96
- package/dist/view/wrapper/completeness.js +42 -96
- package/dist/view/wrapper/dashboard.js +33 -47
- package/dist/view/wrapper/funnel.js +36 -56
- package/dist/view/wrapper/heat-map.js +126 -104
- package/dist/view/wrapper/horizontal-bar-group.js +57 -76
- package/dist/view/wrapper/horizontal-bar-stack.js +56 -109
- package/dist/view/wrapper/horizontal-bar.js +45 -68
- package/dist/view/wrapper/index.js +110 -115
- package/dist/view/wrapper/line-group.js +48 -66
- package/dist/view/wrapper/line.js +47 -67
- package/dist/view/wrapper/map-bubble.js +46 -59
- package/dist/view/wrapper/map-world-bubble.js +45 -58
- package/dist/view/wrapper/map-world.js +47 -60
- package/dist/view/wrapper/map.js +48 -60
- package/dist/view/wrapper/mirror.js +40 -61
- package/dist/view/wrapper/pie.js +48 -59
- package/dist/view/wrapper/ring.js +52 -63
- package/dist/view/wrapper/scatter.js +49 -67
- package/dist/view/wrapper/table/index.js +13 -21
- package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +49 -57
- package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +50 -58
- package/dist/view/wrapper/table/pivot-table-display-name.js +83 -91
- package/dist/view/wrapper/table/two-dimension-table.js +76 -84
- package/dist/view/wrapper/table-element/components/dataset-utils.js +23 -36
- package/dist/view/wrapper/table-element/components/formatter.js +96 -105
- package/dist/view/wrapper/table-element/components/formatters/FileFormatter/index.js +22 -31
- package/dist/view/wrapper/table-element/components/formatters/formula-formatter.js +9 -16
- package/dist/view/wrapper/table-element/components/formatters/link-formatter.js +73 -80
- package/dist/view/wrapper/table-element/components/formula-formatter.js +9 -16
- package/dist/view/wrapper/table-element/components/link-formatter.js +73 -80
- package/dist/view/wrapper/table-element/components/record.js +10 -17
- package/dist/view/wrapper/table-element/components/records-body.js +17 -19
- package/dist/view/wrapper/table-element/components/records-header/index.js +7 -15
- package/dist/view/wrapper/table-element/components/records-header/records-header-cell.js +8 -16
- package/dist/view/wrapper/table-element/components/records.js +23 -33
- package/dist/view/wrapper/table-element/components/resize-column-handle/resize-column-handle.js +5 -12
- package/dist/view/wrapper/table-element/components/utils.js +5 -15
- package/dist/view/wrapper/table-element/components/value-display-utils.js +4 -11
- package/dist/view/wrapper/table-element/components/vertical-scrollbar/index.js +6 -13
- package/dist/view/wrapper/table-element/index.js +18 -26
- package/dist/view/wrapper/treemap.js +39 -57
- package/dist/view/wrapper/trend.js +41 -48
- package/package.json +1 -1
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var d3 = _interopRequireWildcard(require("d3"));
|
|
12
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
var _dtableUtils = require("dtable-utils");
|
|
14
|
-
var _constants = require("../../constants");
|
|
15
|
-
var _chartUtils = require("../../utils/chart-utils");
|
|
16
|
-
var _intl = _interopRequireDefault(require("../../intl"));
|
|
17
|
-
var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
|
|
18
|
-
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
19
|
-
class BarCompare extends _chartComponent.default {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import * as d3 from 'd3';
|
|
4
|
+
import { getNumberDisplayString } from 'dtable-utils';
|
|
5
|
+
import { CHART_SUMMARY_SHOW, TITLE_AMOUNT, TITLE_INCREASE, CHART_THEME_COLOR } from '../../constants';
|
|
6
|
+
import { BaseUtils } from '../../utils/chart-utils';
|
|
7
|
+
import intl from '../../intl';
|
|
8
|
+
import ToolTip from '../../components/tooltip';
|
|
9
|
+
import ChartComponent from './chart-component';
|
|
10
|
+
class BarCompare extends ChartComponent {
|
|
20
11
|
constructor(props) {
|
|
21
12
|
super(props);
|
|
22
13
|
this.createChart = () => {
|
|
@@ -30,8 +21,8 @@ class BarCompare extends _chartComponent.default {
|
|
|
30
21
|
const initConfig = {
|
|
31
22
|
insertPadding: 30,
|
|
32
23
|
borderRadius: 0.2,
|
|
33
|
-
marginLeft: y_axis_show_label ?
|
|
34
|
-
marginBottom: x_axis_show_label ?
|
|
24
|
+
marginLeft: y_axis_show_label ? this.getAxisTitleHeight(chart.config.y_axis_label_font_size) : 0,
|
|
25
|
+
marginBottom: x_axis_show_label ? this.getAxisTitleHeight(chart.config.x_axis_label_font_size) : 0
|
|
35
26
|
};
|
|
36
27
|
this.initChart(this.container, chart === null || chart === void 0 ? void 0 : chart.id, initConfig);
|
|
37
28
|
};
|
|
@@ -39,7 +30,7 @@ class BarCompare extends _chartComponent.default {
|
|
|
39
30
|
let {
|
|
40
31
|
result: data
|
|
41
32
|
} = this.props;
|
|
42
|
-
data =
|
|
33
|
+
data = BaseUtils.formatEmptyName(data, '', intl.get('Empty'));
|
|
43
34
|
if (!Array.isArray(data)) return;
|
|
44
35
|
this.draw(data);
|
|
45
36
|
this.renderAxisLabel(this.props.chart, this.props.tables, this.container);
|
|
@@ -51,7 +42,7 @@ class BarCompare extends _chartComponent.default {
|
|
|
51
42
|
chartColorTheme,
|
|
52
43
|
columnGroupbyColumn
|
|
53
44
|
} = this.props;
|
|
54
|
-
const theme =
|
|
45
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
55
46
|
const {
|
|
56
47
|
display_increase,
|
|
57
48
|
y_axis_auto_range = true,
|
|
@@ -68,9 +59,9 @@ class BarCompare extends _chartComponent.default {
|
|
|
68
59
|
const y = d3.scaleLinear().domain(y_axis_auto_range ? [0, d3.max(data, d => d.value)] : [y_axis_min, y_axis_max]).range([chartHeight - insertPadding, insertPadding]);
|
|
69
60
|
|
|
70
61
|
// Y axis
|
|
71
|
-
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform', `translate(${insertPadding},0)`).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d =>
|
|
62
|
+
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform', `translate(${insertPadding},0)`).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d => BaseUtils.getSummaryValueDisplayString(columnGroupbyColumn, d, y_axis_summary_method))).call(g => this.drawYaxis(g, theme));
|
|
72
63
|
const fx = d3.scaleBand().domain(d3.group(data, d => d.name).keys()).range([insertPadding + this.horizontalOverflowOffset, chartWidth - insertPadding]).paddingInner(0.5).paddingOuter(0.1);
|
|
73
|
-
const color = d3.scaleOrdinal().domain(d3.group(data, d => d.group_name).keys()).range(
|
|
64
|
+
const color = d3.scaleOrdinal().domain(d3.group(data, d => d.group_name).keys()).range(BaseUtils.getCurrentTheme(chartColorTheme).colors).unknown('#ccc');
|
|
74
65
|
const x = d3.scaleBand().domain(d3.group(data, d => d.group_name).keys()).range([0, fx.bandwidth()]).paddingInner(0).paddingOuter(0);
|
|
75
66
|
|
|
76
67
|
// X axis
|
|
@@ -93,14 +84,11 @@ class BarCompare extends _chartComponent.default {
|
|
|
93
84
|
.selectAll().data(_ref2 => {
|
|
94
85
|
let [a, d] = _ref2;
|
|
95
86
|
return d;
|
|
96
|
-
}).join('rect').attr('opacity', 1).attr('x', (d, index) => index * x.bandwidth()).attr('y', d => y(d.value)).attr('width', x.bandwidth()).attr('height', d => y(0) - y(d.value) === 0 ? 0 : y(0) - y(d.value)).attr('fill', d => color(d.group_name)).attr('data-value', d => d.value).attr('data-groupName', d => d.name).
|
|
87
|
+
}).join('rect').attr('opacity', 1).attr('x', (d, index) => index * x.bandwidth()).attr('y', d => y(d.value)).attr('width', x.bandwidth()).attr('height', d => y(0) - y(d.value) === 0 ? 0 : y(0) - y(d.value)).attr('fill', d => color(d.group_name)).attr('data-value', d => d.value).attr('data-groupName', d => d.name).call(g => {
|
|
97
88
|
g.nodes().forEach(rect => {
|
|
98
|
-
const parentNode = rect.parentNode;
|
|
99
89
|
// add rect borderRadius
|
|
100
90
|
this.addClipPath({
|
|
101
|
-
rect
|
|
102
|
-
parentNode,
|
|
103
|
-
rectId: rect.getAttribute('data-slugid')
|
|
91
|
+
rect
|
|
104
92
|
});
|
|
105
93
|
});
|
|
106
94
|
}).on('click', (event, data) => {
|
|
@@ -113,6 +101,9 @@ class BarCompare extends _chartComponent.default {
|
|
|
113
101
|
}).on('mouseleave', event => {
|
|
114
102
|
this.hiddenTooltip();
|
|
115
103
|
this.handleAcitveAndInActiveState('active', event);
|
|
104
|
+
}).call(g => {
|
|
105
|
+
this.animateRectGrowInY(g);
|
|
106
|
+
this.animateFadeIn(this.chart.select('.content-wrapper').selectAll('text'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
116
107
|
});
|
|
117
108
|
if (display_increase) {
|
|
118
109
|
const increaseData = this.getIncreaseData(data);
|
|
@@ -140,7 +131,7 @@ class BarCompare extends _chartComponent.default {
|
|
|
140
131
|
if (isCircle) {
|
|
141
132
|
const circleEl = event.target;
|
|
142
133
|
newTooltipData = {
|
|
143
|
-
title:
|
|
134
|
+
title: intl.get(TITLE_INCREASE),
|
|
144
135
|
items: [{
|
|
145
136
|
color: increase_line_color || '#fbd44a',
|
|
146
137
|
name: circleEl.getAttribute('data-name'),
|
|
@@ -151,7 +142,7 @@ class BarCompare extends _chartComponent.default {
|
|
|
151
142
|
const curGroup = event.target.parentNode;
|
|
152
143
|
const [, data] = curGroup.__data__;
|
|
153
144
|
newTooltipData = {
|
|
154
|
-
title: y_axis_summary_type === 'count' ?
|
|
145
|
+
title: y_axis_summary_type === 'count' ? intl.get(TITLE_AMOUNT) : intl.get(CHART_SUMMARY_SHOW[y_axis_summary_method]),
|
|
155
146
|
items: data.map(item => {
|
|
156
147
|
return {
|
|
157
148
|
color: colorScale(item.group_name),
|
|
@@ -193,7 +184,7 @@ class BarCompare extends _chartComponent.default {
|
|
|
193
184
|
chart,
|
|
194
185
|
globalTheme
|
|
195
186
|
} = this.props;
|
|
196
|
-
const theme =
|
|
187
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
197
188
|
const {
|
|
198
189
|
label_font_size,
|
|
199
190
|
y_axis_min,
|
|
@@ -248,7 +239,7 @@ class BarCompare extends _chartComponent.default {
|
|
|
248
239
|
// circle label
|
|
249
240
|
if (display_increase_percentage) {
|
|
250
241
|
const curCircleEl = g.node();
|
|
251
|
-
wrapper.append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('fill', theme.labelColor).attr('font-size',
|
|
242
|
+
wrapper.append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('fill', theme.labelColor).attr('font-size', BaseUtils.getLabelFontSize(label_font_size)).text(curCircleEl.getAttribute('data-text')).call(g => {
|
|
252
243
|
const {
|
|
253
244
|
width
|
|
254
245
|
} = g.node().getBoundingClientRect();
|
|
@@ -275,7 +266,7 @@ class BarCompare extends _chartComponent.default {
|
|
|
275
266
|
const increaseValue = value.filter(d => (d === null || d === void 0 ? void 0 : d.increase_value) !== undefined) || [{
|
|
276
267
|
increaseValue: 0
|
|
277
268
|
}];
|
|
278
|
-
const formatValue =
|
|
269
|
+
const formatValue = getNumberDisplayString((_increaseValue$ = increaseValue[0]) === null || _increaseValue$ === void 0 ? void 0 : _increaseValue$.increase_value, {
|
|
279
270
|
format: 'percent'
|
|
280
271
|
});
|
|
281
272
|
const data = {
|
|
@@ -311,10 +302,11 @@ class BarCompare extends _chartComponent.default {
|
|
|
311
302
|
componentDidMount() {
|
|
312
303
|
this.createChart();
|
|
313
304
|
this.drawChart();
|
|
305
|
+
super.componentDidMount();
|
|
314
306
|
}
|
|
315
307
|
componentDidUpdate(prevProps) {
|
|
316
308
|
super.componentDidUpdate(prevProps);
|
|
317
|
-
if (
|
|
309
|
+
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
318
310
|
this.destroyChart();
|
|
319
311
|
this.createChart();
|
|
320
312
|
this.drawChart();
|
|
@@ -322,22 +314,17 @@ class BarCompare extends _chartComponent.default {
|
|
|
322
314
|
}
|
|
323
315
|
componentWillUnmount() {
|
|
324
316
|
this.destroyChart();
|
|
317
|
+
super.componentWillUnmount();
|
|
325
318
|
}
|
|
326
319
|
render() {
|
|
327
|
-
const {
|
|
328
|
-
chart
|
|
329
|
-
} = this.props;
|
|
330
320
|
const {
|
|
331
321
|
tooltipData,
|
|
332
322
|
toolTipPosition
|
|
333
323
|
} = this.state;
|
|
334
|
-
return /*#__PURE__*/
|
|
324
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
335
325
|
ref: ref => this.container = ref,
|
|
336
|
-
className:
|
|
337
|
-
|
|
338
|
-
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
339
|
-
})
|
|
340
|
-
}, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
326
|
+
className: "sea-chart-container"
|
|
327
|
+
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
341
328
|
tooltipData: tooltipData,
|
|
342
329
|
toolTipPosition: toolTipPosition,
|
|
343
330
|
chart: this.chart
|
|
@@ -345,15 +332,15 @@ class BarCompare extends _chartComponent.default {
|
|
|
345
332
|
}
|
|
346
333
|
}
|
|
347
334
|
BarCompare.propTypes = {
|
|
348
|
-
canvasStyle:
|
|
349
|
-
chart:
|
|
350
|
-
groupbyColumn:
|
|
351
|
-
columnGroupbyColumn:
|
|
352
|
-
summaryColumn:
|
|
353
|
-
result:
|
|
354
|
-
tables:
|
|
355
|
-
globalTheme:
|
|
356
|
-
chartColorTheme:
|
|
357
|
-
toggleRecords:
|
|
335
|
+
canvasStyle: PropTypes.object,
|
|
336
|
+
chart: PropTypes.object,
|
|
337
|
+
groupbyColumn: PropTypes.object,
|
|
338
|
+
columnGroupbyColumn: PropTypes.object,
|
|
339
|
+
summaryColumn: PropTypes.object,
|
|
340
|
+
result: PropTypes.array,
|
|
341
|
+
tables: PropTypes.array,
|
|
342
|
+
globalTheme: PropTypes.string,
|
|
343
|
+
chartColorTheme: PropTypes.string,
|
|
344
|
+
toggleRecords: PropTypes.func
|
|
358
345
|
};
|
|
359
|
-
|
|
346
|
+
export default BarCompare;
|
|
@@ -1,30 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _lodashEs = require("lodash-es");
|
|
12
|
-
var d3 = _interopRequireWildcard(require("d3"));
|
|
13
|
-
var _slugid = _interopRequireDefault(require("slugid"));
|
|
14
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
var _intl = _interopRequireDefault(require("../../intl"));
|
|
16
|
-
var _chartUtils = require("../../utils/chart-utils");
|
|
17
|
-
var _constants = require("../../constants");
|
|
18
|
-
var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
|
|
19
|
-
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
20
|
-
class BarCustom extends _chartComponent.default {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import * as d3 from 'd3';
|
|
4
|
+
import slugid from 'slugid';
|
|
5
|
+
import intl from '../../intl';
|
|
6
|
+
import { BaseUtils } from '../../utils/chart-utils';
|
|
7
|
+
import { EMPTY_NAME, CHART_THEME_COLOR } from '../../constants';
|
|
8
|
+
import ToolTip from '../../components/tooltip';
|
|
9
|
+
import ChartComponent from './chart-component';
|
|
10
|
+
class BarCustom extends ChartComponent {
|
|
21
11
|
constructor(props) {
|
|
22
12
|
super(props);
|
|
23
|
-
this.handleResize = (0, _lodashEs.debounce)(() => {
|
|
24
|
-
this.destroyChart();
|
|
25
|
-
this.createChart();
|
|
26
|
-
this.drawChart();
|
|
27
|
-
}, 300);
|
|
28
13
|
this.createChart = () => {
|
|
29
14
|
const {
|
|
30
15
|
chart
|
|
@@ -36,8 +21,8 @@ class BarCustom extends _chartComponent.default {
|
|
|
36
21
|
const initConfig = {
|
|
37
22
|
insertPadding: 30,
|
|
38
23
|
borderRadius: 0.2,
|
|
39
|
-
marginLeft: y_axis_show_label ?
|
|
40
|
-
marginBottom: x_axis_show_label ?
|
|
24
|
+
marginLeft: y_axis_show_label ? this.getAxisTitleHeight(chart.config.y_axis_label_font_size) : 0,
|
|
25
|
+
marginBottom: x_axis_show_label ? this.getAxisTitleHeight(chart.config.x_axis_label_font_size) : 0
|
|
41
26
|
};
|
|
42
27
|
this.initChart(this.container, chart === null || chart === void 0 ? void 0 : chart.id, initConfig);
|
|
43
28
|
};
|
|
@@ -45,7 +30,7 @@ class BarCustom extends _chartComponent.default {
|
|
|
45
30
|
let {
|
|
46
31
|
result: data
|
|
47
32
|
} = this.props;
|
|
48
|
-
data =
|
|
33
|
+
data = BaseUtils.formatEmptyName(data, '', intl.get('Empty'));
|
|
49
34
|
if (!Array.isArray(data)) return;
|
|
50
35
|
this.draw(data);
|
|
51
36
|
this.renderAxisLabel(this.props.chart, this.props.tables, this.container);
|
|
@@ -106,7 +91,7 @@ class BarCustom extends _chartComponent.default {
|
|
|
106
91
|
key: itemKey,
|
|
107
92
|
value,
|
|
108
93
|
series,
|
|
109
|
-
slugid:
|
|
94
|
+
slugid: slugid.nice()
|
|
110
95
|
});
|
|
111
96
|
});
|
|
112
97
|
stacksData.push({
|
|
@@ -133,7 +118,7 @@ class BarCustom extends _chartComponent.default {
|
|
|
133
118
|
globalTheme,
|
|
134
119
|
chartColorTheme
|
|
135
120
|
} = this.props;
|
|
136
|
-
const theme =
|
|
121
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
137
122
|
const {
|
|
138
123
|
display_each_block_data
|
|
139
124
|
} = chart.config;
|
|
@@ -148,7 +133,7 @@ class BarCustom extends _chartComponent.default {
|
|
|
148
133
|
insertPadding
|
|
149
134
|
} = this.chartBoundingClientRect;
|
|
150
135
|
const organizedData = this.organizeData(data);
|
|
151
|
-
const color = d3.scaleOrdinal().domain(d3.group(data, d => d.group_name).keys()).range(
|
|
136
|
+
const color = d3.scaleOrdinal().domain(d3.group(data, d => d.group_name).keys()).range(BaseUtils.getCurrentTheme(chartColorTheme).colors).unknown('#ccc');
|
|
152
137
|
const allSeries = this.getAllSeries(organizedData);
|
|
153
138
|
const niceEnd = d3.nice(0, d3.max(allSeries, d => d[1]), 5)[1];
|
|
154
139
|
const y = d3.scaleLinear().domain([0, niceEnd]).range([chartHeight - insertPadding, insertPadding]);
|
|
@@ -182,9 +167,6 @@ class BarCustom extends _chartComponent.default {
|
|
|
182
167
|
const height = y(d[0][0]) - y(d[0][1]);
|
|
183
168
|
return isNaN(height) ? 0 : height;
|
|
184
169
|
}).attr('fill', d => color(d.key)).attr('data-value', d => d.stackData.value).attr('data-rectId', d => d.stackData.slugId).attr('data-groupName', d => d.stackData.group_name).attr('data-title', d => d.stackData.name).call(g => {
|
|
185
|
-
const {
|
|
186
|
-
borderRadius
|
|
187
|
-
} = this.chartBoundingClientRect;
|
|
188
170
|
const xWidth = x.bandwidth();
|
|
189
171
|
const stackGroupNodes = Array.from(g._parents);
|
|
190
172
|
const nameGroups = [];
|
|
@@ -196,28 +178,19 @@ class BarCustom extends _chartComponent.default {
|
|
|
196
178
|
});
|
|
197
179
|
nameGroups.forEach(nameGroup => {
|
|
198
180
|
const stackGroups = Array.from(nameGroup.children);
|
|
199
|
-
let groupBorderRadius = Infinity;
|
|
200
181
|
stackGroups.forEach(stackGroup => {
|
|
201
182
|
const topRect = Array.from(stackGroup.children).reverse().find(rect => Number(rect.getAttribute('height')) !== 0);
|
|
202
183
|
if (!topRect) return;
|
|
203
|
-
|
|
204
|
-
const computedBorderRadius = Math.min(xWidth * borderRadius, rectHeight / 2, xWidth / 2);
|
|
205
|
-
groupBorderRadius = Math.min(groupBorderRadius, computedBorderRadius);
|
|
206
|
-
});
|
|
207
|
-
if (!Number.isFinite(groupBorderRadius)) {
|
|
208
|
-
groupBorderRadius = 0;
|
|
209
|
-
}
|
|
210
|
-
stackGroups.forEach(stackGroup => {
|
|
211
|
-
const topRect = Array.from(stackGroup.children).reverse().find(rect => Number(rect.getAttribute('height')) !== 0);
|
|
212
|
-
if (!topRect) return;
|
|
213
|
-
this.addMaskRect(stackGroup, topRect, xWidth, color, groupBorderRadius);
|
|
184
|
+
this.addMaskRect(stackGroup, topRect, xWidth);
|
|
214
185
|
});
|
|
215
186
|
});
|
|
216
187
|
if (display_each_block_data) {
|
|
217
188
|
this.handleLabelToRectCenter(g, xWidth);
|
|
218
189
|
}
|
|
190
|
+
this.animateFadeIn(this.chart.select('.content-wrapper').selectAll('text'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
191
|
+
this.animateStackGrowInY(g, rect => rect.parentNode.getAttribute('data-slugid'));
|
|
219
192
|
}).on('click', (event, data) => {
|
|
220
|
-
this.props.toggleRecords(data);
|
|
193
|
+
this.props.toggleRecords(data.stackData);
|
|
221
194
|
}).on('mouseover', event => {
|
|
222
195
|
this.showTooltip(event, color);
|
|
223
196
|
this.handleStacksAcitveAndInActiveState('inActive', event);
|
|
@@ -246,10 +219,9 @@ class BarCustom extends _chartComponent.default {
|
|
|
246
219
|
const {
|
|
247
220
|
label_font_size
|
|
248
221
|
} = chart.config;
|
|
249
|
-
const theme =
|
|
222
|
+
const theme = CHART_THEME_COLOR[globalTheme];
|
|
250
223
|
Array.from(g._parents).forEach(group => {
|
|
251
224
|
Array.from(group.children).forEach(rect => {
|
|
252
|
-
// The height is 0, and the label is not displayed.
|
|
253
225
|
if (Number(rect.getAttribute('height')) === 0) return;
|
|
254
226
|
this.addLabelToRectCenter({
|
|
255
227
|
container: rect.parentNode,
|
|
@@ -264,28 +236,8 @@ class BarCustom extends _chartComponent.default {
|
|
|
264
236
|
});
|
|
265
237
|
});
|
|
266
238
|
};
|
|
267
|
-
this.addMaskRect = (topG, rect, xWidth
|
|
268
|
-
|
|
269
|
-
borderRadius
|
|
270
|
-
} = this.chartBoundingClientRect;
|
|
271
|
-
const rectHeight = Number(rect.getAttribute('height'));
|
|
272
|
-
const computedBorderRadius = Math.min(xWidth * borderRadius, rectHeight / 2, xWidth / 2);
|
|
273
|
-
const safeBorderRadius = Math.min(borderRadiusVal !== null && borderRadiusVal !== void 0 ? borderRadiusVal : computedBorderRadius, rectHeight / 2, xWidth / 2);
|
|
274
|
-
// Add mask rect
|
|
275
|
-
d3.select(topG).append('foreignObject').attr('class', 'stack-wrapper').attr('opacity', rect.getAttribute('opacity')).attr('x', rect.getAttribute('x')).attr('data-x', topG.parentNode.getAttribute('data-transform')).attr('y', rect.getAttribute('y')).attr('width', xWidth).attr('height', rect.getAttribute('height')).attr('data-groupName', rect.getAttribute('data-groupName')).attr('data-value', rect.getAttribute('data-value')).attr('data-title', rect.getAttribute('data-title')).attr('data-rectId', rect.getAttribute('data-rectId')).on('click', (event, data) => {
|
|
276
|
-
this.props.toggleRecords(data);
|
|
277
|
-
}).on('mouseover', event => {
|
|
278
|
-
this.showTooltip(event, colorScale, true);
|
|
279
|
-
this.handleStacksAcitveAndInActiveState('inActive', event);
|
|
280
|
-
}).on('mousemove', event => {
|
|
281
|
-
this.moveTooltip(event, true);
|
|
282
|
-
}).on('mouseleave', (event, data) => {
|
|
283
|
-
this.hiddenTooltip();
|
|
284
|
-
this.handleStacksAcitveAndInActiveState('active', event);
|
|
285
|
-
}).append('xhtml:div').attr('class', 'stack').attr('data-rectId', rect.getAttribute('data-rectId')).attr('style', `width: 100%; height: 100%; background-color: ${rect.getAttribute('fill')}; border-radius: ${safeBorderRadius}px ${safeBorderRadius}px 0px 0px`);
|
|
286
|
-
|
|
287
|
-
// Remove old rect
|
|
288
|
-
d3.select(rect).remove();
|
|
239
|
+
this.addMaskRect = (topG, rect, xWidth) => {
|
|
240
|
+
return this.addRoundedClip(rect, 'y', xWidth);
|
|
289
241
|
};
|
|
290
242
|
this.handleStacksAcitveAndInActiveState = (state, event) => {
|
|
291
243
|
const rectsWrapper = event.currentTarget.parentNode.parentNode.parentNode;
|
|
@@ -294,10 +246,8 @@ class BarCustom extends _chartComponent.default {
|
|
|
294
246
|
allGroup.forEach(group => {
|
|
295
247
|
Array.from(group.children).forEach(rectGroup => {
|
|
296
248
|
Array.from(rectGroup.children).forEach(rect => {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
if (curRect.getAttribute('class') === 'stack') {
|
|
300
|
-
isDiv ? d3.select(curRect.parentNode).transition().duration(this.transitionDuration).attr('opacity', 1) : d3.select(curRect).transition().duration(this.transitionDuration).attr('opacity', 1);
|
|
249
|
+
if (rect.getAttribute('class') === 'stack') {
|
|
250
|
+
d3.select(rect).transition().duration(this.interactionDuration).attr('opacity', 1);
|
|
301
251
|
}
|
|
302
252
|
});
|
|
303
253
|
});
|
|
@@ -308,35 +258,27 @@ class BarCustom extends _chartComponent.default {
|
|
|
308
258
|
allGroup.forEach(group => {
|
|
309
259
|
Array.from(group.children).forEach(rectGroup => {
|
|
310
260
|
Array.from(rectGroup.children).forEach(rect => {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
if (curRect.getAttribute('class') === 'stack' && curRect.getAttribute('data-rectId') !== curRectId) {
|
|
314
|
-
isDiv ? d3.select(curRect.parentNode).transition().duration(this.transitionDuration).attr('opacity', 0.3) : d3.select(curRect).transition().duration(this.transitionDuration).attr('opacity', 0.3);
|
|
261
|
+
if (rect.getAttribute('class') === 'stack' && rect.getAttribute('data-rectId') !== curRectId) {
|
|
262
|
+
d3.select(rect).transition().duration(this.interactionDuration).attr('opacity', 0.3);
|
|
315
263
|
}
|
|
316
264
|
});
|
|
317
265
|
});
|
|
318
266
|
});
|
|
319
267
|
}
|
|
320
268
|
};
|
|
321
|
-
this.showTooltip = (event, colorScale
|
|
322
|
-
|
|
269
|
+
this.showTooltip = (event, colorScale) => {
|
|
270
|
+
const {
|
|
323
271
|
offsetX,
|
|
324
272
|
offsetY
|
|
325
273
|
} = event;
|
|
326
|
-
if (isDiv) {
|
|
327
|
-
const initX = Number(event.currentTarget.getAttribute('data-x'));
|
|
328
|
-
const initY = Number(event.currentTarget.getAttribute('y'));
|
|
329
|
-
offsetX = offsetX + initX;
|
|
330
|
-
offsetY = offsetY + initY;
|
|
331
|
-
}
|
|
332
274
|
const title = event.currentTarget.getAttribute('data-title');
|
|
333
275
|
const name = event.currentTarget.getAttribute('data-groupName');
|
|
334
276
|
const value = event.currentTarget.getAttribute('data-value');
|
|
335
277
|
const newTooltipData = {
|
|
336
|
-
title: !title && typeof title !== 'number' ?
|
|
278
|
+
title: !title && typeof title !== 'number' ? intl.get(EMPTY_NAME) : title,
|
|
337
279
|
items: [{
|
|
338
280
|
color: colorScale(name),
|
|
339
|
-
name: !name && typeof name !== 'number' ?
|
|
281
|
+
name: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
|
|
340
282
|
value
|
|
341
283
|
}]
|
|
342
284
|
};
|
|
@@ -350,17 +292,11 @@ class BarCustom extends _chartComponent.default {
|
|
|
350
292
|
}
|
|
351
293
|
});
|
|
352
294
|
};
|
|
353
|
-
this.moveTooltip =
|
|
354
|
-
|
|
295
|
+
this.moveTooltip = event => {
|
|
296
|
+
const {
|
|
355
297
|
offsetX,
|
|
356
298
|
offsetY
|
|
357
299
|
} = event;
|
|
358
|
-
if (isDiv) {
|
|
359
|
-
const initX = Number(event.currentTarget.getAttribute('data-x'));
|
|
360
|
-
const initY = Number(event.currentTarget.getAttribute('y'));
|
|
361
|
-
offsetX = offsetX + initX;
|
|
362
|
-
offsetY = offsetY + initY;
|
|
363
|
-
}
|
|
364
300
|
this.setState({
|
|
365
301
|
toolTipPosition: {
|
|
366
302
|
offsetX,
|
|
@@ -382,11 +318,11 @@ class BarCustom extends _chartComponent.default {
|
|
|
382
318
|
componentDidMount() {
|
|
383
319
|
this.createChart();
|
|
384
320
|
this.drawChart();
|
|
385
|
-
|
|
321
|
+
super.componentDidMount();
|
|
386
322
|
}
|
|
387
323
|
componentDidUpdate(prevProps) {
|
|
388
324
|
super.componentDidUpdate(prevProps);
|
|
389
|
-
if (
|
|
325
|
+
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
390
326
|
this.destroyChart();
|
|
391
327
|
this.createChart();
|
|
392
328
|
this.drawChart();
|
|
@@ -394,23 +330,17 @@ class BarCustom extends _chartComponent.default {
|
|
|
394
330
|
}
|
|
395
331
|
componentWillUnmount() {
|
|
396
332
|
this.destroyChart();
|
|
397
|
-
|
|
333
|
+
super.componentWillUnmount();
|
|
398
334
|
}
|
|
399
335
|
render() {
|
|
400
|
-
const {
|
|
401
|
-
chart
|
|
402
|
-
} = this.props;
|
|
403
336
|
const {
|
|
404
337
|
tooltipData,
|
|
405
338
|
toolTipPosition
|
|
406
339
|
} = this.state;
|
|
407
|
-
return /*#__PURE__*/
|
|
340
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
408
341
|
ref: ref => this.container = ref,
|
|
409
|
-
className:
|
|
410
|
-
|
|
411
|
-
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
412
|
-
})
|
|
413
|
-
}, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
342
|
+
className: "sea-chart-container"
|
|
343
|
+
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
414
344
|
tooltipData: tooltipData,
|
|
415
345
|
toolTipPosition: toolTipPosition,
|
|
416
346
|
chart: this.chart
|
|
@@ -418,15 +348,15 @@ class BarCustom extends _chartComponent.default {
|
|
|
418
348
|
}
|
|
419
349
|
}
|
|
420
350
|
BarCustom.propTypes = {
|
|
421
|
-
canvasStyle:
|
|
422
|
-
chart:
|
|
423
|
-
groupbyColumn:
|
|
424
|
-
columnGroupbyColumn:
|
|
425
|
-
summaryColumn:
|
|
426
|
-
result:
|
|
427
|
-
tables:
|
|
428
|
-
globalTheme:
|
|
429
|
-
chartColorTheme:
|
|
430
|
-
toggleRecords:
|
|
351
|
+
canvasStyle: PropTypes.object,
|
|
352
|
+
chart: PropTypes.object,
|
|
353
|
+
groupbyColumn: PropTypes.object,
|
|
354
|
+
columnGroupbyColumn: PropTypes.object,
|
|
355
|
+
summaryColumn: PropTypes.object,
|
|
356
|
+
result: PropTypes.array,
|
|
357
|
+
tables: PropTypes.array,
|
|
358
|
+
globalTheme: PropTypes.string,
|
|
359
|
+
chartColorTheme: PropTypes.string,
|
|
360
|
+
toggleRecords: PropTypes.func
|
|
431
361
|
};
|
|
432
|
-
|
|
362
|
+
export default BarCustom;
|