sea-chart 1.1.82 → 1.1.84
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/settings/index.js +9 -4
- package/dist/settings/table-element-settings/components/data-filter.js +6 -2
- package/dist/settings/widgets/data-filter/index.js +6 -2
- package/dist/utils/contexts.js +4 -1
- package/dist/view/wrapper/chart-component.js +12 -4
- package/dist/view/wrapper/horizontal-bar.js +2 -3
- package/dist/view/wrapper/scatter.js +0 -11
- package/package.json +1 -1
package/dist/settings/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import React, { useCallback, useMemo, useState, useEffect } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import intl from '../intl';
|
|
5
|
-
import { settingsContext, DepartmentsContext, GlobalThemeContext } from '../utils/contexts';
|
|
5
|
+
import { settingsContext, DepartmentsContext, GlobalThemeContext, FirstDayOfWeekContext } from '../utils/contexts';
|
|
6
6
|
import { eventStopPropagation } from '../utils';
|
|
7
7
|
import { BaseUtils } from '../utils';
|
|
8
8
|
import { CHART_SETTINGS_TYPE, CHART_SETTINGS } from '../constants';
|
|
@@ -22,7 +22,8 @@ const Settings = _ref => {
|
|
|
22
22
|
children,
|
|
23
23
|
departments,
|
|
24
24
|
globalTheme,
|
|
25
|
-
lang
|
|
25
|
+
lang,
|
|
26
|
+
firstDayOfWeek
|
|
26
27
|
} = _ref;
|
|
27
28
|
const [type, setType] = useState(CHART_SETTINGS_TYPE.DATA);
|
|
28
29
|
const [labelColorConfigs, setLabelColorConfigs] = useState([]);
|
|
@@ -100,7 +101,11 @@ const Settings = _ref => {
|
|
|
100
101
|
}, /*#__PURE__*/React.createElement("div", {
|
|
101
102
|
id: "sea-chart-settings-content",
|
|
102
103
|
className: "chart-settings-content"
|
|
103
|
-
}, type === CHART_SETTINGS_TYPE.DATA && /*#__PURE__*/React.createElement(
|
|
104
|
+
}, type === CHART_SETTINGS_TYPE.DATA && /*#__PURE__*/React.createElement(FirstDayOfWeekContext.Provider, {
|
|
105
|
+
value: {
|
|
106
|
+
firstDayOfWeek
|
|
107
|
+
}
|
|
108
|
+
}, /*#__PURE__*/React.createElement(DepartmentsContext.Provider, {
|
|
104
109
|
value: {
|
|
105
110
|
departments
|
|
106
111
|
}
|
|
@@ -109,7 +114,7 @@ const Settings = _ref => {
|
|
|
109
114
|
chart: chart,
|
|
110
115
|
tables: tables,
|
|
111
116
|
onChange: modifyStatistic
|
|
112
|
-
})), type === CHART_SETTINGS_TYPE.CHART_STYLE && /*#__PURE__*/React.createElement(StyleSettings, {
|
|
117
|
+
}))), type === CHART_SETTINGS_TYPE.CHART_STYLE && /*#__PURE__*/React.createElement(StyleSettings, {
|
|
113
118
|
chart: chart,
|
|
114
119
|
tables: tables,
|
|
115
120
|
labelColorConfigs: labelColorConfigs,
|
|
@@ -4,7 +4,7 @@ import { getTableById } from 'dtable-utils';
|
|
|
4
4
|
import { eventStopPropagation, generatorKey } from '../../../utils';
|
|
5
5
|
import intl from '../../../intl';
|
|
6
6
|
import context from '../../../context';
|
|
7
|
-
import { DepartmentsContext } from '../../../utils/contexts';
|
|
7
|
+
import { DepartmentsContext, FirstDayOfWeekContext } from '../../../utils/contexts';
|
|
8
8
|
import { CHART_TYPE } from '../../../constants';
|
|
9
9
|
import './data-filter.css';
|
|
10
10
|
const DataFilter = _ref => {
|
|
@@ -18,6 +18,9 @@ const DataFilter = _ref => {
|
|
|
18
18
|
const {
|
|
19
19
|
departments
|
|
20
20
|
} = useContext(DepartmentsContext);
|
|
21
|
+
const {
|
|
22
|
+
firstDayOfWeek
|
|
23
|
+
} = useContext(FirstDayOfWeekContext);
|
|
21
24
|
const {
|
|
22
25
|
config
|
|
23
26
|
} = chart;
|
|
@@ -83,7 +86,8 @@ const DataFilter = _ref => {
|
|
|
83
86
|
departments: departments,
|
|
84
87
|
collaborators: collaborators,
|
|
85
88
|
hidePopover: toggleFilterPopover,
|
|
86
|
-
update: updateFilters
|
|
89
|
+
update: updateFilters,
|
|
90
|
+
firstDayOfWeek: firstDayOfWeek
|
|
87
91
|
})));
|
|
88
92
|
};
|
|
89
93
|
export default DataFilter;
|
|
@@ -5,7 +5,7 @@ import { getTableById } from 'dtable-utils';
|
|
|
5
5
|
import { eventStopPropagation, generatorKey } from '../../../utils';
|
|
6
6
|
import intl from '../../../intl';
|
|
7
7
|
import context from '../../../context';
|
|
8
|
-
import { DepartmentsContext } from '../../../utils/contexts';
|
|
8
|
+
import { DepartmentsContext, FirstDayOfWeekContext } from '../../../utils/contexts';
|
|
9
9
|
import './index.css';
|
|
10
10
|
const DataFilter = _ref => {
|
|
11
11
|
let {
|
|
@@ -17,6 +17,9 @@ const DataFilter = _ref => {
|
|
|
17
17
|
const {
|
|
18
18
|
departments
|
|
19
19
|
} = useContext(DepartmentsContext);
|
|
20
|
+
const {
|
|
21
|
+
firstDayOfWeek
|
|
22
|
+
} = useContext(FirstDayOfWeekContext);
|
|
20
23
|
const toggleFilterPopover = useCallback(event => {
|
|
21
24
|
eventStopPropagation(event);
|
|
22
25
|
setIsFilterSetterShow(!isFilterSetterShow);
|
|
@@ -84,7 +87,8 @@ const DataFilter = _ref => {
|
|
|
84
87
|
departments: departments,
|
|
85
88
|
collaborators: collaborators,
|
|
86
89
|
hidePopover: toggleFilterPopover,
|
|
87
|
-
update: updateFilters
|
|
90
|
+
update: updateFilters,
|
|
91
|
+
firstDayOfWeek: firstDayOfWeek
|
|
88
92
|
}))) : /*#__PURE__*/React.createElement("div", {
|
|
89
93
|
id: id,
|
|
90
94
|
className: "sea-chart-data-filter disabled"
|
package/dist/utils/contexts.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export const settingsContext = React.createContext('');
|
|
3
3
|
export const DepartmentsContext = React.createContext([]);
|
|
4
|
-
export const GlobalThemeContext = React.createContext({});
|
|
4
|
+
export const GlobalThemeContext = React.createContext({});
|
|
5
|
+
export const FirstDayOfWeekContext = React.createContext({
|
|
6
|
+
firstDayOfWeek: 'Sunday'
|
|
7
|
+
});
|
|
@@ -257,7 +257,8 @@ export default class ChartComponent extends Component {
|
|
|
257
257
|
const div = document.createElement('div');
|
|
258
258
|
div.id = yAxisID;
|
|
259
259
|
div.className = 'chart-axis-label';
|
|
260
|
-
|
|
260
|
+
// SCATTER always has y_axis_column_key
|
|
261
|
+
if (y_axis_summary_type === CHART_SUMMARY_TYPE.COUNT && type !== CHART_TYPE.SCATTER) {
|
|
261
262
|
div.innerHTML = intl.get('Amount');
|
|
262
263
|
} else {
|
|
263
264
|
const column = getTableColumnByKey(table, y_axis_column_key) || {};
|
|
@@ -297,7 +298,8 @@ export default class ChartComponent extends Component {
|
|
|
297
298
|
y_axis_auto_range,
|
|
298
299
|
y_axis_min,
|
|
299
300
|
y_axis_max,
|
|
300
|
-
y_axis_summary_method
|
|
301
|
+
y_axis_summary_method,
|
|
302
|
+
type
|
|
301
303
|
} = config;
|
|
302
304
|
if (summaryColumn) {
|
|
303
305
|
valueScaleOptions['formatter'] = value => {
|
|
@@ -316,12 +318,18 @@ export default class ChartComponent extends Component {
|
|
|
316
318
|
// filter the data
|
|
317
319
|
_this.chart.filterData(data);
|
|
318
320
|
}
|
|
319
|
-
|
|
321
|
+
const scaleConfig = {
|
|
320
322
|
name: {
|
|
321
323
|
type: 'cat'
|
|
322
324
|
},
|
|
323
325
|
value: valueScaleOptions
|
|
324
|
-
}
|
|
326
|
+
};
|
|
327
|
+
// scatter chart need to set name as linear type,otherwise point will be displayed ramdomly
|
|
328
|
+
if (type === CHART_TYPE.SCATTER) {
|
|
329
|
+
scaleConfig.name.type = 'linear';
|
|
330
|
+
scaleConfig.value.nice = true;
|
|
331
|
+
}
|
|
332
|
+
_this.chart.scale(scaleConfig);
|
|
325
333
|
};
|
|
326
334
|
// set axis label and tooltip
|
|
327
335
|
this.setNameLabelAndTooltip = function () {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import {
|
|
4
|
+
import { TYPE_COLOR_USING, CHART_STYLE_COLORS, CHART_THEME_COLOR } from '../../constants';
|
|
5
5
|
import { BaseUtils, isFunction } from '../../utils';
|
|
6
6
|
import { getLabelColor, getConvertedColorRules } from '../../utils/color-utils';
|
|
7
7
|
import intl from '../../intl';
|
|
@@ -16,7 +16,7 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
16
16
|
const {
|
|
17
17
|
display_data
|
|
18
18
|
} = chart.config;
|
|
19
|
-
const appendPadding = [0, display_data ?
|
|
19
|
+
const appendPadding = [0, display_data ? 30 : 0, 0, 0]; // used to display value on the right
|
|
20
20
|
this.initChart(this.container, {
|
|
21
21
|
appendPadding
|
|
22
22
|
});
|
|
@@ -54,7 +54,6 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
54
54
|
const theme = CHART_THEME_COLOR[globalTheme];
|
|
55
55
|
const {
|
|
56
56
|
table_id,
|
|
57
|
-
horizontal_axis_summary_type,
|
|
58
57
|
horizontal_axis_summary_method,
|
|
59
58
|
y_axis_summary_type,
|
|
60
59
|
y_axis_column_key,
|
|
@@ -66,17 +66,6 @@ export function Scatter(_ref) {
|
|
|
66
66
|
currentChart.chart.coordinate('rect');
|
|
67
67
|
currentChart.autoAdjustDataOptions(chart, data);
|
|
68
68
|
|
|
69
|
-
// scatter chart need to set name as linear type,otherwise point will be ramdomly
|
|
70
|
-
currentChart.chart.scale({
|
|
71
|
-
name: {
|
|
72
|
-
type: 'linear',
|
|
73
|
-
nice: true
|
|
74
|
-
},
|
|
75
|
-
value: {
|
|
76
|
-
nice: true
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
|
|
80
69
|
// tooltip template
|
|
81
70
|
currentChart.chart.tooltip({
|
|
82
71
|
showTitle: false,
|