sea-chart 0.0.44-alpha.0 → 0.0.44-alpha.1

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.
@@ -38,7 +38,7 @@ async function calculateBasicChart(chart, value, _ref) {
38
38
  summary_column_key = chart.y_axis_summary_column_key;
39
39
  groupby_date_granularity = chart.x_axis_date_granularity;
40
40
  groupby_geolocation_granularity = chart.x_axis_geolocation_granularity;
41
- include_empty = chart.x_axis_include_empty;
41
+ include_empty = chart.x_axis_include_empty_cells;
42
42
  }
43
43
  const table = getTableById(value.tables, table_id);
44
44
  const view = table && getViewById(table.views, view_id);
@@ -83,7 +83,7 @@ async function calculateGroupingChart(chart, value, _ref2) {
83
83
  table_id,
84
84
  view_id,
85
85
  x_axis_column_key,
86
- x_axis_include_empty,
86
+ x_axis_include_empty_cells,
87
87
  y_axis_summary_column_key,
88
88
  y_axis_summary_type,
89
89
  y_axis_summary_method,
@@ -95,7 +95,7 @@ async function calculateGroupingChart(chart, value, _ref2) {
95
95
  const column_groupby_geolocation_granularity = chart.column_groupby_geolocation_granularity;
96
96
  let groupby_date_granularity = chart.x_axis_date_granularity;
97
97
  let groupby_geolocation_granularity = chart.x_axis_geolocation_granularity;
98
- let column_groupby_numeric_columns = chart.column_groupby_numeric_columns || [];
98
+ let column_groupby_numeric_columns = chart.summary_columns || [];
99
99
  const table = getTableById(value.tables, table_id);
100
100
  const view = table && getViewById(table.views, view_id);
101
101
  if (!view) {
@@ -117,7 +117,7 @@ async function calculateGroupingChart(chart, value, _ref2) {
117
117
  const yAxisType = null;
118
118
  const statRows = await getViewRows(view, table);
119
119
  const formulaRows = await getTableFormulaResults(table, statRows);
120
- let results = getGroupingChartResults(statRows, formulaRows, groupbyColumn, x_axis_include_empty, groupby_date_granularity, groupby_geolocation_granularity, column_groupby_column_key, column_groupby_date_granularity, column_groupby_geolocation_granularity, y_axis_summary_column_key, y_axis_summary_type, y_axis_summary_method, column_groupby_multiple_numeric_column, column_groupby_numeric_columns, yAxisType, table, value);
120
+ let results = getGroupingChartResults(statRows, formulaRows, groupbyColumn, x_axis_include_empty_cells, groupby_date_granularity, groupby_geolocation_granularity, column_groupby_column_key, column_groupby_date_granularity, column_groupby_geolocation_granularity, y_axis_summary_column_key, y_axis_summary_type, y_axis_summary_method, column_groupby_multiple_numeric_column, column_groupby_numeric_columns, yAxisType, table, value);
121
121
  BaseUtils.sortCharts(results, groupbyColumn, 'name');
122
122
  results = results.map(result => {
123
123
  return {
@@ -321,9 +321,9 @@ async function calculateGeolocationBasicChart(chart, value, _ref3) {
321
321
  type,
322
322
  table_id,
323
323
  view_id,
324
- geo_column,
324
+ geo_column_key,
325
325
  summary_type,
326
- summary_column,
326
+ summary_column_key,
327
327
  summary_method
328
328
  } = chart;
329
329
  const table = getTableById(value.tables, table_id);
@@ -331,7 +331,7 @@ async function calculateGeolocationBasicChart(chart, value, _ref3) {
331
331
  if (!view) {
332
332
  return;
333
333
  }
334
- const geoColumn = geo_column && getTableColumnByKey(table, geo_column);
334
+ const geoColumn = geo_column_key && getTableColumnByKey(table, geo_column_key);
335
335
  if (!geoColumn) {
336
336
  return;
337
337
  }
@@ -341,7 +341,7 @@ async function calculateGeolocationBasicChart(chart, value, _ref3) {
341
341
  } else {
342
342
  geolocationGranularity = fixGeoGranularity(chart);
343
343
  }
344
- const summaryColumn = getTableColumnByKey(table, summary_column);
344
+ const summaryColumn = getTableColumnByKey(table, summary_column_key);
345
345
  const statRows = await getViewRows(view, table);
346
346
  const formulaRows = await getTableFormulaResults(table, statRows);
347
347
  const geoColumnType = geoColumn.type;
@@ -391,7 +391,7 @@ async function calculateCustomBar(statItem, value, _ref4) {
391
391
  x_axis_column_key,
392
392
  x_axis_date_granularity,
393
393
  x_axis_geolocation_granularity,
394
- x_axis_include_empty,
394
+ x_axis_include_empty_cells,
395
395
  y_axises
396
396
  } = statItem;
397
397
  const table = getTableById(value.tables, table_id);
@@ -435,7 +435,7 @@ async function calculateCustomBar(statItem, value, _ref4) {
435
435
  column_key: summary_column_key,
436
436
  summary_method
437
437
  } = numericSummaryColumn;
438
- const currentResults = getGroupbyNumericColumnsChartResults(statRows, formulaRows, groupbyColumn, x_axis_include_empty, groupbyDateGranularity, groupbyGeolocationGranularity, summary_column_key, columnGroupbyDateGranularity, columnGroupbyGeolocationGranularity, CHART_SUMMARY_TYPE.ADVANCED, summary_method, yAxisType, table, value);
438
+ const currentResults = getGroupbyNumericColumnsChartResults(statRows, formulaRows, groupbyColumn, x_axis_include_empty_cells, groupbyDateGranularity, groupbyGeolocationGranularity, summary_column_key, columnGroupbyDateGranularity, columnGroupbyGeolocationGranularity, CHART_SUMMARY_TYPE.ADVANCED, summary_method, yAxisType, table, value);
439
439
  results = results.concat(currentResults);
440
440
  });
441
441
  }
@@ -9,12 +9,12 @@ async function calculator(chart, dtableValue, _ref) {
9
9
  const {
10
10
  table_id,
11
11
  view_id,
12
- numeric_column,
12
+ numeric_column_key,
13
13
  summary_method
14
14
  } = chart;
15
15
  const selectedTable = getTableById(dtableValue.tables, table_id);
16
16
  const selectedView = selectedTable && getViewById(selectedTable.views, view_id);
17
- const selectedColumn = getTableColumnByKey(selectedTable, numeric_column);
17
+ const selectedColumn = getTableColumnByKey(selectedTable, numeric_column_key);
18
18
  const _isNumericColumn = selectedColumn && isNumericColumn(selectedColumn);
19
19
  const statRows = await getViewRows(selectedView, selectedTable);
20
20
  const formulaRows = _isNumericColumn ? await getTableFormulaResults(selectedTable, statRows) : {};
@@ -12,7 +12,7 @@ async function calculator(chart, value, _ref) {
12
12
  table_id,
13
13
  view_id,
14
14
  x_axis_column_key,
15
- x_axis_include_empty,
15
+ x_axis_include_empty_cells,
16
16
  x_axis_date_granularity: groupby_date_granularity,
17
17
  x_axis_geolocation_granularity: groupby_geolocation_granularity,
18
18
  y_axis_left_summary_column,
@@ -84,13 +84,13 @@ async function calculator(chart, value, _ref) {
84
84
  leftResultMap.set(name, currentValue);
85
85
  });
86
86
  }
87
- if (label.length === 0 && x_axis_include_empty) {
87
+ if (label.length === 0 && x_axis_include_empty_cells) {
88
88
  let currentValue = leftResultMap.get(null) || 0;
89
89
  currentValue += 1;
90
90
  leftResultMap.set(null, currentValue);
91
91
  }
92
92
  } else {
93
- if (x_axis_include_empty || label) {
93
+ if (x_axis_include_empty_cells || label) {
94
94
  let currentLabelCount = leftResultMap.get(label) || 0;
95
95
  currentLabelCount = currentLabelCount + 1;
96
96
  leftResultMap.set(label, currentLabelCount);
@@ -116,7 +116,7 @@ async function calculator(chart, value, _ref) {
116
116
  leftResultMap.set(name, currentLabelMap);
117
117
  });
118
118
  }
119
- if (label.length === 0 && x_axis_include_empty) {
119
+ if (label.length === 0 && x_axis_include_empty_cells) {
120
120
  let currentValue = leftResultMap.get(null) || {};
121
121
  leftSummaryColumnKeys.forEach(key => {
122
122
  const cellValue = getCellValue(row, formulaRow, {
@@ -132,7 +132,7 @@ async function calculator(chart, value, _ref) {
132
132
  leftResultMap.set(null, currentValue);
133
133
  }
134
134
  } else {
135
- if (x_axis_include_empty || label) {
135
+ if (x_axis_include_empty_cells || label) {
136
136
  const currentValue = leftResultMap.get(label) || {};
137
137
  leftSummaryColumnKeys.forEach(key => {
138
138
  const cellValue = getCellValue(row, formulaRow, {
@@ -160,13 +160,13 @@ async function calculator(chart, value, _ref) {
160
160
  rightResultMap.set(name, currentValue);
161
161
  });
162
162
  }
163
- if (label.length === 0 && x_axis_include_empty) {
163
+ if (label.length === 0 && x_axis_include_empty_cells) {
164
164
  let currentValue = rightResultMap.get(null) || 0;
165
165
  currentValue += 1;
166
166
  rightResultMap.set(null, currentValue);
167
167
  }
168
168
  } else {
169
- if (x_axis_include_empty || label) {
169
+ if (x_axis_include_empty_cells || label) {
170
170
  let currentLabelCount = rightResultMap.get(label) || 0;
171
171
  currentLabelCount = currentLabelCount + 1;
172
172
  rightResultMap.set(label, currentLabelCount);
@@ -185,7 +185,7 @@ async function calculator(chart, value, _ref) {
185
185
  rightResultMap.set(name, currentLabelList);
186
186
  });
187
187
  }
188
- if (label.length === 0 && x_axis_include_empty) {
188
+ if (label.length === 0 && x_axis_include_empty_cells) {
189
189
  let currentValue = rightResultMap.get(null) || [];
190
190
  if (isNumber(cellValue)) {
191
191
  currentValue.push(cellValue);
@@ -193,7 +193,7 @@ async function calculator(chart, value, _ref) {
193
193
  rightResultMap.set(null, currentValue);
194
194
  }
195
195
  } else {
196
- if (x_axis_include_empty || label) {
196
+ if (x_axis_include_empty_cells || label) {
197
197
  const currentLabelList = rightResultMap.get(label) || [];
198
198
  if (isNumber(cellValue)) {
199
199
  currentLabelList.push(cellValue);
@@ -13,7 +13,7 @@ async function calculator(chart, value, _ref) {
13
13
  x_axis_column_key,
14
14
  y_axis_summary_type,
15
15
  y_axis_summary_method,
16
- y_axis_column_key,
16
+ y_axis_summary_column_key,
17
17
  x_axis_date_granularity,
18
18
  x_axis_date_range_start,
19
19
  x_axis_date_range_end,
@@ -32,7 +32,7 @@ async function calculator(chart, value, _ref) {
32
32
  if (!groupbyColumn) {
33
33
  return [];
34
34
  }
35
- const summaryColumn = getTableColumnByKey(table, y_axis_column_key) || {};
35
+ const summaryColumn = getTableColumnByKey(table, y_axis_summary_column_key) || {};
36
36
  const statRows = await getViewRows(view, table);
37
37
  const formulaRows = await getTableFormulaResults(table, statRows);
38
38
  const dateRangeResultMap = new Map();
@@ -11,9 +11,9 @@ async function calculator(chart, value, _ref) {
11
11
  const {
12
12
  table_id,
13
13
  view_id,
14
- name_column,
15
- completed_column,
16
- target_column,
14
+ groupby_column_key,
15
+ completed_column_key,
16
+ target_column_key,
17
17
  group_column,
18
18
  date_granularity,
19
19
  geolocation_granularity
@@ -23,7 +23,7 @@ async function calculator(chart, value, _ref) {
23
23
  if (!view) {
24
24
  return [];
25
25
  }
26
- const nameColumn = getTableColumnByKey(table, name_column);
26
+ const nameColumn = getTableColumnByKey(table, groupby_column_key);
27
27
  if (!nameColumn) return [];
28
28
  const statRows = await getViewRows(view, table);
29
29
  const formulaRows = await getTableFormulaResults(table, statRows);
@@ -32,8 +32,8 @@ async function calculator(chart, value, _ref) {
32
32
  const isGroupChart = !!groupColumn;
33
33
  let result = [];
34
34
  if (!isGroupChart) {
35
- const completedColumn = getTableColumnByKey(table, completed_column);
36
- const targetColumn = getTableColumnByKey(table, target_column);
35
+ const completedColumn = getTableColumnByKey(table, completed_column_key);
36
+ const targetColumn = getTableColumnByKey(table, target_column_key);
37
37
  let labelCountMap = {};
38
38
  let labels = [];
39
39
  statRows.forEach(row => {
@@ -96,8 +96,8 @@ async function calculator(chart, value, _ref) {
96
96
  }
97
97
  });
98
98
  } else {
99
- const completedColumn = getTableColumnByKey(table, completed_column);
100
- const targetColumn = getTableColumnByKey(table, target_column);
99
+ const completedColumn = getTableColumnByKey(table, completed_column_key);
100
+ const targetColumn = getTableColumnByKey(table, target_column_key);
101
101
  let labelCountMap = {};
102
102
  let colorMap = {};
103
103
  let labelGroups = [];
@@ -9,15 +9,15 @@ async function calculator(chart, value, _ref) {
9
9
  const {
10
10
  table_id,
11
11
  view_id,
12
- target_value_column,
12
+ target_value_column_key,
13
13
  target_value_column_summary_method,
14
- total_value_column,
14
+ total_value_column_key,
15
15
  total_value_column_summary_method
16
16
  } = chart;
17
17
  const selectedTable = getTableById(value.tables, table_id);
18
18
  const selectedView = selectedTable && getViewById(selectedTable.views, view_id);
19
- const selectedColumn1 = getTableColumnByKey(selectedTable, target_value_column);
20
- const selectedColumn2 = getTableColumnByKey(selectedTable, total_value_column);
19
+ const selectedColumn1 = getTableColumnByKey(selectedTable, target_value_column_key);
20
+ const selectedColumn2 = getTableColumnByKey(selectedTable, total_value_column_key);
21
21
  const statRows = await getViewRows(selectedView, selectedTable);
22
22
  if (statRows.length === 0) {
23
23
  return 0;
@@ -60,19 +60,19 @@ async function calculator(chart, dtableValue, _ref) {
60
60
  const {
61
61
  table_id,
62
62
  view_id,
63
- column,
63
+ column_key,
64
64
  summary_type,
65
- summary_column,
65
+ summary_column_key,
66
66
  summary_method,
67
- group_column
67
+ group_column_key
68
68
  } = chart;
69
69
  const table = getTableById(dtableValue.tables, table_id);
70
70
  const view = table && getViewById(table.views, view_id);
71
- const columnItem = getTableColumnByKey(table, column);
71
+ const columnItem = getTableColumnByKey(table, column_key);
72
72
  const rows = await getViewRows(view, table);
73
73
  const formulaRows = await getTableFormulaResults(table, rows);
74
- const groupColumn = getTableColumnByKey(table, group_column);
75
- const numericColumn = summary_column && getTableColumnByKey(table, summary_column);
74
+ const groupColumn = getTableColumnByKey(table, group_column_key);
75
+ const numericColumn = summary_column_key && getTableColumnByKey(table, summary_column_key);
76
76
  const groupItems = getGroupItems(rows, groupColumn);
77
77
  if (groupColumn.length === 0) return;
78
78
  let result = {};
@@ -18,7 +18,7 @@ async function calculateOneDimensionTable(chart, value, _ref) {
18
18
  groupby_include_empty_cells: include_empty,
19
19
  groupby_date_granularity,
20
20
  groupby_geolocation_granularity,
21
- summary_columns_option
21
+ summary_columns
22
22
  } = chart;
23
23
  const table = getTableById(value.tables, table_id);
24
24
  const view = table && getViewById(table.views, view_id);
@@ -54,7 +54,7 @@ async function calculateOneDimensionTable(chart, value, _ref) {
54
54
  }
55
55
  }
56
56
  });
57
- const summary_columns_option_keys = Array.isArray(summary_columns_option) ? summary_columns_option.map(option => option.key) : [];
57
+ const summary_columns_option_keys = Array.isArray(summary_columns) ? summary_columns.map(option => option.key) : [];
58
58
  const statisticColumnKeys = [summary_column_key, ...summary_columns_option_keys];
59
59
  const validStatisticColumnKeys = statisticColumnKeys;
60
60
  let statisticColumns = validStatisticColumnKeys.map(key => {
@@ -66,7 +66,7 @@ async function calculateOneDimensionTable(chart, value, _ref) {
66
66
  if (statisticColumns.length > 0) {
67
67
  statisticColumns[0].method = summary_method;
68
68
  }
69
- Array.isArray(summary_columns_option) && summary_columns_option.forEach((option, index) => {
69
+ Array.isArray(summary_columns) && summary_columns.forEach((option, index) => {
70
70
  if (statisticColumns[index + 1]) {
71
71
  statisticColumns[index + 1].method = option.method;
72
72
  }
@@ -35,18 +35,18 @@ async function calculator(chart, value, _ref) {
35
35
  const {
36
36
  table_id,
37
37
  view_id,
38
- x_axis_column,
39
- y_axis_column,
40
- group_column
38
+ x_axis_column_key,
39
+ y_axis_column_key,
40
+ column_groupby_column_key
41
41
  } = chart;
42
42
  const table = getTableById(value.tables, table_id);
43
43
  const view = table && getViewById(table.views, view_id);
44
44
  if (!view) {
45
45
  return [];
46
46
  }
47
- const selectedXAxisColumn = getTableColumnByKey(table, x_axis_column);
48
- const selectedYAxisColumn = getTableColumnByKey(table, y_axis_column);
49
- const selectedGroupColumn = getTableColumnByKey(table, group_column);
47
+ const selectedXAxisColumn = getTableColumnByKey(table, x_axis_column_key);
48
+ const selectedYAxisColumn = getTableColumnByKey(table, y_axis_column_key);
49
+ const selectedGroupColumn = getTableColumnByKey(table, column_groupby_column_key);
50
50
  const statRows = await getViewRows(view, table);
51
51
  const formulaRows = await getTableFormulaResults(table, statRows);
52
52
  const data = [];
@@ -14,19 +14,19 @@ async function calculator(chart, value, _ref) {
14
14
  const {
15
15
  table_id,
16
16
  view_id,
17
- date_column,
17
+ date_column_key,
18
18
  date_granularity,
19
- summary_column,
19
+ summary_column_key,
20
20
  summary_type,
21
21
  summary_method
22
22
  } = chart;
23
23
  const selectedTable = getTableById(value.tables, table_id);
24
24
  const selectedView = selectedTable && getViewById(selectedTable.views, view_id);
25
- const selectedColumn = getTableColumnByKey(selectedTable, date_column);
25
+ const selectedColumn = getTableColumnByKey(selectedTable, date_column_key);
26
26
  const resultMap = new Map();
27
27
  let formulaRows = {};
28
28
  const rows = await getViewRows(selectedView, selectedTable);
29
- const numericColumn = getTableColumnByKey(selectedTable, summary_column);
29
+ const numericColumn = getTableColumnByKey(selectedTable, summary_column_key);
30
30
  if (summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
31
31
  if (FORMULA_COLUMN_TYPES_MAP[numericColumn.type]) {
32
32
  formulaRows = await getTableFormulaResults(selectedTable, rows);
@@ -59,7 +59,7 @@ async function calculator(chart, value, _ref) {
59
59
  const {
60
60
  compareValue: value1,
61
61
  comparedValue: value2
62
- } = summaryDurationResult(resultMap, date_granularity, summary_type, summary_column, false);
62
+ } = summaryDurationResult(resultMap, date_granularity, summary_type, summary_column_key, false);
63
63
  currentValues = value1;
64
64
  previousValues = value2;
65
65
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "0.0.44-alpha.0",
3
+ "version": "0.0.44-alpha.1",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@antv/data-set": "0.11.8",