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
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import React, { useCallback, useMemo } from 'react';
|
|
2
|
+
import { Label, FormGroup } from 'reactstrap';
|
|
3
|
+
import DTableSelect from "dtable-ui-component/lib/DTableSelect";
|
|
4
|
+
import Switch from '../widgets/switch';
|
|
5
|
+
import Divider from '../widgets/divider';
|
|
6
|
+
import MinMaxSetting from '../widgets/min-max-setting';
|
|
7
|
+
import DisplayValuesSettings from '../widgets/display-values-settings';
|
|
8
|
+
import { eventStopPropagation } from '../../utils';
|
|
9
|
+
import { X_LABEL_POSITIONS, Y_LABEL_POSITIONS, LABEL_POSITION_TYPE_SHOW } from '../../constants';
|
|
10
|
+
import intl from '../../intl';
|
|
11
|
+
const StyleSettings = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
chart,
|
|
14
|
+
onChange,
|
|
15
|
+
xLabel
|
|
16
|
+
} = _ref;
|
|
17
|
+
const xAxisLabelOptions = useMemo(() => {
|
|
18
|
+
return X_LABEL_POSITIONS.map(item => {
|
|
19
|
+
return {
|
|
20
|
+
value: item,
|
|
21
|
+
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
}, []);
|
|
25
|
+
const yAxisLabelOptions = useMemo(() => {
|
|
26
|
+
return Y_LABEL_POSITIONS.map(item => {
|
|
27
|
+
return {
|
|
28
|
+
value: item,
|
|
29
|
+
label: intl.get(LABEL_POSITION_TYPE_SHOW[item])
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
}, []);
|
|
33
|
+
const onAxisLabelShowChange = useCallback((event, labelKey) => {
|
|
34
|
+
eventStopPropagation(event);
|
|
35
|
+
const {
|
|
36
|
+
config
|
|
37
|
+
} = chart;
|
|
38
|
+
const value = config[labelKey];
|
|
39
|
+
onChange && onChange({
|
|
40
|
+
[labelKey]: !value
|
|
41
|
+
});
|
|
42
|
+
}, [chart, onChange]);
|
|
43
|
+
const onAxisLabelPositionChange = useCallback((option, positionKey) => {
|
|
44
|
+
const position = option.value;
|
|
45
|
+
const {
|
|
46
|
+
config
|
|
47
|
+
} = chart;
|
|
48
|
+
const oldValue = config[positionKey];
|
|
49
|
+
if (position === oldValue) return;
|
|
50
|
+
onChange && onChange({
|
|
51
|
+
[positionKey]: position
|
|
52
|
+
});
|
|
53
|
+
}, [chart, onChange]);
|
|
54
|
+
const onToggleYAxisAutoRange = useCallback(key => {
|
|
55
|
+
const {
|
|
56
|
+
config
|
|
57
|
+
} = chart;
|
|
58
|
+
const update = {
|
|
59
|
+
[key]: config[key] === undefined ? false : !config[key]
|
|
60
|
+
};
|
|
61
|
+
onChange && onChange(update);
|
|
62
|
+
}, [chart, onChange]);
|
|
63
|
+
const onYAxisMinChange = useCallback((key, min) => {
|
|
64
|
+
const newMin = parseInt(min);
|
|
65
|
+
if (Number.isNaN(newMin)) return;
|
|
66
|
+
const update = {
|
|
67
|
+
[key]: newMin
|
|
68
|
+
};
|
|
69
|
+
onChange && onChange(update);
|
|
70
|
+
}, [onChange]);
|
|
71
|
+
const onYAxisMaxChange = useCallback((key, max) => {
|
|
72
|
+
const newMax = parseInt(max);
|
|
73
|
+
if (Number.isNaN(newMax)) return;
|
|
74
|
+
const update = {
|
|
75
|
+
[key]: newMax
|
|
76
|
+
};
|
|
77
|
+
onChange && onChange(update);
|
|
78
|
+
}, [onChange]);
|
|
79
|
+
const onDisplayValueChange = useCallback(update => {
|
|
80
|
+
onChange && onChange(update);
|
|
81
|
+
}, [onChange]);
|
|
82
|
+
const {
|
|
83
|
+
config
|
|
84
|
+
} = chart;
|
|
85
|
+
const {
|
|
86
|
+
x_axis_show_label,
|
|
87
|
+
x_axis_label_position,
|
|
88
|
+
show_y_axis_left_label,
|
|
89
|
+
y_axis_left_label_position,
|
|
90
|
+
y_axis_right_label_position,
|
|
91
|
+
show_y_axis_right_label,
|
|
92
|
+
y_axis_min_left,
|
|
93
|
+
y_axis_auto_range_left,
|
|
94
|
+
y_axis_max_left,
|
|
95
|
+
y_axis_auto_range_right,
|
|
96
|
+
y_axis_min_right,
|
|
97
|
+
y_axis_max_right,
|
|
98
|
+
display_data,
|
|
99
|
+
label_font_size
|
|
100
|
+
} = config;
|
|
101
|
+
const xAxisLabelPosition = xAxisLabelOptions.find(option => option.value === x_axis_label_position) || xAxisLabelOptions[0];
|
|
102
|
+
const yLeftAxisLabelPosition = yAxisLabelOptions.find(option => option.value === y_axis_left_label_position) || yAxisLabelOptions[0];
|
|
103
|
+
const yRightAxisLabelPosition = yAxisLabelOptions.find(option => option.value === y_axis_right_label_position) || yAxisLabelOptions[0];
|
|
104
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormGroup, {
|
|
105
|
+
className: "sea-chart-parameter-item"
|
|
106
|
+
}, /*#__PURE__*/React.createElement(Label, null, intl.get(xLabel)), /*#__PURE__*/React.createElement(Switch, {
|
|
107
|
+
key: "x_axis_show_label",
|
|
108
|
+
checked: x_axis_show_label || false,
|
|
109
|
+
placeholder: intl.get('Display_title'),
|
|
110
|
+
onChange: event => onAxisLabelShowChange(event, 'x_axis_show_label')
|
|
111
|
+
}), x_axis_show_label && /*#__PURE__*/React.createElement(DTableSelect, {
|
|
112
|
+
value: xAxisLabelPosition,
|
|
113
|
+
options: xAxisLabelOptions,
|
|
114
|
+
onChange: option => onAxisLabelPositionChange(option, 'x_axis_label_position')
|
|
115
|
+
})), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(FormGroup, {
|
|
116
|
+
className: "sea-chart-parameter-item"
|
|
117
|
+
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Y-axis(left side)')), /*#__PURE__*/React.createElement(Switch, {
|
|
118
|
+
key: "show_y_axis_left_label",
|
|
119
|
+
checked: show_y_axis_left_label || false,
|
|
120
|
+
placeholder: intl.get('Display_title'),
|
|
121
|
+
onChange: event => onAxisLabelShowChange(event, 'show_y_axis_left_label')
|
|
122
|
+
}), show_y_axis_left_label && /*#__PURE__*/React.createElement("div", {
|
|
123
|
+
className: "sea-chart-parameter-container"
|
|
124
|
+
}, /*#__PURE__*/React.createElement(DTableSelect, {
|
|
125
|
+
value: yLeftAxisLabelPosition,
|
|
126
|
+
classNamePrefix: "chart-y-axis-label-position",
|
|
127
|
+
options: yAxisLabelOptions,
|
|
128
|
+
onChange: option => onAxisLabelPositionChange(option, 'y_axis_left_label_position')
|
|
129
|
+
})), /*#__PURE__*/React.createElement(Switch, {
|
|
130
|
+
key: "y_axis_auto_range_left",
|
|
131
|
+
checked: y_axis_auto_range_left,
|
|
132
|
+
placeholder: intl.get('Auto_range'),
|
|
133
|
+
onChange: () => onToggleYAxisAutoRange('y_axis_auto_range_left')
|
|
134
|
+
}), !y_axis_auto_range_left && /*#__PURE__*/React.createElement(MinMaxSetting, {
|
|
135
|
+
min: y_axis_min_left,
|
|
136
|
+
max: y_axis_max_left,
|
|
137
|
+
onMinChange: value => onYAxisMinChange('y_axis_min_left', value),
|
|
138
|
+
onMaxChange: value => onYAxisMaxChange('y_axis_max_left', value)
|
|
139
|
+
})), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(FormGroup, {
|
|
140
|
+
className: "sea-chart-parameter-item"
|
|
141
|
+
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Y-axis(right side)')), /*#__PURE__*/React.createElement(Switch, {
|
|
142
|
+
key: "show_y_axis_right_label",
|
|
143
|
+
checked: show_y_axis_right_label || false,
|
|
144
|
+
placeholder: intl.get('Display_title'),
|
|
145
|
+
onChange: event => onAxisLabelShowChange(event, 'show_y_axis_right_label')
|
|
146
|
+
}), show_y_axis_right_label && /*#__PURE__*/React.createElement("div", {
|
|
147
|
+
className: "sea-chart-parameter-container"
|
|
148
|
+
}, /*#__PURE__*/React.createElement(DTableSelect, {
|
|
149
|
+
value: yRightAxisLabelPosition,
|
|
150
|
+
classNamePrefix: "chart-y-axis-label-position",
|
|
151
|
+
options: yAxisLabelOptions,
|
|
152
|
+
onChange: option => onAxisLabelPositionChange(option, 'y_axis_right_label_position')
|
|
153
|
+
})), /*#__PURE__*/React.createElement(Switch, {
|
|
154
|
+
key: "y_axis_auto_range_right",
|
|
155
|
+
checked: y_axis_auto_range_right,
|
|
156
|
+
placeholder: intl.get('Auto_range'),
|
|
157
|
+
onChange: () => onToggleYAxisAutoRange('y_axis_auto_range_right')
|
|
158
|
+
}), !y_axis_auto_range_right && /*#__PURE__*/React.createElement(MinMaxSetting, {
|
|
159
|
+
min: y_axis_min_right,
|
|
160
|
+
max: y_axis_max_right,
|
|
161
|
+
onMinChange: value => onYAxisMinChange('y_axis_min_right', value),
|
|
162
|
+
onMaxChange: value => onYAxisMaxChange('y_axis_max_right', value)
|
|
163
|
+
})), /*#__PURE__*/React.createElement(DisplayValuesSettings, {
|
|
164
|
+
isShowValueKey: "display_data",
|
|
165
|
+
isShowValue: display_data,
|
|
166
|
+
fontSizeKey: "label_font_size",
|
|
167
|
+
fontSize: label_font_size,
|
|
168
|
+
onChange: onDisplayValueChange
|
|
169
|
+
}));
|
|
170
|
+
};
|
|
171
|
+
StyleSettings.defaultProps = {
|
|
172
|
+
xLabel: 'X_axis'
|
|
173
|
+
};
|
|
174
|
+
export default StyleSettings;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import React, { Fragment, useCallback, useMemo } from 'react';
|
|
2
|
+
import { FormGroup } from 'reactstrap';
|
|
3
|
+
import { COLUMNS_ICON_CONFIG, getTableById } from 'dtable-utils';
|
|
4
|
+
import DTableSelect from "dtable-ui-component/lib/DTableSelect";
|
|
5
|
+
import CommonDataSettings from '../widgets/common-data-settings';
|
|
6
|
+
import { ChartUtils } from '../../utils';
|
|
7
|
+
import { CHART_SUMMARY_SHOW, CHART_SUMMARY_CALCULATION_METHOD, CHART_SUPPORT_COLUMNS, BASIC_NUMBER_CARD_CALCULATION_METHOD } from '../../constants';
|
|
8
|
+
import intl from '../../intl';
|
|
9
|
+
const DataSettings = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
tables,
|
|
12
|
+
chart,
|
|
13
|
+
onChange
|
|
14
|
+
} = _ref;
|
|
15
|
+
const summaryMethodsOptions = useMemo(() => {
|
|
16
|
+
const numberCardSummaryMethod = [BASIC_NUMBER_CARD_CALCULATION_METHOD, ...CHART_SUMMARY_CALCULATION_METHOD];
|
|
17
|
+
return numberCardSummaryMethod.map(method => {
|
|
18
|
+
return {
|
|
19
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
20
|
+
className: "select-option-name"
|
|
21
|
+
}, intl.get(CHART_SUMMARY_SHOW[method])),
|
|
22
|
+
value: method
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
}, []);
|
|
26
|
+
const selectedTable = useMemo(() => {
|
|
27
|
+
const {
|
|
28
|
+
table_id: selectedTableId
|
|
29
|
+
} = chart.config;
|
|
30
|
+
return getTableById(tables, selectedTableId);
|
|
31
|
+
}, [chart.config, tables]);
|
|
32
|
+
const validColumns = useMemo(() => {
|
|
33
|
+
const columns = selectedTable && Array.isArray(selectedTable.columns) ? selectedTable.columns : [];
|
|
34
|
+
if (!columns || !Array.isArray(columns)) return [];
|
|
35
|
+
return columns.filter(column => CHART_SUPPORT_COLUMNS.includes(column.type));
|
|
36
|
+
}, [selectedTable]);
|
|
37
|
+
const numericColumns = useMemo(() => {
|
|
38
|
+
return validColumns.filter(column => ChartUtils.isNumericSummaryColumn(column));
|
|
39
|
+
}, [validColumns]);
|
|
40
|
+
const numericColumnOptions = useMemo(() => {
|
|
41
|
+
const options = numericColumns.map(column => {
|
|
42
|
+
return {
|
|
43
|
+
value: column,
|
|
44
|
+
label: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
45
|
+
className: "sea-chart-column-icon"
|
|
46
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
47
|
+
className: COLUMNS_ICON_CONFIG[column.type]
|
|
48
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
49
|
+
className: 'select-module select-module-name ml-0'
|
|
50
|
+
}, column.name))
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
return [{
|
|
54
|
+
value: {
|
|
55
|
+
key: 'Groupby_null'
|
|
56
|
+
},
|
|
57
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
58
|
+
className: 'select-module select-module-name null-option-name ml-0'
|
|
59
|
+
}, intl.get('Select_a_column')),
|
|
60
|
+
style: {
|
|
61
|
+
color: 'rgba(0, 0, 0, .25)'
|
|
62
|
+
}
|
|
63
|
+
}, ...options];
|
|
64
|
+
}, [numericColumns]);
|
|
65
|
+
const onSelectTargetValueColumn = useCallback(option => {
|
|
66
|
+
const {
|
|
67
|
+
config
|
|
68
|
+
} = chart;
|
|
69
|
+
const {
|
|
70
|
+
target_value_column_key
|
|
71
|
+
} = config;
|
|
72
|
+
const newColumnKey = option.value.key;
|
|
73
|
+
if (target_value_column_key === newColumnKey) return;
|
|
74
|
+
onChange && onChange({
|
|
75
|
+
target_value_column_key: newColumnKey
|
|
76
|
+
});
|
|
77
|
+
}, [chart, onChange]);
|
|
78
|
+
const onSelectTotalValueColumn = useCallback(option => {
|
|
79
|
+
const {
|
|
80
|
+
config
|
|
81
|
+
} = chart;
|
|
82
|
+
const {
|
|
83
|
+
total_value_column_key
|
|
84
|
+
} = config;
|
|
85
|
+
const newColumnKey = option.value.key;
|
|
86
|
+
if (total_value_column_key === newColumnKey) return;
|
|
87
|
+
onChange && onChange({
|
|
88
|
+
total_value_column_key: newColumnKey
|
|
89
|
+
});
|
|
90
|
+
}, [chart, onChange]);
|
|
91
|
+
const getSelectedMethodOption = useCallback((method, summaryMethodsOptions) => {
|
|
92
|
+
return summaryMethodsOptions.find(m => m.value === method) || summaryMethodsOptions[0];
|
|
93
|
+
}, []);
|
|
94
|
+
const onSelectTargetValueColumnSummaryMethod = useCallback(option => {
|
|
95
|
+
const {
|
|
96
|
+
config
|
|
97
|
+
} = chart;
|
|
98
|
+
const {
|
|
99
|
+
target_value_column_summary_method
|
|
100
|
+
} = config;
|
|
101
|
+
const newSummaryMethod = option.value;
|
|
102
|
+
if (target_value_column_summary_method === newSummaryMethod) return;
|
|
103
|
+
onChange && onChange({
|
|
104
|
+
target_value_column_summary_method: newSummaryMethod
|
|
105
|
+
});
|
|
106
|
+
}, [chart, onChange]);
|
|
107
|
+
const onSelectTotalValueColumnSummaryMethod = useCallback(option => {
|
|
108
|
+
const {
|
|
109
|
+
config
|
|
110
|
+
} = chart;
|
|
111
|
+
const {
|
|
112
|
+
total_value_column_summary_method
|
|
113
|
+
} = config;
|
|
114
|
+
const newSummaryMethod = option.value;
|
|
115
|
+
if (total_value_column_summary_method === newSummaryMethod) return;
|
|
116
|
+
onChange && onChange({
|
|
117
|
+
total_value_column_summary_method: newSummaryMethod
|
|
118
|
+
});
|
|
119
|
+
}, [chart, onChange]);
|
|
120
|
+
const renderSummaryMethod = useCallback(option => {
|
|
121
|
+
const {
|
|
122
|
+
config
|
|
123
|
+
} = chart;
|
|
124
|
+
const {
|
|
125
|
+
target_value_column_summary_method,
|
|
126
|
+
total_value_column_summary_method
|
|
127
|
+
} = config;
|
|
128
|
+
let summary_method, onSelectSummaryMethod;
|
|
129
|
+
if (option.targetColumn === 'target_value_column') {
|
|
130
|
+
summary_method = target_value_column_summary_method;
|
|
131
|
+
onSelectSummaryMethod = onSelectTargetValueColumnSummaryMethod;
|
|
132
|
+
} else {
|
|
133
|
+
summary_method = total_value_column_summary_method;
|
|
134
|
+
onSelectSummaryMethod = onSelectTotalValueColumnSummaryMethod;
|
|
135
|
+
}
|
|
136
|
+
const selectedMethodOption = getSelectedMethodOption(summary_method, summaryMethodsOptions);
|
|
137
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
138
|
+
className: "dtable-plugin-stat-parameter-item"
|
|
139
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Summary_method')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
140
|
+
value: selectedMethodOption,
|
|
141
|
+
onChange: onSelectSummaryMethod,
|
|
142
|
+
options: summaryMethodsOptions
|
|
143
|
+
}));
|
|
144
|
+
}, [chart, summaryMethodsOptions, getSelectedMethodOption, onSelectTargetValueColumnSummaryMethod, onSelectTotalValueColumnSummaryMethod]);
|
|
145
|
+
const {
|
|
146
|
+
target_value_column_key,
|
|
147
|
+
total_value_column_key
|
|
148
|
+
} = chart.config;
|
|
149
|
+
const selectedTargetValueColumnOption = numericColumnOptions.filter(option => option.value.key === target_value_column_key)[0];
|
|
150
|
+
const selectedTotalValueColumnOption = numericColumnOptions.filter(option => option.value.key === total_value_column_key)[0];
|
|
151
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(CommonDataSettings, {
|
|
152
|
+
chart: chart,
|
|
153
|
+
tables: tables,
|
|
154
|
+
onChange: onChange
|
|
155
|
+
}), /*#__PURE__*/React.createElement(FormGroup, {
|
|
156
|
+
className: "sea-chart-parameter-item"
|
|
157
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Current_value_field')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
158
|
+
value: selectedTargetValueColumnOption,
|
|
159
|
+
options: numericColumnOptions,
|
|
160
|
+
placeholder: intl.get('Select_a_column'),
|
|
161
|
+
onChange: onSelectTargetValueColumn
|
|
162
|
+
})), /*#__PURE__*/React.createElement(FormGroup, {
|
|
163
|
+
className: "sea-chart-parameter-item"
|
|
164
|
+
}, renderSummaryMethod({
|
|
165
|
+
targetColumn: 'target_value_column'
|
|
166
|
+
})), /*#__PURE__*/React.createElement(FormGroup, {
|
|
167
|
+
className: "sea-chart-parameter-item"
|
|
168
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Total_value_field')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
169
|
+
value: selectedTotalValueColumnOption,
|
|
170
|
+
options: numericColumnOptions,
|
|
171
|
+
placeholder: intl.get('Select_a_column'),
|
|
172
|
+
onChange: onSelectTotalValueColumn
|
|
173
|
+
})), /*#__PURE__*/React.createElement(FormGroup, {
|
|
174
|
+
className: "sea-chart-parameter-item"
|
|
175
|
+
}, renderSummaryMethod({
|
|
176
|
+
targetColumn: 'total_value_column'
|
|
177
|
+
})));
|
|
178
|
+
};
|
|
179
|
+
export default DataSettings;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { CHART_TYPE } from '../constants';
|
|
3
3
|
import { BarDataSettings } from './bar-settings';
|
|
4
4
|
import { AdvanceBarDataSettings } from './advance-bar-settings';
|
|
5
5
|
import { TimeComparisonDataSettings } from './time-comparison-settings';
|
|
@@ -9,52 +9,58 @@ import { HorizontalDataSettings } from './horizontal-bar-settings';
|
|
|
9
9
|
import { BasicNumberCardDataSettings } from './basic-number-card';
|
|
10
10
|
import { CombinationDataSettings } from './combination-settings';
|
|
11
11
|
import { DashboardDataSettings } from './dashboard-settings';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const DataSettings = props => {
|
|
13
|
+
const {
|
|
14
|
+
chart
|
|
15
|
+
} = props;
|
|
16
|
+
const {
|
|
17
|
+
config
|
|
18
|
+
} = chart;
|
|
19
|
+
const {
|
|
20
|
+
type
|
|
21
|
+
} = config;
|
|
16
22
|
switch (type) {
|
|
17
|
-
case
|
|
18
|
-
case
|
|
19
|
-
case
|
|
23
|
+
case CHART_TYPE.BAR:
|
|
24
|
+
case CHART_TYPE.LINE:
|
|
25
|
+
case CHART_TYPE.AREA:
|
|
20
26
|
{
|
|
21
27
|
return /*#__PURE__*/React.createElement(BarDataSettings, props);
|
|
22
28
|
}
|
|
23
|
-
case
|
|
29
|
+
case CHART_TYPE.COMBINATION:
|
|
24
30
|
{
|
|
25
31
|
return /*#__PURE__*/React.createElement(CombinationDataSettings, props);
|
|
26
32
|
}
|
|
27
|
-
case
|
|
28
|
-
case
|
|
33
|
+
case CHART_TYPE.HORIZONTAL_BAR:
|
|
34
|
+
case CHART_TYPE.HORIZONTAL_GROUP_BAR:
|
|
29
35
|
{
|
|
30
36
|
return /*#__PURE__*/React.createElement(HorizontalDataSettings, props);
|
|
31
37
|
}
|
|
32
|
-
case
|
|
33
|
-
case
|
|
34
|
-
case
|
|
35
|
-
case
|
|
38
|
+
case CHART_TYPE.BAR_GROUP:
|
|
39
|
+
case CHART_TYPE.BAR_STACK:
|
|
40
|
+
case CHART_TYPE.LINE_GROUP:
|
|
41
|
+
case CHART_TYPE.AREA_GROUP:
|
|
36
42
|
{
|
|
37
43
|
return /*#__PURE__*/React.createElement(AdvanceBarDataSettings, props);
|
|
38
44
|
}
|
|
39
|
-
case
|
|
45
|
+
case CHART_TYPE.COMPARE_BAR:
|
|
40
46
|
{
|
|
41
47
|
return /*#__PURE__*/React.createElement(TimeComparisonDataSettings, props);
|
|
42
48
|
}
|
|
43
|
-
case
|
|
44
|
-
case
|
|
45
|
-
case
|
|
49
|
+
case CHART_TYPE.PIE:
|
|
50
|
+
case CHART_TYPE.RING:
|
|
51
|
+
case CHART_TYPE.TREE_MAP:
|
|
46
52
|
{
|
|
47
53
|
return /*#__PURE__*/React.createElement(PieDataSettings, props);
|
|
48
54
|
}
|
|
49
|
-
case
|
|
55
|
+
case CHART_TYPE.BASIC_NUMBER_CARD:
|
|
50
56
|
{
|
|
51
57
|
return /*#__PURE__*/React.createElement(BasicNumberCardDataSettings, props);
|
|
52
58
|
}
|
|
53
|
-
case
|
|
59
|
+
case CHART_TYPE.DASHBOARD:
|
|
54
60
|
{
|
|
55
61
|
return /*#__PURE__*/React.createElement(DashboardDataSettings, props);
|
|
56
62
|
}
|
|
57
|
-
case
|
|
63
|
+
case CHART_TYPE.TABLE:
|
|
58
64
|
{
|
|
59
65
|
return /*#__PURE__*/React.createElement(TableDataSettings, props);
|
|
60
66
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { BarDataSettings } from '../bar-settings';
|
|
3
|
+
import { AdvanceBarDataSettings } from '../advance-bar-settings';
|
|
4
|
+
import { ChartUtils } from '../../utils';
|
|
5
|
+
import { BAR_MAP_TO_HORIZONTAL_MAP, CHART_TYPE } from '../../constants/';
|
|
6
|
+
const DataSettings = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
chart,
|
|
9
|
+
tables,
|
|
10
|
+
onChange: oldOnChange
|
|
11
|
+
} = _ref;
|
|
12
|
+
const onChange = useCallback(update => {
|
|
13
|
+
const {
|
|
14
|
+
config: oldConfig
|
|
15
|
+
} = chart;
|
|
16
|
+
if (update.type && update.type !== oldConfig.type) {
|
|
17
|
+
oldOnChange && oldOnChange(update);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
let updateConfig = {};
|
|
21
|
+
const newConfig = {
|
|
22
|
+
...oldConfig,
|
|
23
|
+
...update
|
|
24
|
+
};
|
|
25
|
+
Object.keys(newConfig).forEach(key => {
|
|
26
|
+
if (BAR_MAP_TO_HORIZONTAL_MAP[key]) {
|
|
27
|
+
updateConfig[BAR_MAP_TO_HORIZONTAL_MAP[key]] = newConfig[key];
|
|
28
|
+
} else {
|
|
29
|
+
updateConfig[key] = newConfig[key];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
oldOnChange && oldOnChange(updateConfig);
|
|
33
|
+
}, [chart, oldOnChange]);
|
|
34
|
+
const {
|
|
35
|
+
config,
|
|
36
|
+
id
|
|
37
|
+
} = chart;
|
|
38
|
+
const newConfig = ChartUtils.convertConfig(config);
|
|
39
|
+
const newChart = {
|
|
40
|
+
id,
|
|
41
|
+
config: newConfig
|
|
42
|
+
};
|
|
43
|
+
const {
|
|
44
|
+
type
|
|
45
|
+
} = config;
|
|
46
|
+
const BarGroupComponent = type === CHART_TYPE.HORIZONTAL_BAR ? BarDataSettings : AdvanceBarDataSettings;
|
|
47
|
+
return /*#__PURE__*/React.createElement(BarGroupComponent, {
|
|
48
|
+
xLabel: 'Vertical_axis',
|
|
49
|
+
yLabel: 'Horizontal_axis',
|
|
50
|
+
chart: newChart,
|
|
51
|
+
tables: tables,
|
|
52
|
+
onChange: onChange
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
export default DataSettings;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { AdvanceBarStyleSettings } from '../advance-bar-settings';
|
|
3
|
+
import { BarStyleSettings } from '../bar-settings';
|
|
4
|
+
import { ChartUtils } from '../../utils';
|
|
5
|
+
import { BAR_MAP_TO_HORIZONTAL_MAP, CHART_TYPE } from '../../constants';
|
|
6
|
+
const StyleSettings = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
chart,
|
|
9
|
+
onChange: oldOnChange
|
|
10
|
+
} = _ref;
|
|
11
|
+
const onChange = useCallback(update => {
|
|
12
|
+
let updateConfig = {};
|
|
13
|
+
const newConfig = {
|
|
14
|
+
...chart.config,
|
|
15
|
+
...update
|
|
16
|
+
};
|
|
17
|
+
Object.keys(newConfig).forEach(key => {
|
|
18
|
+
if (BAR_MAP_TO_HORIZONTAL_MAP[key]) {
|
|
19
|
+
updateConfig[BAR_MAP_TO_HORIZONTAL_MAP[key]] = newConfig[key];
|
|
20
|
+
} else {
|
|
21
|
+
updateConfig[key] = newConfig[key];
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
oldOnChange && oldOnChange(updateConfig);
|
|
25
|
+
}, [chart, oldOnChange]);
|
|
26
|
+
const {
|
|
27
|
+
config,
|
|
28
|
+
id
|
|
29
|
+
} = chart;
|
|
30
|
+
const newConfig = ChartUtils.convertConfig(config);
|
|
31
|
+
const newChart = {
|
|
32
|
+
id,
|
|
33
|
+
config: newConfig
|
|
34
|
+
};
|
|
35
|
+
const {
|
|
36
|
+
type
|
|
37
|
+
} = config;
|
|
38
|
+
const BarStyleComponent = type === CHART_TYPE.HORIZONTAL_BAR ? BarStyleSettings : AdvanceBarStyleSettings;
|
|
39
|
+
return /*#__PURE__*/React.createElement(BarStyleComponent, {
|
|
40
|
+
xLabel: 'Vertical_axis',
|
|
41
|
+
yLabel: 'Horizontal_axis',
|
|
42
|
+
chart: newChart,
|
|
43
|
+
onChange: onChange
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
export default StyleSettings;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
.sea-chart-settings {
|
|
2
|
+
height: 100%;
|
|
3
|
+
width: 100%;
|
|
4
|
+
padding: 0;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.sea-chart-settings .sea-chart-settings-type {
|
|
9
|
+
height: 49px;
|
|
10
|
+
width: 100%;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
border-bottom: 1px solid #e4e4e4;
|
|
15
|
+
background: #fff;
|
|
16
|
+
padding-left: 10px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.sea-chart-settings .sea-chart-settings-type .sea-chart-settings-type-item {
|
|
20
|
+
text-align: center;
|
|
21
|
+
line-height: 48px;
|
|
22
|
+
height: 48px;
|
|
23
|
+
font-weight: 500;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.sea-chart-settings .sea-chart-settings-type .sea-chart-settings-type-item.selected {
|
|
28
|
+
color: #ff8000;
|
|
29
|
+
border-bottom: 2px solid #ff8000;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.sea-chart-settings .chart-settings-container {
|
|
33
|
+
height: calc(100% - 37px);
|
|
34
|
+
overflow-y: scroll;
|
|
35
|
+
padding: 16px 16px 150px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.sea-chart-settings .statistic-add-number-columns {
|
|
39
|
+
color: #bbb;
|
|
40
|
+
line-height: 1;
|
|
41
|
+
margin-bottom: 10px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.sea-chart-settings .statistic-add-number-columns:hover {
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
color: #212529;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.sea-chart-settings .statistic-add-number-columns .dtable-icon-add-table {
|
|
50
|
+
margin-right: 5px;
|
|
51
|
+
display: inline-block;
|
|
52
|
+
transform: scale(.8);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.sea-chart-settings .statistic-add-number-columns .add-number-column-description {
|
|
56
|
+
font-size: 14px;
|
|
57
|
+
line-height: 14px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.sea-chart-settings .delete-numeric-summary-item-content {
|
|
61
|
+
height: 20px;
|
|
62
|
+
width: 20px;
|
|
63
|
+
line-height: 20px;
|
|
64
|
+
font-weight: 400;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.sea-chart-settings .delete-numeric-summary-item-content:hover {
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.sea-chart-settings .delete-numeric-summary-item-content .delete-icon {
|
|
72
|
+
font-size: 14px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.sea-chart-settings .sea-chart-column-icon {
|
|
76
|
+
display: inline-block;
|
|
77
|
+
padding: 0 0.3125rem;
|
|
78
|
+
margin-left: -0.3125rem;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.sea-chart-settings .sea-chart-column-icon .dtable-font {
|
|
82
|
+
font-size: 14px;
|
|
83
|
+
color: #aaa;
|
|
84
|
+
cursor: default;
|
|
85
|
+
}
|