sea-chart 1.1.78 → 1.1.80
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/components/statistic-record-dialog/index.js +6 -1
- package/dist/utils/chart-utils/base-utils.js +1 -1
- package/dist/utils/chart-utils/original-data-utils/scatter-calculator.js +1 -0
- package/dist/utils/chart-utils/sql-statistics-utils.js +5 -4
- package/dist/utils/row-record-utils.js +14 -7
- package/dist/view/wrapper/scatter.js +6 -2
- package/package.json +3 -3
|
@@ -14,6 +14,7 @@ import { getFilterConditions } from '../../utils/row-record-utils';
|
|
|
14
14
|
import RowCard from '../row-card/row-card';
|
|
15
15
|
import { CommonEventTypes } from '../../constants/common-constants';
|
|
16
16
|
import { getErrorMessage } from '../../utils';
|
|
17
|
+
import { CHART_TYPE } from '../../constants';
|
|
17
18
|
import './index.css';
|
|
18
19
|
class StatisticRecordDialog extends React.Component {
|
|
19
20
|
constructor(_props) {
|
|
@@ -56,7 +57,11 @@ class StatisticRecordDialog extends React.Component {
|
|
|
56
57
|
// if more then 2 filters, use 'Or' conjunction to get them all
|
|
57
58
|
// if the statistic record is '_Others', use 'Or' conjunction to get them all
|
|
58
59
|
if ((detailFilterConditions === null || detailFilterConditions === void 0 ? void 0 : detailFilterConditions.filters.length) > 2 || statisticRecord.name === '_Others') {
|
|
59
|
-
|
|
60
|
+
if (chart.config.type === CHART_TYPE.SCATTER) {
|
|
61
|
+
detailFilterConditions.filter_conjunction = 'And';
|
|
62
|
+
} else {
|
|
63
|
+
detailFilterConditions.filter_conjunction = 'Or';
|
|
64
|
+
}
|
|
60
65
|
}
|
|
61
66
|
context.api.customQueryRows(currentElementId, detailFilterConditions).then(res => {
|
|
62
67
|
const {
|
|
@@ -543,7 +543,7 @@ BaseUtils.formatEmptyName = (dataList, column_groupby_column_key, emptyName) =>
|
|
|
543
543
|
for (let i = 0; i < dataList.length; i++) {
|
|
544
544
|
let item = dataList[i];
|
|
545
545
|
// let updated = {};
|
|
546
|
-
if (!item.name) {
|
|
546
|
+
if (!item.name && item.name !== 0) {
|
|
547
547
|
item.name = emptyName;
|
|
548
548
|
}
|
|
549
549
|
if (column_groupby_column_key && !item.group_name) {
|
|
@@ -1935,8 +1935,8 @@ SQLStatisticsUtils.scatterSQLResult2JavaScript = async (chart, sqlRows, chartSQL
|
|
|
1935
1935
|
if (sqlColumnGroupbyColumnKey) await BaseUtils.updateTableViewList(sqlRows, columnGroupbyColumn, sqlColumnGroupbyColumnKey, 'color', isScatter, false);
|
|
1936
1936
|
const res = [];
|
|
1937
1937
|
sqlRows.forEach((row, index) => {
|
|
1938
|
-
const xValue = row[sqlXColumnKey]
|
|
1939
|
-
const yValue = row[sqlYColumnKey]
|
|
1938
|
+
const xValue = row[sqlXColumnKey];
|
|
1939
|
+
const yValue = row[sqlYColumnKey];
|
|
1940
1940
|
const groupby = row[sqlColumnGroupbyColumnKey] ? '' + row[sqlColumnGroupbyColumnKey] : null;
|
|
1941
1941
|
const originalSqlRow = originalSqlRows[index];
|
|
1942
1942
|
const originalXValue = originalSqlRow[sqlXColumnKey];
|
|
@@ -1944,16 +1944,17 @@ SQLStatisticsUtils.scatterSQLResult2JavaScript = async (chart, sqlRows, chartSQL
|
|
|
1944
1944
|
const originalGroupby = originalSqlRow[sqlColumnGroupbyColumnKey];
|
|
1945
1945
|
res.push({
|
|
1946
1946
|
name: xValue,
|
|
1947
|
-
value: yValue,
|
|
1947
|
+
value: yValue !== null ? Number(yValue) : yValue,
|
|
1948
1948
|
groupby,
|
|
1949
|
+
rows: [originalSqlRow],
|
|
1949
1950
|
original_value: {
|
|
1950
|
-
rows: [originalSqlRow],
|
|
1951
1951
|
name: originalXValue,
|
|
1952
1952
|
value: originalYValue,
|
|
1953
1953
|
groupby: originalGroupby
|
|
1954
1954
|
}
|
|
1955
1955
|
});
|
|
1956
1956
|
});
|
|
1957
|
+
BaseUtils.sortCharts(res, groupbyColumn, 'name');
|
|
1957
1958
|
return res;
|
|
1958
1959
|
};
|
|
1959
1960
|
SQLStatisticsUtils.mapSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
@@ -13,6 +13,7 @@ import DigitalSignUtils from '../utils/digital-sign-utils';
|
|
|
13
13
|
import { getColumnByKey } from '../utils/column-utils';
|
|
14
14
|
import context from '../context';
|
|
15
15
|
import { xAxisMap, groupAxisMap } from '../constants';
|
|
16
|
+
import { CHART_TYPE } from '../constants/type';
|
|
16
17
|
import { chartColumn2SqlColumn } from './sql';
|
|
17
18
|
import { BaseUtils } from './chart-utils';
|
|
18
19
|
export const UNSHOW_COLUMN_TYPE = [CellType.LINK, CellType.LONG_TEXT, CellType.FORMULA, CellType.LINK_FORMULA];
|
|
@@ -612,7 +613,9 @@ export const getFilterConditions = (statisticRecord, chart, table) => {
|
|
|
612
613
|
const chartSQLMap = chartColumn2SqlColumn(chart, table);
|
|
613
614
|
const {
|
|
614
615
|
sqlColumnGroupbyColumnKey,
|
|
615
|
-
sqlGroupbyColumnKey
|
|
616
|
+
sqlGroupbyColumnKey,
|
|
617
|
+
sqlXColumnKey,
|
|
618
|
+
sqlYColumnKey
|
|
616
619
|
} = chartSQLMap;
|
|
617
620
|
if (isPivot && rows.length) {
|
|
618
621
|
const xValueList = [];
|
|
@@ -637,19 +640,23 @@ export const getFilterConditions = (statisticRecord, chart, table) => {
|
|
|
637
640
|
});
|
|
638
641
|
} else {
|
|
639
642
|
if (name === '_Others') {
|
|
640
|
-
const
|
|
641
|
-
filters.push(...
|
|
643
|
+
const flters = rows.map(row => getFilterByColumnType(config[columnKey], columns, [row], sqlGroupbyColumnKey));
|
|
644
|
+
filters.push(...flters);
|
|
642
645
|
} else {
|
|
643
|
-
let columnFilter;
|
|
644
646
|
if (['map', 'map_bubble'].includes(type)) {
|
|
645
|
-
|
|
647
|
+
const filter = {
|
|
646
648
|
column_key: config[columnKey],
|
|
647
649
|
value: name
|
|
648
650
|
};
|
|
651
|
+
filters.push(filter);
|
|
652
|
+
} else if (type === CHART_TYPE.SCATTER) {
|
|
653
|
+
const filterX = getFilterByColumnType(config['x_axis_column_key'], columns, rows, sqlXColumnKey);
|
|
654
|
+
const filterY = getFilterByColumnType(config['y_axis_column_key'], columns, rows, sqlYColumnKey);
|
|
655
|
+
filters.push(filterX, filterY);
|
|
649
656
|
} else {
|
|
650
|
-
|
|
657
|
+
const filter = getFilterByColumnType(config[columnKey], columns, rows, sqlGroupbyColumnKey);
|
|
658
|
+
filters.push(filter);
|
|
651
659
|
}
|
|
652
|
-
filters.push(columnFilter);
|
|
653
660
|
}
|
|
654
661
|
if (sqlColumnGroupbyColumnKey) {
|
|
655
662
|
const groupColumnFilter = getFilterByColumnType(config[groupColumnKey], columns, rows, sqlColumnGroupbyColumnKey);
|
|
@@ -29,7 +29,7 @@ export function Scatter(_ref) {
|
|
|
29
29
|
appendPadding
|
|
30
30
|
});
|
|
31
31
|
currentChart.chart.on('element:click', e => {
|
|
32
|
-
toggleRecords(e.data.data
|
|
32
|
+
toggleRecords(e.data.data);
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
function drawChart() {
|
|
@@ -66,9 +66,13 @@ export function Scatter(_ref) {
|
|
|
66
66
|
currentChart.chart.coordinate('rect');
|
|
67
67
|
currentChart.autoAdjustDataOptions(chart, data);
|
|
68
68
|
|
|
69
|
-
// need to set name as
|
|
69
|
+
// scatter chart need to set name as linear type,otherwise point will be ramdomly
|
|
70
70
|
currentChart.chart.scale({
|
|
71
71
|
name: {
|
|
72
|
+
type: 'linear',
|
|
73
|
+
nice: true
|
|
74
|
+
},
|
|
75
|
+
value: {
|
|
72
76
|
nice: true
|
|
73
77
|
}
|
|
74
78
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sea-chart",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.80",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@antv/data-set": "0.11.8",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"@dnd-kit/sortable": "^10.0.0",
|
|
11
11
|
"@dnd-kit/utilities": "^3.2.2",
|
|
12
12
|
"@seafile/seafile-calendar": "^0.0.24",
|
|
13
|
-
"@seafile/seafile-editor": "^2.0.
|
|
13
|
+
"@seafile/seafile-editor": "^2.0.3",
|
|
14
14
|
"classnames": "^2.3.2",
|
|
15
15
|
"dayjs": "1.10.7",
|
|
16
16
|
"is-hotkey": "0.2.0",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@antv/scale": "0.3.14",
|
|
30
|
-
"dtable-ui-component": "^6.0.
|
|
30
|
+
"dtable-ui-component": "^6.0.14",
|
|
31
31
|
"dtable-utils": "~5.0.*",
|
|
32
32
|
"prop-types": "15.8.1",
|
|
33
33
|
"react": "^18.3.1",
|