sea-chart 0.0.1 → 0.0.2
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/README.md +117 -1
- package/dist/api/index.js +101 -0
- package/{lib → dist}/components/collaborator/index.js +8 -6
- package/{lib → dist}/components/icon/index.css +1 -1
- package/{lib → dist}/components/icon/index.js +7 -5
- package/dist/components/index.js +8 -0
- package/{lib → dist}/components/loading/index.js +4 -2
- package/dist/components/number-input/index.js +31 -0
- package/{lib → dist}/components/pixel-editor/index.css +4 -4
- package/{lib → dist}/components/pixel-editor/index.js +11 -15
- package/{lib → dist}/components/select-group/index.css +10 -10
- package/dist/components/select-group/index.js +52 -0
- package/dist/components/types-dialog/index.css +97 -0
- package/dist/components/types-dialog/index.js +117 -0
- package/{lib → dist}/constants/geolocation.js +3 -3
- package/dist/constants/index.js +184 -0
- package/{lib → dist}/constants/model.js +25 -5
- package/dist/constants/style.js +15 -0
- package/dist/constants/type-image.js +59 -0
- package/dist/constants/type.js +124 -0
- package/dist/context.js +83 -0
- package/dist/editor/index.js +41 -0
- package/dist/index.js +9 -0
- package/dist/intl.js +37 -0
- package/dist/locale/index.js +18 -0
- package/{lib → dist}/locale/lang/de.js +1 -1
- package/{lib → dist}/locale/lang/en.js +1 -1
- package/{lib → dist}/locale/lang/es.js +1 -1
- package/{lib → dist}/locale/lang/fr.js +1 -1
- package/{lib → dist}/locale/lang/pt.js +1 -1
- package/{lib → dist}/locale/lang/ru.js +1 -1
- package/{lib → dist}/locale/lang/zh_CN.js +1 -1
- package/dist/model/area-group.js +41 -0
- package/dist/model/area.js +32 -0
- package/dist/model/bar-group.js +44 -0
- package/dist/model/bar-stack.js +41 -0
- package/dist/model/bar.js +38 -0
- package/dist/model/base-model.js +9 -0
- package/dist/model/basic-number-card.js +22 -0
- package/dist/model/chart.js +23 -0
- package/dist/model/combination.js +38 -0
- package/dist/model/compare-bar.js +39 -0
- package/dist/model/completeness-group.js +24 -0
- package/dist/model/completeness.js +18 -0
- package/dist/model/dashboard.js +16 -0
- package/dist/model/generic-model.js +224 -0
- package/dist/model/heat-map.js +23 -0
- package/dist/model/horizontal-bar.js +38 -0
- package/dist/model/horizontal-group-bar.js +43 -0
- package/dist/model/index.js +63 -0
- package/dist/model/line-group.js +44 -0
- package/dist/model/line.js +38 -0
- package/dist/model/map-bubble.js +27 -0
- package/dist/model/map.js +27 -0
- package/dist/model/mirror.js +26 -0
- package/dist/model/pie.js +26 -0
- package/dist/model/ring.js +26 -0
- package/dist/model/scatter.js +19 -0
- package/dist/model/stacked-horizontal-bar.js +32 -0
- package/dist/model/table.js +23 -0
- package/dist/model/tree-map.js +20 -0
- package/dist/model/trend.js +24 -0
- package/dist/model/user.js +15 -0
- package/dist/model/world-map-bubble.js +26 -0
- package/dist/model/world-map.js +26 -0
- package/{lib/components → dist}/settings/advance-bar-settings/data-settings.js +68 -45
- package/dist/settings/advance-bar-settings/style-settings.js +161 -0
- package/{lib/components → dist}/settings/bar-settings/data-settings.js +76 -51
- package/dist/settings/bar-settings/style-settings.js +179 -0
- package/dist/settings/basic-number-card/data-settings.js +126 -0
- package/dist/settings/basic-number-card/style-settings.js +42 -0
- package/dist/settings/combination-settings/data-settings.js +279 -0
- package/dist/settings/combination-settings/style-settings.js +174 -0
- package/dist/settings/dashboard-settings/data-settings.js +179 -0
- package/{lib/components → dist}/settings/data-settings.js +28 -22
- package/dist/settings/horizontal-bar-settings/data-settings.js +55 -0
- package/dist/settings/horizontal-bar-settings/style-settings.js +46 -0
- package/dist/settings/index.css +85 -0
- package/dist/settings/index.js +76 -0
- package/{lib/components → dist}/settings/pie-settings/data-settings.js +67 -44
- package/{lib/components → dist}/settings/pie-settings/style-settings.js +67 -49
- package/dist/settings/style-settings.js +118 -0
- package/{lib/components → dist}/settings/table-settings/data-settings.js +269 -208
- package/{lib/components → dist}/settings/time-comparison-settings/data-settings.js +82 -67
- package/dist/settings/time-comparison-settings/style-settings.js +213 -0
- package/dist/settings/widgets/basic-summary/index.css +12 -0
- package/dist/settings/widgets/basic-summary/index.js +176 -0
- package/{lib/components/settings/widgets/statistic-type → dist/settings/widgets/chart-type}/index.css +5 -5
- package/dist/settings/widgets/chart-type/index.js +59 -0
- package/{lib/components → dist}/settings/widgets/common-data-settings.js +24 -18
- package/dist/settings/widgets/data-filter/index.css +17 -0
- package/{lib/components → dist}/settings/widgets/data-filter/index.js +51 -37
- package/dist/settings/widgets/data-sort.js +44 -0
- package/dist/settings/widgets/date-summary-item.js +111 -0
- package/dist/settings/widgets/display-values-settings/index.css +13 -0
- package/{lib/components → dist}/settings/widgets/display-values-settings/index.js +19 -14
- package/{lib/components → dist}/settings/widgets/divider/index.css +1 -1
- package/dist/settings/widgets/divider/index.js +12 -0
- package/{lib/components → dist}/settings/widgets/font-settings/font-size-settings.js +14 -12
- package/{lib/components → dist}/settings/widgets/font-settings/font-weight-settings.js +14 -16
- package/dist/settings/widgets/group-by.js +160 -0
- package/{lib/components → dist}/settings/widgets/label-color.js +10 -10
- package/dist/settings/widgets/min-max-setting.js +52 -0
- package/dist/settings/widgets/mininum-slice-percent.js +63 -0
- package/dist/settings/widgets/numeric-summary-item.js +90 -0
- package/dist/settings/widgets/select-table/index.js +38 -0
- package/dist/settings/widgets/stack.js +50 -0
- package/dist/settings/widgets/summary-method-setting.js +66 -0
- package/dist/settings/widgets/summary-settings.js +411 -0
- package/dist/settings/widgets/switch/index.css +37 -0
- package/{lib/components → dist}/settings/widgets/switch/index.js +11 -8
- package/{lib/components → dist}/settings/widgets/text-horizontal-settings.js +12 -10
- package/dist/settings/widgets/time-picker.js +174 -0
- package/{lib/components → dist}/settings/widgets/title-settings/index.js +15 -13
- package/dist/settings/widgets/title-settings/title-text.js +25 -0
- package/dist/settings/widgets/x-axios.js +0 -0
- package/dist/settings/widgets/y-axis-group-settings.js +438 -0
- package/dist/utils/cell-format-utils.js +42 -0
- package/dist/utils/chart-data-sql.js +606 -0
- package/dist/utils/chart-utils.js +1803 -0
- package/dist/utils/chart.js +6 -0
- package/dist/utils/collaborator-manager.js +24 -0
- package/dist/utils/collaborator-utils.js +40 -0
- package/dist/utils/column-2-sql-column.js +551 -0
- package/dist/utils/column-utils.js +208 -0
- package/{lib → dist}/utils/custom-g2.js +11 -11
- package/{lib → dist}/utils/date-translate.js +11 -11
- package/dist/utils/index.js +48 -0
- package/dist/utils/key-generator.js +13 -0
- package/dist/utils/object-utils.js +45 -0
- package/{lib → dist}/utils/options-utils.js +17 -18
- package/dist/view/index.css +53 -0
- package/dist/view/index.js +169 -0
- package/{lib/layout → dist/view}/title/index.css +1 -1
- package/dist/view/title/index.js +46 -0
- package/dist/view/wrapper/area.js +150 -0
- package/dist/view/wrapper/bar-group.js +148 -0
- package/dist/view/wrapper/bar.js +138 -0
- package/dist/view/wrapper/basic-number-card.js +127 -0
- package/dist/view/wrapper/chart-component.js +261 -0
- package/dist/view/wrapper/combination.js +399 -0
- package/dist/view/wrapper/dashboard.js +164 -0
- package/dist/view/wrapper/horizontal-bar-group.js +149 -0
- package/dist/view/wrapper/horizontal-bar.js +140 -0
- package/dist/view/wrapper/horizontal-component.js +78 -0
- package/{lib/components/formatter → dist/view/wrapper}/index.js +90 -71
- package/dist/view/wrapper/line-group.js +145 -0
- package/dist/view/wrapper/line.js +157 -0
- package/dist/view/wrapper/pie.js +185 -0
- package/dist/view/wrapper/ring.js +264 -0
- package/{lib/components/formatter → dist/view/wrapper}/table/index.css +18 -18
- package/dist/view/wrapper/table/index.js +31 -0
- package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +144 -0
- package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +198 -0
- package/dist/view/wrapper/table/pivot-table-display-name.js +248 -0
- package/dist/view/wrapper/table/two-dimension-table.js +249 -0
- package/dist/view/wrapper/treemap.js +186 -0
- package/package.json +91 -100
- package/lib/components/formatter/area.js +0 -162
- package/lib/components/formatter/bar-group.js +0 -160
- package/lib/components/formatter/bar.js +0 -150
- package/lib/components/formatter/basic-number-card.js +0 -138
- package/lib/components/formatter/chart-component.js +0 -266
- package/lib/components/formatter/combination.js +0 -407
- package/lib/components/formatter/dashboard.js +0 -182
- package/lib/components/formatter/horizontal-bar-group.js +0 -161
- package/lib/components/formatter/horizontal-bar.js +0 -152
- package/lib/components/formatter/horizontal-component.js +0 -91
- package/lib/components/formatter/line-group.js +0 -157
- package/lib/components/formatter/line.js +0 -170
- package/lib/components/formatter/pie.js +0 -201
- package/lib/components/formatter/ring.js +0 -277
- package/lib/components/formatter/table/index.js +0 -42
- package/lib/components/formatter/table/one-dimension-table-no-numeric-columns.js +0 -145
- package/lib/components/formatter/table/one-dimension-table-with-numeric-columns.js +0 -193
- package/lib/components/formatter/table/pivot-table-display-name.js +0 -249
- package/lib/components/formatter/table/two-dimension-table.js +0 -241
- package/lib/components/formatter/treemap.js +0 -213
- package/lib/components/index.js +0 -5
- package/lib/components/number-input/index.js +0 -31
- package/lib/components/select-group/index.js +0 -63
- package/lib/components/settings/advance-bar-settings/style-settings.js +0 -149
- package/lib/components/settings/bar-settings/style-settings.js +0 -163
- package/lib/components/settings/basic-number-card/data-settings.js +0 -121
- package/lib/components/settings/basic-number-card/style-settings.js +0 -42
- package/lib/components/settings/combination-settings/data-settings.js +0 -256
- package/lib/components/settings/combination-settings/style-settings.js +0 -183
- package/lib/components/settings/dashboard-settings/data-settings.js +0 -167
- package/lib/components/settings/horizontal-bar-settings/data-settings.js +0 -45
- package/lib/components/settings/horizontal-bar-settings/style-settings.js +0 -38
- package/lib/components/settings/index.css +0 -73
- package/lib/components/settings/index.js +0 -74
- package/lib/components/settings/style-settings.js +0 -100
- package/lib/components/settings/time-comparison-settings/style-settings.js +0 -191
- package/lib/components/settings/widgets/basic-summary/index.css +0 -12
- package/lib/components/settings/widgets/basic-summary/index.js +0 -173
- package/lib/components/settings/widgets/data-filter/index.css +0 -17
- package/lib/components/settings/widgets/data-sort.js +0 -38
- package/lib/components/settings/widgets/date-summary-item.js +0 -126
- package/lib/components/settings/widgets/display-values-settings/index.css +0 -13
- package/lib/components/settings/widgets/divider/index.js +0 -10
- package/lib/components/settings/widgets/group-by.js +0 -168
- package/lib/components/settings/widgets/min-max-setting.js +0 -64
- package/lib/components/settings/widgets/mininum-slice-percent.js +0 -72
- package/lib/components/settings/widgets/numeric-summary-item.js +0 -109
- package/lib/components/settings/widgets/select-table/index.js +0 -49
- package/lib/components/settings/widgets/stack.js +0 -58
- package/lib/components/settings/widgets/statistic-type/index.js +0 -54
- package/lib/components/settings/widgets/summary-method-setting.js +0 -80
- package/lib/components/settings/widgets/summary-settings.js +0 -394
- package/lib/components/settings/widgets/switch/index.css +0 -37
- package/lib/components/settings/widgets/time-picker.js +0 -182
- package/lib/components/settings/widgets/title-settings/title-text.js +0 -31
- package/lib/components/settings/widgets/y-axis-group-settings.js +0 -399
- package/lib/components/types-dialog/index.css +0 -97
- package/lib/components/types-dialog/index.js +0 -127
- package/lib/constants/index.js +0 -164
- package/lib/constants/style.js +0 -13
- package/lib/constants/type-image.js +0 -32
- package/lib/constants/type.js +0 -97
- package/lib/context.js +0 -49
- package/lib/index.js +0 -6
- package/lib/intl.js +0 -37
- package/lib/layout/index.js +0 -4
- package/lib/layout/statistic/index.css +0 -53
- package/lib/layout/statistic/index.js +0 -190
- package/lib/layout/title/index.js +0 -41
- package/lib/locale/index.js +0 -11
- package/lib/model/area-group.js +0 -51
- package/lib/model/area.js +0 -42
- package/lib/model/bar-group.js +0 -54
- package/lib/model/bar-stack.js +0 -51
- package/lib/model/bar.js +0 -48
- package/lib/model/base-model.js +0 -11
- package/lib/model/basic-number-card.js +0 -32
- package/lib/model/combination.js +0 -48
- package/lib/model/compare-bar.js +0 -49
- package/lib/model/completeness-group.js +0 -34
- package/lib/model/completeness.js +0 -28
- package/lib/model/dashboard.js +0 -26
- package/lib/model/generic-model.js +0 -235
- package/lib/model/heat-map.js +0 -33
- package/lib/model/horizontal-bar.js +0 -48
- package/lib/model/horizontal-group-bar.js +0 -53
- package/lib/model/index.js +0 -36
- package/lib/model/line-group.js +0 -54
- package/lib/model/line.js +0 -48
- package/lib/model/map-bubble.js +0 -37
- package/lib/model/map.js +0 -37
- package/lib/model/mirror.js +0 -36
- package/lib/model/pie.js +0 -36
- package/lib/model/ring.js +0 -36
- package/lib/model/scatter.js +0 -29
- package/lib/model/stacked-horizontal-bar.js +0 -42
- package/lib/model/statistic.js +0 -22
- package/lib/model/table.js +0 -33
- package/lib/model/tree-map.js +0 -30
- package/lib/model/trend.js +0 -34
- package/lib/model/user.js +0 -22
- package/lib/model/world-map-bubble.js +0 -36
- package/lib/model/world-map.js +0 -36
- package/lib/utils/cell-format-utils.js +0 -41
- package/lib/utils/chart.js +0 -6
- package/lib/utils/collaborator-utils.js +0 -40
- package/lib/utils/column-utils.js +0 -247
- package/lib/utils/data-filter/filter-item-utils.js +0 -80
- package/lib/utils/data-filter/filters-utils.js +0 -406
- package/lib/utils/data-filter/index.js +0 -3
- package/lib/utils/index.js +0 -50
- package/lib/utils/key-generator.js +0 -13
- package/lib/utils/object-utils.js +0 -61
- package/lib/utils/statistic-column-2-sql-column-utils.js +0 -499
- package/lib/utils/statistic-utils.js +0 -1685
- /package/{lib → dist}/assets/icons/area-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/bar-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/card.svg +0 -0
- /package/{lib → dist}/assets/icons/combination-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/dtable-logo.svg +0 -0
- /package/{lib → dist}/assets/icons/facet-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/gauge.svg +0 -0
- /package/{lib → dist}/assets/icons/heat-map.svg +0 -0
- /package/{lib → dist}/assets/icons/histogram.svg +0 -0
- /package/{lib → dist}/assets/icons/line-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/map.svg +0 -0
- /package/{lib → dist}/assets/icons/pie-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/rectangular-tree-diagram.svg +0 -0
- /package/{lib → dist}/assets/icons/scatter-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/type-change.svg +0 -0
- /package/{lib → dist}/assets/img/area-chart.png +0 -0
- /package/{lib → dist}/assets/img/area-group-chart.png +0 -0
- /package/{lib → dist}/assets/img/bar-group.png +0 -0
- /package/{lib → dist}/assets/img/bar-stack.png +0 -0
- /package/{lib → dist}/assets/img/bar.png +0 -0
- /package/{lib → dist}/assets/img/combination-chart.png +0 -0
- /package/{lib → dist}/assets/img/compared-chart.png +0 -0
- /package/{lib → dist}/assets/img/completeness-chart.png +0 -0
- /package/{lib → dist}/assets/img/custom-bar.png +0 -0
- /package/{lib → dist}/assets/img/dashboard-chart.png +0 -0
- /package/{lib → dist}/assets/img/group-completeness-chart.png +0 -0
- /package/{lib → dist}/assets/img/group_line.png +0 -0
- /package/{lib → dist}/assets/img/heat-map.png +0 -0
- /package/{lib → dist}/assets/img/horizontal-bar.png +0 -0
- /package/{lib → dist}/assets/img/horizontal-group-bar.png +0 -0
- /package/{lib → dist}/assets/img/line.png +0 -0
- /package/{lib → dist}/assets/img/map-bubble.png +0 -0
- /package/{lib → dist}/assets/img/map.png +0 -0
- /package/{lib → dist}/assets/img/mirror.png +0 -0
- /package/{lib → dist}/assets/img/number-card.png +0 -0
- /package/{lib → dist}/assets/img/pie.png +0 -0
- /package/{lib → dist}/assets/img/pivot-table.png +0 -0
- /package/{lib → dist}/assets/img/ring.png +0 -0
- /package/{lib → dist}/assets/img/scatter.png +0 -0
- /package/{lib → dist}/assets/img/stacked-horizontal-bar.png +0 -0
- /package/{lib → dist}/assets/img/treemap.png +0 -0
- /package/{lib → dist}/assets/img/trend-chart.png +0 -0
- /package/{lib → dist}/assets/img/world-map-bubble.png +0 -0
- /package/{lib → dist}/assets/img/world-map.png +0 -0
- /package/{lib → dist}/components/loading/index.css +0 -0
- /package/{lib/components/settings/widgets/select-table → dist/editor}/index.css +0 -0
- /package/{lib/components → dist}/settings/advance-bar-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/bar-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/basic-number-card/index.js +0 -0
- /package/{lib/components → dist}/settings/combination-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/dashboard-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/horizontal-bar-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/pie-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/table-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/time-comparison-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/widgets/font-settings/index.js +0 -0
- /package/{lib/components/settings/widgets/x-axios.js → dist/settings/widgets/select-table/index.css} +0 -0
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
import DataSet from '@antv/data-set';
|
|
9
|
-
import { each, pick } from '@antv/util';
|
|
10
|
-
import { getEllipsisText } from '@antv/g2/esm/util/text';
|
|
11
|
-
import { STATISTIC_SUMMARY_TYPE, EMPTY_NAME } from '../../constants';
|
|
12
|
-
import { StatisticsUtils } from '../../utils';
|
|
13
|
-
import { registerGeometryLabelLayout } from '../../utils/custom-g2';
|
|
14
|
-
import ChartComponent from './chart-component';
|
|
15
|
-
import intl from '../../intl';
|
|
16
|
-
var Treemap = /*#__PURE__*/function (_ChartComponent) {
|
|
17
|
-
_inherits(Treemap, _ChartComponent);
|
|
18
|
-
var _super = _createSuper(Treemap);
|
|
19
|
-
function Treemap(props) {
|
|
20
|
-
var _this;
|
|
21
|
-
_classCallCheck(this, Treemap);
|
|
22
|
-
_this = _super.call(this, props);
|
|
23
|
-
// customize label layout: show ellipsis for long labels
|
|
24
|
-
_this.limitInShape = function (items, labels, shapes, region) {
|
|
25
|
-
each(labels, function (label, index) {
|
|
26
|
-
var labelBBox = label.getCanvasBBox();
|
|
27
|
-
var shapeBBox = shapes[index].getBBox();
|
|
28
|
-
if (labelBBox.minX < shapeBBox.minX || labelBBox.minY < shapeBBox.minY || labelBBox.maxX > shapeBBox.maxX || labelBBox.maxY > shapeBBox.maxY) {
|
|
29
|
-
var translateX = labelBBox.width - shapeBBox.width + 20;
|
|
30
|
-
var textShapes = label.findAll(function (shape) {
|
|
31
|
-
return shape.get('type') === 'text';
|
|
32
|
-
});
|
|
33
|
-
textShapes.forEach(function (textShape) {
|
|
34
|
-
var style = pick(textShape.attr(), ['fontSize', 'fontFamily', 'fontWeight', 'fontStyle', 'fontVariant']);
|
|
35
|
-
var textBox = textShape.getCanvasBBox();
|
|
36
|
-
var text = getEllipsisText(textShape.attr('text'), textBox.width - Math.abs(translateX), style);
|
|
37
|
-
textShape.attr('text', text);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
_this.createChart = function () {
|
|
43
|
-
var canvasStyle = _this.props.canvasStyle;
|
|
44
|
-
_this.initChart(_this.container, canvasStyle, 0);
|
|
45
|
-
};
|
|
46
|
-
_this.destroyChart = function () {
|
|
47
|
-
_this.chart.destroy();
|
|
48
|
-
_this.chart = null;
|
|
49
|
-
};
|
|
50
|
-
_this.clearChart = function () {
|
|
51
|
-
_this.chart.annotation().clear(true);
|
|
52
|
-
_this.chart.clear(true);
|
|
53
|
-
};
|
|
54
|
-
_this.drawChart = function () {
|
|
55
|
-
var _this$props = _this.props,
|
|
56
|
-
data = _this$props.result,
|
|
57
|
-
statistic = _this$props.statistic,
|
|
58
|
-
tables = _this$props.tables,
|
|
59
|
-
summaryColumn = _this$props.summaryColumn;
|
|
60
|
-
var _statistic$config = statistic.config,
|
|
61
|
-
summary_type = _statistic$config.summary_type,
|
|
62
|
-
summary_method = _statistic$config.summary_method;
|
|
63
|
-
var _StatisticsUtils$form = StatisticsUtils.formatPieChartData(data, statistic, tables),
|
|
64
|
-
newData = _StatisticsUtils$form.data,
|
|
65
|
-
colorSet = _StatisticsUtils$form.colorSet;
|
|
66
|
-
if (!Array.isArray(newData)) return;
|
|
67
|
-
var DataView = DataSet.DataView;
|
|
68
|
-
var dv = new DataView();
|
|
69
|
-
var fullData = {
|
|
70
|
-
name: 'root',
|
|
71
|
-
children: newData.map(function (item) {
|
|
72
|
-
var name = item.name;
|
|
73
|
-
item.name = name || name === 0 ? name : intl.get(EMPTY_NAME);
|
|
74
|
-
if (name === '_Others') {
|
|
75
|
-
item.name = intl.get('Others');
|
|
76
|
-
}
|
|
77
|
-
return item;
|
|
78
|
-
})
|
|
79
|
-
};
|
|
80
|
-
dv.source(fullData, {
|
|
81
|
-
type: 'hierarchy'
|
|
82
|
-
}).transform({
|
|
83
|
-
field: 'value',
|
|
84
|
-
type: 'hierarchy.treemap',
|
|
85
|
-
tile: 'treemapResquarify',
|
|
86
|
-
as: ['x', 'y']
|
|
87
|
-
});
|
|
88
|
-
var nodes = [];
|
|
89
|
-
var _iterator = _createForOfIteratorHelper(dv.getAllNodes()),
|
|
90
|
-
_step;
|
|
91
|
-
try {
|
|
92
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
93
|
-
var node = _step.value;
|
|
94
|
-
if (node.data.name === 'root') {
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
var eachNode = {
|
|
98
|
-
name: node.data.name,
|
|
99
|
-
x: node.x,
|
|
100
|
-
y: node.y,
|
|
101
|
-
value: node.data.value,
|
|
102
|
-
percent: node.data.percent,
|
|
103
|
-
original_name: node.data.original_name,
|
|
104
|
-
rows: node.data.rows || null
|
|
105
|
-
};
|
|
106
|
-
nodes.push(eachNode);
|
|
107
|
-
}
|
|
108
|
-
} catch (err) {
|
|
109
|
-
_iterator.e(err);
|
|
110
|
-
} finally {
|
|
111
|
-
_iterator.f();
|
|
112
|
-
}
|
|
113
|
-
_this.chart.data(nodes);
|
|
114
|
-
_this.chart.scale({
|
|
115
|
-
x: {
|
|
116
|
-
nice: true
|
|
117
|
-
},
|
|
118
|
-
y: {
|
|
119
|
-
nice: true
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
_this.chart.axis(false);
|
|
123
|
-
_this.chart.legend(false);
|
|
124
|
-
_this.chart.tooltip({
|
|
125
|
-
showTitle: false,
|
|
126
|
-
showMarkers: false,
|
|
127
|
-
containerTpl: '<div class="g2-tooltip"><div class="g2-tooltip-list"></div></div>',
|
|
128
|
-
itemTpl: '<div class="g2-tooltip-content"><div class="tooltip-name">{name}<div><div class="tooltip-item">{info}<div></div>',
|
|
129
|
-
domStyles: {
|
|
130
|
-
'g2-tooltip': {
|
|
131
|
-
borderRadius: '2px',
|
|
132
|
-
backgroundColor: '#fff',
|
|
133
|
-
padding: '10px'
|
|
134
|
-
},
|
|
135
|
-
'tooltip-item': {
|
|
136
|
-
marginTop: '5px'
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
_this.chart.polygon().position('x*y').color('name', colorSet).tooltip('name*value*percent', function (name, value, percent) {
|
|
141
|
-
var displayValue = StatisticsUtils.getSummaryValueDisplayString(summaryColumn, value, summary_method);
|
|
142
|
-
return {
|
|
143
|
-
name: name,
|
|
144
|
-
info: summary_type === STATISTIC_SUMMARY_TYPE.COUNT ? "".concat(value) : "".concat(summaryColumn.name, ": ").concat(displayValue, " (").concat(percent, ")")
|
|
145
|
-
};
|
|
146
|
-
}).style({
|
|
147
|
-
lineWidth: 1,
|
|
148
|
-
stroke: '#fff'
|
|
149
|
-
}).label('name', {
|
|
150
|
-
offset: 0,
|
|
151
|
-
style: {
|
|
152
|
-
textBaseline: 'middle'
|
|
153
|
-
},
|
|
154
|
-
content: function content(obj) {
|
|
155
|
-
if (obj.name !== 'root') {
|
|
156
|
-
return obj.name;
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
layout: {
|
|
160
|
-
type: 'custom-limit-in-shape'
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
_this.chart.interaction('statistic-active');
|
|
164
|
-
_this.chart.render();
|
|
165
|
-
};
|
|
166
|
-
_this.chart = null;
|
|
167
|
-
registerGeometryLabelLayout('custom-limit-in-shape', _this.limitInShape);
|
|
168
|
-
return _this;
|
|
169
|
-
}
|
|
170
|
-
_createClass(Treemap, [{
|
|
171
|
-
key: "componentDidMount",
|
|
172
|
-
value: function componentDidMount() {
|
|
173
|
-
this.createChart();
|
|
174
|
-
this.drawChart();
|
|
175
|
-
}
|
|
176
|
-
}, {
|
|
177
|
-
key: "componentDidUpdate",
|
|
178
|
-
value: function componentDidUpdate(prevProps) {
|
|
179
|
-
if (StatisticsUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
180
|
-
this.chart && this.destroyChart();
|
|
181
|
-
this.createChart();
|
|
182
|
-
this.drawChart();
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}, {
|
|
186
|
-
key: "componentWillUnmount",
|
|
187
|
-
value: function componentWillUnmount() {
|
|
188
|
-
this.chart && this.destroyChart();
|
|
189
|
-
}
|
|
190
|
-
}, {
|
|
191
|
-
key: "render",
|
|
192
|
-
value: function render() {
|
|
193
|
-
var _this2 = this;
|
|
194
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
195
|
-
className: "seastatistic-container w-100",
|
|
196
|
-
ref: function ref(_ref) {
|
|
197
|
-
return _this2.container = _ref;
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
}]);
|
|
202
|
-
return Treemap;
|
|
203
|
-
}(ChartComponent);
|
|
204
|
-
Treemap.propTypes = {
|
|
205
|
-
canvasStyle: PropTypes.object,
|
|
206
|
-
statistic: PropTypes.object,
|
|
207
|
-
groupbyColumn: PropTypes.object,
|
|
208
|
-
summaryColumn: PropTypes.object,
|
|
209
|
-
result: PropTypes.array,
|
|
210
|
-
tables: PropTypes.array,
|
|
211
|
-
theme: PropTypes.object
|
|
212
|
-
};
|
|
213
|
-
export default Treemap;
|
package/lib/components/index.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
-
var _excluded = ["value", "onChange", "min", "step", "max", "readOnly", "className"];
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { Input } from 'reactstrap';
|
|
5
|
-
function NumberInput(props) {
|
|
6
|
-
var value = props.value,
|
|
7
|
-
onChange = props.onChange,
|
|
8
|
-
min = props.min,
|
|
9
|
-
step = props.step,
|
|
10
|
-
max = props.max,
|
|
11
|
-
readOnly = props.readOnly,
|
|
12
|
-
className = props.className,
|
|
13
|
-
otherProps = _objectWithoutProperties(props, _excluded);
|
|
14
|
-
return /*#__PURE__*/React.createElement(Input, Object.assign({
|
|
15
|
-
type: "number",
|
|
16
|
-
className: className,
|
|
17
|
-
value: value || '0',
|
|
18
|
-
min: min,
|
|
19
|
-
step: step,
|
|
20
|
-
max: max,
|
|
21
|
-
readOnly: readOnly,
|
|
22
|
-
onChange: onChange
|
|
23
|
-
}, otherProps));
|
|
24
|
-
}
|
|
25
|
-
NumberInput.defaultProps = {
|
|
26
|
-
min: 0,
|
|
27
|
-
step: 1,
|
|
28
|
-
max: Infinity,
|
|
29
|
-
readOnly: false
|
|
30
|
-
};
|
|
31
|
-
export default NumberInput;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import intl from '../../intl';
|
|
7
|
-
import './index.css';
|
|
8
|
-
var SelectGroup = /*#__PURE__*/function (_React$Component) {
|
|
9
|
-
_inherits(SelectGroup, _React$Component);
|
|
10
|
-
var _super = _createSuper(SelectGroup);
|
|
11
|
-
function SelectGroup(props) {
|
|
12
|
-
var _this;
|
|
13
|
-
_classCallCheck(this, SelectGroup);
|
|
14
|
-
_this = _super.call(this, props);
|
|
15
|
-
_this.onSelectChanged = function (event) {
|
|
16
|
-
var option = event.target.dataset.option;
|
|
17
|
-
if (option === _this.state.activeOption) return;
|
|
18
|
-
_this.setState({
|
|
19
|
-
activeOption: option
|
|
20
|
-
});
|
|
21
|
-
_this.props.onSelectChanged(option);
|
|
22
|
-
};
|
|
23
|
-
_this.state = {
|
|
24
|
-
activeOption: props.activeOption
|
|
25
|
-
};
|
|
26
|
-
return _this;
|
|
27
|
-
}
|
|
28
|
-
_createClass(SelectGroup, [{
|
|
29
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
30
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
31
|
-
if (nextProps.activeOption !== this.state.activeOption) {
|
|
32
|
-
this.setState({
|
|
33
|
-
activeOption: nextProps.activeOption
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}, {
|
|
38
|
-
key: "render",
|
|
39
|
-
value: function render() {
|
|
40
|
-
var _this2 = this;
|
|
41
|
-
var _this$props = this.props,
|
|
42
|
-
options = _this$props.options,
|
|
43
|
-
optionsDisplay = _this$props.optionsDisplay;
|
|
44
|
-
var activeOption = this.state.activeOption;
|
|
45
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
-
className: "select-group-container"
|
|
47
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
48
|
-
className: "select-group"
|
|
49
|
-
}, options.map(function (option) {
|
|
50
|
-
var isActive = activeOption === option ? true : false;
|
|
51
|
-
var displayOption = optionsDisplay && optionsDisplay[option] ? intl.get(optionsDisplay[option]) : option;
|
|
52
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
53
|
-
key: option,
|
|
54
|
-
className: "select-group-item ".concat(isActive ? 'active' : ''),
|
|
55
|
-
"data-option": option,
|
|
56
|
-
onClick: _this2.onSelectChanged
|
|
57
|
-
}, displayOption);
|
|
58
|
-
})));
|
|
59
|
-
}
|
|
60
|
-
}]);
|
|
61
|
-
return SelectGroup;
|
|
62
|
-
}(React.Component);
|
|
63
|
-
export default SelectGroup;
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import React, { useCallback, useMemo } from 'react';
|
|
3
|
-
import { Label, FormGroup } from 'reactstrap';
|
|
4
|
-
import DTableSelect from "dtable-ui-component/lib/DTableSelect";
|
|
5
|
-
import Switch from '../widgets/switch';
|
|
6
|
-
import Divider from '../widgets/divider';
|
|
7
|
-
import MinMaxSetting from '../widgets/min-max-setting';
|
|
8
|
-
import DisplayValuesSettings from '../widgets/display-values-settings';
|
|
9
|
-
import { eventStopPropagation } from '../../../utils';
|
|
10
|
-
import { X_LABEL_POSITIONS, Y_LABEL_POSITIONS, LABEL_POSITION_TYPE_SHOW } from '../../../constants';
|
|
11
|
-
import intl from '../../../intl';
|
|
12
|
-
var StyleSettings = function StyleSettings(_ref) {
|
|
13
|
-
var statistic = _ref.statistic,
|
|
14
|
-
xLabel = _ref.xLabel,
|
|
15
|
-
yLabel = _ref.yLabel,
|
|
16
|
-
onChange = _ref.onChange;
|
|
17
|
-
var xAxisLabelOptions = useMemo(function () {
|
|
18
|
-
return X_LABEL_POSITIONS.map(function (item) {
|
|
19
|
-
return {
|
|
20
|
-
value: item,
|
|
21
|
-
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
|
-
}, []);
|
|
25
|
-
var yAxisLabelOptions = useMemo(function () {
|
|
26
|
-
return Y_LABEL_POSITIONS.map(function (item) {
|
|
27
|
-
return {
|
|
28
|
-
value: item,
|
|
29
|
-
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
}, []);
|
|
33
|
-
var onAxisLabelShowChange = useCallback(function (event, labelKey) {
|
|
34
|
-
eventStopPropagation(event);
|
|
35
|
-
var config = statistic.config;
|
|
36
|
-
var value = config[labelKey];
|
|
37
|
-
onChange && onChange(_defineProperty({}, labelKey, !value));
|
|
38
|
-
}, [statistic, onChange]);
|
|
39
|
-
var onAxisLabelPositionChange = useCallback(function (option, positionKey) {
|
|
40
|
-
var position = option.value;
|
|
41
|
-
var config = statistic.config;
|
|
42
|
-
var oldValue = config[positionKey];
|
|
43
|
-
if (position === oldValue) return;
|
|
44
|
-
onChange && onChange(_defineProperty({}, positionKey, position));
|
|
45
|
-
}, [statistic, onChange]);
|
|
46
|
-
var onYAxisAutoRangeChange = useCallback(function (event) {
|
|
47
|
-
eventStopPropagation(event);
|
|
48
|
-
var config = statistic.config;
|
|
49
|
-
var y_axis_auto_range = config.y_axis_auto_range;
|
|
50
|
-
onChange && onChange({
|
|
51
|
-
y_axis_auto_range: !y_axis_auto_range
|
|
52
|
-
});
|
|
53
|
-
}, [statistic, onChange]);
|
|
54
|
-
var onYAxisMinChange = useCallback(function (min) {
|
|
55
|
-
var newMin = parseInt(min);
|
|
56
|
-
if (Number.isNaN(newMin)) return;
|
|
57
|
-
var config = statistic.config;
|
|
58
|
-
var y_axis_min = config.y_axis_min;
|
|
59
|
-
if (y_axis_min === newMin) return;
|
|
60
|
-
onChange && onChange({
|
|
61
|
-
y_axis_min: newMin
|
|
62
|
-
});
|
|
63
|
-
}, [statistic, onChange]);
|
|
64
|
-
var onYAxisMaxChange = useCallback(function (max) {
|
|
65
|
-
var newMax = parseInt(max);
|
|
66
|
-
if (Number.isNaN(newMax)) return;
|
|
67
|
-
var config = statistic.config;
|
|
68
|
-
var y_axis_max = config.y_axis_max;
|
|
69
|
-
if (y_axis_max === newMax) return;
|
|
70
|
-
onChange && onChange({
|
|
71
|
-
y_axis_max: newMax
|
|
72
|
-
});
|
|
73
|
-
}, [statistic, onChange]);
|
|
74
|
-
var onDisplayValueChange = useCallback(function (update) {
|
|
75
|
-
onChange(update);
|
|
76
|
-
}, [onChange]);
|
|
77
|
-
var config = statistic.config;
|
|
78
|
-
var x_axis_show_label = config.x_axis_show_label,
|
|
79
|
-
x_axis_label_position = config.x_axis_label_position,
|
|
80
|
-
y_axis_show_label = config.y_axis_show_label,
|
|
81
|
-
y_axis_label_position = config.y_axis_label_position,
|
|
82
|
-
_config$y_axis_auto_r = config.y_axis_auto_range,
|
|
83
|
-
y_axis_auto_range = _config$y_axis_auto_r === void 0 ? true : _config$y_axis_auto_r,
|
|
84
|
-
y_axis_min = config.y_axis_min,
|
|
85
|
-
y_axis_max = config.y_axis_max,
|
|
86
|
-
y_axis_show_value = config.y_axis_show_value,
|
|
87
|
-
label_font_size = config.label_font_size;
|
|
88
|
-
var xAxisLabelPosition = xAxisLabelOptions.find(function (option) {
|
|
89
|
-
return option.value === x_axis_label_position;
|
|
90
|
-
}) || xAxisLabelOptions[0];
|
|
91
|
-
var yAxisLabelPosition = yAxisLabelOptions.find(function (option) {
|
|
92
|
-
return option.value === y_axis_label_position;
|
|
93
|
-
}) || yAxisLabelOptions[0];
|
|
94
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormGroup, {
|
|
95
|
-
className: "seastatistic-parameter-item"
|
|
96
|
-
}, /*#__PURE__*/React.createElement(Label, null, intl.get(xLabel)), /*#__PURE__*/React.createElement(Switch, {
|
|
97
|
-
key: "x_axis_show_label",
|
|
98
|
-
checked: x_axis_show_label || false,
|
|
99
|
-
placeholder: intl.get('Display_title'),
|
|
100
|
-
onChange: function onChange(event) {
|
|
101
|
-
return onAxisLabelShowChange(event, 'x_axis_show_label');
|
|
102
|
-
}
|
|
103
|
-
}), x_axis_show_label && /*#__PURE__*/React.createElement(DTableSelect, {
|
|
104
|
-
value: xAxisLabelPosition,
|
|
105
|
-
options: xAxisLabelOptions,
|
|
106
|
-
onChange: function onChange(option) {
|
|
107
|
-
return onAxisLabelPositionChange(option, 'x_axis_label_position');
|
|
108
|
-
}
|
|
109
|
-
})), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(FormGroup, {
|
|
110
|
-
className: "seastatistic-parameter-item"
|
|
111
|
-
}, /*#__PURE__*/React.createElement(Label, null, intl.get(yLabel)), /*#__PURE__*/React.createElement(Switch, {
|
|
112
|
-
key: "y_axis_show_label",
|
|
113
|
-
checked: y_axis_show_label || false,
|
|
114
|
-
placeholder: intl.get('Display_title'),
|
|
115
|
-
onChange: function onChange(event) {
|
|
116
|
-
return onAxisLabelShowChange(event, 'y_axis_show_label');
|
|
117
|
-
}
|
|
118
|
-
}), y_axis_show_label && /*#__PURE__*/React.createElement("div", {
|
|
119
|
-
className: "seastatistic-parameter-container"
|
|
120
|
-
}, /*#__PURE__*/React.createElement(DTableSelect, {
|
|
121
|
-
value: yAxisLabelPosition,
|
|
122
|
-
classNamePrefix: "chart-y-axis-label-position",
|
|
123
|
-
options: yAxisLabelOptions,
|
|
124
|
-
onChange: function onChange(option) {
|
|
125
|
-
return onAxisLabelPositionChange(option, 'y_axis_label_position');
|
|
126
|
-
}
|
|
127
|
-
})), /*#__PURE__*/React.createElement(Switch, {
|
|
128
|
-
key: "y_axis_auto_range",
|
|
129
|
-
checked: y_axis_auto_range,
|
|
130
|
-
placeholder: intl.get('Auto_range'),
|
|
131
|
-
onChange: onYAxisAutoRangeChange
|
|
132
|
-
}), !y_axis_auto_range && /*#__PURE__*/React.createElement(MinMaxSetting, {
|
|
133
|
-
min: y_axis_min,
|
|
134
|
-
max: y_axis_max,
|
|
135
|
-
onMinChange: onYAxisMinChange,
|
|
136
|
-
onMaxChange: onYAxisMaxChange
|
|
137
|
-
})), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(DisplayValuesSettings, {
|
|
138
|
-
isShowValueKey: "y_axis_show_value",
|
|
139
|
-
isShowValue: y_axis_show_value,
|
|
140
|
-
fontSizeKey: "label_font_size",
|
|
141
|
-
fontSize: label_font_size,
|
|
142
|
-
onChange: onDisplayValueChange
|
|
143
|
-
}));
|
|
144
|
-
};
|
|
145
|
-
StyleSettings.defaultProps = {
|
|
146
|
-
xLabel: 'X_axis',
|
|
147
|
-
yLabel: 'Y_axis'
|
|
148
|
-
};
|
|
149
|
-
export default StyleSettings;
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import React, { useMemo, useCallback } from 'react';
|
|
3
|
-
import { Label, FormGroup } from 'reactstrap';
|
|
4
|
-
import DTableSelect from "dtable-ui-component/lib/DTableSelect";
|
|
5
|
-
import Switch from '../widgets/switch';
|
|
6
|
-
import Divider from '../widgets/divider';
|
|
7
|
-
import LabelColor from '../widgets/label-color';
|
|
8
|
-
import MinMaxSetting from '../widgets/min-max-setting';
|
|
9
|
-
import DisplayValuesSettings from '../widgets/display-values-settings';
|
|
10
|
-
import { eventStopPropagation } from '../../../utils';
|
|
11
|
-
import { X_LABEL_POSITIONS, Y_LABEL_POSITIONS, LABEL_POSITION_TYPE_SHOW } from '../../../constants';
|
|
12
|
-
import intl from '../../../intl';
|
|
13
|
-
var StyleSettings = function StyleSettings(_ref) {
|
|
14
|
-
var statistic = _ref.statistic,
|
|
15
|
-
xLabel = _ref.xLabel,
|
|
16
|
-
yLabel = _ref.yLabel,
|
|
17
|
-
onChange = _ref.onChange;
|
|
18
|
-
var xAxisLabelOptions = useMemo(function () {
|
|
19
|
-
return X_LABEL_POSITIONS.map(function (item) {
|
|
20
|
-
return {
|
|
21
|
-
value: item,
|
|
22
|
-
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
}, []);
|
|
26
|
-
var yAxisLabelOptions = useMemo(function () {
|
|
27
|
-
return Y_LABEL_POSITIONS.map(function (item) {
|
|
28
|
-
return {
|
|
29
|
-
value: item,
|
|
30
|
-
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
}, []);
|
|
34
|
-
var onAxisLabelShowChange = useCallback(function (event, labelKey) {
|
|
35
|
-
eventStopPropagation(event);
|
|
36
|
-
var config = statistic.config;
|
|
37
|
-
var value = config[labelKey];
|
|
38
|
-
onChange && onChange(_defineProperty({}, labelKey, !value));
|
|
39
|
-
}, [statistic, onChange]);
|
|
40
|
-
var onAxisLabelPositionChange = useCallback(function (option, positionKey) {
|
|
41
|
-
var position = option.value;
|
|
42
|
-
var config = statistic.config;
|
|
43
|
-
var oldValue = config[positionKey];
|
|
44
|
-
if (position === oldValue) return;
|
|
45
|
-
onChange && onChange(_defineProperty({}, positionKey, position));
|
|
46
|
-
}, [statistic, onChange]);
|
|
47
|
-
var onYAxisAutoRangeChange = useCallback(function (event) {
|
|
48
|
-
eventStopPropagation(event);
|
|
49
|
-
var config = statistic.config;
|
|
50
|
-
var y_axis_auto_range = config.y_axis_auto_range;
|
|
51
|
-
onChange && onChange({
|
|
52
|
-
y_axis_auto_range: !y_axis_auto_range
|
|
53
|
-
});
|
|
54
|
-
}, [statistic, onChange]);
|
|
55
|
-
var onYAxisMinChange = useCallback(function (min) {
|
|
56
|
-
var newMin = parseInt(min);
|
|
57
|
-
if (Number.isNaN(newMin)) return;
|
|
58
|
-
var config = statistic.config;
|
|
59
|
-
var y_axis_min = config.y_axis_min;
|
|
60
|
-
if (y_axis_min === newMin) return;
|
|
61
|
-
onChange && onChange({
|
|
62
|
-
y_axis_min: newMin
|
|
63
|
-
});
|
|
64
|
-
}, [statistic, onChange]);
|
|
65
|
-
var onYAxisMaxChange = useCallback(function (max) {
|
|
66
|
-
var newMax = parseInt(max);
|
|
67
|
-
if (Number.isNaN(newMax)) return;
|
|
68
|
-
var config = statistic.config;
|
|
69
|
-
var y_axis_max = config.y_axis_max;
|
|
70
|
-
if (y_axis_max === newMax) return;
|
|
71
|
-
onChange && onChange({
|
|
72
|
-
y_axis_max: newMax
|
|
73
|
-
});
|
|
74
|
-
}, [statistic, onChange]);
|
|
75
|
-
var onLabelColorChange = useCallback(function (event, color) {
|
|
76
|
-
eventStopPropagation(event);
|
|
77
|
-
var config = statistic.config;
|
|
78
|
-
var y_axis_label_color = config.y_axis_label_color;
|
|
79
|
-
if (y_axis_label_color === color) return;
|
|
80
|
-
onChange && onChange({
|
|
81
|
-
y_axis_label_color: color
|
|
82
|
-
});
|
|
83
|
-
}, [statistic, onChange]);
|
|
84
|
-
var onDisplayValueChange = useCallback(function (update) {
|
|
85
|
-
onChange && onChange(update);
|
|
86
|
-
}, [onChange]);
|
|
87
|
-
var config = statistic.config;
|
|
88
|
-
var x_axis_show_label = config.x_axis_show_label,
|
|
89
|
-
x_axis_label_position = config.x_axis_label_position,
|
|
90
|
-
y_axis_show_label = config.y_axis_show_label,
|
|
91
|
-
y_axis_label_position = config.y_axis_label_position,
|
|
92
|
-
_config$y_axis_auto_r = config.y_axis_auto_range,
|
|
93
|
-
y_axis_auto_range = _config$y_axis_auto_r === void 0 ? true : _config$y_axis_auto_r,
|
|
94
|
-
y_axis_min = config.y_axis_min,
|
|
95
|
-
y_axis_max = config.y_axis_max,
|
|
96
|
-
y_axis_show_value = config.y_axis_show_value,
|
|
97
|
-
label_font_size = config.label_font_size,
|
|
98
|
-
y_axis_label_color = config.y_axis_label_color;
|
|
99
|
-
var xAxisLabelPosition = xAxisLabelOptions.find(function (option) {
|
|
100
|
-
return option.value === x_axis_label_position;
|
|
101
|
-
}) || xAxisLabelOptions[0];
|
|
102
|
-
var yAxisLabelPosition = yAxisLabelOptions.find(function (option) {
|
|
103
|
-
return option.value === y_axis_label_position;
|
|
104
|
-
}) || yAxisLabelOptions[0];
|
|
105
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormGroup, {
|
|
106
|
-
className: "seastatistic-parameter-item"
|
|
107
|
-
}, /*#__PURE__*/React.createElement(Label, null, intl.get(xLabel)), /*#__PURE__*/React.createElement(Switch, {
|
|
108
|
-
key: "x_axis_show_label",
|
|
109
|
-
checked: x_axis_show_label || false,
|
|
110
|
-
placeholder: intl.get('Display_title'),
|
|
111
|
-
onChange: function onChange(event) {
|
|
112
|
-
return onAxisLabelShowChange(event, 'x_axis_show_label');
|
|
113
|
-
}
|
|
114
|
-
}), x_axis_show_label && /*#__PURE__*/React.createElement(DTableSelect, {
|
|
115
|
-
value: xAxisLabelPosition,
|
|
116
|
-
options: xAxisLabelOptions,
|
|
117
|
-
onChange: function onChange(option) {
|
|
118
|
-
return onAxisLabelPositionChange(option, 'x_axis_label_position');
|
|
119
|
-
}
|
|
120
|
-
})), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(FormGroup, {
|
|
121
|
-
className: "seastatistic-parameter-item"
|
|
122
|
-
}, /*#__PURE__*/React.createElement(Label, null, intl.get(yLabel)), /*#__PURE__*/React.createElement(Switch, {
|
|
123
|
-
key: "y_axis_show_label",
|
|
124
|
-
checked: y_axis_show_label || false,
|
|
125
|
-
placeholder: intl.get('Display_title'),
|
|
126
|
-
onChange: function onChange(event) {
|
|
127
|
-
return onAxisLabelShowChange(event, 'y_axis_show_label');
|
|
128
|
-
}
|
|
129
|
-
}), y_axis_show_label && /*#__PURE__*/React.createElement("div", {
|
|
130
|
-
className: "seastatistic-parameter-container"
|
|
131
|
-
}, /*#__PURE__*/React.createElement(DTableSelect, {
|
|
132
|
-
value: yAxisLabelPosition,
|
|
133
|
-
classNamePrefix: "chart-y-axis-label-position",
|
|
134
|
-
options: yAxisLabelOptions,
|
|
135
|
-
onChange: function onChange(option) {
|
|
136
|
-
return onAxisLabelPositionChange(option, 'y_axis_label_position');
|
|
137
|
-
}
|
|
138
|
-
})), /*#__PURE__*/React.createElement(Switch, {
|
|
139
|
-
key: "y_axis_auto_range",
|
|
140
|
-
checked: y_axis_auto_range,
|
|
141
|
-
placeholder: intl.get('Auto_range'),
|
|
142
|
-
onChange: onYAxisAutoRangeChange
|
|
143
|
-
}), !y_axis_auto_range && /*#__PURE__*/React.createElement(MinMaxSetting, {
|
|
144
|
-
min: y_axis_min,
|
|
145
|
-
max: y_axis_max,
|
|
146
|
-
onMinChange: onYAxisMinChange,
|
|
147
|
-
onMaxChange: onYAxisMaxChange
|
|
148
|
-
})), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(LabelColor, {
|
|
149
|
-
labelColor: y_axis_label_color,
|
|
150
|
-
onChange: onLabelColorChange
|
|
151
|
-
}), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(DisplayValuesSettings, {
|
|
152
|
-
isShowValueKey: "y_axis_show_value",
|
|
153
|
-
isShowValue: y_axis_show_value,
|
|
154
|
-
fontSizeKey: "label_font_size",
|
|
155
|
-
fontSize: label_font_size,
|
|
156
|
-
onChange: onDisplayValueChange
|
|
157
|
-
}));
|
|
158
|
-
};
|
|
159
|
-
StyleSettings.defaultProps = {
|
|
160
|
-
xLabel: 'X_axis',
|
|
161
|
-
yLabel: 'Y_axis'
|
|
162
|
-
};
|
|
163
|
-
export default StyleSettings;
|