sea-chart 2.0.1 → 2.0.2

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.
Files changed (94) hide show
  1. package/dist/components/cell-factory/SimpleCellFormatter.js +1 -1
  2. package/dist/components/cell-factory/link-content.js +4 -4
  3. package/dist/components/color-picker/index.js +1 -1
  4. package/dist/components/color-popover/color-rules/color-rule.js +1 -1
  5. package/dist/components/color-popover/color-rules/index.js +1 -1
  6. package/dist/components/color-popover/color-rules-popover.js +6 -6
  7. package/dist/components/color-popover/color-selector-popover.js +2 -2
  8. package/dist/components/color-setting/color-group-selector.js +1 -1
  9. package/dist/components/common-add-tool/index.js +2 -2
  10. package/dist/components/data-process-setter/hide-column-setter.js +1 -1
  11. package/dist/components/data-process-setter/sort-setter.js +2 -2
  12. package/dist/components/drill-down-settings/drill-down-fields-popover/index.js +4 -4
  13. package/dist/components/icon/index.js +2 -2
  14. package/dist/components/popover/hide-column-popover/hide-column-popover-widgets/hide-column-item.js +1 -1
  15. package/dist/components/popover/hide-column-popover/hide-column-popover.js +1 -1
  16. package/dist/components/popover/sort-popover/sort-popover.js +1 -1
  17. package/dist/components/row-card/row-card-header-cell.js +2 -2
  18. package/dist/components/row-card/row-card-header.js +1 -1
  19. package/dist/components/row-card/row-card-item.js +2 -2
  20. package/dist/components/row-card/row-card.js +2 -2
  21. package/dist/components/statistic-record-dialog/index.js +1 -1
  22. package/dist/components/types-dialog/index.js +7 -7
  23. package/dist/context.js +2 -2
  24. package/dist/services/map-json.js +4 -4
  25. package/dist/settings/basic-number-card/style-settings.js +1 -1
  26. package/dist/settings/index.js +3 -3
  27. package/dist/settings/map-settings/map-style-settings.js +1 -1
  28. package/dist/settings/stacks-settings/index.js +1 -1
  29. package/dist/settings/style-settings.js +1 -1
  30. package/dist/settings/table-settings/data-settings.js +1 -1
  31. package/dist/settings/trend-settings/style-setting.js +2 -2
  32. package/dist/settings/widgets/chart-type/index.js +3 -3
  33. package/dist/settings/widgets/date-summary-item.js +2 -2
  34. package/dist/settings/widgets/numeric-summary-item.js +2 -2
  35. package/dist/settings/widgets/summary-settings.js +2 -2
  36. package/dist/settings/widgets/switch/index.js +1 -1
  37. package/dist/settings/widgets/y-axis-group-settings.js +1 -1
  38. package/dist/utils/chart-utils/base-utils.js +7 -7
  39. package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +1 -1
  40. package/dist/utils/chart-utils/original-data-utils/compare-bar-chart-calculator.js +2 -2
  41. package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +1 -1
  42. package/dist/utils/chart-utils/sql-statistics-utils.js +9 -9
  43. package/dist/utils/collaborator-utils.js +1 -1
  44. package/dist/utils/collaborator.js +2 -2
  45. package/dist/utils/column-utils.js +12 -12
  46. package/dist/utils/common-utils.js +1 -1
  47. package/dist/utils/date-translate.js +1 -1
  48. package/dist/utils/object-utils.js +1 -1
  49. package/dist/utils/options-utils.js +2 -2
  50. package/dist/utils/row-record-utils.js +2 -2
  51. package/dist/utils/sql/chart-data-sql.js +58 -58
  52. package/dist/utils/sql/column-2-sql-column.js +18 -18
  53. package/dist/view/index.js +2 -5
  54. package/dist/view/title/index.js +2 -2
  55. package/dist/view/wrapper/bar.js +168 -93
  56. package/dist/view/wrapper/basic-number-card.js +8 -8
  57. package/dist/view/wrapper/chart-component.js +16 -52
  58. package/dist/view/wrapper/index.js +1 -237
  59. package/dist/view/wrapper/table/index.js +1 -1
  60. package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +3 -3
  61. package/dist/view/wrapper/table/pivot-table-display-name.js +1 -1
  62. package/dist/view/wrapper/table/two-dimension-table.js +8 -8
  63. package/dist/view/wrapper/table-element/components/formatter.js +2 -2
  64. package/dist/view/wrapper/table-element/components/formatters/FileFormatter/index.js +1 -1
  65. package/dist/view/wrapper/table-element/components/formatters/link-formatter.js +17 -17
  66. package/dist/view/wrapper/table-element/components/link-formatter.js +17 -17
  67. package/dist/view/wrapper/table-element/components/record.js +3 -3
  68. package/dist/view/wrapper/table-element/components/records.js +4 -4
  69. package/dist/view/wrapper/table-element/components/utils.js +1 -1
  70. package/dist/view/wrapper/trend.js +18 -18
  71. package/package.json +5 -11
  72. package/dist/utils/custom-g2.js +0 -684
  73. package/dist/view/wrapper/area.js +0 -282
  74. package/dist/view/wrapper/bar-custom.js +0 -239
  75. package/dist/view/wrapper/bar-group.js +0 -274
  76. package/dist/view/wrapper/combination.js +0 -728
  77. package/dist/view/wrapper/compare.js +0 -383
  78. package/dist/view/wrapper/completeness.js +0 -174
  79. package/dist/view/wrapper/dashboard.js +0 -179
  80. package/dist/view/wrapper/funnel.js +0 -206
  81. package/dist/view/wrapper/heat-map.js +0 -434
  82. package/dist/view/wrapper/horizontal-bar-group.js +0 -226
  83. package/dist/view/wrapper/horizontal-bar.js +0 -175
  84. package/dist/view/wrapper/horizontal-component.js +0 -89
  85. package/dist/view/wrapper/line-group.js +0 -219
  86. package/dist/view/wrapper/line.js +0 -222
  87. package/dist/view/wrapper/map.js +0 -368
  88. package/dist/view/wrapper/mirror.js +0 -218
  89. package/dist/view/wrapper/pie.js +0 -253
  90. package/dist/view/wrapper/ring.js +0 -328
  91. package/dist/view/wrapper/scatter.js +0 -140
  92. package/dist/view/wrapper/treemap.js +0 -206
  93. package/dist/view/wrapper/world-map.js +0 -413
  94. package/dist/view/wrapper/wrappers-d3/bar.js +0 -262
@@ -1,179 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _react = _interopRequireWildcard(require("react"));
9
- var _dtableUtils = require("dtable-utils");
10
- var _customG = require("../../utils/custom-g2");
11
- var _utils = require("../../utils");
12
- var _constants = require("../../constants");
13
- class Dashboard extends _react.Component {
14
- constructor() {
15
- super(...arguments);
16
- this.componentDidMount = () => {
17
- this.drawChart();
18
- };
19
- this.drawChart = () => {
20
- const {
21
- chart,
22
- globalTheme,
23
- canvasStyle,
24
- result,
25
- customRender
26
- } = this.props;
27
- const theme = _constants.CHART_THEME_COLOR[globalTheme];
28
- const value = (0, _dtableUtils.isNumber)(result) ? result : 0;
29
- const {
30
- config
31
- } = chart;
32
- this.chart = new _customG.Chart({
33
- container: this.container,
34
- autoFit: true,
35
- width: '100%',
36
- height: '100%'
37
- });
38
- this.chart.on('interval:click', e => {
39
- this.props.toggleRecords(e.data.data);
40
- });
41
- (0, _customG.registerShape)('point', 'pointer', {
42
- draw(cfg, container) {
43
- const group = container.addGroup();
44
- const center = this.parsePoint({
45
- x: 0,
46
- y: 0
47
- });
48
- group.addShape('line', {
49
- attrs: {
50
- x1: center.x,
51
- y1: center.y - 15,
52
- x2: cfg.x,
53
- y2: cfg.y - 15,
54
- stroke: cfg.color,
55
- lineWidth: 5,
56
- lineCap: 'round'
57
- }
58
- });
59
- group.addShape('circle', {
60
- attrs: {
61
- x: center.x,
62
- y: center.y - 15,
63
- r: 9.75,
64
- stroke: cfg.color,
65
- lineWidth: 4.5,
66
- fill: '#fff'
67
- }
68
- });
69
- return group;
70
- }
71
- });
72
- const number = value > 1 ? 10 : value * 10;
73
- const data = [{
74
- value: number
75
- }];
76
- this.chart.data(data);
77
- this.chart.scale('value', {
78
- min: 0,
79
- max: 10,
80
- tickInterval: 1
81
- });
82
- this.chart.coordinate('polar', {
83
- startAngle: -9 / 8 * Math.PI,
84
- endAngle: 1 / 8 * Math.PI,
85
- radius: 0.75
86
- });
87
- this.chart.axis('1', false);
88
- this.chart.axis('value', {
89
- line: null,
90
- label: {
91
- offset: -36,
92
- style: {
93
- fontSize: 12,
94
- textAlign: 'center',
95
- textBaseline: 'middle'
96
- }
97
- },
98
- subTickLine: {
99
- count: 4,
100
- length: -15
101
- },
102
- tickLine: {
103
- length: -24
104
- },
105
- grid: null,
106
- offsetY: -15
107
- });
108
- this.chart.legend(false);
109
- this.chart.point().position('value*1').shape('pointer').color('#1890FF').animate({
110
- appear: {
111
- animation: 'fade-in'
112
- }
113
- });
114
- this.chart.annotation().arc({
115
- top: false,
116
- start: [0, 1],
117
- end: [10, 1],
118
- style: {
119
- stroke: '#CBCBCB',
120
- lineWidth: 10,
121
- lineDash: null
122
- },
123
- offsetY: -15
124
- });
125
- this.chart.annotation().arc({
126
- start: [0, 1],
127
- end: [data[0].value, 1],
128
- style: {
129
- stroke: '#1890FF',
130
- lineWidth: 10,
131
- lineDash: null
132
- },
133
- offsetY: -15
134
- });
135
- this.chart.annotation().text({
136
- position: ['50%', '85%'],
137
- content: config.name,
138
- style: {
139
- fontSize: canvasStyle.height > 240 ? 20 : 12,
140
- fill: '#545454',
141
- textAlign: 'center'
142
- },
143
- offsetY: -10
144
- });
145
- let shownValue = value * 100;
146
- const shownDotPos = `${shownValue}`.indexOf('.');
147
- if (shownDotPos > -1 && shownDotPos < `${shownValue}`.length - 2) {
148
- shownValue = shownValue.toFixed(1);
149
- }
150
- this.chart.annotation().text({
151
- position: ['50%', '90%'],
152
- content: `${shownValue} %`,
153
- style: {
154
- fontSize: canvasStyle.height > 240 ? 36 : 16,
155
- fill: theme.textColor,
156
- textAlign: 'center'
157
- },
158
- offsetY: 0
159
- });
160
- (0, _utils.isFunction)(customRender) && customRender(this.chart);
161
- this.chart.render();
162
- this.container.title = `${data[0].value * 10} %`;
163
- };
164
- }
165
- componentDidUpdate(prevProps) {
166
- if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
167
- var _this$chart;
168
- ((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
169
- this.drawChart();
170
- }
171
- }
172
- render() {
173
- return /*#__PURE__*/_react.default.createElement("div", {
174
- ref: ref => this.container = ref,
175
- className: "sea-chart-container "
176
- });
177
- }
178
- }
179
- var _default = exports.default = Dashboard;
@@ -1,206 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _dataSet = require("@antv/data-set");
10
- var _classnames = _interopRequireDefault(require("classnames"));
11
- var _utils = require("../../utils");
12
- var _constants = require("../../constants");
13
- var _chartComponent = _interopRequireDefault(require("./chart-component"));
14
- class Funnel extends _chartComponent.default {
15
- constructor(props) {
16
- super(props);
17
- this.createChart = () => {
18
- const appendPadding = [17, 0, 0, 0]; // used to display value on the top
19
- this.initChart(this.container, {
20
- appendPadding
21
- });
22
- this.chart.on('interval:click', e => {
23
- this.props.toggleRecords(e.data.data);
24
- });
25
- };
26
- this.drawChart = () => {
27
- const {
28
- result: data,
29
- chart
30
- } = this.props;
31
- const {
32
- x_axis_option_list,
33
- funnel_accumulate_values
34
- } = chart.config;
35
- if (!x_axis_option_list.length) return;
36
- const sortedData = (0, _utils.getSortedDataByGivenOrder)(data, x_axis_option_list);
37
- sortedData.total = 0;
38
- sortedData.forEach(item => {
39
- sortedData.total += item.value;
40
- });
41
- if (funnel_accumulate_values) {
42
- for (let i = sortedData.length - 2; i >= 0; i--) {
43
- sortedData[i].value += sortedData[i + 1].value;
44
- }
45
- }
46
- const {
47
- DataView
48
- } = _dataSet.DataSet;
49
- const dv = new DataView().source(sortedData);
50
- dv.transform({
51
- type: 'map',
52
- callback(row) {
53
- row.percent = sortedData.total === 0 ? 0 : (row.value / sortedData.total * 100).toFixed(2);
54
- return row;
55
- }
56
- });
57
- const dvData = dv.rows;
58
- this.loadData(dvData);
59
- this.draw(dvData);
60
- this.chart.render();
61
- };
62
- this.draw = sortedData => {
63
- const {
64
- chart,
65
- summaryColumn,
66
- tables,
67
- globalTheme
68
- } = this.props;
69
- const {
70
- table_id,
71
- y_axis_summary_type,
72
- y_axis_column_key,
73
- y_axis_summary_column_key,
74
- y_axis_summary_method,
75
- funnel_show_legend,
76
- funnel_label_position,
77
- funnel_label_font_size,
78
- funnel_label_format,
79
- funnel_show_labels,
80
- funnel_show_overall_rate
81
- } = chart.config;
82
- const theme = _constants.CHART_THEME_COLOR[globalTheme];
83
- const title = this.getTitle(tables, table_id, y_axis_summary_type, y_axis_column_key || y_axis_summary_column_key);
84
- const isInside = funnel_label_position === _constants.FUNNEL_LABEL_POSITIONS.INSIDE;
85
- let labelStyle;
86
- if (isInside) {
87
- labelStyle = {
88
- position: 'middle',
89
- offsetY: -(funnel_label_font_size + 5),
90
- style: {
91
- fontSize: funnel_label_font_size,
92
- fill: '#fff'
93
- },
94
- labelLine: true
95
- };
96
- } else {
97
- labelStyle = {
98
- position: 'left',
99
- offsetX: -80,
100
- style: {
101
- fontSize: funnel_label_font_size,
102
- fill: theme.labelColor
103
- },
104
- labelLine: true
105
- };
106
- }
107
- const contentFormatterMap = {
108
- [_constants.FUNNEL_LABEL_FORMAT.NUMBER]: obj => obj.value,
109
- [_constants.FUNNEL_LABEL_FORMAT.PERCENTAGE]: obj => ((obj === null || obj === void 0 ? void 0 : obj.percent) || 0) + '%',
110
- [_constants.FUNNEL_LABEL_FORMAT.NUMBER_AND_PERCENTAGE]: obj => `${obj.value} (${(obj === null || obj === void 0 ? void 0 : obj.percent) || 0}%)`
111
- };
112
- this.chart.axis(false);
113
- this.chart.coordinate('rect').transpose().scale(1, -1);
114
- this.chart.interval().adjust('symmetric').position('name*value').shape('funnel').color('name', ['#0050B3', '#1890FF', '#40A9FF', '#69C0FF', '#BAE7FF']).label('name*value*percent', name => {
115
- if (name.length > 10) {
116
- name = name.substring(0, 10) + '...';
117
- }
118
- return {
119
- content: funnel_show_labels ? `${name}` : ''
120
- };
121
- }, labelStyle).tooltip('name*value', (name, value) => {
122
- return {
123
- title,
124
- value: _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, value, y_axis_summary_method),
125
- name
126
- };
127
- }).animate({
128
- appear: {
129
- animation: 'fade-in'
130
- },
131
- update: {
132
- annotation: 'fade-in'
133
- }
134
- }).state({
135
- active: {
136
- style: {
137
- stroke: null
138
- }
139
- }
140
- });
141
- this.chart.on('beforepaint', () => {
142
- this.chart.annotation().clear(true);
143
- if (!funnel_show_labels) return;
144
- sortedData.forEach(obj => {
145
- this.chart.annotation().text({
146
- top: true,
147
- offsetY: isInside ? 12 : 0,
148
- position: [obj.name, 'center'],
149
- content: contentFormatterMap[funnel_label_format](obj),
150
- style: {
151
- fontSize: funnel_label_font_size,
152
- stroke: null,
153
- fill: '#fff',
154
- textAlign: 'center'
155
- }
156
- });
157
- });
158
- if (funnel_show_overall_rate) {
159
- var _sortedData;
160
- this.chart.annotation().text({
161
- top: true,
162
- position: ['50.5%', '-4%'],
163
- content: (((_sortedData = sortedData[sortedData.length - 1]) === null || _sortedData === void 0 ? void 0 : _sortedData.percent) || 0) + '%',
164
- style: {
165
- fontSize: funnel_label_font_size,
166
- stroke: null,
167
- fill: theme.labelColor,
168
- textAlign: 'center'
169
- }
170
- });
171
- }
172
- });
173
- if (funnel_show_legend) {
174
- this.setLegend('name', theme, 'top-right');
175
- } else {
176
- this.chart.legend(false);
177
- }
178
- this.setToolTip();
179
- this.chart.interaction('element-active');
180
- };
181
- this.chart = null;
182
- }
183
- componentDidMount() {
184
- this.createChart();
185
- this.drawChart();
186
- }
187
- componentDidUpdate(prevProps) {
188
- if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
189
- var _this$chart;
190
- ((_this$chart = this.chart) === null || _this$chart === void 0 ? void 0 : _this$chart.autoPadding) && this.chart.destroy();
191
- this.createChart();
192
- this.drawChart();
193
- }
194
- }
195
- componentWillUnmount() {
196
- var _this$chart2;
197
- ((_this$chart2 = this.chart) === null || _this$chart2 === void 0 ? void 0 : _this$chart2.autoPadding) && this.chart.destroy();
198
- }
199
- render() {
200
- return /*#__PURE__*/_react.default.createElement("div", {
201
- className: (0, _classnames.default)('sea-chart-container'),
202
- ref: ref => this.container = ref
203
- });
204
- }
205
- }
206
- var _default = exports.default = Funnel;