sea-chart 2.0.42 → 2.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/color-popover/color-rules/rule-filters/number-input.js +2 -2
- package/dist/components/drill-down-settings/drill-down-fields-popover/index.js +2 -2
- package/dist/components/tooltip/index.js +11 -4
- package/dist/constants/index.js +8 -3
- package/dist/context.js +10 -7
- package/dist/model/base-model.js +4 -0
- package/dist/model/combination.js +4 -0
- package/dist/model/horizontal-bar.js +4 -0
- package/dist/model/horizontal-group-bar.js +5 -1
- package/dist/model/stacked-horizontal-bar.js +4 -0
- package/dist/settings/advance-bar-settings/style-settings.js +24 -7
- package/dist/settings/bar-settings/style-settings.js +24 -7
- package/dist/settings/combination-settings/style-settings.js +35 -10
- package/dist/settings/time-comparison-settings/style-settings.js +24 -7
- package/dist/settings/widgets/axis-title-font-settings/index.js +39 -0
- package/dist/utils/cell-format-utils.js +2 -2
- package/dist/utils/chart-utils/base-utils.js +49 -13
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +4 -3
- package/dist/utils/chart-utils/original-data-utils/mirror-calculator.js +3 -3
- package/dist/utils/chart-utils/original-data-utils/pivot-table-calculator.js +2 -2
- package/dist/utils/chart-utils/sql-statistics-utils.js +64 -18
- package/dist/utils/row-record-utils.js +21 -5
- package/dist/utils/sql/column-2-sql-column.js +2 -0
- package/dist/view/index.css +0 -17
- package/dist/view/wrapper/area-group.js +14 -25
- package/dist/view/wrapper/area.js +14 -27
- package/dist/view/wrapper/bar-compare.js +10 -15
- package/dist/view/wrapper/bar-custom-stack.js +19 -81
- package/dist/view/wrapper/bar-group.js +15 -50
- package/dist/view/wrapper/bar-stack.js +12 -40
- package/dist/view/wrapper/bar.js +10 -23
- package/dist/view/wrapper/basic-number-card.js +9 -2
- package/dist/view/wrapper/chart-component.js +461 -76
- package/dist/view/wrapper/combination.js +17 -29
- package/dist/view/wrapper/completeness-group.js +13 -59
- package/dist/view/wrapper/completeness.js +14 -60
- package/dist/view/wrapper/dashboard.js +8 -14
- package/dist/view/wrapper/funnel.js +6 -18
- package/dist/view/wrapper/heat-map.js +80 -50
- package/dist/view/wrapper/horizontal-bar-group.js +14 -25
- package/dist/view/wrapper/horizontal-bar-stack.js +16 -61
- package/dist/view/wrapper/horizontal-bar.js +10 -25
- package/dist/view/wrapper/index.js +3 -0
- package/dist/view/wrapper/line-group.js +11 -21
- package/dist/view/wrapper/line.js +11 -23
- package/dist/view/wrapper/map-bubble.js +9 -14
- package/dist/view/wrapper/map-world-bubble.js +9 -14
- package/dist/view/wrapper/map-world.js +9 -14
- package/dist/view/wrapper/map.js +9 -13
- package/dist/view/wrapper/mirror.js +7 -20
- package/dist/view/wrapper/pie.js +9 -12
- package/dist/view/wrapper/ring.js +10 -13
- package/dist/view/wrapper/scatter.js +13 -23
- package/dist/view/wrapper/table/pivot-table-display-name.js +2 -2
- package/dist/view/wrapper/table-element/components/formatter.js +2 -2
- package/dist/view/wrapper/table-element/components/records-body.js +8 -2
- package/dist/view/wrapper/table-element/components/records.js +2 -4
- package/dist/view/wrapper/treemap.js +8 -18
- package/dist/view/wrapper/trend.js +3 -2
- package/package.json +2 -2
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { debounce } from 'lodash-es';
|
|
4
3
|
import * as d3 from 'd3';
|
|
5
|
-
import classNames from 'classnames';
|
|
6
4
|
import { CellType } from 'dtable-utils';
|
|
7
5
|
import { EMPTY_NAME, CHART_THEME_COLOR, CHART_LINE_TYPES } from '../../constants';
|
|
8
6
|
import { SUPPORT_SINGLE_SELECT_THEMES_OPTIONS } from '../../constants/color-rules';
|
|
@@ -13,11 +11,6 @@ import ChartComponent from './chart-component';
|
|
|
13
11
|
class LineGroup extends ChartComponent {
|
|
14
12
|
constructor(props) {
|
|
15
13
|
super(props);
|
|
16
|
-
this.handleResize = () => {
|
|
17
|
-
this.destroyChart();
|
|
18
|
-
this.createChart();
|
|
19
|
-
this.drawChart();
|
|
20
|
-
};
|
|
21
14
|
this.createChart = () => {
|
|
22
15
|
const {
|
|
23
16
|
chart
|
|
@@ -29,8 +22,8 @@ class LineGroup extends ChartComponent {
|
|
|
29
22
|
} = chart.config;
|
|
30
23
|
const initConfig = {
|
|
31
24
|
insertPadding: 30,
|
|
32
|
-
marginLeft: y_axis_show_label ?
|
|
33
|
-
marginBottom: x_axis_show_label ?
|
|
25
|
+
marginLeft: y_axis_show_label ? this.getAxisTitleHeight(chart.config.y_axis_label_font_size) : 0,
|
|
26
|
+
marginBottom: x_axis_show_label ? this.getAxisTitleHeight(chart.config.x_axis_label_font_size) : 0,
|
|
34
27
|
marginTop: y_axis_show_value ? 15 : 0
|
|
35
28
|
};
|
|
36
29
|
this.initChart(this.container, chart === null || chart === void 0 ? void 0 : chart.id, initConfig);
|
|
@@ -187,6 +180,7 @@ class LineGroup extends ChartComponent {
|
|
|
187
180
|
const xVal = x(d.name) + x.bandwidth() / 2;
|
|
188
181
|
circleData[index]['x'] = xVal;
|
|
189
182
|
circleData[index]['name'] = d.name;
|
|
183
|
+
circleData[index]['originalData'] = d;
|
|
190
184
|
return xVal;
|
|
191
185
|
}).y((d, index) => {
|
|
192
186
|
const yVal = y(d.value);
|
|
@@ -214,7 +208,7 @@ class LineGroup extends ChartComponent {
|
|
|
214
208
|
} = _ref;
|
|
215
209
|
circleData.forEach(item => {
|
|
216
210
|
if (Object.keys(item).length > 0) {
|
|
217
|
-
contentWrapper.append('circle').attr('cx', item.x).attr('cy', item.y).attr('r', 3).attr('fill', () => {
|
|
211
|
+
contentWrapper.append('circle').datum(item).attr('cx', item.x).attr('cy', item.y).attr('r', 3).attr('fill', () => {
|
|
218
212
|
const colorKey = group_name || group_name === 0 ? group_name : '';
|
|
219
213
|
return this.colorMap[colorKey];
|
|
220
214
|
}).attr('opacity', y_axis_show_value ? 1 : 0).attr('data-groupName', group_name).attr('data-text', item.value).attr('data-name', item.name).call(g => {
|
|
@@ -231,11 +225,14 @@ class LineGroup extends ChartComponent {
|
|
|
231
225
|
});
|
|
232
226
|
}
|
|
233
227
|
}).on('click', (event, data) => {
|
|
234
|
-
this.props.toggleRecords(data);
|
|
228
|
+
this.props.toggleRecords(data.originalData || data);
|
|
235
229
|
});
|
|
236
230
|
}
|
|
237
231
|
});
|
|
238
232
|
});
|
|
233
|
+
this.animateFadeIn(contentWrapper.selectAll('path'), this.transitionDuration);
|
|
234
|
+
this.animateFadeIn(contentWrapper.selectAll('circle'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
235
|
+
this.animateFadeIn(contentWrapper.selectAll('text'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
239
236
|
this.chart.on('mouseover', event => {
|
|
240
237
|
this.updateCircleAndTickStyle({
|
|
241
238
|
event,
|
|
@@ -350,8 +347,7 @@ class LineGroup extends ChartComponent {
|
|
|
350
347
|
componentDidMount() {
|
|
351
348
|
this.createChart();
|
|
352
349
|
this.drawChart();
|
|
353
|
-
|
|
354
|
-
window.addEventListener('resize', this.debouncedHandleResize);
|
|
350
|
+
super.componentDidMount();
|
|
355
351
|
}
|
|
356
352
|
componentDidUpdate(prevProps) {
|
|
357
353
|
super.componentDidUpdate(prevProps);
|
|
@@ -363,22 +359,16 @@ class LineGroup extends ChartComponent {
|
|
|
363
359
|
}
|
|
364
360
|
componentWillUnmount() {
|
|
365
361
|
this.destroyChart();
|
|
366
|
-
|
|
362
|
+
super.componentWillUnmount();
|
|
367
363
|
}
|
|
368
364
|
render() {
|
|
369
|
-
const {
|
|
370
|
-
chart
|
|
371
|
-
} = this.props;
|
|
372
365
|
const {
|
|
373
366
|
tooltipData,
|
|
374
367
|
toolTipPosition
|
|
375
368
|
} = this.state;
|
|
376
369
|
return /*#__PURE__*/React.createElement("div", {
|
|
377
370
|
ref: ref => this.container = ref,
|
|
378
|
-
className:
|
|
379
|
-
'show-x-axis-label': this.isShowXAxisLabel(chart),
|
|
380
|
-
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
381
|
-
})
|
|
371
|
+
className: "sea-chart-container"
|
|
382
372
|
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
383
373
|
tooltipData: tooltipData,
|
|
384
374
|
toolTipPosition: toolTipPosition,
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { debounce } from 'lodash-es';
|
|
4
3
|
import * as d3 from 'd3';
|
|
5
|
-
import classNames from 'classnames';
|
|
6
4
|
import { TYPE_COLOR_USING, CHART_STYLE_COLORS, CHART_THEME_COLOR, CHART_LINE_TYPES } from '../../constants';
|
|
7
5
|
import { BaseUtils, isFunction } from '../../utils';
|
|
8
6
|
import intl from '../../intl';
|
|
@@ -11,11 +9,6 @@ import ChartComponent from './chart-component';
|
|
|
11
9
|
class Line extends ChartComponent {
|
|
12
10
|
constructor(props) {
|
|
13
11
|
super(props);
|
|
14
|
-
this.handleResize = () => {
|
|
15
|
-
this.destroyChart();
|
|
16
|
-
this.createChart();
|
|
17
|
-
this.drawChart();
|
|
18
|
-
};
|
|
19
12
|
this.createChart = () => {
|
|
20
13
|
const {
|
|
21
14
|
chart
|
|
@@ -27,8 +20,8 @@ class Line extends ChartComponent {
|
|
|
27
20
|
} = chart.config;
|
|
28
21
|
const initConfig = {
|
|
29
22
|
insertPadding: 30,
|
|
30
|
-
marginLeft: y_axis_show_label ?
|
|
31
|
-
marginBottom: x_axis_show_label ?
|
|
23
|
+
marginLeft: y_axis_show_label ? this.getAxisTitleHeight(chart.config.y_axis_label_font_size) : 0,
|
|
24
|
+
marginBottom: x_axis_show_label ? this.getAxisTitleHeight(chart.config.x_axis_label_font_size) : 0,
|
|
32
25
|
marginTop: y_axis_show_value ? 15 : 0
|
|
33
26
|
};
|
|
34
27
|
this.initChart(this.container, chart === null || chart === void 0 ? void 0 : chart.id, initConfig);
|
|
@@ -169,6 +162,7 @@ class Line extends ChartComponent {
|
|
|
169
162
|
const xVal = x(d.name) + x.bandwidth() / 2;
|
|
170
163
|
circleData[index]['x'] = xVal;
|
|
171
164
|
circleData[index]['name'] = d.name;
|
|
165
|
+
circleData[index]['originalData'] = d;
|
|
172
166
|
return xVal;
|
|
173
167
|
}).y((d, index) => {
|
|
174
168
|
const yVal = y(d.value);
|
|
@@ -177,12 +171,11 @@ class Line extends ChartComponent {
|
|
|
177
171
|
return yVal;
|
|
178
172
|
}).curve(line_type === CHART_LINE_TYPES[1] ? d3.curveBumpX : d3.curveLinear);
|
|
179
173
|
const contentWrapper = this.chart.append('g').attr('class', 'content-wrapper');
|
|
180
|
-
contentWrapper.append('path').attr('fill', 'none').attr('stroke', chartBarColor).attr('stroke-width', 2).attr('d', () => line(data));
|
|
174
|
+
contentWrapper.append('path').attr('fill', 'none').attr('stroke', chartBarColor).attr('stroke-width', 2).attr('d', () => line(data)).call(g => this.animateFadeIn(g));
|
|
181
175
|
|
|
182
176
|
// circle
|
|
183
177
|
circleData.forEach(item => {
|
|
184
|
-
contentWrapper.append('circle').attr('cx', item.x).attr('cy', item.y).attr('r', 3).attr('fill', chartBarColor).attr('opacity', y_axis_show_value ? 1 : 0).attr('data-text', item.value).attr('data-name', item.name).call(g => {
|
|
185
|
-
// circle label
|
|
178
|
+
contentWrapper.append('circle').datum(item).attr('cx', item.x).attr('cy', item.y).attr('r', 3).attr('fill', chartBarColor).attr('opacity', y_axis_show_value ? 1 : 0).attr('data-text', item.value).attr('data-name', item.name).call(g => {
|
|
186
179
|
if (y_axis_show_value) {
|
|
187
180
|
const curCircleEl = g.node();
|
|
188
181
|
contentWrapper.append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('fill', theme.labelColor).attr('font-size', BaseUtils.getLabelFontSize(label_font_size)).text(BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(curCircleEl.getAttribute('data-text')), y_axis_summary_method)).call(g => {
|
|
@@ -195,9 +188,11 @@ class Line extends ChartComponent {
|
|
|
195
188
|
});
|
|
196
189
|
}
|
|
197
190
|
}).on('click', (event, data) => {
|
|
198
|
-
this.props.toggleRecords(data);
|
|
191
|
+
this.props.toggleRecords(data.originalData || data);
|
|
199
192
|
});
|
|
200
193
|
});
|
|
194
|
+
this.animateFadeIn(contentWrapper.selectAll('circle'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
195
|
+
this.animateFadeIn(contentWrapper.selectAll('text'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
201
196
|
this.chart.on('mouseover', event => {
|
|
202
197
|
this.updateCircleAndTickStyle({
|
|
203
198
|
event,
|
|
@@ -316,8 +311,7 @@ class Line extends ChartComponent {
|
|
|
316
311
|
componentDidMount() {
|
|
317
312
|
this.createChart();
|
|
318
313
|
this.drawChart();
|
|
319
|
-
|
|
320
|
-
window.addEventListener('resize', this.debouncedHandleResize);
|
|
314
|
+
super.componentDidMount();
|
|
321
315
|
}
|
|
322
316
|
componentDidUpdate(prevProps) {
|
|
323
317
|
super.componentDidUpdate(prevProps);
|
|
@@ -329,22 +323,16 @@ class Line extends ChartComponent {
|
|
|
329
323
|
}
|
|
330
324
|
componentWillUnmount() {
|
|
331
325
|
this.destroyChart();
|
|
332
|
-
|
|
326
|
+
super.componentWillUnmount();
|
|
333
327
|
}
|
|
334
328
|
render() {
|
|
335
|
-
const {
|
|
336
|
-
chart
|
|
337
|
-
} = this.props;
|
|
338
329
|
const {
|
|
339
330
|
tooltipData,
|
|
340
331
|
toolTipPosition
|
|
341
332
|
} = this.state;
|
|
342
333
|
return /*#__PURE__*/React.createElement("div", {
|
|
343
334
|
ref: ref => this.container = ref,
|
|
344
|
-
className:
|
|
345
|
-
'show-x-axis-label': this.isShowXAxisLabel(chart),
|
|
346
|
-
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
347
|
-
})
|
|
335
|
+
className: "sea-chart-container"
|
|
348
336
|
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
349
337
|
tooltipData: tooltipData,
|
|
350
338
|
toolTipPosition: toolTipPosition,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { debounce } from 'lodash-es';
|
|
4
3
|
import * as d3 from 'd3';
|
|
5
4
|
import { feature } from 'topojson';
|
|
6
5
|
import { getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
@@ -13,11 +12,6 @@ import ChartComponent from './chart-component';
|
|
|
13
12
|
class MapBubble extends ChartComponent {
|
|
14
13
|
constructor(props) {
|
|
15
14
|
super(props);
|
|
16
|
-
this.handleResize = () => {
|
|
17
|
-
this.destroyChart();
|
|
18
|
-
this.createChart();
|
|
19
|
-
this.drawChart();
|
|
20
|
-
};
|
|
21
15
|
this.createChart = () => {
|
|
22
16
|
const {
|
|
23
17
|
chart
|
|
@@ -116,7 +110,7 @@ class MapBubble extends ChartComponent {
|
|
|
116
110
|
// 3. Rendering map
|
|
117
111
|
this.chart.append('g').attr('class', 'map-wrapper').selectAll().data(mapJson.features).join('g').append('path').attr('d', d => {
|
|
118
112
|
return pathGenerator(d);
|
|
119
|
-
}).attr('stroke-width', 1).attr('stroke', '#bdbdbd').attr('stroke-opacity', 1).attr('fill', '#e2e2e2').attr('opacity', 1).attr('data-name', d => d.properties.name);
|
|
113
|
+
}).attr('stroke-width', 1).attr('stroke', '#bdbdbd').attr('stroke-opacity', 1).attr('fill', '#e2e2e2').attr('opacity', 1).attr('data-name', d => d.properties.name).call(g => this.animateFadeIn(g));
|
|
120
114
|
|
|
121
115
|
// draw bubble circle
|
|
122
116
|
this.drawCircle(data, mapJson, pathGenerator);
|
|
@@ -135,14 +129,15 @@ class MapBubble extends ChartComponent {
|
|
|
135
129
|
};
|
|
136
130
|
this.handleAcitveAndInActiveState = (state, event, highlightedBorderColor) => {
|
|
137
131
|
if (state === 'active') {
|
|
138
|
-
d3.select(event.currentTarget).transition().duration(this.
|
|
132
|
+
d3.select(event.currentTarget).transition().duration(this.interactionDuration).attr('fill-opacity', 0.9);
|
|
139
133
|
return;
|
|
140
134
|
}
|
|
141
|
-
d3.select(event.currentTarget).transition().duration(this.
|
|
135
|
+
d3.select(event.currentTarget).transition().duration(this.interactionDuration).attr('fill-opacity', 0.6);
|
|
142
136
|
};
|
|
143
137
|
this.getColumnData = () => {
|
|
144
138
|
const {
|
|
145
|
-
chart
|
|
139
|
+
chart,
|
|
140
|
+
tables
|
|
146
141
|
} = this.props;
|
|
147
142
|
const {
|
|
148
143
|
summary_type,
|
|
@@ -151,7 +146,7 @@ class MapBubble extends ChartComponent {
|
|
|
151
146
|
} = chart.config;
|
|
152
147
|
let columnData = DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
153
148
|
if (summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
154
|
-
const table = getTableById(table_id);
|
|
149
|
+
const table = getTableById(tables, table_id);
|
|
155
150
|
const summaryColumn = getTableColumnByKey(table, summary_column_key) || {};
|
|
156
151
|
columnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
157
152
|
}
|
|
@@ -204,6 +199,7 @@ class MapBubble extends ChartComponent {
|
|
|
204
199
|
});
|
|
205
200
|
}
|
|
206
201
|
});
|
|
202
|
+
this.animateCircleZoomIn(bubbleWrapper.selectAll('circle'));
|
|
207
203
|
};
|
|
208
204
|
this.chart = null;
|
|
209
205
|
this.state = {
|
|
@@ -214,8 +210,7 @@ class MapBubble extends ChartComponent {
|
|
|
214
210
|
componentDidMount() {
|
|
215
211
|
this.createChart();
|
|
216
212
|
this.drawChart();
|
|
217
|
-
|
|
218
|
-
window.addEventListener('resize', this.debouncedHandleResize);
|
|
213
|
+
super.componentDidMount();
|
|
219
214
|
}
|
|
220
215
|
componentDidUpdate(prevProps) {
|
|
221
216
|
super.componentDidUpdate(prevProps);
|
|
@@ -227,7 +222,7 @@ class MapBubble extends ChartComponent {
|
|
|
227
222
|
}
|
|
228
223
|
componentWillUnmount() {
|
|
229
224
|
this.destroyChart();
|
|
230
|
-
|
|
225
|
+
super.componentWillUnmount();
|
|
231
226
|
}
|
|
232
227
|
render() {
|
|
233
228
|
const {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { debounce } from 'lodash-es';
|
|
4
3
|
import * as d3 from 'd3';
|
|
5
4
|
import { feature } from 'topojson';
|
|
6
5
|
import { getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
@@ -13,11 +12,6 @@ import ChartComponent from './chart-component';
|
|
|
13
12
|
class MapBubble extends ChartComponent {
|
|
14
13
|
constructor(props) {
|
|
15
14
|
super(props);
|
|
16
|
-
this.handleResize = () => {
|
|
17
|
-
this.destroyChart();
|
|
18
|
-
this.createChart();
|
|
19
|
-
this.drawChart();
|
|
20
|
-
};
|
|
21
15
|
this.createChart = () => {
|
|
22
16
|
const {
|
|
23
17
|
chart
|
|
@@ -116,7 +110,7 @@ class MapBubble extends ChartComponent {
|
|
|
116
110
|
// 3. Rendering map
|
|
117
111
|
this.chart.append('g').attr('class', 'map-wrapper').selectAll().data(mapJson.features).join('g').append('path').attr('d', d => {
|
|
118
112
|
return pathGenerator(d);
|
|
119
|
-
}).attr('stroke-width', 1).attr('stroke', '#bdbdbd').attr('stroke-opacity', 1).attr('fill', '#e2e2e2').attr('opacity', 1).attr('data-name', d => d.properties.name);
|
|
113
|
+
}).attr('stroke-width', 1).attr('stroke', '#bdbdbd').attr('stroke-opacity', 1).attr('fill', '#e2e2e2').attr('opacity', 1).attr('data-name', d => d.properties.name).call(g => this.animateFadeIn(g));
|
|
120
114
|
|
|
121
115
|
// draw bubble circle
|
|
122
116
|
this.drawCircle(data, mapJson, pathGenerator);
|
|
@@ -135,14 +129,15 @@ class MapBubble extends ChartComponent {
|
|
|
135
129
|
};
|
|
136
130
|
this.handleAcitveAndInActiveState = (state, event, highlightedBorderColor) => {
|
|
137
131
|
if (state === 'active') {
|
|
138
|
-
d3.select(event.currentTarget).transition().duration(this.
|
|
132
|
+
d3.select(event.currentTarget).transition().duration(this.interactionDuration).attr('fill-opacity', 0.9);
|
|
139
133
|
return;
|
|
140
134
|
}
|
|
141
|
-
d3.select(event.currentTarget).transition().duration(this.
|
|
135
|
+
d3.select(event.currentTarget).transition().duration(this.interactionDuration).attr('fill-opacity', 0.6);
|
|
142
136
|
};
|
|
143
137
|
this.getColumnData = () => {
|
|
144
138
|
const {
|
|
145
|
-
chart
|
|
139
|
+
chart,
|
|
140
|
+
tables
|
|
146
141
|
} = this.props;
|
|
147
142
|
const {
|
|
148
143
|
summary_type,
|
|
@@ -151,7 +146,7 @@ class MapBubble extends ChartComponent {
|
|
|
151
146
|
} = chart.config;
|
|
152
147
|
let columnData = DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
153
148
|
if (summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
154
|
-
const table = getTableById(table_id);
|
|
149
|
+
const table = getTableById(tables, table_id);
|
|
155
150
|
const summaryColumn = getTableColumnByKey(table, summary_column_key) || {};
|
|
156
151
|
columnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
157
152
|
}
|
|
@@ -204,6 +199,7 @@ class MapBubble extends ChartComponent {
|
|
|
204
199
|
});
|
|
205
200
|
}
|
|
206
201
|
});
|
|
202
|
+
this.animateCircleZoomIn(bubbleWrapper.selectAll('circle'));
|
|
207
203
|
};
|
|
208
204
|
this.chart = null;
|
|
209
205
|
this.state = {
|
|
@@ -214,8 +210,7 @@ class MapBubble extends ChartComponent {
|
|
|
214
210
|
componentDidMount() {
|
|
215
211
|
this.createChart();
|
|
216
212
|
this.drawChart();
|
|
217
|
-
|
|
218
|
-
window.addEventListener('resize', this.debouncedHandleResize);
|
|
213
|
+
super.componentDidMount();
|
|
219
214
|
}
|
|
220
215
|
componentDidUpdate(prevProps) {
|
|
221
216
|
super.componentDidUpdate(prevProps);
|
|
@@ -227,7 +222,7 @@ class MapBubble extends ChartComponent {
|
|
|
227
222
|
}
|
|
228
223
|
componentWillUnmount() {
|
|
229
224
|
this.destroyChart();
|
|
230
|
-
|
|
225
|
+
super.componentWillUnmount();
|
|
231
226
|
}
|
|
232
227
|
render() {
|
|
233
228
|
const {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { debounce } from 'lodash-es';
|
|
4
3
|
import * as d3 from 'd3';
|
|
5
4
|
import { feature } from 'topojson';
|
|
6
5
|
import { getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
@@ -14,11 +13,6 @@ import ChartComponent from './chart-component';
|
|
|
14
13
|
class Map extends ChartComponent {
|
|
15
14
|
constructor(props) {
|
|
16
15
|
super(props);
|
|
17
|
-
this.handleResize = () => {
|
|
18
|
-
this.destroyChart();
|
|
19
|
-
this.createChart();
|
|
20
|
-
this.drawChart();
|
|
21
|
-
};
|
|
22
16
|
this.createChart = () => {
|
|
23
17
|
const {
|
|
24
18
|
chart
|
|
@@ -135,7 +129,6 @@ class Map extends ChartComponent {
|
|
|
135
129
|
}
|
|
136
130
|
}
|
|
137
131
|
}).on('mousemove', event => {
|
|
138
|
-
console.log(data);
|
|
139
132
|
const value = Number(event.target.parentNode.getAttribute('data-value'));
|
|
140
133
|
if (this.curElement) {
|
|
141
134
|
this.handleAcitveAndInActiveState('inActive', event, highlightedBorderColor);
|
|
@@ -176,7 +169,7 @@ class Map extends ChartComponent {
|
|
|
176
169
|
d3.select(curGroup).attr('fill', color());
|
|
177
170
|
}
|
|
178
171
|
});
|
|
179
|
-
});
|
|
172
|
+
}).call(g => this.animateFadeIn(g));
|
|
180
173
|
const columnData = this.getColumnData();
|
|
181
174
|
this.setContinuousLegend({
|
|
182
175
|
previewType: canvasStyle.previewType,
|
|
@@ -192,12 +185,12 @@ class Map extends ChartComponent {
|
|
|
192
185
|
const lastElement = Array.from(event.target.parentNode.parentNode.children).at(-1);
|
|
193
186
|
|
|
194
187
|
// Add element to the end
|
|
195
|
-
d3.select(this.curElement).transition().duration(this.
|
|
188
|
+
d3.select(this.curElement).transition().duration(this.interactionDuration).attr('stroke-opacity', 0.7).attr('stroke-width', 0.5).attr('stroke', highlightedBorderColor);
|
|
196
189
|
lastElement.after(this.curElement);
|
|
197
190
|
return;
|
|
198
191
|
}
|
|
199
192
|
if (this.curElement) {
|
|
200
|
-
d3.select(this.curElement).transition().duration(this.
|
|
193
|
+
d3.select(this.curElement).transition().duration(this.interactionDuration).attr('stroke-opacity', 1).attr('stroke-width', 1).attr('stroke', '#bdbdbd');
|
|
201
194
|
}
|
|
202
195
|
};
|
|
203
196
|
this.getColumnData = () => {
|
|
@@ -211,7 +204,10 @@ class Map extends ChartComponent {
|
|
|
211
204
|
} = chart.config;
|
|
212
205
|
let columnData = DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
213
206
|
if (summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
214
|
-
const
|
|
207
|
+
const {
|
|
208
|
+
tables
|
|
209
|
+
} = this.props;
|
|
210
|
+
const table = getTableById(tables, table_id);
|
|
215
211
|
const summaryColumn = getTableColumnByKey(table, summary_column_key) || {};
|
|
216
212
|
columnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
217
213
|
}
|
|
@@ -227,8 +223,7 @@ class Map extends ChartComponent {
|
|
|
227
223
|
componentDidMount() {
|
|
228
224
|
this.createChart();
|
|
229
225
|
this.drawChart();
|
|
230
|
-
|
|
231
|
-
window.addEventListener('resize', this.debouncedHandleResize);
|
|
226
|
+
super.componentDidMount();
|
|
232
227
|
}
|
|
233
228
|
componentDidUpdate(prevProps) {
|
|
234
229
|
super.componentDidUpdate(prevProps);
|
|
@@ -240,7 +235,7 @@ class Map extends ChartComponent {
|
|
|
240
235
|
}
|
|
241
236
|
componentWillUnmount() {
|
|
242
237
|
this.destroyChart();
|
|
243
|
-
|
|
238
|
+
super.componentWillUnmount();
|
|
244
239
|
}
|
|
245
240
|
render() {
|
|
246
241
|
const {
|
package/dist/view/wrapper/map.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { debounce } from 'lodash-es';
|
|
4
3
|
import * as d3 from 'd3';
|
|
5
4
|
import { feature } from 'topojson';
|
|
6
5
|
import { getTableById, getTableColumnByKey } from 'dtable-utils';
|
|
@@ -14,11 +13,6 @@ import ChartComponent from './chart-component';
|
|
|
14
13
|
class Map extends ChartComponent {
|
|
15
14
|
constructor(props) {
|
|
16
15
|
super(props);
|
|
17
|
-
this.handleResize = () => {
|
|
18
|
-
this.destroyChart();
|
|
19
|
-
this.createChart();
|
|
20
|
-
this.drawChart();
|
|
21
|
-
};
|
|
22
16
|
this.createChart = () => {
|
|
23
17
|
const {
|
|
24
18
|
chart
|
|
@@ -163,7 +157,7 @@ class Map extends ChartComponent {
|
|
|
163
157
|
d3.select(item).attr('fill', color());
|
|
164
158
|
}
|
|
165
159
|
});
|
|
166
|
-
});
|
|
160
|
+
}).call(g => this.animateFadeIn(g));
|
|
167
161
|
const columnData = this.getColumnData();
|
|
168
162
|
this.setContinuousLegend({
|
|
169
163
|
previewType: canvasStyle.previewType,
|
|
@@ -179,12 +173,12 @@ class Map extends ChartComponent {
|
|
|
179
173
|
const lastElement = Array.from(event.target.parentNode.parentNode.children).at(-1);
|
|
180
174
|
|
|
181
175
|
// Add element to the end
|
|
182
|
-
d3.select(this.curElement).select('path').transition().duration(this.
|
|
176
|
+
d3.select(this.curElement).select('path').transition().duration(this.interactionDuration).attr('stroke-opacity', 0.7).attr('stroke-width', 0.5).attr('stroke', highlightedBorderColor);
|
|
183
177
|
lastElement.after(this.curElement);
|
|
184
178
|
return;
|
|
185
179
|
}
|
|
186
180
|
if (this.curElement) {
|
|
187
|
-
d3.select(this.curElement).select('path').transition().duration(this.
|
|
181
|
+
d3.select(this.curElement).select('path').transition().duration(this.interactionDuration).attr('stroke-opacity', 1).attr('stroke-width', 1).attr('stroke', '#bdbdbd');
|
|
188
182
|
}
|
|
189
183
|
};
|
|
190
184
|
this.getColumnData = () => {
|
|
@@ -198,7 +192,10 @@ class Map extends ChartComponent {
|
|
|
198
192
|
} = chart.config;
|
|
199
193
|
let columnData = DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
200
194
|
if (summary_type === CHART_SUMMARY_TYPE.ADVANCED) {
|
|
201
|
-
const
|
|
195
|
+
const {
|
|
196
|
+
tables
|
|
197
|
+
} = this.props;
|
|
198
|
+
const table = getTableById(tables, table_id);
|
|
202
199
|
const summaryColumn = getTableColumnByKey(table, summary_column_key) || {};
|
|
203
200
|
columnData = summaryColumn.data || DEFAULT_NUMBER_FORMAT_OBJECT;
|
|
204
201
|
}
|
|
@@ -214,8 +211,7 @@ class Map extends ChartComponent {
|
|
|
214
211
|
componentDidMount() {
|
|
215
212
|
this.createChart();
|
|
216
213
|
this.drawChart();
|
|
217
|
-
|
|
218
|
-
window.addEventListener('resize', this.debouncedHandleResize);
|
|
214
|
+
super.componentDidMount();
|
|
219
215
|
}
|
|
220
216
|
componentDidUpdate(prevProps) {
|
|
221
217
|
super.componentDidUpdate(prevProps);
|
|
@@ -227,7 +223,7 @@ class Map extends ChartComponent {
|
|
|
227
223
|
}
|
|
228
224
|
componentWillUnmount() {
|
|
229
225
|
this.destroyChart();
|
|
230
|
-
|
|
226
|
+
super.componentWillUnmount();
|
|
231
227
|
}
|
|
232
228
|
render() {
|
|
233
229
|
const {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { debounce } from 'lodash-es';
|
|
4
3
|
import * as d3 from 'd3';
|
|
5
|
-
import classNames from 'classnames';
|
|
6
4
|
import { getTableById, getTableColumnByKey, getNumberDisplayString } from 'dtable-utils';
|
|
7
5
|
import { CHART_SUMMARY_SHOW, DEFAULT_NUMBER_FORMAT_OBJECT, CHART_SUMMARY_TYPE, TITLE_AMOUNT } from '../../constants';
|
|
8
6
|
import { BaseUtils } from '../../utils';
|
|
@@ -12,11 +10,6 @@ import ChartComponent from './chart-component';
|
|
|
12
10
|
class Mirror extends ChartComponent {
|
|
13
11
|
constructor(props) {
|
|
14
12
|
super(props);
|
|
15
|
-
this.handleResize = () => {
|
|
16
|
-
this.destroyChart();
|
|
17
|
-
this.createChart();
|
|
18
|
-
this.drawChart();
|
|
19
|
-
};
|
|
20
13
|
this.createChart = () => {
|
|
21
14
|
const {
|
|
22
15
|
chart
|
|
@@ -118,9 +111,10 @@ class Mirror extends ChartComponent {
|
|
|
118
111
|
const scaleBand = d3.scaleBand().domain(scaleBandDomain).range(is_transpose ? [insertPadding, chartWidth - insertPadding] : [insertPadding, chartHeight - insertPadding - bottomLegendSpace]).paddingInner(0.1).paddingOuter(0);
|
|
119
112
|
|
|
120
113
|
// ScaleLinear axis
|
|
121
|
-
const maxDomain = d3.max(data, d => d.value);
|
|
114
|
+
const maxDomain = d3.max(data, d => d.value) || 0;
|
|
122
115
|
const scaleLinear1 = d3.scaleLinear().domain([maxDomain, 0]).range([scaleBand(scaleBandDomain[0]), scaleBand.bandwidth()]);
|
|
123
|
-
const
|
|
116
|
+
const secondDomainKey = scaleBandDomain[1] !== undefined ? scaleBandDomain[1] : scaleBandDomain[0];
|
|
117
|
+
const scaleLinear2 = d3.scaleLinear().domain([0, maxDomain]).range([scaleBand(secondDomainKey), scaleBand(secondDomainKey) + scaleBand.bandwidth()]);
|
|
124
118
|
const scaleLinearWrapper = this.chart.append('g').attr('class', 'scale-linear-axis-wrapper');
|
|
125
119
|
scaleLinearWrapper.append('g').attr('class', 'scale-linear-1').attr('transform', is_transpose ? `translate(0, ${chartHeight - insertPadding - bottomLegendSpace})` : `translate(${insertPadding}, 0)`).call(is_transpose ? d3.axisBottom(scaleLinear1).tickSizeInner(0).tickSizeOuter(0).ticks(5) : d3.axisLeft(scaleLinear1).tickSizeInner(0).tickSizeOuter(0).ticks(5)).call(g => {
|
|
126
120
|
g.select('.domain').remove();
|
|
@@ -237,7 +231,7 @@ class Mirror extends ChartComponent {
|
|
|
237
231
|
this.moveTooltip(event);
|
|
238
232
|
}).on('mouseleave', event => {
|
|
239
233
|
this.hiddenTooltip(event);
|
|
240
|
-
});
|
|
234
|
+
}).call(g => this.animateFadeIn(g));
|
|
241
235
|
this.setLegend({
|
|
242
236
|
legendName: 'group_name',
|
|
243
237
|
theme: themeColors,
|
|
@@ -260,8 +254,7 @@ class Mirror extends ChartComponent {
|
|
|
260
254
|
componentDidMount() {
|
|
261
255
|
this.createChart();
|
|
262
256
|
this.drawChart();
|
|
263
|
-
|
|
264
|
-
window.addEventListener('resize', this.debouncedHandleResize);
|
|
257
|
+
super.componentDidMount();
|
|
265
258
|
}
|
|
266
259
|
componentDidUpdate(prevProps) {
|
|
267
260
|
super.componentDidUpdate(prevProps);
|
|
@@ -273,22 +266,16 @@ class Mirror extends ChartComponent {
|
|
|
273
266
|
}
|
|
274
267
|
componentWillUnmount() {
|
|
275
268
|
this.destroyChart();
|
|
276
|
-
|
|
269
|
+
super.componentWillUnmount();
|
|
277
270
|
}
|
|
278
271
|
render() {
|
|
279
|
-
const {
|
|
280
|
-
chart
|
|
281
|
-
} = this.props;
|
|
282
272
|
const {
|
|
283
273
|
tooltipData,
|
|
284
274
|
toolTipPosition
|
|
285
275
|
} = this.state;
|
|
286
276
|
return /*#__PURE__*/React.createElement("div", {
|
|
287
277
|
ref: ref => this.container = ref,
|
|
288
|
-
className:
|
|
289
|
-
'show-x-axis-label': this.isShowXAxisLabel(chart),
|
|
290
|
-
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
291
|
-
})
|
|
278
|
+
className: "sea-chart-container"
|
|
292
279
|
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
293
280
|
tooltipData: tooltipData,
|
|
294
281
|
toolTipPosition: toolTipPosition,
|
package/dist/view/wrapper/pie.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { debounce } from 'lodash-es';
|
|
4
3
|
import * as d3 from 'd3';
|
|
5
4
|
import { CHART_LABEL_POSITIONS, CHART_LABEL_FORMATS, CHART_THEME_COLOR, CHART_TYPE } from '../../constants';
|
|
6
5
|
import { BaseUtils, isFunction } from '../../utils';
|
|
@@ -11,11 +10,6 @@ import ChartComponent from './chart-component';
|
|
|
11
10
|
class Pie extends ChartComponent {
|
|
12
11
|
constructor(props) {
|
|
13
12
|
super(props);
|
|
14
|
-
this.handleResize = () => {
|
|
15
|
-
this.destroyChart();
|
|
16
|
-
this.createChart();
|
|
17
|
-
this.drawChart();
|
|
18
|
-
};
|
|
19
13
|
this.createChart = () => {
|
|
20
14
|
const {
|
|
21
15
|
chart
|
|
@@ -68,13 +62,13 @@ class Pie extends ChartComponent {
|
|
|
68
62
|
if (!Array.isArray(newData) || newData.length === 0) return;
|
|
69
63
|
|
|
70
64
|
// Color
|
|
71
|
-
const colorDomain = new Set(
|
|
65
|
+
const colorDomain = new Set(newData.map(d => d.name));
|
|
72
66
|
const colorRange = Array.from(colorDomain).map(name => colorMap[name === null || name === void 0 ? void 0 : name.trim()]);
|
|
73
67
|
const color = d3.scaleOrdinal().domain(colorDomain).range(colorRange);
|
|
74
68
|
|
|
75
69
|
// Pie and Arc
|
|
76
70
|
const pie = d3.pie().sort(null).value(d => d.value);
|
|
77
|
-
const arcs = pie(
|
|
71
|
+
const arcs = pie(newData);
|
|
78
72
|
const arc = d3.arc().innerRadius(0).outerRadius(Math.min(chartWidth, chartHeight) / 2 * 0.7);
|
|
79
73
|
|
|
80
74
|
// Draw Pie
|
|
@@ -119,13 +113,17 @@ class Pie extends ChartComponent {
|
|
|
119
113
|
}).on('mouseleave', (event, data) => {
|
|
120
114
|
this.hiddenTooltip();
|
|
121
115
|
this.handleAcitveAndInActiveState('active', event);
|
|
116
|
+
}).call(g => {
|
|
117
|
+
this.animateArcGrowIn(g, arc);
|
|
118
|
+
this.animateFadeIn(this.chart.selectAll('text'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
119
|
+
this.animateFadeIn(this.chart.selectAll('line'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
122
120
|
});
|
|
123
121
|
if (show_legend) {
|
|
124
122
|
this.setLegend({
|
|
125
123
|
legendName: 'name',
|
|
126
124
|
theme,
|
|
127
125
|
legendPosition: 'center-right',
|
|
128
|
-
data,
|
|
126
|
+
data: newData,
|
|
129
127
|
colorScale: color
|
|
130
128
|
});
|
|
131
129
|
}
|
|
@@ -222,8 +220,7 @@ class Pie extends ChartComponent {
|
|
|
222
220
|
componentDidMount() {
|
|
223
221
|
this.createChart();
|
|
224
222
|
this.drawChart();
|
|
225
|
-
|
|
226
|
-
window.addEventListener('resize', this.debouncedHandleResize);
|
|
223
|
+
super.componentDidMount();
|
|
227
224
|
}
|
|
228
225
|
componentDidUpdate(prevProps) {
|
|
229
226
|
super.componentDidUpdate(prevProps);
|
|
@@ -235,7 +232,7 @@ class Pie extends ChartComponent {
|
|
|
235
232
|
}
|
|
236
233
|
componentWillUnmount() {
|
|
237
234
|
this.destroyChart();
|
|
238
|
-
|
|
235
|
+
super.componentWillUnmount();
|
|
239
236
|
}
|
|
240
237
|
render() {
|
|
241
238
|
const {
|