sea-chart 0.0.1-beta
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/README.md +120 -0
- package/dist/assets/icons/area-chart.svg +10 -0
- package/dist/assets/icons/bar-chart.svg +12 -0
- package/dist/assets/icons/card.svg +22 -0
- package/dist/assets/icons/combination-chart.svg +17 -0
- package/dist/assets/icons/dtable-logo.svg +16 -0
- package/dist/assets/icons/facet-chart.svg +12 -0
- package/dist/assets/icons/gauge.svg +18 -0
- package/dist/assets/icons/heat-map.svg +14 -0
- package/dist/assets/icons/histogram.svg +12 -0
- package/dist/assets/icons/line-chart.svg +12 -0
- package/dist/assets/icons/map.svg +20 -0
- package/dist/assets/icons/pie-chart.svg +11 -0
- package/dist/assets/icons/rectangular-tree-diagram.svg +10 -0
- package/dist/assets/icons/scatter-chart.svg +15 -0
- package/dist/assets/icons/type-change.svg +17 -0
- package/dist/assets/img/area-chart.png +0 -0
- package/dist/assets/img/area-group-chart.png +0 -0
- package/dist/assets/img/bar-group.png +0 -0
- package/dist/assets/img/bar-stack.png +0 -0
- package/dist/assets/img/bar.png +0 -0
- package/dist/assets/img/combination-chart.png +0 -0
- package/dist/assets/img/compared-chart.png +0 -0
- package/dist/assets/img/completeness-chart.png +0 -0
- package/dist/assets/img/custom-bar.png +0 -0
- package/dist/assets/img/dashboard-chart.png +0 -0
- package/dist/assets/img/group-completeness-chart.png +0 -0
- package/dist/assets/img/group_line.png +0 -0
- package/dist/assets/img/heat-map.png +0 -0
- package/dist/assets/img/horizontal-bar.png +0 -0
- package/dist/assets/img/horizontal-group-bar.png +0 -0
- package/dist/assets/img/line.png +0 -0
- package/dist/assets/img/map-bubble.png +0 -0
- package/dist/assets/img/map.png +0 -0
- package/dist/assets/img/mirror.png +0 -0
- package/dist/assets/img/number-card.png +0 -0
- package/dist/assets/img/pie.png +0 -0
- package/dist/assets/img/pivot-table.png +0 -0
- package/dist/assets/img/ring.png +0 -0
- package/dist/assets/img/scatter.png +0 -0
- package/dist/assets/img/stacked-horizontal-bar.png +0 -0
- package/dist/assets/img/treemap.png +0 -0
- package/dist/assets/img/trend-chart.png +0 -0
- package/dist/assets/img/world-map-bubble.png +0 -0
- package/dist/assets/img/world-map.png +0 -0
- package/dist/components/collaborator/index.js +26 -0
- package/dist/components/icon/index.css +5 -0
- package/dist/components/icon/index.js +24 -0
- package/dist/components/index.js +8 -0
- package/dist/components/loading/index.css +54 -0
- package/dist/components/loading/index.js +12 -0
- package/dist/components/number-input/index.js +31 -0
- package/dist/components/pixel-editor/index.css +29 -0
- package/dist/components/pixel-editor/index.js +38 -0
- package/dist/components/select-group/index.css +67 -0
- package/dist/components/select-group/index.js +52 -0
- package/dist/components/types-dialog/index.css +97 -0
- package/dist/components/types-dialog/index.js +116 -0
- package/dist/constants/geolocation.js +11 -0
- package/dist/constants/index.js +184 -0
- package/dist/constants/model.js +187 -0
- package/dist/constants/style.js +15 -0
- package/dist/constants/type-image.js +59 -0
- package/dist/constants/type.js +124 -0
- package/dist/context.js +33 -0
- package/dist/editor/index.css +0 -0
- package/dist/editor/index.js +36 -0
- package/dist/index.js +6 -0
- package/dist/intl.js +37 -0
- package/dist/locale/index.js +18 -0
- package/dist/locale/lang/de.js +141 -0
- package/dist/locale/lang/en.js +143 -0
- package/dist/locale/lang/es.js +141 -0
- package/dist/locale/lang/fr.js +141 -0
- package/dist/locale/lang/pt.js +141 -0
- package/dist/locale/lang/ru.js +141 -0
- package/dist/locale/lang/zh_CN.js +143 -0
- package/dist/model/area-group.js +41 -0
- package/dist/model/area.js +32 -0
- package/dist/model/bar-group.js +44 -0
- package/dist/model/bar-stack.js +41 -0
- package/dist/model/bar.js +38 -0
- package/dist/model/base-model.js +9 -0
- package/dist/model/basic-number-card.js +22 -0
- package/dist/model/chart.js +23 -0
- package/dist/model/combination.js +38 -0
- package/dist/model/compare-bar.js +39 -0
- package/dist/model/completeness-group.js +24 -0
- package/dist/model/completeness.js +18 -0
- package/dist/model/dashboard.js +16 -0
- package/dist/model/generic-model.js +224 -0
- package/dist/model/heat-map.js +23 -0
- package/dist/model/horizontal-bar.js +38 -0
- package/dist/model/horizontal-group-bar.js +43 -0
- package/dist/model/index.js +63 -0
- package/dist/model/line-group.js +44 -0
- package/dist/model/line.js +38 -0
- package/dist/model/map-bubble.js +27 -0
- package/dist/model/map.js +27 -0
- package/dist/model/mirror.js +26 -0
- package/dist/model/pie.js +26 -0
- package/dist/model/ring.js +26 -0
- package/dist/model/scatter.js +19 -0
- package/dist/model/stacked-horizontal-bar.js +32 -0
- package/dist/model/table.js +23 -0
- package/dist/model/tree-map.js +20 -0
- package/dist/model/trend.js +24 -0
- package/dist/model/user.js +15 -0
- package/dist/model/world-map-bubble.js +26 -0
- package/dist/model/world-map.js +26 -0
- package/dist/settings/advance-bar-settings/data-settings.js +143 -0
- package/dist/settings/advance-bar-settings/index.js +3 -0
- package/dist/settings/advance-bar-settings/style-settings.js +161 -0
- package/dist/settings/bar-settings/data-settings.js +162 -0
- package/dist/settings/bar-settings/index.js +3 -0
- package/dist/settings/bar-settings/style-settings.js +179 -0
- package/dist/settings/basic-number-card/data-settings.js +126 -0
- package/dist/settings/basic-number-card/index.js +3 -0
- package/dist/settings/basic-number-card/style-settings.js +42 -0
- package/dist/settings/combination-settings/data-settings.js +279 -0
- package/dist/settings/combination-settings/index.js +3 -0
- package/dist/settings/combination-settings/style-settings.js +174 -0
- package/dist/settings/dashboard-settings/data-settings.js +179 -0
- package/dist/settings/dashboard-settings/index.js +2 -0
- package/dist/settings/data-settings.js +73 -0
- package/dist/settings/horizontal-bar-settings/data-settings.js +55 -0
- package/dist/settings/horizontal-bar-settings/index.js +3 -0
- package/dist/settings/horizontal-bar-settings/style-settings.js +46 -0
- package/dist/settings/index.css +85 -0
- package/dist/settings/index.js +76 -0
- package/dist/settings/pie-settings/data-settings.js +146 -0
- package/dist/settings/pie-settings/index.js +3 -0
- package/dist/settings/pie-settings/style-settings.js +141 -0
- package/dist/settings/style-settings.js +118 -0
- package/dist/settings/table-settings/data-settings.js +549 -0
- package/dist/settings/table-settings/index.js +2 -0
- package/dist/settings/time-comparison-settings/data-settings.js +172 -0
- package/dist/settings/time-comparison-settings/index.js +3 -0
- package/dist/settings/time-comparison-settings/style-settings.js +213 -0
- package/dist/settings/widgets/basic-summary/index.css +12 -0
- package/dist/settings/widgets/basic-summary/index.js +176 -0
- package/dist/settings/widgets/chart-type/index.css +31 -0
- package/dist/settings/widgets/chart-type/index.js +59 -0
- package/dist/settings/widgets/common-data-settings.js +48 -0
- package/dist/settings/widgets/data-filter/index.css +17 -0
- package/dist/settings/widgets/data-filter/index.js +89 -0
- package/dist/settings/widgets/data-sort.js +44 -0
- package/dist/settings/widgets/date-summary-item.js +111 -0
- package/dist/settings/widgets/display-values-settings/index.css +13 -0
- package/dist/settings/widgets/display-values-settings/index.js +42 -0
- package/dist/settings/widgets/divider/index.css +4 -0
- package/dist/settings/widgets/divider/index.js +12 -0
- package/dist/settings/widgets/font-settings/font-size-settings.js +33 -0
- package/dist/settings/widgets/font-settings/font-weight-settings.js +44 -0
- package/dist/settings/widgets/font-settings/index.js +3 -0
- package/dist/settings/widgets/group-by.js +160 -0
- package/dist/settings/widgets/label-color.js +30 -0
- package/dist/settings/widgets/min-max-setting.js +52 -0
- package/dist/settings/widgets/mininum-slice-percent.js +63 -0
- package/dist/settings/widgets/numeric-summary-item.js +90 -0
- package/dist/settings/widgets/select-table/index.css +0 -0
- package/dist/settings/widgets/select-table/index.js +38 -0
- package/dist/settings/widgets/stack.js +50 -0
- package/dist/settings/widgets/summary-method-setting.js +66 -0
- package/dist/settings/widgets/summary-settings.js +411 -0
- package/dist/settings/widgets/switch/index.css +37 -0
- package/dist/settings/widgets/switch/index.js +24 -0
- package/dist/settings/widgets/text-horizontal-settings.js +25 -0
- package/dist/settings/widgets/time-picker.js +173 -0
- package/dist/settings/widgets/title-settings/index.js +60 -0
- package/dist/settings/widgets/title-settings/title-text.js +25 -0
- package/dist/settings/widgets/x-axios.js +0 -0
- package/dist/settings/widgets/y-axis-group-settings.js +438 -0
- package/dist/utils/cell-format-utils.js +42 -0
- package/dist/utils/chart-data-sql.js +606 -0
- package/dist/utils/chart-utils.js +1800 -0
- package/dist/utils/chart.js +6 -0
- package/dist/utils/collaborator-utils.js +39 -0
- package/dist/utils/column-2-sql-column.js +551 -0
- package/dist/utils/column-utils.js +208 -0
- package/dist/utils/custom-g2.js +612 -0
- package/dist/utils/date-translate.js +66 -0
- package/dist/utils/index.js +48 -0
- package/dist/utils/key-generator.js +13 -0
- package/dist/utils/object-utils.js +45 -0
- package/dist/utils/options-utils.js +60 -0
- package/dist/view/index.css +53 -0
- package/dist/view/index.js +189 -0
- package/dist/view/title/index.css +3 -0
- package/dist/view/title/index.js +46 -0
- package/dist/view/wrapper/area.js +150 -0
- package/dist/view/wrapper/bar-group.js +148 -0
- package/dist/view/wrapper/bar.js +138 -0
- package/dist/view/wrapper/basic-number-card.js +127 -0
- package/dist/view/wrapper/chart-component.js +261 -0
- package/dist/view/wrapper/combination.js +399 -0
- package/dist/view/wrapper/dashboard.js +164 -0
- package/dist/view/wrapper/horizontal-bar-group.js +149 -0
- package/dist/view/wrapper/horizontal-bar.js +140 -0
- package/dist/view/wrapper/horizontal-component.js +78 -0
- package/dist/view/wrapper/index.js +200 -0
- package/dist/view/wrapper/line-group.js +145 -0
- package/dist/view/wrapper/line.js +157 -0
- package/dist/view/wrapper/pie.js +185 -0
- package/dist/view/wrapper/ring.js +264 -0
- package/dist/view/wrapper/table/index.css +103 -0
- package/dist/view/wrapper/table/index.js +31 -0
- package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +144 -0
- package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +198 -0
- package/dist/view/wrapper/table/pivot-table-display-name.js +247 -0
- package/dist/view/wrapper/table/two-dimension-table.js +249 -0
- package/dist/view/wrapper/treemap.js +186 -0
- package/package.json +151 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BaseModel from './base-model';
|
|
2
|
+
import { isBoolean } from '../utils';
|
|
3
|
+
import { LABEL_COLORS, CHART_TYPE } from '../constants';
|
|
4
|
+
class Completeness extends BaseModel {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
super({
|
|
7
|
+
...options,
|
|
8
|
+
type: CHART_TYPE.COMPLETENESS
|
|
9
|
+
});
|
|
10
|
+
this.name_column_key = options.x_axis_column_key;
|
|
11
|
+
this.completed_column_key = options.completed_column_key;
|
|
12
|
+
this.target_column_key = options.target_column_key;
|
|
13
|
+
this.completed_color = options.completed_color || LABEL_COLORS[0];
|
|
14
|
+
this.display_percentage = isBoolean(options.display_percentage) ? options.display_percentage : true;
|
|
15
|
+
this.label_font_size = options.label_font_size;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export default Completeness;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import BaseModel from './base-model';
|
|
2
|
+
import { CHART_SUMMARY_TYPE, CHART_TYPE } from '../constants';
|
|
3
|
+
class Dashboard extends BaseModel {
|
|
4
|
+
constructor(options) {
|
|
5
|
+
super({
|
|
6
|
+
...options,
|
|
7
|
+
type: CHART_TYPE.DASHBOARD
|
|
8
|
+
});
|
|
9
|
+
this.name = '';
|
|
10
|
+
this.target_value_column_key = options.target_value_column_key;
|
|
11
|
+
this.target_value_column_summary_method = options.target_value_column_summary_method || CHART_SUMMARY_TYPE.ROW_COUNT;
|
|
12
|
+
this.total_value_column_key = options.total_value_column_key;
|
|
13
|
+
this.total_value_column_summary_method = options.total_value_column_summary_method || CHART_SUMMARY_TYPE.ROW_COUNT;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export default Dashboard;
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { isNumber } from 'dtable-utils';
|
|
2
|
+
import BaseModel from './base-model';
|
|
3
|
+
import { isBoolean, getChartConfigValueByKey } from '../utils';
|
|
4
|
+
import { DATE_GRANULATES, DEFAULT_LABEL_FONT_SIZE, GEOLOCATION_GRANULATES, LABEL_POSITION_TYPE, CHART_SUMMARY_TYPE, GENERIC_KEY, CHART_KEY, LEGEND_DIRECTION } from '../constants';
|
|
5
|
+
export default class GenericModel extends BaseModel {
|
|
6
|
+
constructor(object) {
|
|
7
|
+
const options = object || {};
|
|
8
|
+
super(options);
|
|
9
|
+
|
|
10
|
+
// x data
|
|
11
|
+
this.x_axis_column_key = getChartConfigValueByKey(GENERIC_KEY.X_AXIS_COLUMN_KEY, options);
|
|
12
|
+
this.x_axis_include_empty_cells = getChartConfigValueByKey(GENERIC_KEY.X_AXIS_INCLUDE_EMPTY_CELLS, options);
|
|
13
|
+
this.x_axis_date_granularity = getChartConfigValueByKey(GENERIC_KEY.X_AXIS_DATE_GRANULARITY, options);
|
|
14
|
+
this.x_axis_geolocation_granularity = getChartConfigValueByKey(GENERIC_KEY.X_AXIS_GEOLOCATION_GRANULARITY, options);
|
|
15
|
+
|
|
16
|
+
// set default value
|
|
17
|
+
if (!isBoolean(this.x_axis_include_empty_cells)) {
|
|
18
|
+
this.x_axis_include_empty_cells = false;
|
|
19
|
+
}
|
|
20
|
+
if (this.x_axis_date_granularity && !DATE_GRANULATES.includes(this.x_axis_date_granularity)) {
|
|
21
|
+
this.x_axis_date_granularity = CHART_SUMMARY_TYPE.MONTH;
|
|
22
|
+
}
|
|
23
|
+
if (this.x_axis_geolocation_granularity && !GEOLOCATION_GRANULATES.includes(this.x_axis_geolocation_granularity)) {
|
|
24
|
+
this.x_axis_geolocation_granularity = CHART_SUMMARY_TYPE.DISTRICT;
|
|
25
|
+
}
|
|
26
|
+
this.x_axis_date_range_start = getChartConfigValueByKey(CHART_KEY.X_AXIS_DATE_RANGE_START, options);
|
|
27
|
+
this.x_axis_date_range_end = getChartConfigValueByKey(CHART_KEY.X_AXIS_DATE_RANGE_END, options);
|
|
28
|
+
this.x_axis_compared_date_range_start = getChartConfigValueByKey(CHART_KEY.X_AXIS_COMPARED_DATE_RANGE_START, options);
|
|
29
|
+
this.x_axis_compared_date_range_end = getChartConfigValueByKey(CHART_KEY.X_AXIS_COMPARED_DATE_RANGE_END, options);
|
|
30
|
+
|
|
31
|
+
// x style
|
|
32
|
+
this.x_axis_show_label = getChartConfigValueByKey(GENERIC_KEY.X_AXIS_SHOW_LABEL, options);
|
|
33
|
+
this.x_axis_label_position = getChartConfigValueByKey(GENERIC_KEY.X_AXIS_LABEL_POSITION, options) || LABEL_POSITION_TYPE.CENTER;
|
|
34
|
+
if (!isBoolean(this.x_axis_show_label)) {
|
|
35
|
+
this.x_axis_show_label = null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// y data
|
|
39
|
+
this.y_axis_summary_column_key = getChartConfigValueByKey(GENERIC_KEY.Y_AXIS_SUMMARY_COLUMN_KEY, options);
|
|
40
|
+
this.y_axis_summary_type = getChartConfigValueByKey(GENERIC_KEY.Y_AXIS_SUMMARY_TYPE, options);
|
|
41
|
+
this.y_axis_summary_method = getChartConfigValueByKey(GENERIC_KEY.Y_AXIS_SUMMARY_METHOD, options);
|
|
42
|
+
if (this.y_axis_summary_method === CHART_SUMMARY_TYPE.ROW_COUNT) {
|
|
43
|
+
this.y_axis_summary_method = CHART_SUMMARY_TYPE.MAX;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// y style
|
|
47
|
+
this.color_option = getChartConfigValueByKey(CHART_KEY.COLOR_OPTION, options);
|
|
48
|
+
this.y_axis_label_color = getChartConfigValueByKey(GENERIC_KEY.Y_AXIS_LABEL_COLOR, options);
|
|
49
|
+
this.y_axis_label_color_rules = getChartConfigValueByKey(GENERIC_KEY.Y_AXIS_LABEL_COLOR_RULES, options);
|
|
50
|
+
this.y_axis_show_value = getChartConfigValueByKey(GENERIC_KEY.Y_AXIS_SHOW_VALUE, options);
|
|
51
|
+
this.y_axis_show_label = getChartConfigValueByKey(GENERIC_KEY.Y_AXIS_SHOW_LABEL, options);
|
|
52
|
+
if (!isBoolean(this.y_axis_show_value)) {
|
|
53
|
+
this.y_axis_show_value = null;
|
|
54
|
+
}
|
|
55
|
+
if (!isBoolean(this.y_axis_show_label)) {
|
|
56
|
+
this.y_axis_show_label = null;
|
|
57
|
+
}
|
|
58
|
+
this.y_axis_label_position = getChartConfigValueByKey(GENERIC_KEY.Y_AXIS_LABEL_POSITION, options) || LABEL_POSITION_TYPE.CENTER;
|
|
59
|
+
this.y_axis_auto_range = getChartConfigValueByKey(GENERIC_KEY.Y_AXIS_AUTO_RANGE, options);
|
|
60
|
+
this.y_axis_min = getChartConfigValueByKey(GENERIC_KEY.Y_AXIS_MIN, options);
|
|
61
|
+
this.y_axis_max = getChartConfigValueByKey(GENERIC_KEY.Y_AXIS_MAX, options);
|
|
62
|
+
if (!isBoolean(this.y_axis_auto_range)) {
|
|
63
|
+
this.y_axis_auto_range = true;
|
|
64
|
+
}
|
|
65
|
+
if (!isNumber(this.y_axis_min)) {
|
|
66
|
+
this.y_axis_min = null;
|
|
67
|
+
}
|
|
68
|
+
if (!isNumber(this.y_axis_max)) {
|
|
69
|
+
this.y_axis_max = null;
|
|
70
|
+
}
|
|
71
|
+
this.y_axis_use_stack = getChartConfigValueByKey(CHART_KEY.Y_AXIS_USE_STACK, options);
|
|
72
|
+
if (!isBoolean(this.y_axis_use_stack)) {
|
|
73
|
+
this.y_axis_use_stack = null;
|
|
74
|
+
}
|
|
75
|
+
this.y_axis_compare_label_color = getChartConfigValueByKey(CHART_KEY.Y_AXIS_COMPARE_LABEL_COLOR, options);
|
|
76
|
+
this.y_axis_compared_label_color = getChartConfigValueByKey(CHART_KEY.Y_AXIS_COMPARED_LABEL_COLOR, options);
|
|
77
|
+
|
|
78
|
+
// column-group
|
|
79
|
+
this.column_groupby_column_key = getChartConfigValueByKey(GENERIC_KEY.COLUMN_GROUPBY_COLUMN_KEY, options);
|
|
80
|
+
this.column_groupby_date_granularity = getChartConfigValueByKey(GENERIC_KEY.COLUMN_GROUPBY_DATE_GRANULARITY, options);
|
|
81
|
+
this.column_groupby_geolocation_granularity = getChartConfigValueByKey(GENERIC_KEY.COLUMN_GROUPBY_GEOLOCATION_GRANULARITY, options);
|
|
82
|
+
if (this.column_groupby_date_granularity && !DATE_GRANULATES.includes(this.column_groupby_date_granularity)) {
|
|
83
|
+
this.column_groupby_date_granularity = CHART_SUMMARY_TYPE.MONTH;
|
|
84
|
+
}
|
|
85
|
+
if (this.column_groupby_geolocation_granularity && !GEOLOCATION_GRANULATES.includes(this.column_groupby_geolocation_granularity)) {
|
|
86
|
+
this.column_groupby_geolocation_granularity = CHART_SUMMARY_TYPE.DISTRICT;
|
|
87
|
+
}
|
|
88
|
+
this.column_groupby_multiple_numeric_column = getChartConfigValueByKey(CHART_KEY.COLUMN_GROUPBY_MULTIPLE_NUMERIC_COLUMN, options);
|
|
89
|
+
if (!isBoolean(this.column_groupby_multiple_numeric_column)) {
|
|
90
|
+
this.column_groupby_multiple_numeric_column = null;
|
|
91
|
+
}
|
|
92
|
+
this.column_groupby_numeric_columns = getChartConfigValueByKey(CHART_KEY.COLUMN_GROUPBY_NUMERIC_COLUMNS, options);
|
|
93
|
+
this.summary_columns = getChartConfigValueByKey(CHART_KEY.SUMMARY_COLUMNS, options);
|
|
94
|
+
if (!Array.isArray(this.summary_columns)) {
|
|
95
|
+
this.summary_columns = [];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// other
|
|
99
|
+
this.sort_type = getChartConfigValueByKey(CHART_KEY.SORT_TYPE, options);
|
|
100
|
+
this.display_each_block_data = getChartConfigValueByKey(CHART_KEY.DISPLAY_EACH_BLOCK_DATA, options);
|
|
101
|
+
if (!isBoolean(this.display_each_block_data)) {
|
|
102
|
+
this.display_each_block_data = null;
|
|
103
|
+
}
|
|
104
|
+
this.title_name = getChartConfigValueByKey(CHART_KEY.TITLE_NAME, options);
|
|
105
|
+
this.label_font_size = getChartConfigValueByKey(GENERIC_KEY.LABEL_FONT_SIZE, options);
|
|
106
|
+
if (!isNumber(this.label_font_size)) {
|
|
107
|
+
this.label_font_size = DEFAULT_LABEL_FONT_SIZE;
|
|
108
|
+
}
|
|
109
|
+
this.y_axis_left_summary_type = getChartConfigValueByKey(CHART_KEY.Y_AXIS_LEFT_SUMMARY_TYPE, options);
|
|
110
|
+
this.y_axis_right_summary_type = getChartConfigValueByKey(CHART_KEY.Y_AXIS_RIGHT_SUMMARY_TYPE, options);
|
|
111
|
+
this.y_axis_left_summary_method = getChartConfigValueByKey(CHART_KEY.Y_AXIS_LEFT_SUMMARY_METHOD, options);
|
|
112
|
+
this.y_axis_right_summary_method = getChartConfigValueByKey(CHART_KEY.Y_AXIS_RIGHT_SUMMARY_METHOD, options);
|
|
113
|
+
this.y_axis_left_summary_column = getChartConfigValueByKey(CHART_KEY.Y_AXIS_LEFT_SUMMARY_COLUMN, options);
|
|
114
|
+
this.y_axis_right_summary_column = getChartConfigValueByKey(CHART_KEY.Y_AXIS_RIGHT_SUMMARY_COLUMN, options);
|
|
115
|
+
this.y_axis_left_group_by_multiple_numeric_column = getChartConfigValueByKey(CHART_KEY.Y_AXIS_LEFT_GROUP_BY_MULTIPLE_NUMERIC_COLUMN, options);
|
|
116
|
+
this.y_axis_left_group_by_numeric_columns = getChartConfigValueByKey(CHART_KEY.Y_AXIS_LEFT_GROUP_BY_NUMERIC_COLUMNS, options);
|
|
117
|
+
if (!isBoolean(this.y_axis_left_group_by_multiple_numeric_column)) {
|
|
118
|
+
this.y_axis_left_group_by_multiple_numeric_column = null;
|
|
119
|
+
}
|
|
120
|
+
if (!Array.isArray(this.y_axis_left_group_by_numeric_columns)) {
|
|
121
|
+
this.y_axis_left_group_by_numeric_columns = [];
|
|
122
|
+
}
|
|
123
|
+
this.y_axis_left_color = getChartConfigValueByKey(CHART_KEY.Y_AXIS_LEFT_COLOR, options);
|
|
124
|
+
this.y_axis_right_color = getChartConfigValueByKey(CHART_KEY.Y_AXIS_RIGHT_COLOR, options);
|
|
125
|
+
this.show_y_axis_left_label = getChartConfigValueByKey(CHART_KEY.SHOW_Y_AXIS_LEFT_LABEL, options);
|
|
126
|
+
this.show_y_axis_right_label = getChartConfigValueByKey(CHART_KEY.SHOW_Y_AXIS_RIGHT_LABEL, options);
|
|
127
|
+
this.y_axis_left_label_position = getChartConfigValueByKey(CHART_KEY.Y_AXIS_LEFT_LABEL_POSITION, options) || LABEL_POSITION_TYPE.CENTER;
|
|
128
|
+
this.y_axis_right_label_position = getChartConfigValueByKey(CHART_KEY.Y_AXIS_RIGHT_LABEL_POSITION, options) || LABEL_POSITION_TYPE.CENTER;
|
|
129
|
+
this.y_axis_auto_range_left = getChartConfigValueByKey(CHART_KEY.Y_AXIS_AUTO_RANGE_LEFT, options);
|
|
130
|
+
this.y_axis_min_left = getChartConfigValueByKey(CHART_KEY.Y_AXIS_MIN_LEFT, options);
|
|
131
|
+
this.y_axis_max_left = getChartConfigValueByKey(CHART_KEY.Y_AXIS_MAX_LEFT, options);
|
|
132
|
+
if (!isBoolean(this.y_axis_auto_range_left)) {
|
|
133
|
+
this.y_axis_auto_range_left = true;
|
|
134
|
+
}
|
|
135
|
+
if (!isNumber(this.y_axis_min_left)) {
|
|
136
|
+
this.y_axis_min_left = null;
|
|
137
|
+
}
|
|
138
|
+
if (!isNumber(this.y_axis_max_left)) {
|
|
139
|
+
this.y_axis_max_left = null;
|
|
140
|
+
}
|
|
141
|
+
this.y_axis_auto_range_right = getChartConfigValueByKey(CHART_KEY.Y_AXIS_AUTO_RANGE_RIGHT, options);
|
|
142
|
+
this.y_axis_min_right = getChartConfigValueByKey(CHART_KEY.Y_AXIS_MIN_RIGHT, options);
|
|
143
|
+
this.y_axis_max_right = getChartConfigValueByKey(CHART_KEY.Y_AXIS_MAX_RIGHT, options);
|
|
144
|
+
if (!isBoolean(this.y_axis_auto_range_right)) {
|
|
145
|
+
this.y_axis_auto_range_right = true;
|
|
146
|
+
}
|
|
147
|
+
if (!isNumber(this.y_axis_min_right)) {
|
|
148
|
+
this.y_axis_min_right = null;
|
|
149
|
+
}
|
|
150
|
+
if (!isNumber(this.y_axis_max_right)) {
|
|
151
|
+
this.y_axis_max_right = null;
|
|
152
|
+
}
|
|
153
|
+
this.display_increase = getChartConfigValueByKey(CHART_KEY.DISPLAY_INCREASE, options);
|
|
154
|
+
this.display_increase_percentage = getChartConfigValueByKey(CHART_KEY.DISPLAY_INCREASE_PERCENTAGE, options);
|
|
155
|
+
if (!isBoolean(this.display_increase)) {
|
|
156
|
+
this.display_increase = null;
|
|
157
|
+
}
|
|
158
|
+
if (!isBoolean(this.display_increase_percentage)) {
|
|
159
|
+
this.display_increase_percentage = null;
|
|
160
|
+
}
|
|
161
|
+
this.increase_display_color = getChartConfigValueByKey(CHART_KEY.INCREASE_DISPLAY_COLOR, options);
|
|
162
|
+
if (!isBoolean(this.increase_display_color)) {
|
|
163
|
+
this.increase_display_color = null;
|
|
164
|
+
}
|
|
165
|
+
this.completed_column_key = getChartConfigValueByKey(CHART_KEY.COMPLETED_COLUMN_KEY, options);
|
|
166
|
+
this.target_column_key = getChartConfigValueByKey(CHART_KEY.TARGET_COLUMN_KEY, options);
|
|
167
|
+
this.target_value_column_summary_method = getChartConfigValueByKey(CHART_KEY.TARGET_VALUE_COLUMN_SUMMARY_METHOD, options);
|
|
168
|
+
this.total_value_column_key = getChartConfigValueByKey(CHART_KEY.TOTAL_VALUE_COLUMN_KEY, options);
|
|
169
|
+
this.total_value_column_summary_method = getChartConfigValueByKey(CHART_KEY.TOTAL_VALUE_COLUMN_SUMMARY_METHOD, options);
|
|
170
|
+
this.completed_color = getChartConfigValueByKey(CHART_KEY.COMPLETED_COLOR, options);
|
|
171
|
+
this.display_percentage = getChartConfigValueByKey(CHART_KEY.DISPLAY_PERCENTAGE, options);
|
|
172
|
+
if (!isBoolean(this.display_percentage)) {
|
|
173
|
+
this.display_percentage = null;
|
|
174
|
+
}
|
|
175
|
+
this.target_value_column_key = getChartConfigValueByKey(CHART_KEY.TARGET_VALUE_COLUMN_KEY, options);
|
|
176
|
+
this.legend_direction = getChartConfigValueByKey(CHART_KEY.LEGEND_DIRECTION, options) || LEGEND_DIRECTION.VERTICAL;
|
|
177
|
+
this.legend_size = getChartConfigValueByKey(CHART_KEY.LEGEND_SIZE, options);
|
|
178
|
+
if (!isNumber(this.legend_size)) {
|
|
179
|
+
this.legend_size = 1;
|
|
180
|
+
}
|
|
181
|
+
this.is_transpose = getChartConfigValueByKey(CHART_KEY.IS_TRANSPOSE, options);
|
|
182
|
+
if (!isBoolean(this.is_transpose)) {
|
|
183
|
+
this.is_transpose = null;
|
|
184
|
+
}
|
|
185
|
+
this.show_legend = getChartConfigValueByKey(CHART_KEY.SHOW_LEGEND, options);
|
|
186
|
+
if (!isBoolean(this.show_legend)) {
|
|
187
|
+
this.show_legend = null;
|
|
188
|
+
}
|
|
189
|
+
this.display_label = getChartConfigValueByKey(CHART_KEY.DISPLAY_LABEL, options);
|
|
190
|
+
if (!isBoolean(this.display_label)) {
|
|
191
|
+
this.display_label = null;
|
|
192
|
+
}
|
|
193
|
+
this.show_percent = getChartConfigValueByKey(CHART_KEY.SHOW_PERCENT, options);
|
|
194
|
+
if (!isBoolean(this.show_percent)) {
|
|
195
|
+
this.show_percent = null;
|
|
196
|
+
}
|
|
197
|
+
this.minimum_slice_percent = getChartConfigValueByKey(CHART_KEY.MINIMUM_SLICE_PERCENT, options);
|
|
198
|
+
if (!isNumber(this.minimum_slice_percent)) {
|
|
199
|
+
this.minimum_slice_percent = 1.5;
|
|
200
|
+
}
|
|
201
|
+
this.display_annotation = getChartConfigValueByKey(CHART_KEY.DISPLAY_ANNOTATION, options);
|
|
202
|
+
if (!isBoolean(this.display_annotation)) {
|
|
203
|
+
this.display_annotation = null;
|
|
204
|
+
}
|
|
205
|
+
this.display_total = getChartConfigValueByKey(CHART_KEY.DISPLAY_TOTAL, options);
|
|
206
|
+
if (!isBoolean(this.display_total)) {
|
|
207
|
+
this.display_total = null;
|
|
208
|
+
}
|
|
209
|
+
this.summary_columns_option = getChartConfigValueByKey(CHART_KEY.SUMMARY_COLUMNS_OPTION, options);
|
|
210
|
+
this.increase_line_color = getChartConfigValueByKey(CHART_KEY.INCREASE_LINE_COLOR, options);
|
|
211
|
+
this.data_color = getChartConfigValueByKey(CHART_KEY.DATA_COLOR, options);
|
|
212
|
+
this.grid_distance = getChartConfigValueByKey(CHART_KEY.GRID_DISTANCE, options);
|
|
213
|
+
this.grid_size = getChartConfigValueByKey(CHART_KEY.GRID_SIZE, options);
|
|
214
|
+
if (!isNumber(this.grid_distance)) {
|
|
215
|
+
this.grid_distance = null;
|
|
216
|
+
}
|
|
217
|
+
if (!isNumber(this.grid_size)) {
|
|
218
|
+
this.grid_size = null;
|
|
219
|
+
}
|
|
220
|
+
this.bubble_color = getChartConfigValueByKey(CHART_KEY.BUBBLE_COLOR, options);
|
|
221
|
+
this.label_position = getChartConfigValueByKey(CHART_KEY.LABEL_POSITION, options);
|
|
222
|
+
this.label_format = getChartConfigValueByKey(CHART_KEY.LABEL_FORMAT, options);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isDateColumn, getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
2
|
+
import BaseModel from './base-model';
|
|
3
|
+
import { CHART_TYPE } from '../constants';
|
|
4
|
+
class HeatMap extends BaseModel {
|
|
5
|
+
constructor(options, tables) {
|
|
6
|
+
super({
|
|
7
|
+
...options,
|
|
8
|
+
type: CHART_TYPE.HEAT_MAP
|
|
9
|
+
});
|
|
10
|
+
this.time_column_key = options.x_axis_column_key;
|
|
11
|
+
if (this.time_column_key && this.table_id && tables) {
|
|
12
|
+
const table = getTableById(tables, this.table_id);
|
|
13
|
+
const column = getTableColumnByKey(table, this.time_column_key);
|
|
14
|
+
if (!column || !isDateColumn(column)) {
|
|
15
|
+
this.time_column_key = null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
this.summary_type = options.y_axis_summary_type;
|
|
19
|
+
this.summary_column_key = options.y_axis_summary_column_key;
|
|
20
|
+
this.summary_method = options.y_axis_summary_method;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export default HeatMap;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import BaseModel from './base-model';
|
|
2
|
+
import { isBoolean } from '../utils';
|
|
3
|
+
import { LABEL_COLORS, CHART_TYPE, CHART_SUMMARY_TYPE } from '../constants';
|
|
4
|
+
class HorizontalBar extends BaseModel {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
super({
|
|
7
|
+
...options,
|
|
8
|
+
type: CHART_TYPE.HORIZONTAL_BAR
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
// vertical axis data
|
|
12
|
+
this.vertical_axis_column_key = options.x_axis_column_key;
|
|
13
|
+
this.vertical_axis_date_granularity = options.x_axis_date_granularity;
|
|
14
|
+
this.vertical_axis_geolocation_granularity = options.x_axis_geolocation_granularity;
|
|
15
|
+
this.vertical_axis_include_empty = options.x_axis_include_empty_cells;
|
|
16
|
+
|
|
17
|
+
// vertical axis style
|
|
18
|
+
this.show_vertical_axis_label = isBoolean(options.x_axis_show_label) ? options.x_axis_show_label : false;
|
|
19
|
+
this.vertical_axis_label_position = options.x_axis_label_position;
|
|
20
|
+
|
|
21
|
+
// horizontal axis data
|
|
22
|
+
this.horizontal_axis_summary_type = options.y_axis_summary_type || CHART_SUMMARY_TYPE.COUNT;
|
|
23
|
+
this.horizontal_axis_column_key = options.y_axis_summary_column_key;
|
|
24
|
+
this.horizontal_axis_summary_method = options.y_axis_summary_method || CHART_SUMMARY_TYPE.SUM;
|
|
25
|
+
|
|
26
|
+
// horizontal axis style
|
|
27
|
+
this.horizontal_axis_label_color = options.y_axis_label_color || LABEL_COLORS[0];
|
|
28
|
+
this.show_horizontal_axis_label = isBoolean(options.y_axis_show_label) ? options.y_axis_show_label : false;
|
|
29
|
+
this.horizontal_axis_label_position = options.y_axis_label_position;
|
|
30
|
+
this.display_data = isBoolean(options.y_axis_show_value) ? options.y_axis_show_value : false;
|
|
31
|
+
this.horizontal_axis_auto_range = options.y_axis_auto_range;
|
|
32
|
+
this.horizontal_axis_min = options.y_axis_min;
|
|
33
|
+
this.horizontal_axis_max = options.y_axis_max;
|
|
34
|
+
this.sort_type = options.sort_type;
|
|
35
|
+
this.label_font_size = options.label_font_size;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export default HorizontalBar;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import BaseModel from './base-model';
|
|
2
|
+
import { isBoolean } from '../utils';
|
|
3
|
+
import { CHART_TYPE, LABEL_COLORS, CHART_SUMMARY_TYPE } from '../constants';
|
|
4
|
+
class HorizontalGroupBar extends BaseModel {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
super({
|
|
7
|
+
...options,
|
|
8
|
+
type: CHART_TYPE.HORIZONTAL_GROUP_BAR
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
// vertical axis data
|
|
12
|
+
this.vertical_axis_column_key = options.x_axis_column_key;
|
|
13
|
+
this.vertical_axis_date_granularity = options.x_axis_date_granularity;
|
|
14
|
+
this.vertical_axis_geolocation_granularity = options.x_axis_geolocation_granularity;
|
|
15
|
+
this.vertical_axis_include_empty = options.x_axis_include_empty_cells;
|
|
16
|
+
|
|
17
|
+
// vertical axis style
|
|
18
|
+
this.show_vertical_axis_label = isBoolean(options.x_axis_show_label) ? options.x_axis_show_label : false;
|
|
19
|
+
this.vertical_axis_label_position = options.x_axis_label_position;
|
|
20
|
+
|
|
21
|
+
// horizontal axis data
|
|
22
|
+
this.horizontal_axis_summary_type = options.y_axis_summary_type || CHART_SUMMARY_TYPE.COUNT;
|
|
23
|
+
this.horizontal_axis_column_key = options.y_axis_summary_column_key;
|
|
24
|
+
this.horizontal_axis_summary_method = options.y_axis_summary_method || CHART_SUMMARY_TYPE.SUM;
|
|
25
|
+
|
|
26
|
+
// horizontal axis style
|
|
27
|
+
this.horizontal_axis_label_color = options.y_axis_label_color || LABEL_COLORS[0];
|
|
28
|
+
this.show_horizontal_axis_label = isBoolean(options.y_axis_show_label) ? options.y_axis_show_label : false;
|
|
29
|
+
this.horizontal_axis_label_position = options.y_axis_label_position;
|
|
30
|
+
this.horizontal_axis_auto_range = options.y_axis_auto_range;
|
|
31
|
+
this.horizontal_axis_min = options.y_axis_min;
|
|
32
|
+
this.horizontal_axis_max = options.y_axis_max;
|
|
33
|
+
|
|
34
|
+
// column-group
|
|
35
|
+
this.column_groupby_column_key = options.column_groupby_column_key;
|
|
36
|
+
this.column_groupby_date_granularity = options.column_groupby_date_granularity;
|
|
37
|
+
this.column_groupby_geolocation_granularity = options.column_groupby_geolocation_granularity;
|
|
38
|
+
this.column_groupby_multiple_numeric_column = options.column_groupby_multiple_numeric_column;
|
|
39
|
+
this.summary_columns = options.summary_columns;
|
|
40
|
+
this.label_font_size = options.label_font_size;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export default HorizontalGroupBar;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import ChartModel from './chart';
|
|
2
|
+
import { CHART_TYPE } from '../constants';
|
|
3
|
+
import GenericModel from './generic-model';
|
|
4
|
+
import Map from './map';
|
|
5
|
+
import MapBubble from './map-bubble';
|
|
6
|
+
import WorldMap from './world-map';
|
|
7
|
+
import WorldMapBubble from './world-map-bubble';
|
|
8
|
+
import HeatMap from './heat-map';
|
|
9
|
+
import Mirror from './mirror';
|
|
10
|
+
import Bar from './bar';
|
|
11
|
+
import Line from './line';
|
|
12
|
+
import BarGroup from './bar-group';
|
|
13
|
+
import BarStack from './bar-stack';
|
|
14
|
+
import LineGroup from './line-group';
|
|
15
|
+
import AreaGroup from './area-group';
|
|
16
|
+
import Pie from './pie';
|
|
17
|
+
import Ring from './ring';
|
|
18
|
+
import TreeMap from './tree-map';
|
|
19
|
+
import Scatter from './scatter';
|
|
20
|
+
import BasicNumberCard from './basic-number-card';
|
|
21
|
+
import HorizontalBar from './horizontal-bar';
|
|
22
|
+
import HorizontalGroupBar from './horizontal-group-bar';
|
|
23
|
+
import StackedHorizontalBar from './stacked-horizontal-bar';
|
|
24
|
+
import Combination from './combination';
|
|
25
|
+
import CompareBar from './compare-bar';
|
|
26
|
+
import Trend from './trend';
|
|
27
|
+
import Completeness from './completeness';
|
|
28
|
+
import CompletenessGroup from './completeness-group';
|
|
29
|
+
import Dashboard from './dashboard';
|
|
30
|
+
import Table from './table';
|
|
31
|
+
import Area from './area';
|
|
32
|
+
import User from './user';
|
|
33
|
+
const CHART_MAP = {
|
|
34
|
+
[CHART_TYPE.BAR]: Bar,
|
|
35
|
+
[CHART_TYPE.BAR_GROUP]: BarGroup,
|
|
36
|
+
[CHART_TYPE.BAR_STACK]: BarStack,
|
|
37
|
+
[CHART_TYPE.COMPARE_BAR]: CompareBar,
|
|
38
|
+
[CHART_TYPE.HORIZONTAL_BAR]: HorizontalBar,
|
|
39
|
+
[CHART_TYPE.HORIZONTAL_GROUP_BAR]: HorizontalGroupBar,
|
|
40
|
+
[CHART_TYPE.STACKED_HORIZONTAL_BAR]: StackedHorizontalBar,
|
|
41
|
+
[CHART_TYPE.COMPLETENESS]: Completeness,
|
|
42
|
+
[CHART_TYPE.COMPLETENESS_GROUP]: CompletenessGroup,
|
|
43
|
+
[CHART_TYPE.LINE]: Line,
|
|
44
|
+
[CHART_TYPE.LINE_GROUP]: LineGroup,
|
|
45
|
+
[CHART_TYPE.AREA]: Area,
|
|
46
|
+
[CHART_TYPE.AREA_GROUP]: AreaGroup,
|
|
47
|
+
[CHART_TYPE.PIE]: Pie,
|
|
48
|
+
[CHART_TYPE.RING]: Ring,
|
|
49
|
+
[CHART_TYPE.SCATTER]: Scatter,
|
|
50
|
+
[CHART_TYPE.COMBINATION]: Combination,
|
|
51
|
+
[CHART_TYPE.MAP]: Map,
|
|
52
|
+
[CHART_TYPE.MAP_BUBBLE]: MapBubble,
|
|
53
|
+
[CHART_TYPE.WORLD_MAP]: WorldMap,
|
|
54
|
+
[CHART_TYPE.WORLD_MAP_BUBBLE]: WorldMapBubble,
|
|
55
|
+
[CHART_TYPE.HEAT_MAP]: HeatMap,
|
|
56
|
+
[CHART_TYPE.MIRROR]: Mirror,
|
|
57
|
+
[CHART_TYPE.BASIC_NUMBER_CARD]: BasicNumberCard,
|
|
58
|
+
[CHART_TYPE.TREND]: Trend,
|
|
59
|
+
[CHART_TYPE.DASHBOARD]: Dashboard,
|
|
60
|
+
[CHART_TYPE.TREE_MAP]: TreeMap,
|
|
61
|
+
[CHART_TYPE.TABLE]: Table
|
|
62
|
+
};
|
|
63
|
+
export { ChartModel, GenericModel, CHART_MAP, User };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import BaseModel from './base-model';
|
|
2
|
+
import { isBoolean } from '../utils';
|
|
3
|
+
import { LABEL_COLORS, CHART_TYPE, CHART_SUMMARY_TYPE } from '../constants';
|
|
4
|
+
class LineGroup extends BaseModel {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
super({
|
|
7
|
+
...options,
|
|
8
|
+
type: CHART_TYPE.LINE_GROUP
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
// x axis data
|
|
12
|
+
this.x_axis_column_key = options.x_axis_column_key;
|
|
13
|
+
this.x_axis_include_empty_cells = options.x_axis_include_empty_cells;
|
|
14
|
+
this.x_axis_date_granularity = options.x_axis_date_granularity;
|
|
15
|
+
this.x_axis_geolocation_granularity = options.x_axis_geolocation_granularity;
|
|
16
|
+
|
|
17
|
+
// x axis style
|
|
18
|
+
this.x_axis_show_label = isBoolean(options.x_axis_show_label) ? options.x_axis_show_label : false;
|
|
19
|
+
this.x_axis_label_position = options.x_axis_label_position;
|
|
20
|
+
|
|
21
|
+
// y axis data
|
|
22
|
+
this.y_axis_summary_column_key = options.y_axis_summary_column_key;
|
|
23
|
+
this.y_axis_summary_type = options.y_axis_summary_type || CHART_SUMMARY_TYPE.COUNT;
|
|
24
|
+
this.y_axis_summary_method = options.y_axis_summary_method || CHART_SUMMARY_TYPE.SUM;
|
|
25
|
+
|
|
26
|
+
// y axis style
|
|
27
|
+
this.y_axis_show_value = isBoolean(options.y_axis_show_value) ? options.y_axis_show_value : false;
|
|
28
|
+
this.y_axis_show_label = isBoolean(options.y_axis_show_label) ? options.y_axis_show_label : false;
|
|
29
|
+
this.y_axis_label_position = options.y_axis_label_position;
|
|
30
|
+
this.y_axis_auto_range = options.y_axis_auto_range;
|
|
31
|
+
this.y_axis_min = options.y_axis_min;
|
|
32
|
+
this.y_axis_max = options.y_axis_max;
|
|
33
|
+
this.y_axis_label_color = options.y_axis_label_color || LABEL_COLORS[0];
|
|
34
|
+
|
|
35
|
+
// column group
|
|
36
|
+
this.column_groupby_column_key = options.column_groupby_column_key;
|
|
37
|
+
this.column_groupby_date_granularity = options.column_groupby_date_granularity;
|
|
38
|
+
this.column_groupby_geolocation_granularity = options.column_groupby_geolocation_granularity;
|
|
39
|
+
this.column_groupby_multiple_numeric_column = isBoolean(options.column_groupby_multiple_numeric_column) ? options.column_groupby_multiple_numeric_column : false;
|
|
40
|
+
this.summary_columns = options.summary_columns;
|
|
41
|
+
this.label_font_size = options.label_font_size;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export default LineGroup;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import BaseModel from './base-model';
|
|
2
|
+
import { isBoolean } from '../utils';
|
|
3
|
+
import { LABEL_COLORS, CHART_TYPE, CHART_SUMMARY_TYPE } from '../constants';
|
|
4
|
+
class Line extends BaseModel {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
super({
|
|
7
|
+
...options,
|
|
8
|
+
type: CHART_TYPE.LINE
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
// x axis data
|
|
12
|
+
this.x_axis_column_key = options.x_axis_column_key;
|
|
13
|
+
this.x_axis_include_empty_cells = options.x_axis_include_empty_cells;
|
|
14
|
+
this.x_axis_date_granularity = options.x_axis_date_granularity;
|
|
15
|
+
this.x_axis_geolocation_granularity = options.x_axis_geolocation_granularity;
|
|
16
|
+
|
|
17
|
+
// x axis style
|
|
18
|
+
this.x_axis_show_label = isBoolean(options.x_axis_show_label) ? options.x_axis_show_label : false;
|
|
19
|
+
this.x_axis_label_position = options.x_axis_label_position;
|
|
20
|
+
|
|
21
|
+
// y axis data
|
|
22
|
+
this.y_axis_summary_column_key = options.y_axis_summary_column_key;
|
|
23
|
+
this.y_axis_summary_type = options.y_axis_summary_type || CHART_SUMMARY_TYPE.COUNT;
|
|
24
|
+
this.y_axis_summary_method = options.y_axis_summary_method || CHART_SUMMARY_TYPE.SUM;
|
|
25
|
+
|
|
26
|
+
// y axis style
|
|
27
|
+
this.y_axis_show_value = isBoolean(options.y_axis_show_value) ? options.y_axis_show_value : false;
|
|
28
|
+
this.y_axis_show_label = isBoolean(options.y_axis_show_label) ? options.y_axis_show_label : false;
|
|
29
|
+
this.y_axis_label_position = options.y_axis_label_position;
|
|
30
|
+
this.y_axis_auto_range = options.y_axis_auto_range;
|
|
31
|
+
this.y_axis_min = options.y_axis_min;
|
|
32
|
+
this.y_axis_max = options.y_axis_max;
|
|
33
|
+
this.y_axis_label_color = options.y_axis_label_color || LABEL_COLORS[0];
|
|
34
|
+
this.sort_type = options.sort_type;
|
|
35
|
+
this.label_font_size = options.label_font_size;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export default Line;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
2
|
+
import BaseModel from './base-model';
|
|
3
|
+
import { isStatisticMapColumn } from '../utils';
|
|
4
|
+
import { CHART_TYPE } from '../constants';
|
|
5
|
+
class MapBubble extends BaseModel {
|
|
6
|
+
constructor(options, tables) {
|
|
7
|
+
super({
|
|
8
|
+
...options,
|
|
9
|
+
type: CHART_TYPE.MAP_BUBBLE
|
|
10
|
+
});
|
|
11
|
+
this.geo_column_key = options.x_axis_column_key;
|
|
12
|
+
if (this.geo_column_key && this.table_id && tables) {
|
|
13
|
+
const table = getTableById(tables, this.table_id);
|
|
14
|
+
const column = getTableColumnByKey(table, this.geo_column_key);
|
|
15
|
+
if (!isStatisticMapColumn(column)) {
|
|
16
|
+
this.geo_column_key = null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
this.geolocation_granularity = options.x_axis_geolocation_granularity;
|
|
20
|
+
this.summary_type = options.y_axis_summary_type;
|
|
21
|
+
this.summary_method = options.y_axis_summary_method;
|
|
22
|
+
this.summary_column_key = options.y_axis_summary_column_key;
|
|
23
|
+
this.legend_direction = options.legend_direction;
|
|
24
|
+
this.legend_size = options.legend_size;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export default MapBubble;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
2
|
+
import BaseModel from './base-model';
|
|
3
|
+
import { isStatisticMapColumn } from '../utils';
|
|
4
|
+
import { CHART_TYPE } from '../constants';
|
|
5
|
+
class Map extends BaseModel {
|
|
6
|
+
constructor(options, tables) {
|
|
7
|
+
super({
|
|
8
|
+
...options,
|
|
9
|
+
type: CHART_TYPE.MAP
|
|
10
|
+
});
|
|
11
|
+
this.geo_column_key = options.x_axis_column_key;
|
|
12
|
+
if (this.geo_column_key && this.table_id && tables) {
|
|
13
|
+
const table = getTableById(tables, this.table_id);
|
|
14
|
+
const column = getTableColumnByKey(table, this.geo_column_key);
|
|
15
|
+
if (!isStatisticMapColumn(column)) {
|
|
16
|
+
this.geo_column_key = null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
this.geolocation_granularity = options.x_axis_geolocation_granularity;
|
|
20
|
+
this.summary_type = options.y_axis_summary_type;
|
|
21
|
+
this.summary_method = options.y_axis_summary_method;
|
|
22
|
+
this.summary_column_key = options.y_axis_summary_column_key;
|
|
23
|
+
this.legend_direction = options.legend_direction;
|
|
24
|
+
this.legend_size = options.legend_size;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export default Map;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
2
|
+
import BaseModel from './base-model';
|
|
3
|
+
import { isBoolean, isStatisticMirrorColumn } from '../utils';
|
|
4
|
+
import { CHART_TYPE } from '../constants';
|
|
5
|
+
class Mirror extends BaseModel {
|
|
6
|
+
constructor(options, tables) {
|
|
7
|
+
super({
|
|
8
|
+
...options,
|
|
9
|
+
type: CHART_TYPE.MIRROR
|
|
10
|
+
});
|
|
11
|
+
this.column_key = options.x_axis_column_key;
|
|
12
|
+
if (this.column && this.table_id && tables) {
|
|
13
|
+
const table = getTableById(tables, this.table_id);
|
|
14
|
+
const column = getTableColumnByKey(table, this.column_key);
|
|
15
|
+
if (!isStatisticMirrorColumn(column)) {
|
|
16
|
+
this.column_key = null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
this.is_transpose = isBoolean(options.is_transpose) ? options.is_transpose : false;
|
|
20
|
+
this.group_column_key = options.column_groupby_column_key;
|
|
21
|
+
this.summary_method = options.y_axis_summary_method;
|
|
22
|
+
this.summary_column_key = options.y_axis_summary_column_key;
|
|
23
|
+
this.summary_type = options.y_axis_summary_type;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export default Mirror;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import BaseModel from './base-model';
|
|
2
|
+
import { isBoolean } from '../utils';
|
|
3
|
+
import { CHART_TYPE, CHART_LABEL_POSITIONS, CHART_LABEL_FORMATS, CHART_SUMMARY_TYPE } from '../constants';
|
|
4
|
+
class Pie extends BaseModel {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
super({
|
|
7
|
+
...options,
|
|
8
|
+
type: CHART_TYPE.PIE
|
|
9
|
+
});
|
|
10
|
+
this.groupby_column_key = options.x_axis_column_key;
|
|
11
|
+
this.groupby_date_granularity = options.x_axis_date_granularity;
|
|
12
|
+
this.groupby_geolocation_granularity = options.x_axis_geolocation_granularity;
|
|
13
|
+
this.groupby_include_empty_cells = options.x_axis_include_empty_cells;
|
|
14
|
+
this.summary_column_key = options.y_axis_summary_column_key;
|
|
15
|
+
this.summary_type = options.y_axis_summary_type || CHART_SUMMARY_TYPE.COUNT;
|
|
16
|
+
this.summary_method = options.y_axis_summary_method || CHART_SUMMARY_TYPE.SUM;
|
|
17
|
+
this.show_legend = isBoolean(options.show_legend) ? options.show_legend : true;
|
|
18
|
+
this.display_label = isBoolean(options.display_label) ? options.display_label : true;
|
|
19
|
+
this.label_position = options.label_position || CHART_LABEL_POSITIONS[0];
|
|
20
|
+
this.label_format = options.label_format || CHART_LABEL_FORMATS[0];
|
|
21
|
+
this.minimum_slice_percent = options.minimum_slice_percent;
|
|
22
|
+
this.sort_type = options.sort_type;
|
|
23
|
+
this.label_font_size = options.label_font_size;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export default Pie;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import BaseModel from './base-model';
|
|
2
|
+
import { isBoolean } from '../utils';
|
|
3
|
+
import { CHART_TYPE, CHART_LABEL_POSITIONS, CHART_LABEL_FORMATS, CHART_SUMMARY_TYPE } from '../constants';
|
|
4
|
+
class Ring extends BaseModel {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
super({
|
|
7
|
+
...options,
|
|
8
|
+
type: CHART_TYPE.RING
|
|
9
|
+
});
|
|
10
|
+
this.groupby_column_key = options.x_axis_column_key;
|
|
11
|
+
this.groupby_date_granularity = options.x_axis_date_granularity;
|
|
12
|
+
this.groupby_geolocation_granularity = options.x_axis_geolocation_granularity;
|
|
13
|
+
this.groupby_include_empty_cells = options.x_axis_include_empty_cells;
|
|
14
|
+
this.summary_column_key = options.y_axis_summary_column_key;
|
|
15
|
+
this.summary_type = options.y_axis_summary_type || CHART_SUMMARY_TYPE.COUNT;
|
|
16
|
+
this.summary_method = options.y_axis_summary_method || CHART_SUMMARY_TYPE.SUM;
|
|
17
|
+
this.show_legend = isBoolean(options.show_legend) ? options.show_legend : true;
|
|
18
|
+
this.display_label = isBoolean(options.display_label) ? options.display_label : true;
|
|
19
|
+
this.label_position = options.label_position || CHART_LABEL_POSITIONS[0];
|
|
20
|
+
this.label_format = options.label_format || CHART_LABEL_FORMATS[0];
|
|
21
|
+
this.minimum_slice_percent = options.minimum_slice_percent;
|
|
22
|
+
this.sort_type = options.sort_type;
|
|
23
|
+
this.label_font_size = options.label_font_size;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export default Ring;
|