sea-chart 2.0.19 → 2.0.20

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.
@@ -19,7 +19,8 @@ const ToolTip = _ref => {
19
19
  });
20
20
  const {
21
21
  title,
22
- items
22
+ items,
23
+ titleMarkColor
23
24
  } = tooltipData || {
24
25
  title: '',
25
26
  items: []
@@ -71,13 +72,22 @@ const ToolTip = _ref => {
71
72
  }
72
73
  }, title && /*#__PURE__*/_react.default.createElement("div", {
73
74
  className: "sea-chart-d3-tooltip-title"
74
- }, title), /*#__PURE__*/_react.default.createElement("ul", {
75
+ }, titleMarkColor && /*#__PURE__*/_react.default.createElement("span", {
76
+ style: {
77
+ width: '8px',
78
+ height: '8px',
79
+ borderRadius: '50%',
80
+ backgroundColor: titleMarkColor,
81
+ display: 'inline-block',
82
+ marginRight: '12px'
83
+ }
84
+ }), title), /*#__PURE__*/_react.default.createElement("ul", {
75
85
  className: "sea-chart-d3-tooltip-list"
76
86
  }, items.map((item, index) => {
77
87
  return /*#__PURE__*/_react.default.createElement("li", {
78
88
  className: "sea-chart-d3-tooltip-list-item",
79
89
  key: index
80
- }, /*#__PURE__*/_react.default.createElement("span", {
90
+ }, item.color && /*#__PURE__*/_react.default.createElement("span", {
81
91
  className: "sea-chart-d3-tooltip-marker",
82
92
  style: {
83
93
  backgroundColor: item.color
@@ -69,7 +69,7 @@ const TypesDialog = _ref => {
69
69
  }, [onChange, selectedType, onToggle]);
70
70
  const handleFilterTypes = (0, _react.useCallback)(() => {
71
71
  if (hideTypeToggle) {
72
- const newChartTypes = _constants.CHART_TYPES.filter(item => ['Histogram', 'Bar_chart', 'Line_chart', 'Area', 'Pie_chart'].includes(item.name));
72
+ const newChartTypes = _constants.CHART_TYPES.filter(item => ['Histogram', 'Bar_chart', 'Line_chart', 'Area', 'Pie_chart', 'Scatter_chart'].includes(item.name));
73
73
  return newChartTypes;
74
74
  }
75
75
  return _constants.CHART_TYPES;
@@ -61,7 +61,7 @@ class ChartComponent extends _react.Component {
61
61
  } = initConfig;
62
62
  const width = containerWidth - marginLeft;
63
63
  const height = containerHeight - marginBottom;
64
- _this.chart = d3.create('svg').attr('id', id).attr('class', "svg-wrapper-".concat(id)).attr('width', width).attr('height', height).attr('viewBox', [0, 0, width, height]);
64
+ _this.chart = d3.create('svg').attr('id', id).attr('width', width).attr('height', height).attr('viewBox', [0, 0, width, height]);
65
65
  _this.container.appendChild(_this.chart.node());
66
66
  _this.chartBoundingClientRect = {
67
67
  ...JSON.parse(JSON.stringify(_this.chart.node().getBoundingClientRect())),
@@ -585,7 +585,6 @@ class ChartComponent extends _react.Component {
585
585
  };
586
586
  // set legend
587
587
  this.setLegend = _ref => {
588
- var _this$chart$node;
589
588
  let {
590
589
  legendName,
591
590
  theme = _constants.CHART_THEME_COLOR['light'],
@@ -619,7 +618,7 @@ class ChartComponent extends _react.Component {
619
618
  rightLegendSpace
620
619
  } = this.chartBoundingClientRect;
621
620
  const groupsData = this.getLegendDataGroups(legendData);
622
- const legendWrapper = this.chart.append('g').attr('class', "legend-wrapper-".concat((_this$chart$node = this.chart.node()) === null || _this$chart$node === void 0 ? void 0 : _this$chart$node.id));
621
+ const legendWrapper = this.chart.append('g').attr('class', 'legend-wrapper');
623
622
 
624
623
  // Render first group legend
625
624
  this.renderLegend({
@@ -913,15 +912,20 @@ class ChartComponent extends _react.Component {
913
912
  }
914
913
  };
915
914
  this.setLegendItemOffset = (legendItems, end) => {
915
+ const {
916
+ height: chartHeight,
917
+ bottomLegendSpace
918
+ } = this.chartBoundingClientRect;
916
919
  const endItem = legendItems[legendItems.length - 1];
917
920
  const endTranslateX = Number(endItem.getAttribute('data-translateX'));
918
921
  const {
919
922
  width: endWidth
920
923
  } = endItem.getBoundingClientRect();
921
924
  const offset = end - (endTranslateX + endWidth);
925
+ const curTranslateY = bottomLegendSpace ? chartHeight - bottomLegendSpace : 0; // legend offset bottom
922
926
  legendItems.forEach(legendItem => {
923
927
  const curTranslateX = Number(legendItem.getAttribute('data-translateX')) + offset;
924
- d3.select(legendItem).attr('transform', "translate(".concat(curTranslateX, ",0)")).attr('data-translateX', curTranslateX);
928
+ d3.select(legendItem).attr('transform', "translate(".concat(curTranslateX, ", ").concat(curTranslateY, ")")).attr('data-translateX', curTranslateX);
925
929
  d3.select(legendItem).attr('opacity', 1);
926
930
  });
927
931
  };
@@ -1125,11 +1129,11 @@ class ChartComponent extends _react.Component {
1125
1129
  return themeColors || _constants.CHART_THEME_COLOR[_constants.THEME_NAME_MAP.LIGHT];
1126
1130
  };
1127
1131
  this.setDispalyGoalLine = (goal_label, goal_value, insertPadding, yScale) => {
1128
- var _this$chart$node2;
1132
+ var _this$chart$node;
1129
1133
  const {
1130
1134
  width: chartWidth
1131
1135
  } = this.chartBoundingClientRect;
1132
- const annotationWrapper = this.chart.append('g').attr('class', "annotation-wrapper-".concat((_this$chart$node2 = this.chart.node()) === null || _this$chart$node2 === void 0 ? void 0 : _this$chart$node2.id));
1136
+ const annotationWrapper = this.chart.append('g').attr('class', "annotation-wrapper-".concat((_this$chart$node = this.chart.node()) === null || _this$chart$node === void 0 ? void 0 : _this$chart$node.id));
1133
1137
  annotationWrapper.append('line').attr('stroke', '#aaa').attr('x1', insertPadding).attr('y1', yScale(goal_value)).attr('x2', chartWidth - insertPadding).attr('y2', yScale(goal_value)).attr('stroke-dasharray', '8,3').call(g => {
1134
1138
  annotationWrapper.append('text').attr('x', chartWidth - insertPadding - 30).attr('y', yScale(goal_value) - 10).attr('fill', '#666').text(goal_label);
1135
1139
  });
@@ -1197,12 +1201,15 @@ class ChartComponent extends _react.Component {
1197
1201
  g.attr('transform', "translate(".concat(translateX, ", ").concat(translateY, ")"));
1198
1202
  });
1199
1203
  };
1200
- this.setActiveAndInActiveState = (state, allGroup, curGroupName) => {
1204
+ this.setActiveAndInActiveState = (state, allGroup, curGroupName, chartType) => {
1201
1205
  if (state === 'active') {
1202
1206
  allGroup.forEach(g => {
1203
1207
  const rects = Array.from(g.children);
1204
1208
  rects.forEach(item => {
1205
- d3.select(item).transition().duration(200).attr('opacity', 1);
1209
+ d3.select(item).transition().duration(500).attr('opacity', 1);
1210
+ if ([_constants.CHART_TYPE.PIE, _constants.CHART_TYPE.RING].includes(chartType)) {
1211
+ d3.select(item).attr('stroke-width', 2);
1212
+ }
1206
1213
  });
1207
1214
  });
1208
1215
  }
@@ -1211,7 +1218,11 @@ class ChartComponent extends _react.Component {
1211
1218
  const rects = Array.from(g.children);
1212
1219
  rects.forEach(item => {
1213
1220
  if (item.getAttribute('data-groupName') !== curGroupName) {
1214
- d3.select(item).transition().duration(200).attr('opacity', 0.3);
1221
+ d3.selectAll([item]).transition().duration(500).attr('opacity', 0.3);
1222
+ } else {
1223
+ if ([_constants.CHART_TYPE.PIE, _constants.CHART_TYPE.RING].includes(chartType)) {
1224
+ d3.select(item).attr('stroke-width', 0.5);
1225
+ }
1215
1226
  }
1216
1227
  });
1217
1228
  });
@@ -1410,20 +1421,22 @@ class ChartComponent extends _react.Component {
1410
1421
  const minItem = newAllData[minIndex];
1411
1422
  return minItem;
1412
1423
  };
1413
- this.clearOldVerticalAnnotation = rectsWrapper => {
1414
- const oldAnnotationWrapper = rectsWrapper.selectAll('.vertical-annotation-wrapper');
1424
+ this.clearOldVerticalAnnotation = contentWrapper => {
1425
+ const oldAnnotationWrapper = contentWrapper.selectAll('.vertical-annotation-wrapper');
1415
1426
  oldAnnotationWrapper.node() && oldAnnotationWrapper.node().remove();
1416
1427
  };
1417
- this.addVerticalAnnotation = (rectsWrapper, minDistanceItem, theme) => {
1428
+ this.addVerticalAnnotation = (contentWrapper, minDistanceItem, theme) => {
1418
1429
  const {
1419
1430
  height: chartHeight,
1420
1431
  insertPadding,
1421
1432
  marginTop
1422
1433
  } = this.chartBoundingClientRect;
1423
1434
  const {
1424
- x
1435
+ x,
1436
+ y
1425
1437
  } = minDistanceItem;
1426
- rectsWrapper.append('g').attr('class', 'vertical-annotation-wrapper').append('line').attr('x1', x).attr('y1', insertPadding + marginTop).attr('x2', x).attr('y2', chartHeight - insertPadding).attr('stroke', theme.XAxisColor);
1438
+ const annotationWrapper = contentWrapper.insert('g', ':first-child').attr('class', 'vertical-annotation-wrapper');
1439
+ annotationWrapper.append('line').attr('x1', x).attr('y1', insertPadding + marginTop).attr('x2', x).attr('y2', chartHeight - insertPadding).attr('stroke', theme.XAxisColor);
1427
1440
  };
1428
1441
  this.initLabelStroke(props === null || props === void 0 ? void 0 : props.globalTheme);
1429
1442
  this.chartBoundingClientRect = {};
@@ -27,6 +27,7 @@ var _area = _interopRequireDefault(require("./area"));
27
27
  var _areaGroup = _interopRequireDefault(require("./area-group"));
28
28
  var _pie = _interopRequireDefault(require("./pie"));
29
29
  var _ring = _interopRequireDefault(require("./ring"));
30
+ var _scatter = _interopRequireDefault(require("./scatter"));
30
31
  var _basicNumberCard = _interopRequireDefault(require("./basic-number-card"));
31
32
  var _trend = _interopRequireDefault(require("./trend"));
32
33
  var _tableElement = _interopRequireDefault(require("./table-element"));
@@ -237,6 +238,12 @@ const Wrapper = _ref => {
237
238
  canvasStyle: canvasStyle
238
239
  }));
239
240
  }
241
+ case _constants.CHART_TYPE.SCATTER:
242
+ {
243
+ return /*#__PURE__*/_react.default.createElement(_scatter.default, Object.assign({}, baseProps, {
244
+ canvasStyle: canvasStyle
245
+ }));
246
+ }
240
247
  case _constants.CHART_TYPE.BASIC_NUMBER_CARD:
241
248
  {
242
249
  return /*#__PURE__*/_react.default.createElement(_basicNumberCard.default, Object.assign({}, baseProps, {
@@ -56,7 +56,7 @@ class LineGroup extends _chartComponent.default {
56
56
  this.renderAxisLabel(this.props.chart, this.props.tables, this.container);
57
57
  (0, _utils.isFunction)(customRender) && customRender(this.chart);
58
58
  };
59
- this.showTooltip = (event, data, rectsWrapper) => {
59
+ this.showTooltip = (event, data, contentWrapper) => {
60
60
  const {
61
61
  offsetX,
62
62
  offsetY
@@ -64,7 +64,7 @@ class LineGroup extends _chartComponent.default {
64
64
  const {
65
65
  title,
66
66
  items
67
- } = this.getTooltipItems(data, rectsWrapper);
67
+ } = this.getTooltipItems(data, contentWrapper);
68
68
  const newTooltipData = {
69
69
  title,
70
70
  items
@@ -79,7 +79,7 @@ class LineGroup extends _chartComponent.default {
79
79
  }
80
80
  });
81
81
  };
82
- this.moveTooltip = (event, data, rectsWrapper) => {
82
+ this.moveTooltip = (event, data, contentWrapper) => {
83
83
  const {
84
84
  offsetX,
85
85
  offsetY
@@ -87,7 +87,7 @@ class LineGroup extends _chartComponent.default {
87
87
  const {
88
88
  title,
89
89
  items
90
- } = this.getTooltipItems(data, rectsWrapper);
90
+ } = this.getTooltipItems(data, contentWrapper);
91
91
  const newTooltipData = {
92
92
  title,
93
93
  items
@@ -107,8 +107,8 @@ class LineGroup extends _chartComponent.default {
107
107
  toolTipPosition: null
108
108
  });
109
109
  };
110
- this.getTooltipItems = (data, rectsWrapper) => {
111
- var _rectsWrapper$selectA;
110
+ this.getTooltipItems = (data, contentWrapper) => {
111
+ var _contentWrapper$selec;
112
112
  const {
113
113
  summaryColumn,
114
114
  chart
@@ -117,7 +117,7 @@ class LineGroup extends _chartComponent.default {
117
117
  y_axis_summary_method
118
118
  } = chart.config;
119
119
  const title = !data.name && typeof data.name !== 'number' ? _intl.default.get(_constants.EMPTY_NAME) : data.name;
120
- const circleList = (_rectsWrapper$selectA = rectsWrapper.selectAll('circle')) === null || _rectsWrapper$selectA === void 0 ? void 0 : _rectsWrapper$selectA.nodes();
120
+ const circleList = (_contentWrapper$selec = contentWrapper.selectAll('circle')) === null || _contentWrapper$selec === void 0 ? void 0 : _contentWrapper$selec.nodes();
121
121
  const items = circleList.filter(circle => circle.getAttribute('data-name') === title).map(circle => {
122
122
  return {
123
123
  color: this.colorMap[circle.getAttribute('data-groupName')],
@@ -166,12 +166,12 @@ class LineGroup extends _chartComponent.default {
166
166
  // Y axis
167
167
  const niceEnd = d3.nice(0, d3.max(data, d => d.value), 5)[1];
168
168
  const y = d3.scaleLinear().domain(y_axis_auto_range ? [0, niceEnd] : [y_axis_min || 0, y_axis_max || niceEnd]).range([chartHeight - insertPadding, insertPadding + marginTop]);
169
- this.chart.append('g').attr('transform', "translate(".concat(insertPadding, ", 0)")).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d => _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, d, y_axis_summary_method))).call(g => this.drawYaxis(g, theme));
169
+ this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform', "translate(".concat(insertPadding, ", 0)")).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d => _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, d, y_axis_summary_method))).call(g => this.drawYaxis(g, theme));
170
170
 
171
171
  // X axis
172
172
  const xDomain = data.map(item => item.name);
173
173
  const x = d3.scaleBand().domain(xDomain).range([insertPadding + this.horizontalOverflowOffset, chartWidth - insertPadding]).paddingInner(0.4).paddingOuter(0.1);
174
- this.chart.append('g').attr('transform', "translate(0, ".concat(chartHeight - insertPadding, ")")).call(d3.axisBottom(x).tickSizeOuter(0).tickSizeInner(5)).call(g => {
174
+ this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform', "translate(0, ".concat(chartHeight - insertPadding, ")")).call(d3.axisBottom(x).tickSizeOuter(0).tickSizeInner(5)).call(g => {
175
175
  this.ticksAddName(g);
176
176
  g.selectAll('.domain').attr('stroke', theme.XAxisColor);
177
177
  g.selectAll('.tick line').attr('stroke', theme.XAxisColor);
@@ -181,7 +181,7 @@ class LineGroup extends _chartComponent.default {
181
181
  });
182
182
 
183
183
  // Line
184
- const rectsWrapper = this.chart.append('g').attr('class', "rects-wrapper-".concat(chart === null || chart === void 0 ? void 0 : chart.id));
184
+ const contentWrapper = this.chart.append('g').attr('class', 'content-wrapper');
185
185
  const circleDatas = [];
186
186
  const groupData = d3.groups(data, d => d.group_name);
187
187
  groupData.forEach(item => {
@@ -199,7 +199,7 @@ class LineGroup extends _chartComponent.default {
199
199
  }).curve(line_type === _constants.CHART_LINE_TYPES[1] ? d3.curveBumpX : d3.curveLinear);
200
200
  const group_name = item[0];
201
201
  const data = item[1];
202
- rectsWrapper.append('path').attr('fill', 'none').attr('stroke', this.colorMap[group_name]).attr('stroke-width', 2).attr('d', () => line(data));
202
+ contentWrapper.append('path').attr('fill', 'none').attr('stroke', this.colorMap[group_name]).attr('stroke-width', 2).attr('d', () => line(data));
203
203
  circleDatas.push({
204
204
  group_name,
205
205
  circleData
@@ -214,11 +214,11 @@ class LineGroup extends _chartComponent.default {
214
214
  } = _ref;
215
215
  circleData.forEach(item => {
216
216
  if (Object.keys(item).length > 0) {
217
- rectsWrapper.append('circle').attr('cx', item.x).attr('cy', item.y).attr('r', 3).attr('fill', this.colorMap[group_name]).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 => {
217
+ contentWrapper.append('circle').attr('cx', item.x).attr('cy', item.y).attr('r', 3).attr('fill', this.colorMap[group_name]).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 => {
218
218
  // circle label
219
219
  if (y_axis_show_value) {
220
220
  const curCircleEl = g.node();
221
- rectsWrapper.append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('fill', theme.labelColor).attr('font-size', _utils.BaseUtils.getLabelFontSize(label_font_size)).text(_utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(curCircleEl.getAttribute('data-text')), y_axis_summary_method)).call(g => {
221
+ contentWrapper.append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('fill', theme.labelColor).attr('font-size', _utils.BaseUtils.getLabelFontSize(label_font_size)).text(_utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(curCircleEl.getAttribute('data-text')), y_axis_summary_method)).call(g => {
222
222
  const {
223
223
  width
224
224
  } = g.node().getBoundingClientRect();
@@ -238,7 +238,7 @@ class LineGroup extends _chartComponent.default {
238
238
  event,
239
239
  state: 'zoomIn',
240
240
  circleDatas,
241
- rectsWrapper,
241
+ contentWrapper,
242
242
  eventState: 'over'
243
243
  });
244
244
  }).on('mousemove', event => {
@@ -246,7 +246,7 @@ class LineGroup extends _chartComponent.default {
246
246
  event,
247
247
  state: 'zoomIn',
248
248
  circleDatas,
249
- rectsWrapper,
249
+ contentWrapper,
250
250
  eventState: 'move'
251
251
  });
252
252
  }).on('mouseleave', event => {
@@ -254,7 +254,7 @@ class LineGroup extends _chartComponent.default {
254
254
  event,
255
255
  state: 'zoomOut',
256
256
  circleDatas,
257
- rectsWrapper,
257
+ contentWrapper,
258
258
  eventState: 'leave'
259
259
  });
260
260
  });
@@ -271,12 +271,12 @@ class LineGroup extends _chartComponent.default {
271
271
  });
272
272
  };
273
273
  this.updateCircleAndTickStyle = _ref2 => {
274
- var _rectsWrapper$selectA2;
274
+ var _contentWrapper$selec2;
275
275
  let {
276
276
  event,
277
277
  state,
278
278
  circleDatas,
279
- rectsWrapper,
279
+ contentWrapper,
280
280
  eventState
281
281
  } = _ref2;
282
282
  const {
@@ -300,7 +300,7 @@ class LineGroup extends _chartComponent.default {
300
300
  });
301
301
  const minIndex = d3.minIndex(minDistanceArr, d => d.distance);
302
302
  const minDistanceItem = minDistanceArr[minIndex];
303
- const circleList = (_rectsWrapper$selectA2 = rectsWrapper.selectAll('circle')) === null || _rectsWrapper$selectA2 === void 0 ? void 0 : _rectsWrapper$selectA2.nodes();
303
+ const circleList = (_contentWrapper$selec2 = contentWrapper.selectAll('circle')) === null || _contentWrapper$selec2 === void 0 ? void 0 : _contentWrapper$selec2.nodes();
304
304
  if (state === 'zoomIn') {
305
305
  // circle
306
306
  circleList && circleList.forEach(circle => {
@@ -309,14 +309,14 @@ class LineGroup extends _chartComponent.default {
309
309
  d3.select(circle).attr('opacity', 1);
310
310
  d3.select(circle).attr('r', 5);
311
311
  } else {
312
- d3.select(circle).attr('opacity', 0);
312
+ !y_axis_show_value && d3.select(circle).attr('opacity', 0);
313
313
  d3.select(circle).attr('r', 3);
314
314
  }
315
315
  });
316
316
  // line
317
317
  const theme = _constants.CHART_THEME_COLOR[globalTheme];
318
- this.clearOldVerticalAnnotation(rectsWrapper);
319
- this.addVerticalAnnotation(rectsWrapper, minDistanceItem, theme);
318
+ this.clearOldVerticalAnnotation(contentWrapper);
319
+ this.addVerticalAnnotation(contentWrapper, minDistanceItem, theme);
320
320
  } else {
321
321
  // circle
322
322
  circleList && circleList.forEach(circle => {
@@ -324,15 +324,15 @@ class LineGroup extends _chartComponent.default {
324
324
  d3.select(circle).attr('r', 3);
325
325
  });
326
326
  // line
327
- this.clearOldVerticalAnnotation(rectsWrapper);
327
+ this.clearOldVerticalAnnotation(contentWrapper);
328
328
  }
329
329
 
330
330
  // tooltip
331
331
  if (eventState === 'over') {
332
- this.showTooltip(event, minDistanceItem, rectsWrapper);
332
+ this.showTooltip(event, minDistanceItem, contentWrapper);
333
333
  }
334
334
  if (eventState === 'move') {
335
- this.moveTooltip(event, minDistanceItem, rectsWrapper);
335
+ this.moveTooltip(event, minDistanceItem, contentWrapper);
336
336
  }
337
337
  if (eventState === 'leave') {
338
338
  this.hiddenTooltip();
@@ -157,12 +157,12 @@ class Line extends _chartComponent.default {
157
157
  // Y axis
158
158
  const niceEnd = d3.nice(0, d3.max(data, d => d.value), 5)[1];
159
159
  const y = d3.scaleLinear().domain(y_axis_auto_range ? [0, niceEnd] : [y_axis_min || 0, y_axis_max || niceEnd]).range([chartHeight - insertPadding, insertPadding + marginTop]);
160
- this.chart.append('g').attr('transform', "translate(".concat(insertPadding, ", 0)")).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d => _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, d, y_axis_summary_method))).call(g => this.drawYaxis(g, theme));
160
+ this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform', "translate(".concat(insertPadding, ", 0)")).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d => _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, d, y_axis_summary_method))).call(g => this.drawYaxis(g, theme));
161
161
 
162
162
  // X axis
163
163
  const xDomain = data.map(item => item.name);
164
164
  const x = d3.scaleBand().domain(xDomain).range([insertPadding + this.horizontalOverflowOffset, chartWidth - insertPadding]).paddingInner(0.4).paddingOuter(0.1);
165
- this.chart.append('g').attr('transform', "translate(0, ".concat(chartHeight - insertPadding, ")")).call(d3.axisBottom(x).tickSizeOuter(0).tickSizeInner(5)).call(g => {
165
+ this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform', "translate(0, ".concat(chartHeight - insertPadding, ")")).call(d3.axisBottom(x).tickSizeOuter(0).tickSizeInner(5)).call(g => {
166
166
  this.ticksAddName(g);
167
167
  g.selectAll('.domain').attr('stroke', theme.XAxisColor);
168
168
  g.selectAll('.tick line').attr('stroke', theme.XAxisColor);
@@ -184,16 +184,16 @@ class Line extends _chartComponent.default {
184
184
  circleData[index]['value'] = d.value;
185
185
  return yVal;
186
186
  }).curve(line_type === _constants.CHART_LINE_TYPES[1] ? d3.curveBumpX : d3.curveLinear);
187
- const rectsWrapper = this.chart.append('g').attr('class', "rects-wrapper-".concat(chart === null || chart === void 0 ? void 0 : chart.id));
188
- rectsWrapper.append('path').attr('fill', 'none').attr('stroke', chartBarColor).attr('stroke-width', 2).attr('d', () => line(data));
187
+ const contentWrapper = this.chart.append('g').attr('class', 'content-wrapper');
188
+ contentWrapper.append('path').attr('fill', 'none').attr('stroke', chartBarColor).attr('stroke-width', 2).attr('d', () => line(data));
189
189
 
190
190
  // circle
191
191
  circleData.forEach(item => {
192
- rectsWrapper.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 => {
192
+ 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 => {
193
193
  // circle label
194
194
  if (y_axis_show_value) {
195
195
  const curCircleEl = g.node();
196
- rectsWrapper.append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('fill', theme.labelColor).attr('font-size', _utils.BaseUtils.getLabelFontSize(label_font_size)).text(_utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(curCircleEl.getAttribute('data-text')), y_axis_summary_method)).call(g => {
196
+ contentWrapper.append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('fill', theme.labelColor).attr('font-size', _utils.BaseUtils.getLabelFontSize(label_font_size)).text(_utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(curCircleEl.getAttribute('data-text')), y_axis_summary_method)).call(g => {
197
197
  const {
198
198
  width
199
199
  } = g.node().getBoundingClientRect();
@@ -211,7 +211,7 @@ class Line extends _chartComponent.default {
211
211
  event,
212
212
  state: 'zoomIn',
213
213
  circleData,
214
- rectsWrapper,
214
+ contentWrapper,
215
215
  eventState: 'over',
216
216
  tooltipTitle
217
217
  });
@@ -220,7 +220,7 @@ class Line extends _chartComponent.default {
220
220
  event,
221
221
  state: 'zoomIn',
222
222
  circleData,
223
- rectsWrapper,
223
+ contentWrapper,
224
224
  eventState: 'move',
225
225
  tooltipTitle
226
226
  });
@@ -229,7 +229,7 @@ class Line extends _chartComponent.default {
229
229
  event,
230
230
  state: 'zoomOut',
231
231
  circleData,
232
- rectsWrapper,
232
+ contentWrapper,
233
233
  eventState: 'leave',
234
234
  tooltipTitle
235
235
  });
@@ -239,12 +239,12 @@ class Line extends _chartComponent.default {
239
239
  }
240
240
  };
241
241
  this.updateCircleAndTickStyle = _ref => {
242
- var _rectsWrapper$selectA;
242
+ var _contentWrapper$selec;
243
243
  let {
244
244
  event,
245
245
  state,
246
246
  circleData,
247
- rectsWrapper,
247
+ contentWrapper,
248
248
  eventState,
249
249
  tooltipTitle
250
250
  } = _ref;
@@ -259,7 +259,7 @@ class Line extends _chartComponent.default {
259
259
  offsetX
260
260
  } = event;
261
261
  const minDistanceItem = this.getMinDistanceItem(offsetX, circleData);
262
- const circleList = (_rectsWrapper$selectA = rectsWrapper.selectAll('circle')) === null || _rectsWrapper$selectA === void 0 ? void 0 : _rectsWrapper$selectA.nodes();
262
+ const circleList = (_contentWrapper$selec = contentWrapper.selectAll('circle')) === null || _contentWrapper$selec === void 0 ? void 0 : _contentWrapper$selec.nodes();
263
263
  if (state === 'zoomIn') {
264
264
  // circle
265
265
  circleList && circleList.forEach(circle => {
@@ -268,14 +268,14 @@ class Line extends _chartComponent.default {
268
268
  d3.select(circle).attr('opacity', 1);
269
269
  d3.select(circle).attr('r', 5);
270
270
  } else {
271
- d3.select(circle).attr('opacity', 0);
271
+ !y_axis_show_value && d3.select(circle).attr('opacity', 0);
272
272
  d3.select(circle).attr('r', 3);
273
273
  }
274
274
  });
275
275
  // line
276
276
  const theme = _constants.CHART_THEME_COLOR[globalTheme];
277
- this.clearOldVerticalAnnotation(rectsWrapper);
278
- this.addVerticalAnnotation(rectsWrapper, minDistanceItem, theme);
277
+ this.clearOldVerticalAnnotation(contentWrapper);
278
+ this.addVerticalAnnotation(contentWrapper, minDistanceItem, theme);
279
279
  } else {
280
280
  // circle
281
281
  circleList && circleList.forEach(circle => {
@@ -283,7 +283,7 @@ class Line extends _chartComponent.default {
283
283
  d3.select(circle).attr('r', 3);
284
284
  });
285
285
  // line
286
- this.clearOldVerticalAnnotation(rectsWrapper);
286
+ this.clearOldVerticalAnnotation(contentWrapper);
287
287
  }
288
288
 
289
289
  // tooltip
@@ -86,7 +86,7 @@ class Pie extends _chartComponent.default {
86
86
  const arc = d3.arc().innerRadius(0).outerRadius(Math.min(chartWidth, chartHeight) / 2 * 0.7);
87
87
 
88
88
  // Draw Pie
89
- this.chart.append('g').attr('stroke', 'white').attr('stroke-width', 2).selectAll().data(arcs).join('path').attr('fill', d => color(d.data.name)).attr('d', arc).attr('data-groupName', d => d.data.name).call(g => {
89
+ this.chart.append('g').attr('class', 'content-wrapper').attr('stroke', 'white').selectAll().data(arcs).join('path').attr('stroke-width', 2).attr('opacity', 1).attr('fill', d => color(d.data.name)).attr('d', arc).attr('data-groupName', d => d.data.name).call(g => {
90
90
  var _g$node$parentNode;
91
91
  const {
92
92
  width,
@@ -185,7 +185,7 @@ class Pie extends _chartComponent.default {
185
185
  this.handleAcitveAndInActiveState = (state, event) => {
186
186
  const allGroup = [event.currentTarget.parentNode];
187
187
  const curGroupName = event.currentTarget.getAttribute('data-groupName');
188
- this.setActiveAndInActiveState(state, allGroup, curGroupName);
188
+ this.setActiveAndInActiveState(state, allGroup, curGroupName, _constants.CHART_TYPE.PIE);
189
189
  };
190
190
  this.getLabel = (val, percent) => {
191
191
  const {
@@ -87,7 +87,7 @@ class Ring extends _chartComponent.default {
87
87
  const arc = d3.arc().innerRadius(Math.min(chartWidth, chartHeight) / 2 * 0.7).outerRadius(Math.min(chartWidth, chartHeight) / 2 * 0.5);
88
88
 
89
89
  // Draw Ring
90
- this.chart.append('g').selectAll().data(arcs).join('path').attr('stroke', 'white').attr('stroke-width', 2).attr('fill', d => color(d.data.name)).attr('d', arc).attr('data-groupName', d => d.data.name).call(g => {
90
+ this.chart.append('g').attr('class', 'content-wrapper').selectAll().data(arcs).join('path').attr('stroke', 'white').attr('stroke-width', 2).attr('opacity', 1).attr('fill', d => color(d.data.name)).attr('d', arc).attr('data-groupName', d => d.data.name).call(g => {
91
91
  var _g$node$parentNode;
92
92
  const {
93
93
  width,
@@ -108,7 +108,7 @@ class Ring extends _chartComponent.default {
108
108
  if (display_label) {
109
109
  const labelRadius = this.isInnerLabel ? arc.outerRadius()() * 1.2 : arc.outerRadius()() * 1.65;
110
110
  const arcLabel = d3.arc().innerRadius(labelRadius).outerRadius(labelRadius);
111
- this.chart.append('g').attr('transform', "translate(".concat(left + offsetX, ", ").concat(top + offsetY, ")")).attr('text-anchor', 'middle').selectAll().data(arcs).join('text').attr('class', 'label').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('transform', d => "translate(".concat(arcLabel.centroid(d), ")")).text(d => {
111
+ this.chart.append('g').attr('class', 'label-wrapper').attr('transform', "translate(".concat(left + offsetX, ", ").concat(top + offsetY, ")")).attr('text-anchor', 'middle').selectAll().data(arcs).join('text').attr('class', 'label').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('transform', d => "translate(".concat(arcLabel.centroid(d), ")")).text(d => {
112
112
  const {
113
113
  value,
114
114
  percent
@@ -199,7 +199,7 @@ class Ring extends _chartComponent.default {
199
199
  this.handleAcitveAndInActiveState = (state, event) => {
200
200
  const allGroup = [event.currentTarget.parentNode];
201
201
  const curGroupName = event.currentTarget.getAttribute('data-groupName');
202
- this.setActiveAndInActiveState(state, allGroup, curGroupName);
202
+ this.setActiveAndInActiveState(state, allGroup, curGroupName, _constants.CHART_TYPE.RING);
203
203
  };
204
204
  this.getLabel = (val, percent) => {
205
205
  const {
@@ -0,0 +1,333 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+ var _lodashEs = require("lodash-es");
12
+ var d3 = _interopRequireWildcard(require("d3"));
13
+ var _classnames = _interopRequireDefault(require("classnames"));
14
+ var _dtableUtils = require("dtable-utils");
15
+ var _constants = require("../../constants");
16
+ var _utils = require("../../utils");
17
+ var _intl = _interopRequireDefault(require("../../intl"));
18
+ var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
19
+ var _chartComponent = _interopRequireDefault(require("./chart-component"));
20
+ class Scatter extends _chartComponent.default {
21
+ constructor(props) {
22
+ super(props);
23
+ this.handleResize = () => {
24
+ this.chart.node() && this.chart.node().remove();
25
+ this.createChart();
26
+ this.drawChart();
27
+ };
28
+ this.createChart = () => {
29
+ const {
30
+ chart,
31
+ columnGroupbyColumn
32
+ } = this.props;
33
+ const {
34
+ y_axis_show_label,
35
+ x_axis_show_label,
36
+ y_axis_show_value
37
+ } = chart.config;
38
+ const initConfig = {
39
+ insertPadding: 30,
40
+ marginLeft: y_axis_show_label ? 20 : 0,
41
+ marginBottom: x_axis_show_label ? 20 : 0,
42
+ marginTop: y_axis_show_value ? 15 : 0,
43
+ bottomLegendSpace: columnGroupbyColumn ? 20 : 0
44
+ };
45
+ this.initChart(this.container, chart === null || chart === void 0 ? void 0 : chart.id, initConfig);
46
+ };
47
+ this.drawChart = () => {
48
+ const {
49
+ customRender
50
+ } = this.props;
51
+ let {
52
+ result: data
53
+ } = this.props;
54
+ data = _utils.BaseUtils.formatEmptyName(data, '', _intl.default.get('Empty'));
55
+ if (!Array.isArray(data)) return;
56
+ this.transformStringToNumber(data);
57
+ this.draw(data);
58
+ this.renderAxisLabel(this.props.chart, this.props.tables, this.container);
59
+ (0, _utils.isFunction)(customRender) && customRender(this.chart);
60
+ };
61
+ this.transformStringToNumber = data => {
62
+ data.forEach(item => {
63
+ item.name = Number(item.name);
64
+ item.value = Number(item.value);
65
+ });
66
+ };
67
+ this.getFillColor = data => {
68
+ const {
69
+ chartColorTheme
70
+ } = this.props;
71
+ let currentIdx = 0;
72
+ let colors = _utils.BaseUtils.getCurrentTheme(chartColorTheme).colors;
73
+ const colorMap = data.reduce((acc, cur) => {
74
+ if (cur.groupby && !acc[cur.groupby]) {
75
+ acc[cur.groupby] = colors[currentIdx++ % colors.length];
76
+ }
77
+ return acc;
78
+ }, {});
79
+ return colorMap;
80
+ };
81
+ this.showTooltip = (event, data, selectedXAxisColumn, selectedYAxisColumn) => {
82
+ const {
83
+ groupby,
84
+ name,
85
+ value
86
+ } = data;
87
+ const {
88
+ offsetX,
89
+ offsetY
90
+ } = event;
91
+ const newTooltipData = {
92
+ titleMarkColor: event.currentTarget.getAttribute('fill'),
93
+ title: groupby || groupby === 0 ? groupby : _intl.default.get('Empty'),
94
+ items: [{
95
+ name: selectedXAxisColumn.name,
96
+ value: name
97
+ }, {
98
+ name: selectedYAxisColumn.name,
99
+ value: value
100
+ }]
101
+ };
102
+ this.setState({
103
+ tooltipData: newTooltipData
104
+ });
105
+ this.setState({
106
+ toolTipPosition: {
107
+ offsetX,
108
+ offsetY
109
+ }
110
+ });
111
+ };
112
+ this.moveTooltip = event => {
113
+ const {
114
+ offsetX,
115
+ offsetY
116
+ } = event;
117
+ this.setState({
118
+ toolTipPosition: {
119
+ offsetX,
120
+ offsetY
121
+ }
122
+ });
123
+ };
124
+ this.hiddenTooltip = event => {
125
+ this.setState({
126
+ toolTipPosition: null
127
+ });
128
+ };
129
+ this.handleAcitveAndInActiveState = (state, event) => {
130
+ const {
131
+ globalTheme
132
+ } = this.props;
133
+ const theme = _constants.CHART_THEME_COLOR[globalTheme];
134
+ const contentWrapper = event.currentTarget.parentNode;
135
+
136
+ // Remove old mark line wrapper
137
+ const markLineWrapper = d3.select(contentWrapper).select('.mark-line-wrapper');
138
+ markLineWrapper.node() && markLineWrapper.node().remove();
139
+ if (state === 'inActive') {
140
+ // Remove stroke
141
+ d3.select(event.currentTarget).attr('stroke', '').attr('storke-width', '');
142
+ return;
143
+ }
144
+ if (state === 'active') {
145
+ const {
146
+ width: chartWidth,
147
+ height: chartHeight,
148
+ insertPadding,
149
+ marginTop,
150
+ bottomLegendSpace
151
+ } = this.chartBoundingClientRect;
152
+ const x = Number(event.currentTarget.getAttribute('data-x'));
153
+ const y = Number(event.currentTarget.getAttribute('data-y'));
154
+ const r = Number(event.currentTarget.getAttribute('r'));
155
+
156
+ // Add stroke and shadow
157
+ d3.select(event.currentTarget).attr('stroke', 'white').attr('stroke-width', 1.5).attr('style', 'filter: drop-shadow(0px 0px 1px rgba(0, 0, 0, 0.1));');
158
+ const markLineWrapper = d3.select(contentWrapper).append('g').attr('class', 'mark-line-wrapper');
159
+ // X axis
160
+ if (x - r >= insertPadding) {
161
+ // The length of the line must be a positive number
162
+ markLineWrapper.append('line').attr('x1', insertPadding).attr('y1', y).attr('x2', x - r).attr('y2', y).attr('stroke', theme.XAxisColor);
163
+ }
164
+ if (chartWidth - insertPadding >= x + r) {
165
+ // The length of the line must be a positive number
166
+ markLineWrapper.append('line').attr('x1', x + r).attr('y1', y).attr('x2', chartWidth - insertPadding).attr('y2', y).attr('stroke', theme.XAxisColor);
167
+ }
168
+ // Y axis
169
+ if (y - r >= insertPadding) {
170
+ // The length of the line must be a positive number
171
+ markLineWrapper.append('line').attr('x1', x).attr('y1', insertPadding + marginTop).attr('x2', x).attr('y2', y - r).attr('stroke', theme.XAxisColor);
172
+ }
173
+ if (chartHeight - insertPadding >= y + r) {
174
+ // The length of the line must be a positive number
175
+ markLineWrapper.append('line').attr('x1', x).attr('y1', y + r).attr('x2', x).attr('y2', chartHeight - insertPadding - bottomLegendSpace).attr('stroke', theme.XAxisColor);
176
+ }
177
+ }
178
+ };
179
+ this.draw = data => {
180
+ const {
181
+ chart,
182
+ globalTheme,
183
+ tables,
184
+ chartColorTheme
185
+ } = this.props;
186
+ const theme = _constants.CHART_THEME_COLOR[globalTheme];
187
+ const {
188
+ label_font_size,
189
+ x_axis_column_key,
190
+ y_axis_column_key,
191
+ table_id,
192
+ y_axis_show_value,
193
+ y_axis_max,
194
+ y_axis_min,
195
+ y_axis_auto_range
196
+ } = chart.config;
197
+ const {
198
+ width: chartWidth,
199
+ height: chartHeight,
200
+ insertPadding,
201
+ marginTop,
202
+ bottomLegendSpace
203
+ } = this.chartBoundingClientRect;
204
+ const colorMap = this.getFillColor(data);
205
+ const selectedTable = (0, _dtableUtils.getTableById)(tables, table_id);
206
+ const selectedXAxisColumn = (0, _dtableUtils.getTableColumnByKey)(selectedTable, x_axis_column_key);
207
+ const selectedYAxisColumn = (0, _dtableUtils.getTableColumnByKey)(selectedTable, y_axis_column_key);
208
+
209
+ // Y axis
210
+ const y = d3.scaleLinear().domain(y_axis_auto_range ? [0, d3.max(data, d => d.value)] : [y_axis_min, y_axis_max]).range([chartHeight - insertPadding - bottomLegendSpace, insertPadding + marginTop]);
211
+ this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform', "translate(".concat(insertPadding, ", 0)")).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d => d)).call(g => this.drawYaxis(g, theme));
212
+
213
+ // X axis
214
+ const niceEnd = d3.nice(0, d3.max(data, d => d.name), 5)[1];
215
+ const x = d3.scaleLinear().domain([0, niceEnd]).range([insertPadding + this.horizontalOverflowOffset, chartWidth - insertPadding]);
216
+ this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform', "translate(0, ".concat(chartHeight - insertPadding - bottomLegendSpace, ")")).call(d3.axisBottom(x).tickSizeOuter(0).tickSizeInner(5).ticks(5).tickFormat(d => d)).call(g => {
217
+ g.selectAll('.domain').attr('stroke', theme.XAxisColor);
218
+ g.selectAll('.tick line').attr('stroke', theme.XAxisColor);
219
+ g.selectAll('text').attr('font-size', theme.fontSize);
220
+ g.selectAll('text').attr('fill', theme.textColor);
221
+ const allLineNode = g.selectAll('line').nodes();
222
+ if (Array.isArray(allLineNode)) {
223
+ // delete the first line and last line
224
+ allLineNode[0] && allLineNode[0].remove();
225
+ allLineNode[allLineNode.length - 1] && allLineNode[allLineNode.length - 1].remove();
226
+ }
227
+ this.checkTickOverlap(g);
228
+ });
229
+
230
+ // Circle
231
+ const contentWrapper = this.chart.append('g').attr('class', 'content-wrapper');
232
+ contentWrapper.selectAll().data(data).join('circle').attr('fill', d => {
233
+ const {
234
+ groupby
235
+ } = d;
236
+ if (groupby && groupby[0] === 'groupby') {
237
+ return _utils.BaseUtils.getCurrentTheme(chartColorTheme).colors[0];
238
+ }
239
+ return colorMap[d.groupby];
240
+ }).attr('data-x', d => x(d.name)).attr('data-y', d => y(d.value)).attr('data-value', d => d.value).attr('data-width', 3.5).attr('data-groupName', d => d.name).attr('cx', d => x(d.name)).attr('cy', d => y(d.value)).attr('r', 3.5).attr('opacity', 0.85).call(g => {
241
+ g.nodes().forEach(path => {
242
+ // Add label
243
+ if (y_axis_show_value) {
244
+ this.addLabelToRectTop({
245
+ container: contentWrapper.node(),
246
+ xWidth: Number(path.dataset.width),
247
+ x: Number(path.dataset.x),
248
+ y: Number(path.dataset.y),
249
+ theme,
250
+ label_font_size,
251
+ text: path.dataset.value
252
+ });
253
+ }
254
+ });
255
+ }).on('click', (event, data) => {
256
+ this.props.toggleRecords(data);
257
+ }).on('mouseover', (event, data) => {
258
+ this.showTooltip(event, data, selectedXAxisColumn, selectedYAxisColumn);
259
+ this.handleAcitveAndInActiveState('active', event);
260
+ }).on('mousemove', (event, data) => {
261
+ this.moveTooltip(event, data, selectedXAxisColumn, selectedYAxisColumn);
262
+ }).on('mouseleave', (event, data) => {
263
+ this.hiddenTooltip();
264
+ this.handleAcitveAndInActiveState('inActive', event);
265
+ });
266
+ this.setLegend({
267
+ legendName: 'groupby',
268
+ theme,
269
+ legendPosition: 'top-right',
270
+ data,
271
+ groupColumn: this.props.columnGroupbyColumn,
272
+ chart,
273
+ colorScale: key => colorMap[key]
274
+ });
275
+ };
276
+ this.chart = null;
277
+ this.state = {
278
+ tooltipData: null,
279
+ toolTipPosition: null
280
+ };
281
+ }
282
+ componentDidMount() {
283
+ this.createChart();
284
+ this.drawChart();
285
+ this.debouncedHandleResize = (0, _lodashEs.debounce)(this.handleResize, 300);
286
+ window.addEventListener('resize', this.debouncedHandleResize);
287
+ }
288
+ componentDidUpdate(prevProps) {
289
+ super.componentDidUpdate(prevProps);
290
+ if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
291
+ this.createChart();
292
+ this.drawChart();
293
+ }
294
+ }
295
+ componentWillUnmount() {
296
+ this.chart.node() && this.chart.node().remove();
297
+ window.removeEventListener('resize', this.debouncedHandleResize);
298
+ }
299
+ render() {
300
+ const {
301
+ chart
302
+ } = this.props;
303
+ const {
304
+ tooltipData,
305
+ toolTipPosition
306
+ } = this.state;
307
+ return /*#__PURE__*/_react.default.createElement("div", {
308
+ ref: ref => this.container = ref,
309
+ className: (0, _classnames.default)('sea-chart-container', {
310
+ 'show-x-axis-label': this.isShowXAxisLabel(chart),
311
+ 'show-y-axis-label': this.isShowYAxisLabel(chart)
312
+ })
313
+ }, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
314
+ tooltipData: tooltipData,
315
+ toolTipPosition: toolTipPosition,
316
+ chart: this.chart
317
+ }));
318
+ }
319
+ }
320
+ Scatter.propTypes = {
321
+ canvasStyle: _propTypes.default.object,
322
+ chart: _propTypes.default.object,
323
+ groupbyColumn: _propTypes.default.object,
324
+ columnGroupbyColumn: _propTypes.default.object,
325
+ summaryColumn: _propTypes.default.object,
326
+ result: _propTypes.default.array,
327
+ tables: _propTypes.default.array,
328
+ globalTheme: _propTypes.default.string,
329
+ chartColorTheme: _propTypes.default.string,
330
+ toggleRecords: _propTypes.default.func,
331
+ customRender: _propTypes.default.func
332
+ };
333
+ var _default = exports.default = Scatter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "2.0.19",
3
+ "version": "2.0.20",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@dnd-kit/core": "^6.1.0",