sea-chart 1.1.63-alpha.9 → 1.1.64
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/services/map-json.js +1 -3
- package/dist/utils/chart-utils/base-utils.js +4 -5
- package/dist/utils/chart-utils/sql-statistics-utils.js +103 -24
- package/dist/utils/custom-g2.js +655 -0
- package/dist/view/index.css +2 -6
- package/dist/view/wrapper/area.js +121 -84
- package/dist/view/wrapper/bar-custom.js +89 -138
- package/dist/view/wrapper/bar-group.js +89 -104
- package/dist/view/wrapper/bar.js +54 -47
- package/dist/view/wrapper/chart-component.js +48 -272
- package/dist/view/wrapper/combination.js +299 -168
- package/dist/view/wrapper/compare.js +190 -97
- package/dist/view/wrapper/completeness.js +71 -147
- package/dist/view/wrapper/dashboard.js +137 -102
- package/dist/view/wrapper/funnel.js +84 -49
- package/dist/view/wrapper/heat-map.js +257 -165
- package/dist/view/wrapper/horizontal-bar-group.js +72 -55
- package/dist/view/wrapper/horizontal-bar.js +69 -34
- package/dist/view/wrapper/horizontal-component.js +6 -6
- package/dist/view/wrapper/line-group.js +87 -32
- package/dist/view/wrapper/line.js +85 -32
- package/dist/view/wrapper/map.js +244 -323
- package/dist/view/wrapper/mirror.js +109 -214
- package/dist/view/wrapper/pie.js +121 -99
- package/dist/view/wrapper/ring.js +200 -130
- package/dist/view/wrapper/scatter.js +47 -140
- package/dist/view/wrapper/treemap.js +74 -56
- package/dist/view/wrapper/world-map.js +272 -340
- package/package.json +4 -6
|
@@ -69,8 +69,7 @@ function getMapJsonQueryUrl(mapLevel, mapLocation) {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
function handleLoadedMapJson(url, mapJson) {
|
|
72
|
-
|
|
73
|
-
const isValid = mapJson && mapJson.features || mapJson && mapJson.type === 'Topology';
|
|
72
|
+
const isValid = mapJson && mapJson.features;
|
|
74
73
|
if (isValid) {
|
|
75
74
|
setMapJson(url, mapJson);
|
|
76
75
|
return mapJson;
|
|
@@ -90,7 +89,6 @@ export default async function fetchMapJson(mapLevel, mapLocation, mediaUrl) {
|
|
|
90
89
|
let mapJson;
|
|
91
90
|
try {
|
|
92
91
|
const res = await fetch("".concat(mediaUrl, "dtable-statistic/geolocation/").concat(url, ".json"));
|
|
93
|
-
console.log('res', res);
|
|
94
92
|
mapJson = await res.json();
|
|
95
93
|
} catch (error) {
|
|
96
94
|
console.error('on fetchMapJson: fetch error', error);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
var _BaseUtils;
|
|
2
2
|
import shallowEqual from 'shallowequal';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
|
-
import slugid from 'slugid';
|
|
5
4
|
import { CellType, COLLABORATOR_COLUMN_TYPES, FORMULA_COLUMN_TYPES_MAP, FORMULA_RESULT_TYPE, getDateDisplayString, getNumberDisplayString, getOption, getPrecisionNumber, getTableById, getTableColumnByKey, isNumber, isNumericColumn, isDateColumn, sortText, sortNumber, sortDate, sortSingleSelect, sortFormula, getColumnOptions, DateUtils, getGeolocationDisplayString, getFormulaDisplayString, isArchiveView, getViewById, MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP } from 'dtable-utils';
|
|
6
|
-
import { PIE_CHART_COLORS, CHART_SUMMARY_TYPE, CHART_SUPPORT_SORT_COLUMNS, CHART_TYPE, CHART_STYLE_SETTING_KEYS, DEFAULT_LABEL_FONT_SIZE, DEFAULT_NUMBER_FORMAT_OBJECT, X_AXIS_IS_GROUPBY_COLUMN_KEY_CHART_TYPES, STYLE_COLORS, CHART_DATA_SORT_TYPE, CHART_Y_GROUP_TYPE, HORIZONTAL_BAR_CHART_TYPES, COMPLTETELESS_CHART_TYPES, CHART_STYLE_CONFIG_SETTING_KEYS } from '../../constants';
|
|
5
|
+
import { PIE_CHART_COLORS, CHART_SUMMARY_TYPE, CHART_SUPPORT_SORT_COLUMNS, CHART_TYPE, CHART_STYLE_SETTING_KEYS, DEFAULT_LABEL_FONT_SIZE, DEFAULT_NUMBER_FORMAT_OBJECT, X_AXIS_IS_GROUPBY_COLUMN_KEY_CHART_TYPES, STYLE_COLORS, CHART_DATA_SORT_TYPE, CHART_Y_GROUP_TYPE, HORIZONTAL_BAR_CHART_TYPES, COMPLTETELESS_CHART_TYPES, CHART_STYLE_CONFIG_SETTING_KEYS, MAP_CHART_TYPES } from '../../constants';
|
|
7
6
|
import { getClientFormulaDisplayString } from '../cell-format-utils';
|
|
8
7
|
import { getKnownCollaboratorByEmail, generateDefaultUser, getUsers } from '../collaborator-utils';
|
|
9
8
|
import { getDateColumnFormat, getColumnByKey } from '../column-utils';
|
|
@@ -190,6 +189,9 @@ BaseUtils.getGroupColumn = (table, chart) => {
|
|
|
190
189
|
if (type === CHART_TYPE.HEAT_MAP) {
|
|
191
190
|
return getTableColumnByKey(table, config.time_column_key);
|
|
192
191
|
}
|
|
192
|
+
if (MAP_CHART_TYPES.includes(type)) {
|
|
193
|
+
return getTableColumnByKey(table, config.geo_column_key);
|
|
194
|
+
}
|
|
193
195
|
return getTableColumnByKey(table, config.x_axis_column_key);
|
|
194
196
|
};
|
|
195
197
|
BaseUtils.getColumnGroupColumn = (table, chart) => {
|
|
@@ -544,9 +546,6 @@ BaseUtils.formatEmptyName = (dataList, column_groupby_column_key, emptyName) =>
|
|
|
544
546
|
if (!item.name) {
|
|
545
547
|
item.name = emptyName;
|
|
546
548
|
}
|
|
547
|
-
if (!item.slugid) {
|
|
548
|
-
item.slugId = slugid.nice();
|
|
549
|
-
}
|
|
550
549
|
if (column_groupby_column_key && !item.group_name) {
|
|
551
550
|
item.group_name = emptyName;
|
|
552
551
|
}
|
|
@@ -1933,16 +1933,53 @@ SQLStatisticsUtils.mapSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, colum
|
|
|
1933
1933
|
sqlGeoColumnKey,
|
|
1934
1934
|
sqlSummaryColumnKey
|
|
1935
1935
|
} = chartSQLMap;
|
|
1936
|
-
const
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
}
|
|
1944
|
-
|
|
1945
|
-
|
|
1936
|
+
const {
|
|
1937
|
+
groupbyColumn
|
|
1938
|
+
} = columnMap;
|
|
1939
|
+
if (groupbyColumn.type === 'link-formula') {
|
|
1940
|
+
const {
|
|
1941
|
+
data,
|
|
1942
|
+
key
|
|
1943
|
+
} = groupbyColumn;
|
|
1944
|
+
const {
|
|
1945
|
+
array_data: {
|
|
1946
|
+
geo_format
|
|
1947
|
+
}
|
|
1948
|
+
} = data;
|
|
1949
|
+
if (!geo_format) {
|
|
1950
|
+
return [];
|
|
1951
|
+
}
|
|
1952
|
+
const nameValueMap = sqlRows.reduce((acc, row) => {
|
|
1953
|
+
const geoList = row[key];
|
|
1954
|
+
const value = row[sqlSummaryColumnKey];
|
|
1955
|
+
geoList.forEach(geo => {
|
|
1956
|
+
const name = geo[geo_format];
|
|
1957
|
+
if (!acc[name]) {
|
|
1958
|
+
acc[name] = value;
|
|
1959
|
+
} else {
|
|
1960
|
+
acc[name] += value;
|
|
1961
|
+
}
|
|
1962
|
+
});
|
|
1963
|
+
return acc;
|
|
1964
|
+
}, {});
|
|
1965
|
+
return Object.keys(nameValueMap).reduce((acc, name) => {
|
|
1966
|
+
acc.push({
|
|
1967
|
+
name,
|
|
1968
|
+
value: nameValueMap[name]
|
|
1969
|
+
});
|
|
1970
|
+
return acc;
|
|
1971
|
+
}, []);
|
|
1972
|
+
} else {
|
|
1973
|
+
return sqlRows.reduce((acc, row) => {
|
|
1974
|
+
const name = row[sqlGeoColumnKey];
|
|
1975
|
+
const value = row[sqlSummaryColumnKey];
|
|
1976
|
+
acc.push({
|
|
1977
|
+
name,
|
|
1978
|
+
value
|
|
1979
|
+
});
|
|
1980
|
+
return acc;
|
|
1981
|
+
}, []);
|
|
1982
|
+
}
|
|
1946
1983
|
};
|
|
1947
1984
|
SQLStatisticsUtils.worldMapSQLResult2JavaScript = (chart, sqlRows, chartSQLMap, columnMap, tables) => {
|
|
1948
1985
|
const {
|
|
@@ -1956,25 +1993,67 @@ SQLStatisticsUtils.worldMapSQLResult2JavaScript = (chart, sqlRows, chartSQLMap,
|
|
|
1956
1993
|
const {
|
|
1957
1994
|
sqlSummaryColumnKey
|
|
1958
1995
|
} = chartSQLMap;
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1996
|
+
if (groupbyColumn.type === 'link-formula') {
|
|
1997
|
+
const {
|
|
1998
|
+
data,
|
|
1999
|
+
key
|
|
2000
|
+
} = groupbyColumn;
|
|
2001
|
+
const {
|
|
2002
|
+
array_data: {
|
|
2003
|
+
geo_format
|
|
2004
|
+
}
|
|
2005
|
+
} = data;
|
|
2006
|
+
if (!geo_format) {
|
|
2007
|
+
return [];
|
|
1967
2008
|
}
|
|
1968
|
-
|
|
1969
|
-
const
|
|
1970
|
-
|
|
2009
|
+
const nameValueMap = sqlRows.reduce((acc, row) => {
|
|
2010
|
+
const geoList = row[key];
|
|
2011
|
+
const value = row[sqlSummaryColumnKey];
|
|
2012
|
+
geoList.forEach(geo => {
|
|
2013
|
+
const name = geo[geo_format];
|
|
2014
|
+
if (!acc[name]) {
|
|
2015
|
+
acc[name] = value;
|
|
2016
|
+
} else {
|
|
2017
|
+
acc[name] += value;
|
|
2018
|
+
}
|
|
2019
|
+
});
|
|
2020
|
+
return acc;
|
|
2021
|
+
}, {});
|
|
2022
|
+
return Object.keys(nameValueMap).reduce((acc, name) => {
|
|
2023
|
+
let value = nameValueMap[name];
|
|
2024
|
+
let formatted_value = value;
|
|
2025
|
+
if (summary_type === 'advanced') {
|
|
2026
|
+
value = formatNumericValue(value, summaryColumn);
|
|
2027
|
+
formatted_value = getFormattedValue(value, summaryColumn, summary_method);
|
|
2028
|
+
}
|
|
2029
|
+
acc.push({
|
|
1971
2030
|
name,
|
|
1972
2031
|
value,
|
|
1973
2032
|
formatted_value
|
|
1974
2033
|
});
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
2034
|
+
return acc;
|
|
2035
|
+
}, []);
|
|
2036
|
+
} else {
|
|
2037
|
+
const result = [];
|
|
2038
|
+
sqlRows.forEach(item => {
|
|
2039
|
+
const currentValue = item[groupbyColumn.key];
|
|
2040
|
+
let value = item[sqlSummaryColumnKey];
|
|
2041
|
+
let formatted_value = value;
|
|
2042
|
+
if (summary_type === 'advanced') {
|
|
2043
|
+
value = formatNumericValue(value, summaryColumn);
|
|
2044
|
+
formatted_value = getFormattedValue(value, summaryColumn, summary_method);
|
|
2045
|
+
}
|
|
2046
|
+
if (currentValue) {
|
|
2047
|
+
const name = typeof currentValue === 'string' ? currentValue : currentValue.country_region;
|
|
2048
|
+
result.push({
|
|
2049
|
+
name,
|
|
2050
|
+
value,
|
|
2051
|
+
formatted_value
|
|
2052
|
+
});
|
|
2053
|
+
}
|
|
2054
|
+
});
|
|
2055
|
+
return result;
|
|
2056
|
+
}
|
|
1978
2057
|
};
|
|
1979
2058
|
SQLStatisticsUtils.calculateChart = async (chart, value, callback, sqlRows) => {
|
|
1980
2059
|
const {
|