sea-chart 0.0.22 → 0.0.24
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/constants/index.js +2 -1
- package/dist/model/bar-stack.js +1 -1
- package/dist/model/bar.js +1 -1
- package/dist/model/combination.js +1 -1
- package/dist/model/compare-bar.js +1 -1
- package/dist/model/completeness.js +1 -1
- package/dist/model/dashboard.js +1 -1
- package/dist/model/generic-model.js +1 -1
- package/dist/model/heat-map.js +1 -1
- package/dist/model/horizontal-bar.js +1 -1
- package/dist/model/index.js +1 -1
- package/dist/settings/widgets/numeric-summary-item.js +11 -6
- package/dist/utils/chart-utils/base-utils.js +2 -2
- package/dist/utils/chart-utils/sql-statistics-utils.js +3 -2
- package/dist/utils/column-utils.js +3 -3
- package/dist/view/wrapper/area.js +9 -2
- package/dist/view/wrapper/bar-custom.js +9 -2
- package/dist/view/wrapper/bar-group.js +9 -2
- package/dist/view/wrapper/bar.js +16 -10
- package/dist/view/wrapper/chart-component.js +53 -13
- package/dist/view/wrapper/completeness.js +10 -3
- package/dist/view/wrapper/horizontal-bar-group.js +9 -2
- package/dist/view/wrapper/horizontal-bar.js +18 -8
- package/dist/view/wrapper/line-group.js +1 -1
- package/dist/view/wrapper/mirror.js +2 -2
- package/dist/view/wrapper/pie.js +2 -2
- package/dist/view/wrapper/scatter.js +2 -2
- package/package.json +1 -1
package/dist/constants/index.js
CHANGED
|
@@ -171,7 +171,8 @@ export const CHART_THEME_COLOR = {
|
|
|
171
171
|
light: {
|
|
172
172
|
textColor: '#666666',
|
|
173
173
|
fontSize: 13,
|
|
174
|
-
gridColor: '#
|
|
174
|
+
gridColor: '#F3F3F3',
|
|
175
|
+
XAxisColor: '#CCCCCC',
|
|
175
176
|
labelColor: '#999999',
|
|
176
177
|
cardColor: '#545454',
|
|
177
178
|
legendTextColor: '#333333',
|
package/dist/model/bar-stack.js
CHANGED
package/dist/model/bar.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isDateColumn, getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
2
|
-
import BaseModel from './base-model';
|
|
3
2
|
import { isBoolean } from '../utils';
|
|
4
3
|
import { CHART_TYPE } from '../constants';
|
|
4
|
+
import BaseModel from './base-model';
|
|
5
5
|
class CompareBar extends BaseModel {
|
|
6
6
|
constructor(options, tables) {
|
|
7
7
|
super({
|
package/dist/model/dashboard.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isNumber } from 'dtable-utils';
|
|
2
|
-
import BaseModel from './base-model';
|
|
3
2
|
import { isBoolean, getChartConfigValueByKey } from '../utils';
|
|
4
3
|
import { DATE_GRANULATES, DEFAULT_LABEL_FONT_SIZE, GEOLOCATION_GRANULATES, LABEL_POSITION_TYPE, CHART_SUMMARY_TYPE, GENERIC_KEY, CHART_KEY, LEGEND_DIRECTION } from '../constants';
|
|
4
|
+
import BaseModel from './base-model';
|
|
5
5
|
export default class GenericModel extends BaseModel {
|
|
6
6
|
constructor(object) {
|
|
7
7
|
const options = object || {};
|
package/dist/model/heat-map.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isDateColumn, getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
2
|
-
import BaseModel from './base-model';
|
|
3
2
|
import { CHART_TYPE } from '../constants';
|
|
3
|
+
import BaseModel from './base-model';
|
|
4
4
|
class HeatMap extends BaseModel {
|
|
5
5
|
constructor(options, tables) {
|
|
6
6
|
super({
|
package/dist/model/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { CHART_TYPE } from '../constants';
|
|
1
2
|
import ChartModel from './chart';
|
|
2
3
|
import User from './user';
|
|
3
4
|
import GenericModel from './generic-model';
|
|
4
|
-
import { CHART_TYPE } from '../constants';
|
|
5
5
|
import Bar from './bar';
|
|
6
6
|
import BarGroup from './bar-group';
|
|
7
7
|
import BarStack from './bar-stack';
|
|
@@ -36,15 +36,13 @@ class NumericSummaryItem extends Component {
|
|
|
36
36
|
setCurrentSelectedOptions,
|
|
37
37
|
currentAxisesIndex
|
|
38
38
|
} = this.props;
|
|
39
|
-
if (!currentSelectedOptions) {
|
|
40
|
-
currentSelectedOptions = [];
|
|
41
|
-
}
|
|
42
39
|
let selectedColumnOption;
|
|
43
|
-
const availableOptions = numericColumnOptions.filter(option => {
|
|
40
|
+
const availableOptions = currentSelectedOptions && numericColumnOptions.filter(option => {
|
|
41
|
+
var _option$column;
|
|
44
42
|
const index = currentSelectedOptions.findIndex(o => Object.values(o)[0] && Object.values(o)[0].key === option.column.key);
|
|
45
43
|
// find current option
|
|
46
44
|
// even index === -1 still return true case it's current selected option
|
|
47
|
-
if (option.column.key === value.column_key) {
|
|
45
|
+
if (((_option$column = option.column) === null || _option$column === void 0 ? void 0 : _option$column.key) === value.column_key) {
|
|
48
46
|
// "addCurrentSelectedOptions" is an async action in react, won't effect loops here
|
|
49
47
|
if (index === -1) {
|
|
50
48
|
addCurrentSelectedOptions(option.column, currentAxisesIndex);
|
|
@@ -88,13 +86,20 @@ class NumericSummaryItem extends Component {
|
|
|
88
86
|
index,
|
|
89
87
|
value,
|
|
90
88
|
numericColumnOptions,
|
|
89
|
+
currentSelectedOptions,
|
|
91
90
|
currentAxisesIndex
|
|
92
91
|
} = this.props;
|
|
93
92
|
const {
|
|
94
93
|
column_key,
|
|
95
94
|
summary_method
|
|
96
95
|
} = value;
|
|
97
|
-
|
|
96
|
+
let selectedColumnOption, availableOptions;
|
|
97
|
+
if (currentSelectedOptions) {
|
|
98
|
+
[selectedColumnOption, availableOptions] = this.getAvailableOptions();
|
|
99
|
+
} else {
|
|
100
|
+
selectedColumnOption = numericColumnOptions.find(option => option.value.key === column_key);
|
|
101
|
+
availableOptions = numericColumnOptions;
|
|
102
|
+
}
|
|
98
103
|
const selectedSummaryMethodOption = this.summaryMethodOptions.find(option => option.value === summary_method);
|
|
99
104
|
const {
|
|
100
105
|
isExpand
|
|
@@ -75,11 +75,11 @@ BaseUtils.isValidExistChart = (tables, chart) => {
|
|
|
75
75
|
|
|
76
76
|
// if current chart is using "groupby_column_key" as key
|
|
77
77
|
// if groupby_column_key is null, still return false
|
|
78
|
-
let groupByColumnKey = config.groupby_column_key;
|
|
78
|
+
let groupByColumnKey = config.groupby_column_key || config.x_axis_column_key || config.vertical_axis_column_key || config.columnKey || config.date_column_key;
|
|
79
79
|
if ([CHART_TYPE.BAR, CHART_TYPE.BAR_GROUP, CHART_TYPE.BAR_CUSTOM, CHART_TYPE.BAR_STACK, CHART_TYPE.LINE, CHART_TYPE.LINE_GROUP, CHART_TYPE.AREA, CHART_TYPE.AREA_GROUP].includes(config.type)) {
|
|
80
80
|
groupByColumnKey = config.x_axis_column_key;
|
|
81
81
|
}
|
|
82
|
-
if ([CHART_TYPE.HORIZONTAL_BAR, CHART_TYPE.HORIZONTAL_GROUP_BAR].includes(config.type)) {
|
|
82
|
+
if ([CHART_TYPE.HORIZONTAL_BAR, CHART_TYPE.HORIZONTAL_GROUP_BAR, CHART_TYPE.STACKED_HORIZONTAL_BAR].includes(config.type)) {
|
|
83
83
|
groupByColumnKey = config.vertical_axis_column_key;
|
|
84
84
|
}
|
|
85
85
|
if ([CHART_TYPE.MAP, CHART_TYPE.MAP_BUBBLE, CHART_TYPE.WORLD_MAP, CHART_TYPE.WORLD_MAP_BUBBLE].includes(config.type)) {
|
|
@@ -7,8 +7,9 @@ import { getClientLinkDisplayString } from '../cell-format-utils';
|
|
|
7
7
|
import context from '../../context';
|
|
8
8
|
import { column2SqlColumn } from '../sql/column-2-sql-column';
|
|
9
9
|
import { formatNumericValue, getFormattedValue, getColumnByKey, getSqlGroup, getSummaryResult } from '../column-utils';
|
|
10
|
-
import BaseUtils from './base-utils';
|
|
11
10
|
import { getCompareDate } from '../trend-utils';
|
|
11
|
+
import intl from '../../intl';
|
|
12
|
+
import BaseUtils from './base-utils';
|
|
12
13
|
class SQLStatisticsUtils {}
|
|
13
14
|
_class = SQLStatisticsUtils;
|
|
14
15
|
SQLStatisticsUtils.dataSources = 'sql_statistics';
|
|
@@ -1475,7 +1476,7 @@ SQLStatisticsUtils.completenessSQlResult = (chart, sqlRows, sqlStatistics, table
|
|
|
1475
1476
|
if (sqlColumnGroupByColumnKey) {
|
|
1476
1477
|
targetValue = row["SUM(".concat(target_column.name, ")")];
|
|
1477
1478
|
completedValue = row["SUM(".concat(completed_column.name, ")")];
|
|
1478
|
-
groupby = row[sqlColumnGroupByColumnKey];
|
|
1479
|
+
groupby = row[sqlColumnGroupByColumnKey] || intl.get('Empty');
|
|
1479
1480
|
} else {
|
|
1480
1481
|
completedValue = getFormatedKey(row, completed_column);
|
|
1481
1482
|
targetValue = getFormatedKey(row, target_column);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CellType, DEFAULT_DATE_FORMAT, FORMULA_COLUMN_TYPES_MAP, FORMULA_RESULT_TYPE, isNumber, isNumericColumn, getNumberDisplayString } from 'dtable-utils';
|
|
2
|
+
import { COLUMNS_ICON_CONFIG } from 'dtable-utils';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { MIRROR_COLUMN_LIST, CHART_SUMMARY_TYPE } from '../constants';
|
|
2
5
|
import { getClientFormulaDisplayString } from './cell-format-utils';
|
|
3
6
|
import { ChartUtils } from './chart-utils';
|
|
4
|
-
import { MIRROR_COLUMN_LIST, CHART_SUMMARY_TYPE } from '../constants';
|
|
5
|
-
/* eslint-disable react/react-in-jsx-scope */
|
|
6
|
-
import { COLUMNS_ICON_CONFIG } from 'dtable-utils';
|
|
7
7
|
|
|
8
8
|
// get dtable column options
|
|
9
9
|
export function getColumnOptions(columns) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
3
4
|
import { CHART_LINE_TYPES, CHART_SUMMARY_SHOW, CHART_SUMMARY_TYPE } from '../../constants';
|
|
4
5
|
import intl from '../../intl';
|
|
5
6
|
import { BaseUtils, isFunction } from '../../utils';
|
|
@@ -172,7 +173,7 @@ class Area extends ChartComponent {
|
|
|
172
173
|
});
|
|
173
174
|
this.chart.render();
|
|
174
175
|
});
|
|
175
|
-
this.
|
|
176
|
+
this.setToolTipForArea();
|
|
176
177
|
isFunction(customRender) && customRender(this.chart);
|
|
177
178
|
this.setNameLabelAndTooltip(theme, this.labelCount);
|
|
178
179
|
this.setValueLabel(theme);
|
|
@@ -206,8 +207,14 @@ class Area extends ChartComponent {
|
|
|
206
207
|
super.componentWillUnmount();
|
|
207
208
|
}
|
|
208
209
|
render() {
|
|
210
|
+
const {
|
|
211
|
+
chart
|
|
212
|
+
} = this.props;
|
|
209
213
|
return /*#__PURE__*/React.createElement("div", {
|
|
210
|
-
className: 'sea-chart-container',
|
|
214
|
+
className: classNames('sea-chart-container', {
|
|
215
|
+
'show-x-axis-label': this.isShowXAxisLabel(chart),
|
|
216
|
+
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
217
|
+
}),
|
|
211
218
|
ref: ref => this.container = ref
|
|
212
219
|
});
|
|
213
220
|
}
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import DataSet from '@antv/data-set';
|
|
4
4
|
import { debounce, maxBy } from 'lodash-es';
|
|
5
|
+
import classNames from 'classnames';
|
|
5
6
|
import intl from '../../intl';
|
|
6
7
|
import { BaseUtils } from '../../utils/chart-utils';
|
|
7
8
|
import { EMPTY_NAME } from '../../constants';
|
|
@@ -124,7 +125,7 @@ class BarCustom extends ChartComponent {
|
|
|
124
125
|
let labelCfg = {
|
|
125
126
|
style: {
|
|
126
127
|
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
127
|
-
fill: themeColors.
|
|
128
|
+
fill: themeColors.labelColor
|
|
128
129
|
}
|
|
129
130
|
};
|
|
130
131
|
if (displayData) {
|
|
@@ -191,8 +192,14 @@ class BarCustom extends ChartComponent {
|
|
|
191
192
|
window.removeEventListener('resize', this.handleResize);
|
|
192
193
|
}
|
|
193
194
|
render() {
|
|
195
|
+
const {
|
|
196
|
+
chart
|
|
197
|
+
} = this.props;
|
|
194
198
|
return /*#__PURE__*/React.createElement("div", {
|
|
195
|
-
className: 'sea-chart-container
|
|
199
|
+
className: classNames('sea-chart-container', {
|
|
200
|
+
'show-x-axis-label': this.isShowXAxisLabel(chart),
|
|
201
|
+
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
202
|
+
}),
|
|
196
203
|
ref: ref => this.container = ref
|
|
197
204
|
});
|
|
198
205
|
}
|
|
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import DataSet from '@antv/data-set';
|
|
4
4
|
import { getNumberDisplayString } from 'dtable-utils';
|
|
5
5
|
import { debounce, maxBy } from 'lodash-es';
|
|
6
|
+
import classNames from 'classnames';
|
|
6
7
|
import intl from '../../intl';
|
|
7
8
|
import { sortDataByGroupSum } from '../../utils/column-utils';
|
|
8
9
|
import { EMPTY_NAME, CHART_TYPE, CHART_SUMMARY_TYPE, DEFAULT_NUMBER_FORMAT_OBJECT } from '../../constants';
|
|
@@ -145,7 +146,7 @@ class BarGroup extends ChartComponent {
|
|
|
145
146
|
},
|
|
146
147
|
style: {
|
|
147
148
|
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
148
|
-
fill: theme.
|
|
149
|
+
fill: theme.labelColor
|
|
149
150
|
},
|
|
150
151
|
position: type === CHART_TYPE.BAR_STACK ? 'middle' : ''
|
|
151
152
|
}).position('name*value').size(singleBarWidth).color(chartBarColor).tooltip('name*value*group_name*raw_name', (name, value, group_name, raw_name) => {
|
|
@@ -208,8 +209,14 @@ class BarGroup extends ChartComponent {
|
|
|
208
209
|
window.removeEventListener('resize', this.debouncedHandleResize);
|
|
209
210
|
}
|
|
210
211
|
render() {
|
|
212
|
+
const {
|
|
213
|
+
chart
|
|
214
|
+
} = this.props;
|
|
211
215
|
return /*#__PURE__*/React.createElement("div", {
|
|
212
|
-
className: 'sea-chart-container',
|
|
216
|
+
className: classNames('sea-chart-container', {
|
|
217
|
+
'show-x-axis-label': this.isShowXAxisLabel(chart),
|
|
218
|
+
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
219
|
+
}),
|
|
213
220
|
ref: ref => this.container = ref
|
|
214
221
|
});
|
|
215
222
|
}
|
package/dist/view/wrapper/bar.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { debounce } from 'lodash-es';
|
|
4
|
-
import
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { CHART_SUMMARY_TYPE, CHART_SUMMARY_SHOW } from '../../constants';
|
|
5
6
|
import { BaseUtils, isFunction } from '../../utils';
|
|
6
|
-
import { getConvertedColorRules } from '../../utils/color-utils';
|
|
7
7
|
import intl from '../../intl';
|
|
8
8
|
import ChartComponent from './chart-component';
|
|
9
9
|
class Bar extends ChartComponent {
|
|
@@ -67,11 +67,12 @@ class Bar extends ChartComponent {
|
|
|
67
67
|
const singleBarRadius = singleBarWidth / 5;
|
|
68
68
|
|
|
69
69
|
// #8B99EA is designed color, don't change it unless design is changed
|
|
70
|
-
let chartBarColor = y_axis_label_color || '#8B99EA';
|
|
71
|
-
if (themeName) {
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
const colorRules = color_option === TYPE_COLOR_USING.USE_RULES && y_axis_label_color_rules && getConvertedColorRules(y_axis_label_color_rules);
|
|
70
|
+
// let chartBarColor = y_axis_label_color || '#8B99EA';
|
|
71
|
+
// if (themeName) {
|
|
72
|
+
// chartBarColor = BaseUtils.getCurrentTheme(themeName).colors[0];
|
|
73
|
+
// }
|
|
74
|
+
// const colorRules = color_option === TYPE_COLOR_USING.USE_RULES && y_axis_label_color_rules && getConvertedColorRules(y_axis_label_color_rules);
|
|
75
|
+
|
|
75
76
|
this.drawLabels(data);
|
|
76
77
|
// set Coord type
|
|
77
78
|
this.chart.coordinate('rect');
|
|
@@ -79,7 +80,7 @@ class Bar extends ChartComponent {
|
|
|
79
80
|
this.chart.interval().label(y_axis_show_value ? 'value' : false, {
|
|
80
81
|
style: {
|
|
81
82
|
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
82
|
-
fill: theme.
|
|
83
|
+
fill: theme.labelColor
|
|
83
84
|
}
|
|
84
85
|
}).position('name*value').size(singleBarWidth).tooltip('name*value', (name, value) => {
|
|
85
86
|
return {
|
|
@@ -101,7 +102,6 @@ class Bar extends ChartComponent {
|
|
|
101
102
|
// });
|
|
102
103
|
return {
|
|
103
104
|
// fill: color || chartBarColor,
|
|
104
|
-
fill: chartBarColor,
|
|
105
105
|
radius: [singleBarRadius, singleBarRadius, 0, 0]
|
|
106
106
|
};
|
|
107
107
|
});
|
|
@@ -131,8 +131,14 @@ class Bar extends ChartComponent {
|
|
|
131
131
|
window.removeEventListener('resize', this.debouncedHandleResize);
|
|
132
132
|
}
|
|
133
133
|
render() {
|
|
134
|
+
const {
|
|
135
|
+
chart
|
|
136
|
+
} = this.props;
|
|
134
137
|
return /*#__PURE__*/React.createElement("div", {
|
|
135
|
-
className: 'sea-chart-container
|
|
138
|
+
className: classNames('sea-chart-container', {
|
|
139
|
+
'show-x-axis-label': this.isShowXAxisLabel(chart),
|
|
140
|
+
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
141
|
+
}),
|
|
136
142
|
ref: ref => this.container = ref
|
|
137
143
|
});
|
|
138
144
|
}
|
|
@@ -195,11 +195,11 @@ export default class ChartComponent extends Component {
|
|
|
195
195
|
div.className = 'chart-axis-label';
|
|
196
196
|
const column = getTableColumnByKey(table, x_axis_column_key);
|
|
197
197
|
div.innerHTML = "".concat(column ? column.name : '');
|
|
198
|
-
div.setAttribute('style', "color:".concat(textColor, "; width: 100%; text-align: ").concat(x_axis_label_position, "; bottom: -
|
|
198
|
+
div.setAttribute('style', "color:".concat(textColor, "; width: 100%; text-align: ").concat(x_axis_label_position, "; bottom: -20px; position: absolute"));
|
|
199
199
|
chartContainer.appendChild(div);
|
|
200
200
|
}
|
|
201
201
|
if (xLabel && x_axis_show_label) {
|
|
202
|
-
xLabel.setAttribute('style', "color:".concat(textColor, "; width: 100%; text-align: ").concat(x_axis_label_position, "; bottom: -
|
|
202
|
+
xLabel.setAttribute('style', "color:".concat(textColor, "; width: 100%; text-align: ").concat(x_axis_label_position, "; bottom: -20px; position: absolute"));
|
|
203
203
|
}
|
|
204
204
|
if (xLabel && !x_axis_show_label) {
|
|
205
205
|
xLabel.parentNode.removeChild(xLabel);
|
|
@@ -283,12 +283,15 @@ export default class ChartComponent extends Component {
|
|
|
283
283
|
if (!_this.chart) return;
|
|
284
284
|
_this.chart.axis('name', {
|
|
285
285
|
line: {
|
|
286
|
-
style:
|
|
286
|
+
style: {
|
|
287
|
+
stroke: theme.XAxisColor,
|
|
288
|
+
lineWidth: 1
|
|
289
|
+
}
|
|
287
290
|
},
|
|
288
291
|
tickLine: {
|
|
289
292
|
length: 5,
|
|
290
293
|
// color of the tick line
|
|
291
|
-
stroke: theme.
|
|
294
|
+
stroke: theme.XAxisColor
|
|
292
295
|
},
|
|
293
296
|
label: {
|
|
294
297
|
style: {
|
|
@@ -327,7 +330,8 @@ export default class ChartComponent extends Component {
|
|
|
327
330
|
grid: {
|
|
328
331
|
line: {
|
|
329
332
|
style: {
|
|
330
|
-
stroke: theme.gridColor
|
|
333
|
+
stroke: theme.gridColor,
|
|
334
|
+
lineDash: [8, 3]
|
|
331
335
|
}
|
|
332
336
|
}
|
|
333
337
|
}
|
|
@@ -401,15 +405,19 @@ export default class ChartComponent extends Component {
|
|
|
401
405
|
},
|
|
402
406
|
style: style => {
|
|
403
407
|
// fill legend with stroke color
|
|
404
|
-
|
|
408
|
+
if (style.stroke) {
|
|
409
|
+
style.fill = style.stroke;
|
|
410
|
+
}
|
|
405
411
|
return style;
|
|
406
412
|
}
|
|
407
413
|
}
|
|
408
414
|
});
|
|
409
415
|
};
|
|
410
|
-
this.
|
|
416
|
+
this.getToolTipSettings = () => {
|
|
411
417
|
return {
|
|
412
418
|
showMarkers: false,
|
|
419
|
+
containerTpl: "<div class=\"g2-tooltip\">\n <div class=\"g2-tooltip-title\">{title}</div>\n <ul class=\"g2-tooltip-list\"></ul>\n </div>",
|
|
420
|
+
itemTpl: "<li class=\"g2-tooltip-list-item\">\n <span class=\"g2-tooltip-marker\" style=\"background-color:{color};display:inline-block;\"></span>\n <span class=\"g2-tooltip-name\">{name}</span>\n <span class=\"g2-tooltip-value\">{value}</span>\n </li>",
|
|
413
421
|
domStyles: {
|
|
414
422
|
'g2-tooltip': {
|
|
415
423
|
boxSizing: 'border-box',
|
|
@@ -426,7 +434,12 @@ export default class ChartComponent extends Component {
|
|
|
426
434
|
'g2-tooltip-title': {
|
|
427
435
|
color: '#333333',
|
|
428
436
|
fontSize: '14px',
|
|
429
|
-
paddingBottom: '10px'
|
|
437
|
+
paddingBottom: '10px',
|
|
438
|
+
maxWidth: '160px',
|
|
439
|
+
whiteSpace: 'nowrap',
|
|
440
|
+
overflow: 'hidden',
|
|
441
|
+
lineHeight: '14px',
|
|
442
|
+
textOverflow: 'ellipsis'
|
|
430
443
|
},
|
|
431
444
|
'g2-tooltip-list-item': {
|
|
432
445
|
marginBottom: '8px'
|
|
@@ -435,11 +448,16 @@ export default class ChartComponent extends Component {
|
|
|
435
448
|
width: '12px',
|
|
436
449
|
height: '12px',
|
|
437
450
|
borderRadius: '2px',
|
|
438
|
-
marginBottom: '-1.5px',
|
|
439
451
|
marginRight: '8px'
|
|
440
452
|
},
|
|
441
453
|
'g2-tooltip-name': {
|
|
442
|
-
|
|
454
|
+
display: 'inline-block',
|
|
455
|
+
fontSize: '12px',
|
|
456
|
+
maxWidth: '80px',
|
|
457
|
+
whiteSpace: 'nowrap',
|
|
458
|
+
overflow: 'hidden',
|
|
459
|
+
lineHeight: '12px',
|
|
460
|
+
textOverflow: 'ellipsis'
|
|
443
461
|
},
|
|
444
462
|
'g2-tooltip-value': {
|
|
445
463
|
fontSize: '12px'
|
|
@@ -448,11 +466,33 @@ export default class ChartComponent extends Component {
|
|
|
448
466
|
};
|
|
449
467
|
};
|
|
450
468
|
this.setToolTip = () => {
|
|
451
|
-
const settings = this.
|
|
469
|
+
const settings = this.getToolTipSettings();
|
|
452
470
|
this.chart.tooltip(settings);
|
|
453
471
|
};
|
|
454
472
|
this.setToolTipForLine = () => {
|
|
455
|
-
const settings = this.
|
|
473
|
+
const settings = this.getToolTipSettings();
|
|
474
|
+
const lineToolTipSettings = {
|
|
475
|
+
showCrosshairs: true,
|
|
476
|
+
showTitle: true,
|
|
477
|
+
shared: true,
|
|
478
|
+
showMarkers: true,
|
|
479
|
+
marker: {
|
|
480
|
+
strokeOpacity: 0,
|
|
481
|
+
r: 6
|
|
482
|
+
},
|
|
483
|
+
crosshairs: {
|
|
484
|
+
line: {
|
|
485
|
+
fill: '#F3F3F3'
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
this.chart.tooltip({
|
|
490
|
+
...settings,
|
|
491
|
+
...lineToolTipSettings
|
|
492
|
+
});
|
|
493
|
+
};
|
|
494
|
+
this.setToolTipForArea = () => {
|
|
495
|
+
const settings = this.getToolTipSettings();
|
|
456
496
|
const lineToolTipSettings = {
|
|
457
497
|
showCrosshairs: true,
|
|
458
498
|
showTitle: true,
|
|
@@ -464,7 +504,7 @@ export default class ChartComponent extends Component {
|
|
|
464
504
|
},
|
|
465
505
|
crosshairs: {
|
|
466
506
|
line: {
|
|
467
|
-
fill: '#
|
|
507
|
+
fill: '#F3F3F3'
|
|
468
508
|
}
|
|
469
509
|
}
|
|
470
510
|
};
|
|
@@ -6,6 +6,7 @@ import intl from '../../intl';
|
|
|
6
6
|
import { CHART_STYLE_COLORS, CHART_TYPE } from '../../constants';
|
|
7
7
|
import ChartComponent from './chart-component';
|
|
8
8
|
export default function Completeness(props) {
|
|
9
|
+
var _chartRef$current, _chartRef$current2;
|
|
9
10
|
const chartRef = useRef(null);
|
|
10
11
|
const chartContainerRef = useRef(null);
|
|
11
12
|
useEffect(() => {
|
|
@@ -77,7 +78,7 @@ export default function Completeness(props) {
|
|
|
77
78
|
if (group_name === 'rest') {
|
|
78
79
|
return '#bdbdbd';
|
|
79
80
|
}
|
|
80
|
-
if (isGroup) {
|
|
81
|
+
if (isGroup && column_groupby_column_key) {
|
|
81
82
|
return colorMap[groupby];
|
|
82
83
|
}
|
|
83
84
|
return CHART_STYLE_COLORS[0];
|
|
@@ -122,7 +123,7 @@ export default function Completeness(props) {
|
|
|
122
123
|
},
|
|
123
124
|
style: {
|
|
124
125
|
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
125
|
-
fill: theme.
|
|
126
|
+
fill: theme.labelColor
|
|
126
127
|
}
|
|
127
128
|
}).position('name*value').size(singleBarWidth).color(colorField, colorFieldCb).adjust(adjustType).tooltip('name*group_name*value', (name, group_name, value) => {
|
|
128
129
|
return {
|
|
@@ -156,8 +157,14 @@ export default function Completeness(props) {
|
|
|
156
157
|
window.removeEventListener('resize', handleReize);
|
|
157
158
|
};
|
|
158
159
|
}, [props]);
|
|
160
|
+
const {
|
|
161
|
+
chart
|
|
162
|
+
} = props;
|
|
159
163
|
return /*#__PURE__*/React.createElement("div", {
|
|
160
|
-
className: classnames('sea-chart-completeness-chart sea-chart-container
|
|
164
|
+
className: classnames('sea-chart-completeness-chart sea-chart-container', {
|
|
165
|
+
'show-x-axis-label': (_chartRef$current = chartRef.current) === null || _chartRef$current === void 0 ? void 0 : _chartRef$current.isShowXAxisLabel(chart),
|
|
166
|
+
'show-y-axis-label': (_chartRef$current2 = chartRef.current) === null || _chartRef$current2 === void 0 ? void 0 : _chartRef$current2.isShowYAxisLabel(chart)
|
|
167
|
+
}),
|
|
161
168
|
ref: chartContainerRef
|
|
162
169
|
});
|
|
163
170
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { debounce, maxBy } from 'lodash-es';
|
|
4
|
+
import classNames from 'classnames';
|
|
4
5
|
import { CHART_TYPE, EMPTY_NAME } from '../../constants';
|
|
5
6
|
import { BaseUtils, isFunction } from '../../utils';
|
|
6
7
|
import intl from '../../intl';
|
|
@@ -92,7 +93,7 @@ class HorizontalBarGroup extends HorizontalComponent {
|
|
|
92
93
|
},
|
|
93
94
|
style: {
|
|
94
95
|
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
95
|
-
fill: theme.
|
|
96
|
+
fill: theme.labelColor
|
|
96
97
|
}
|
|
97
98
|
}).position('name*value').size(singleBarWidth).color(chartBarColor).tooltip('name*value*group_name*raw_name', (name, value, group_name, raw_name) => {
|
|
98
99
|
return {
|
|
@@ -153,8 +154,14 @@ class HorizontalBarGroup extends HorizontalComponent {
|
|
|
153
154
|
window.removeEventListener('resize', this.handleResize);
|
|
154
155
|
}
|
|
155
156
|
render() {
|
|
157
|
+
const {
|
|
158
|
+
chart
|
|
159
|
+
} = this.props;
|
|
156
160
|
return /*#__PURE__*/React.createElement("div", {
|
|
157
|
-
className: 'sea-chart-container
|
|
161
|
+
className: classNames('sea-chart-container', {
|
|
162
|
+
'show-x-axis-label': this.isShowXAxisLabel(chart),
|
|
163
|
+
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
164
|
+
}),
|
|
158
165
|
ref: ref => this.container = ref
|
|
159
166
|
});
|
|
160
167
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
3
|
+
import classNames from 'classnames';
|
|
4
4
|
import { CHART_SUMMARY_TYPE, CHART_SUMMARY_SHOW } from '../../constants';
|
|
5
5
|
import { BaseUtils, isFunction } from '../../utils';
|
|
6
6
|
import intl from '../../intl';
|
|
@@ -50,6 +50,8 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
50
50
|
const {
|
|
51
51
|
horizontal_axis_summary_type,
|
|
52
52
|
horizontal_axis_summary_method,
|
|
53
|
+
color_option,
|
|
54
|
+
y_axis_label_color_rules,
|
|
53
55
|
horizontal_axis_label_color,
|
|
54
56
|
display_data,
|
|
55
57
|
label_font_size
|
|
@@ -59,10 +61,13 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
59
61
|
const chartHeight = this.chart.height - 6 - 10;
|
|
60
62
|
const singleBarWidth = Math.round(chartHeight / (2 * data.length));
|
|
61
63
|
const singleBarRadius = singleBarWidth / 5;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
|
|
65
|
+
// let chartBarColor = horizontal_axis_label_color || '#8B99EA';
|
|
66
|
+
// if (themeName) {
|
|
67
|
+
// chartBarColor = BaseUtils.getCurrentTheme(themeName).colors[0];
|
|
68
|
+
// }
|
|
69
|
+
// const colorRules = color_option === TYPE_COLOR_USING.USE_RULES && y_axis_label_color_rules && getConvertedColorRules(y_axis_label_color_rules);
|
|
70
|
+
|
|
66
71
|
data.reverse();
|
|
67
72
|
this.drawLabels(data);
|
|
68
73
|
|
|
@@ -72,7 +77,7 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
72
77
|
this.chart.interval().label(display_data ? 'value' : false, {
|
|
73
78
|
style: {
|
|
74
79
|
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
75
|
-
fill: theme.
|
|
80
|
+
fill: theme.labelColor
|
|
76
81
|
}
|
|
77
82
|
}).position('name*value')
|
|
78
83
|
// .color(chartBarColor)
|
|
@@ -96,7 +101,6 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
96
101
|
// });
|
|
97
102
|
return {
|
|
98
103
|
// fill: color || chartBarColor,
|
|
99
|
-
fill: chartBarColor,
|
|
100
104
|
radius: [singleBarRadius, singleBarRadius, 0, 0]
|
|
101
105
|
};
|
|
102
106
|
});
|
|
@@ -125,8 +129,14 @@ class HorizontalBar extends HorizontalComponent {
|
|
|
125
129
|
super.componentWillUnmount();
|
|
126
130
|
}
|
|
127
131
|
render() {
|
|
132
|
+
const {
|
|
133
|
+
chart
|
|
134
|
+
} = this.props;
|
|
128
135
|
return /*#__PURE__*/React.createElement("div", {
|
|
129
|
-
className: 'sea-chart-container',
|
|
136
|
+
className: classNames('sea-chart-container', {
|
|
137
|
+
'show-x-axis-label': this.isShowXAxisLabel(chart),
|
|
138
|
+
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
139
|
+
}),
|
|
130
140
|
ref: ref => this.container = ref
|
|
131
141
|
});
|
|
132
142
|
}
|
|
@@ -71,7 +71,7 @@ class LineGroup extends ChartComponent {
|
|
|
71
71
|
const line = this.chart.line().label(y_axis_show_value ? 'value' : false, {
|
|
72
72
|
style: {
|
|
73
73
|
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
74
|
-
fill: theme.
|
|
74
|
+
fill: theme.labelColor
|
|
75
75
|
}
|
|
76
76
|
}).animate({
|
|
77
77
|
appear: {
|
|
@@ -2,10 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { getTableById, getTableColumnByKey, getNumberDisplayString } from 'dtable-utils';
|
|
5
|
-
import ChartComponent from './chart-component';
|
|
6
5
|
import intl from '../../intl';
|
|
7
6
|
import { BaseUtils } from '../../utils';
|
|
8
7
|
import { CHART_SUMMARY_TYPE, TITLE_AMOUNT, DEFAULT_NUMBER_FORMAT_OBJECT, CHART_SUMMARY_SHOW } from '../../constants';
|
|
8
|
+
import ChartComponent from './chart-component';
|
|
9
9
|
class Mirror extends ChartComponent {
|
|
10
10
|
constructor(props) {
|
|
11
11
|
super(props);
|
|
@@ -71,7 +71,7 @@ class Mirror extends ChartComponent {
|
|
|
71
71
|
},
|
|
72
72
|
label: {
|
|
73
73
|
style: {
|
|
74
|
-
fill: themeColors.
|
|
74
|
+
fill: themeColors.labelColor
|
|
75
75
|
},
|
|
76
76
|
formatter: name => {
|
|
77
77
|
let label = name;
|
package/dist/view/wrapper/pie.js
CHANGED
|
@@ -2,8 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { CHART_LABEL_POSITIONS, CHART_LABEL_FORMATS } from '../../constants';
|
|
4
4
|
import { BaseUtils, isFunction } from '../../utils';
|
|
5
|
-
import ChartComponent from './chart-component';
|
|
6
5
|
import intl from '../../intl';
|
|
6
|
+
import ChartComponent from './chart-component';
|
|
7
7
|
class Pie extends ChartComponent {
|
|
8
8
|
constructor(props) {
|
|
9
9
|
super(props);
|
|
@@ -56,7 +56,7 @@ class Pie extends ChartComponent {
|
|
|
56
56
|
custom: true,
|
|
57
57
|
itemName: {
|
|
58
58
|
style: {
|
|
59
|
-
fill: theme.
|
|
59
|
+
fill: theme.labelColor
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
items: newData.map((obj, index) => {
|
|
@@ -83,7 +83,7 @@ export function Scatter(props) {
|
|
|
83
83
|
currentChart.chart.point().position('name*value').label(y_axis_show_value ? 'value' : false, {
|
|
84
84
|
style: {
|
|
85
85
|
fontSize: BaseUtils.getLabelFontSize(label_font_size),
|
|
86
|
-
fill:
|
|
86
|
+
fill: theme.labelColor
|
|
87
87
|
}
|
|
88
88
|
}).color('groupby', groupby => {
|
|
89
89
|
if (groupby[0] === 'groupby') {
|
|
@@ -121,7 +121,7 @@ export function Scatter(props) {
|
|
|
121
121
|
const showXLabel = chartRef.current.isShowXAxisLabel(chart);
|
|
122
122
|
const showYLabel = chartRef.current.isShowYAxisLabel(chart);
|
|
123
123
|
return /*#__PURE__*/React.createElement("div", {
|
|
124
|
-
className: classnames('sea-chart-container
|
|
124
|
+
className: classnames('sea-chart-container', {
|
|
125
125
|
'show-x-axis-label': showXLabel,
|
|
126
126
|
'show-y-axis-label': showYLabel
|
|
127
127
|
}),
|