@semcore/d3-chart 16.0.6 → 16.1.0-prerelease.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/lib/cjs/Area.js +55 -30
  3. package/lib/cjs/Area.js.map +1 -1
  4. package/lib/cjs/Axis.js +14 -14
  5. package/lib/cjs/Bar.js +16 -16
  6. package/lib/cjs/Bubble.js +28 -15
  7. package/lib/cjs/Bubble.js.map +1 -1
  8. package/lib/cjs/CompactHorizontalBar.js +31 -19
  9. package/lib/cjs/CompactHorizontalBar.js.map +1 -1
  10. package/lib/cjs/Donut.js +31 -16
  11. package/lib/cjs/Donut.js.map +1 -1
  12. package/lib/cjs/Dots.js +24 -10
  13. package/lib/cjs/Dots.js.map +1 -1
  14. package/lib/cjs/HorizontalBar.js +16 -16
  15. package/lib/cjs/Hover.js +3 -3
  16. package/lib/cjs/Line.js +51 -25
  17. package/lib/cjs/Line.js.map +1 -1
  18. package/lib/cjs/Plot.js +3 -3
  19. package/lib/cjs/Radar.js +206 -176
  20. package/lib/cjs/Radar.js.map +1 -1
  21. package/lib/cjs/RadialTree.js +12 -12
  22. package/lib/cjs/Reference.js +12 -12
  23. package/lib/cjs/ScatterPlot.js +22 -10
  24. package/lib/cjs/ScatterPlot.js.map +1 -1
  25. package/lib/cjs/Tooltip.js +9 -9
  26. package/lib/cjs/Venn.js +32 -15
  27. package/lib/cjs/Venn.js.map +1 -1
  28. package/lib/cjs/a11y/PlotA11yModule.js +2 -2
  29. package/lib/cjs/a11y/PlotA11yView.js +2 -2
  30. package/lib/cjs/component/Chart/AreaChart.js +6 -3
  31. package/lib/cjs/component/Chart/AreaChart.js.map +1 -1
  32. package/lib/cjs/component/Chart/AreaChart.type.js.map +1 -1
  33. package/lib/cjs/component/Chart/BubbleChart.js +2 -0
  34. package/lib/cjs/component/Chart/BubbleChart.js.map +1 -1
  35. package/lib/cjs/component/Chart/BubbleChart.type.js.map +1 -1
  36. package/lib/cjs/component/Chart/DonutChart.js +3 -1
  37. package/lib/cjs/component/Chart/DonutChart.js.map +1 -1
  38. package/lib/cjs/component/Chart/DonutChart.type.js.map +1 -1
  39. package/lib/cjs/component/Chart/LineChart.js +4 -2
  40. package/lib/cjs/component/Chart/LineChart.js.map +1 -1
  41. package/lib/cjs/component/Chart/LineChart.type.js.map +1 -1
  42. package/lib/cjs/component/Chart/RadarChart.js +3 -1
  43. package/lib/cjs/component/Chart/RadarChart.js.map +1 -1
  44. package/lib/cjs/component/Chart/RadarChart.type.js.map +1 -1
  45. package/lib/cjs/component/Chart/ScatterPlotChart.js +3 -1
  46. package/lib/cjs/component/Chart/ScatterPlotChart.js.map +1 -1
  47. package/lib/cjs/component/Chart/ScatterPlotChart.type.js.map +1 -1
  48. package/lib/cjs/component/Chart/VennChart.js +6 -2
  49. package/lib/cjs/component/Chart/VennChart.js.map +1 -1
  50. package/lib/cjs/component/Chart/VennChart.type.js.map +1 -1
  51. package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
  52. package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +17 -17
  53. package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +6 -6
  54. package/lib/cjs/types/Area.d.js.map +1 -1
  55. package/lib/cjs/types/Bubble.d.js.map +1 -1
  56. package/lib/cjs/types/Donut.d.js.map +1 -1
  57. package/lib/cjs/types/Line.d.js.map +1 -1
  58. package/lib/cjs/types/Radar.d.js.map +1 -1
  59. package/lib/cjs/types/ScatterPlot.d.js.map +1 -1
  60. package/lib/es6/Area.js +56 -31
  61. package/lib/es6/Area.js.map +1 -1
  62. package/lib/es6/Axis.js +14 -14
  63. package/lib/es6/Bar.js +16 -16
  64. package/lib/es6/Bubble.js +28 -15
  65. package/lib/es6/Bubble.js.map +1 -1
  66. package/lib/es6/CompactHorizontalBar.js +31 -19
  67. package/lib/es6/CompactHorizontalBar.js.map +1 -1
  68. package/lib/es6/Donut.js +31 -16
  69. package/lib/es6/Donut.js.map +1 -1
  70. package/lib/es6/Dots.js +24 -10
  71. package/lib/es6/Dots.js.map +1 -1
  72. package/lib/es6/HorizontalBar.js +16 -16
  73. package/lib/es6/Hover.js +3 -3
  74. package/lib/es6/Line.js +52 -26
  75. package/lib/es6/Line.js.map +1 -1
  76. package/lib/es6/Plot.js +3 -3
  77. package/lib/es6/Radar.js +206 -176
  78. package/lib/es6/Radar.js.map +1 -1
  79. package/lib/es6/RadialTree.js +12 -12
  80. package/lib/es6/Reference.js +12 -12
  81. package/lib/es6/ScatterPlot.js +22 -10
  82. package/lib/es6/ScatterPlot.js.map +1 -1
  83. package/lib/es6/Tooltip.js +9 -9
  84. package/lib/es6/Venn.js +32 -15
  85. package/lib/es6/Venn.js.map +1 -1
  86. package/lib/es6/a11y/PlotA11yModule.js +2 -2
  87. package/lib/es6/a11y/PlotA11yView.js +2 -2
  88. package/lib/es6/component/Chart/AreaChart.js +6 -3
  89. package/lib/es6/component/Chart/AreaChart.js.map +1 -1
  90. package/lib/es6/component/Chart/AreaChart.type.js.map +1 -1
  91. package/lib/es6/component/Chart/BubbleChart.js +2 -0
  92. package/lib/es6/component/Chart/BubbleChart.js.map +1 -1
  93. package/lib/es6/component/Chart/BubbleChart.type.js.map +1 -1
  94. package/lib/es6/component/Chart/DonutChart.js +3 -1
  95. package/lib/es6/component/Chart/DonutChart.js.map +1 -1
  96. package/lib/es6/component/Chart/DonutChart.type.js.map +1 -1
  97. package/lib/es6/component/Chart/LineChart.js +4 -2
  98. package/lib/es6/component/Chart/LineChart.js.map +1 -1
  99. package/lib/es6/component/Chart/LineChart.type.js.map +1 -1
  100. package/lib/es6/component/Chart/RadarChart.js +3 -1
  101. package/lib/es6/component/Chart/RadarChart.js.map +1 -1
  102. package/lib/es6/component/Chart/RadarChart.type.js.map +1 -1
  103. package/lib/es6/component/Chart/ScatterPlotChart.js +3 -1
  104. package/lib/es6/component/Chart/ScatterPlotChart.js.map +1 -1
  105. package/lib/es6/component/Chart/ScatterPlotChart.type.js.map +1 -1
  106. package/lib/es6/component/Chart/VennChart.js +6 -2
  107. package/lib/es6/component/Chart/VennChart.js.map +1 -1
  108. package/lib/es6/component/Chart/VennChart.type.js.map +1 -1
  109. package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
  110. package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +17 -17
  111. package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +6 -6
  112. package/lib/es6/types/Area.d.js.map +1 -1
  113. package/lib/es6/types/Bubble.d.js.map +1 -1
  114. package/lib/es6/types/Donut.d.js.map +1 -1
  115. package/lib/es6/types/Line.d.js.map +1 -1
  116. package/lib/es6/types/Radar.d.js.map +1 -1
  117. package/lib/es6/types/ScatterPlot.d.js.map +1 -1
  118. package/lib/esm/Area.mjs +33 -17
  119. package/lib/esm/Axis.mjs +15 -15
  120. package/lib/esm/Bar.mjs +17 -17
  121. package/lib/esm/Bubble.mjs +28 -16
  122. package/lib/esm/CompactHorizontalBar.mjs +31 -20
  123. package/lib/esm/Donut.mjs +32 -18
  124. package/lib/esm/Dots.mjs +21 -11
  125. package/lib/esm/HorizontalBar.mjs +17 -17
  126. package/lib/esm/Hover.mjs +4 -4
  127. package/lib/esm/Line.mjs +32 -15
  128. package/lib/esm/Plot.mjs +4 -4
  129. package/lib/esm/Radar.mjs +119 -96
  130. package/lib/esm/RadialTree.mjs +13 -13
  131. package/lib/esm/Reference.mjs +13 -13
  132. package/lib/esm/ScatterPlot.mjs +23 -11
  133. package/lib/esm/Tooltip.mjs +10 -10
  134. package/lib/esm/Venn.mjs +31 -16
  135. package/lib/esm/a11y/PlotA11yModule.mjs +3 -3
  136. package/lib/esm/a11y/PlotA11yView.mjs +3 -3
  137. package/lib/esm/component/Chart/AreaChart.mjs +5 -3
  138. package/lib/esm/component/Chart/BubbleChart.mjs +2 -0
  139. package/lib/esm/component/Chart/DonutChart.mjs +2 -1
  140. package/lib/esm/component/Chart/LineChart.mjs +3 -2
  141. package/lib/esm/component/Chart/RadarChart.mjs +2 -1
  142. package/lib/esm/component/Chart/ScatterPlotChart.mjs +2 -1
  143. package/lib/esm/component/Chart/VennChart.mjs +4 -2
  144. package/lib/esm/component/ChartLegend/LegendFlex/LegendFlex.mjs +5 -5
  145. package/lib/esm/component/ChartLegend/LegendItem/LegendItem.mjs +18 -18
  146. package/lib/esm/component/ChartLegend/LegendTable/LegendTable.mjs +7 -7
  147. package/lib/types/Area.d.ts +2 -0
  148. package/lib/types/Bubble.d.ts +2 -0
  149. package/lib/types/Donut.d.ts +2 -0
  150. package/lib/types/Line.d.ts +2 -0
  151. package/lib/types/Radar.d.ts +2 -0
  152. package/lib/types/ScatterPlot.d.ts +2 -0
  153. package/lib/types/component/Chart/AreaChart.type.d.ts +2 -0
  154. package/lib/types/component/Chart/BubbleChart.type.d.ts +2 -0
  155. package/lib/types/component/Chart/DonutChart.type.d.ts +4 -1
  156. package/lib/types/component/Chart/LineChart.type.d.ts +2 -0
  157. package/lib/types/component/Chart/RadarChart.type.d.ts +2 -0
  158. package/lib/types/component/Chart/ScatterPlotChart.type.d.ts +2 -0
  159. package/lib/types/component/Chart/VennChart.type.d.ts +4 -1
  160. package/package.json +16 -16
package/lib/es6/Radar.js CHANGED
@@ -22,27 +22,27 @@ import React, { cloneElement } from 'react';
22
22
  import createElement from './createElement';
23
23
  import { PatternFill, PatternSymbol, getPatternSymbolSize } from './Pattern';
24
24
  /*!__reshadow-styles__:"./style/radar.shadow.css"*/
25
- var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SAxisLine_1q8vt_gg_,.___SAxisTick_1q8vt_gg_,.___SAxis_1q8vt_gg_{stroke:var(--intergalactic-chart-grid-line, #e0e1e9);stroke-width:1;fill:transparent}.___SAxisLine_1q8vt_gg_,.___SAxisTick_1q8vt_gg_{stroke-dasharray:2}.___SAxisLine_1q8vt_gg_.__active_1q8vt_gg_{stroke:var(--intergalactic-chart-grid-y-accent-hover-line, #a9abb6)}.___SAxisLabel_1q8vt_gg_{text-anchor:middle;dominant-baseline:central;font-size:12px}.___SAxisLabel_1q8vt_gg_.__xDirection_1q8vt_gg_{text-anchor:var(--xDirection_1q8vt)}.___SAxisLabel_1q8vt_gg_.__yDirection_1q8vt_gg_{dominant-baseline:var(--yDirection_1q8vt)}.___SPolygonDot_1q8vt_gg_,.___SPolygon_1q8vt_gg_{fill:var(--intergalactic-chart-palette-order-1, #2bb3ff)}.___SPolygon_1q8vt_gg_{opacity:.2}.___SPolygon_1q8vt_gg_.__color_1q8vt_gg_{fill:var(--color_1q8vt)}.___SPolygon_1q8vt_gg_.__pattern_1q8vt_gg_.__color_1q8vt_gg_{fill:var(--pattern_1q8vt);stroke:var(--color_1q8vt);stroke-width:1px}.___SPolygonDot_1q8vt_gg_{stroke-width:2px;stroke:var(--intergalactic-chart-grid-border, #ffffff);r:6px}.___SPolygonDot_1q8vt_gg_.__transparent_1q8vt_gg_{opacity:.3}.___SPolygonDot_1q8vt_gg_.__color_1q8vt_gg_{fill:var(--color_1q8vt)}.___SPolygonLine_1q8vt_gg_{stroke:var(--intergalactic-chart-palette-order-1, #2bb3ff);stroke-width:3;fill:transparent}.___SPolygonLine_1q8vt_gg_.__transparent_1q8vt_gg_{opacity:.3}.___SPolygonLine_1q8vt_gg_.__color_1q8vt_gg_{stroke:var(--color_1q8vt)}.___SPieRect_1q8vt_gg_{outline:0;fill:var(--intergalactic-chart-grid-bar-chart-hover, rgba(196, 199, 207, 0.3))}", /*__inner_css_end__*/"1q8vt_gg_"),
25
+ var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SAxisLine_15mev_gg_,.___SAxisTick_15mev_gg_,.___SAxis_15mev_gg_{stroke:var(--intergalactic-chart-grid-line, #e0e1e9);stroke-width:1;fill:transparent}.___SAxisLine_15mev_gg_,.___SAxisTick_15mev_gg_{stroke-dasharray:2}.___SAxisLine_15mev_gg_.__active_15mev_gg_{stroke:var(--intergalactic-chart-grid-y-accent-hover-line, #a9abb6)}.___SAxisLabel_15mev_gg_{text-anchor:middle;dominant-baseline:central;font-size:12px}.___SAxisLabel_15mev_gg_.__xDirection_15mev_gg_{text-anchor:var(--xDirection_15mev)}.___SAxisLabel_15mev_gg_.__yDirection_15mev_gg_{dominant-baseline:var(--yDirection_15mev)}.___SPolygonDot_15mev_gg_,.___SPolygon_15mev_gg_{fill:var(--intergalactic-chart-palette-order-1, #2bb3ff)}.___SPolygon_15mev_gg_{opacity:.2}.___SPolygon_15mev_gg_.__color_15mev_gg_{fill:var(--color_15mev)}.___SPolygon_15mev_gg_.__pattern_15mev_gg_.__color_15mev_gg_{fill:var(--pattern_15mev);stroke:var(--color_15mev);stroke-width:1px}.___SPolygonDot_15mev_gg_{stroke-width:2px;stroke:var(--intergalactic-chart-grid-border, #ffffff);r:6px}.___SPolygonDot_15mev_gg_.__transparent_15mev_gg_{opacity:.3}.___SPolygonDot_15mev_gg_.__color_15mev_gg_{fill:var(--color_15mev)}.___SPolygonLine_15mev_gg_{stroke:var(--intergalactic-chart-palette-order-1, #2bb3ff);stroke-width:3;fill:transparent}.___SPolygonLine_15mev_gg_.__transparent_15mev_gg_{opacity:.3}.___SPolygonLine_15mev_gg_.__color_15mev_gg_{stroke:var(--color_15mev)}.___SPieRect_15mev_gg_{outline:0;fill:var(--intergalactic-chart-grid-bar-chart-hover, rgba(196, 199, 207, 0.3))}", /*__inner_css_end__*/"15mev_gg_"),
26
26
  /*__reshadow_css_end__*/
27
27
  {
28
- "__SAxis": "___SAxis_1q8vt_gg_",
29
- "__SAxisLine": "___SAxisLine_1q8vt_gg_",
30
- "__SAxisTick": "___SAxisTick_1q8vt_gg_",
31
- "_active": "__active_1q8vt_gg_",
32
- "__SAxisLabel": "___SAxisLabel_1q8vt_gg_",
33
- "_xDirection": "__xDirection_1q8vt_gg_",
34
- "--xDirection": "--xDirection_1q8vt",
35
- "_yDirection": "__yDirection_1q8vt_gg_",
36
- "--yDirection": "--yDirection_1q8vt",
37
- "__SPolygon": "___SPolygon_1q8vt_gg_",
38
- "_color": "__color_1q8vt_gg_",
39
- "--color": "--color_1q8vt",
40
- "_pattern": "__pattern_1q8vt_gg_",
41
- "--pattern": "--pattern_1q8vt",
42
- "__SPolygonDot": "___SPolygonDot_1q8vt_gg_",
43
- "_transparent": "__transparent_1q8vt_gg_",
44
- "__SPolygonLine": "___SPolygonLine_1q8vt_gg_",
45
- "__SPieRect": "___SPieRect_1q8vt_gg_"
28
+ "__SAxis": "___SAxis_15mev_gg_",
29
+ "__SAxisLine": "___SAxisLine_15mev_gg_",
30
+ "__SAxisTick": "___SAxisTick_15mev_gg_",
31
+ "_active": "__active_15mev_gg_",
32
+ "__SAxisLabel": "___SAxisLabel_15mev_gg_",
33
+ "_xDirection": "__xDirection_15mev_gg_",
34
+ "--xDirection": "--xDirection_15mev",
35
+ "_yDirection": "__yDirection_15mev_gg_",
36
+ "--yDirection": "--yDirection_15mev",
37
+ "__SPolygon": "___SPolygon_15mev_gg_",
38
+ "_color": "__color_15mev_gg_",
39
+ "--color": "--color_15mev",
40
+ "_pattern": "__pattern_15mev_gg_",
41
+ "--pattern": "--pattern_15mev",
42
+ "__SPolygonDot": "___SPolygonDot_15mev_gg_",
43
+ "_transparent": "__transparent_15mev_gg_",
44
+ "__SPolygonLine": "___SPolygonLine_15mev_gg_",
45
+ "__SPieRect": "___SPieRect_15mev_gg_"
46
46
  });
47
47
  import Tooltip from './Tooltip';
48
48
  import { eventToPoint, getChartDefaultColorName, measureText } from './utils';
@@ -211,20 +211,104 @@ var RadarRoot = /*#__PURE__*/function (_Component) {
211
211
  type: this.asProps.type,
212
212
  offset: this.offset,
213
213
  categories: this.asProps.data[this.categoriesKey],
214
- angleOffset: this.asProps.angleOffset
214
+ angleOffset: this.asProps.angleOffset,
215
+ getIndex: this.getIndex.bind(this),
216
+ getPolygon: this.getPolygon.bind(this),
217
+ getPie: this.getPie.bind(this)
215
218
  };
216
219
  }
220
+ }, {
221
+ key: "getIndex",
222
+ value: function getIndex(point) {
223
+ var _this2 = this;
224
+ var _this$asProps3 = this.asProps,
225
+ data = _this$asProps3.data,
226
+ type = _this$asProps3.type;
227
+ var categories = data[this.categoriesKey];
228
+ var index;
229
+ if (type === 'circle') {
230
+ index = categories.findIndex(function (_c, i) {
231
+ return pieContains(_this2.getPie(i), point);
232
+ });
233
+ } else {
234
+ index = categories.findIndex(function (_c, i) {
235
+ return polygonContains(_this2.getPolygon(i), point);
236
+ });
237
+ }
238
+ return index === -1 ? null : index;
239
+ }
240
+ }, {
241
+ key: "getPolygon",
242
+ value: function getPolygon(index) {
243
+ var _this$asProps4 = this.asProps,
244
+ data = _this$asProps4.data,
245
+ size = _this$asProps4.size,
246
+ angleOffset = _this$asProps4.angleOffset;
247
+ var offset = this.offset;
248
+ var categories = data[this.categoriesKey];
249
+ var total = categories.length;
250
+ var diam = Math.min(size[0], size[1]);
251
+ var radius = diam / 2 - offset;
252
+ var prevIndex = (index - 1 + total) % total;
253
+ var nextIndex = (index + 1 + total) % total;
254
+ var _getRadianPosition = getRadianPosition(prevIndex, radius, total, angleOffset),
255
+ _getRadianPosition2 = _slicedToArray(_getRadianPosition, 2),
256
+ prevX1 = _getRadianPosition2[0],
257
+ prevY1 = _getRadianPosition2[1];
258
+ var _getRadianPosition3 = getRadianPosition(index, radius, total, angleOffset),
259
+ _getRadianPosition4 = _slicedToArray(_getRadianPosition3, 2),
260
+ x = _getRadianPosition4[0],
261
+ y = _getRadianPosition4[1];
262
+ var _getRadianPosition5 = getRadianPosition(nextIndex, radius, total, angleOffset),
263
+ _getRadianPosition6 = _slicedToArray(_getRadianPosition5, 2),
264
+ nextX1 = _getRadianPosition6[0],
265
+ nextY1 = _getRadianPosition6[1];
266
+ return [[0, 0], [(prevX1 + x) / 2, (prevY1 + y) / 2], [x, y], [(nextX1 + x) / 2, (nextY1 + y) / 2]];
267
+ }
268
+ }, {
269
+ key: "getPie",
270
+ value: function getPie(index) {
271
+ var _this$asProps5 = this.asProps,
272
+ data = _this$asProps5.data,
273
+ size = _this$asProps5.size,
274
+ angleOffset = _this$asProps5.angleOffset;
275
+ var categories = data[this.categoriesKey];
276
+ var offset = this.offset;
277
+ var angle = Math.PI * 2 / categories.length;
278
+ var radius = Math.min(size[0], size[1]) / 2 - offset;
279
+ return [index * angle - angle / 2 - angleOffset, (index + 1) * angle - angle / 2 - angleOffset, radius];
280
+ }
281
+ }, {
282
+ key: "handlerOnClick",
283
+ value: function handlerOnClick(e) {
284
+ e.stopPropagation();
285
+ var _this$asProps6 = this.asProps,
286
+ rootRef = _this$asProps6.rootRef,
287
+ size = _this$asProps6.size,
288
+ onClick = _this$asProps6.onClick;
289
+ if (!onClick) return;
290
+ var _eventToPoint = eventToPoint(e, rootRef.current),
291
+ _eventToPoint2 = _slicedToArray(_eventToPoint, 2),
292
+ pointX = _eventToPoint2[0],
293
+ pointY = _eventToPoint2[1];
294
+ var r = Math.min(size[0], size[1]) / 2;
295
+ var centerX = pointX - r;
296
+ var centerY = pointY - r;
297
+ var index = this.getIndex([centerX, centerY]);
298
+ if (index === null) return;
299
+ onClick(index, e);
300
+ }
217
301
  }, {
218
302
  key: "render",
219
303
  value: function render() {
220
304
  var _ref2;
221
305
  var SRadar = this.Element;
222
- var _this$asProps3 = this.asProps,
223
- Children = _this$asProps3.Children,
224
- styles = _this$asProps3.styles,
225
- size = _this$asProps3.size,
226
- data = _this$asProps3.data,
227
- offset = _this$asProps3.offset;
306
+ var _this$asProps7 = this.asProps,
307
+ Children = _this$asProps7.Children,
308
+ styles = _this$asProps7.styles,
309
+ size = _this$asProps7.size,
310
+ data = _this$asProps7.data,
311
+ offset = _this$asProps7.offset;
228
312
  var _size = _slicedToArray(size, 2),
229
313
  width = _size[0],
230
314
  height = _size[1];
@@ -247,7 +331,8 @@ var RadarRoot = /*#__PURE__*/function (_Component) {
247
331
  "id": this.id,
248
332
  "render": 'g',
249
333
  "childrenPosition": 'inside',
250
- "transform": "translate(".concat(width / 2, ",").concat(height / 2, ")")
334
+ "transform": "translate(".concat(width / 2, ",").concat(height / 2, ")"),
335
+ "onClickCapture": this.handlerOnClick.bind(this)
251
336
  }));
252
337
  }
253
338
  }]);
@@ -268,16 +353,16 @@ var PolygonRoot = /*#__PURE__*/function (_Component2) {
268
353
  return _createClass(PolygonRoot, [{
269
354
  key: "getDotsProps",
270
355
  value: function getDotsProps() {
271
- var _this$asProps4 = this.asProps,
272
- data = _this$asProps4.data,
273
- scale = _this$asProps4.scale,
274
- color = _this$asProps4.color,
275
- resolveColor = _this$asProps4.resolveColor,
276
- transparent = _this$asProps4.transparent,
277
- dataKey = _this$asProps4.dataKey,
278
- dataHintsHandler = _this$asProps4.dataHintsHandler,
279
- angleOffset = _this$asProps4.angleOffset,
280
- patterns = _this$asProps4.patterns;
356
+ var _this$asProps8 = this.asProps,
357
+ data = _this$asProps8.data,
358
+ scale = _this$asProps8.scale,
359
+ color = _this$asProps8.color,
360
+ resolveColor = _this$asProps8.resolveColor,
361
+ transparent = _this$asProps8.transparent,
362
+ dataKey = _this$asProps8.dataKey,
363
+ dataHintsHandler = _this$asProps8.dataHintsHandler,
364
+ angleOffset = _this$asProps8.angleOffset,
365
+ patterns = _this$asProps8.patterns;
281
366
  return {
282
367
  data: data,
283
368
  scale: scale,
@@ -293,12 +378,12 @@ var PolygonRoot = /*#__PURE__*/function (_Component2) {
293
378
  }, {
294
379
  key: "getLineProps",
295
380
  value: function getLineProps() {
296
- var _this$asProps5 = this.asProps,
297
- d3 = _this$asProps5.d3,
298
- data = _this$asProps5.data,
299
- color = _this$asProps5.color,
300
- resolveColor = _this$asProps5.resolveColor,
301
- transparent = _this$asProps5.transparent;
381
+ var _this$asProps9 = this.asProps,
382
+ d3 = _this$asProps9.d3,
383
+ data = _this$asProps9.data,
384
+ color = _this$asProps9.color,
385
+ resolveColor = _this$asProps9.resolveColor,
386
+ transparent = _this$asProps9.transparent;
302
387
  return {
303
388
  data: data,
304
389
  color: color,
@@ -311,16 +396,16 @@ var PolygonRoot = /*#__PURE__*/function (_Component2) {
311
396
  key: "render",
312
397
  value: function render() {
313
398
  var _ref3;
314
- var _this$asProps6 = this.asProps,
315
- SPolygon = _this$asProps6.Element,
316
- styles = _this$asProps6.styles,
317
- d3 = _this$asProps6.d3,
318
- data = _this$asProps6.data,
319
- color = _this$asProps6.color,
320
- resolveColor = _this$asProps6.resolveColor,
321
- fill = _this$asProps6.fill,
322
- uid = _this$asProps6.uid,
323
- patterns = _this$asProps6.patterns;
399
+ var _this$asProps0 = this.asProps,
400
+ SPolygon = _this$asProps0.Element,
401
+ styles = _this$asProps0.styles,
402
+ d3 = _this$asProps0.d3,
403
+ data = _this$asProps0.data,
404
+ color = _this$asProps0.color,
405
+ resolveColor = _this$asProps0.resolveColor,
406
+ fill = _this$asProps0.fill,
407
+ uid = _this$asProps0.uid,
408
+ patterns = _this$asProps0.patterns;
324
409
  return /*#__PURE__*/React.createElement(React.Fragment, null, (_ref3 = sstyled(styles), /*#__PURE__*/React.createElement(SPolygon, _ref3.cn("SPolygon", {
325
410
  "render": 'path',
326
411
  "d": d3(data),
@@ -385,10 +470,10 @@ function PolygonDots(props) {
385
470
  if (value === null || value === undefined) return;
386
471
  var radius = scale(value);
387
472
  props.dataHintsHandler.describeGroupedValues(categoryKey, "".concat(categoryKey, ".").concat(i));
388
- var _getRadianPosition = getRadianPosition(i, radius, data.length, angleOffset),
389
- _getRadianPosition2 = _slicedToArray(_getRadianPosition, 2),
390
- cx = _getRadianPosition2[0],
391
- cy = _getRadianPosition2[1];
473
+ var _getRadianPosition7 = getRadianPosition(i, radius, data.length, angleOffset),
474
+ _getRadianPosition8 = _slicedToArray(_getRadianPosition7, 2),
475
+ cx = _getRadianPosition8[0],
476
+ cy = _getRadianPosition8[1];
392
477
  if (!patterns) {
393
478
  var _ref5;
394
479
  return _ref5 = sstyled(styles), /*#__PURE__*/React.createElement(SPolygonDot, _ref5.cn("SPolygonDot", {
@@ -422,23 +507,23 @@ function PolygonDots(props) {
422
507
  }
423
508
  var AxisRoot = /*#__PURE__*/function (_Component3) {
424
509
  function AxisRoot() {
425
- var _this2;
510
+ var _this3;
426
511
  _classCallCheck(this, AxisRoot);
427
512
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
428
513
  args[_key2] = arguments[_key2];
429
514
  }
430
- _this2 = _callSuper(this, AxisRoot, [].concat(args));
431
- _defineProperty(_this2, "unsubscribeTooltipVisible", null);
432
- _defineProperty(_this2, "state", {
515
+ _this3 = _callSuper(this, AxisRoot, [].concat(args));
516
+ _defineProperty(_this3, "unsubscribeTooltipVisible", null);
517
+ _defineProperty(_this3, "state", {
433
518
  activeLineIndex: null
434
519
  });
435
- _defineProperty(_this2, "handleTooltipRenderingProps", function (_anchorProps, _ref16) {
520
+ _defineProperty(_this3, "handleTooltipRenderingProps", function (_anchorProps, _ref16) {
436
521
  var index = _ref16.index;
437
- _this2.setState({
522
+ _this3.setState({
438
523
  activeLineIndex: index
439
524
  });
440
525
  });
441
- return _this2;
526
+ return _this3;
442
527
  }
443
528
  _inherits(AxisRoot, _Component3);
444
529
  return _createClass(AxisRoot, [{
@@ -455,12 +540,12 @@ var AxisRoot = /*#__PURE__*/function (_Component3) {
455
540
  value: function getTicksProps(_ref17) {
456
541
  var _ref17$tickSize = _ref17.tickSize,
457
542
  tickSize = _ref17$tickSize === void 0 ? 100 : _ref17$tickSize;
458
- var _this$asProps7 = this.asProps,
459
- data = _this$asProps7.data,
460
- offset = _this$asProps7.offset,
461
- categories = _this$asProps7.categories,
462
- size = _this$asProps7.size,
463
- type = _this$asProps7.type;
543
+ var _this$asProps1 = this.asProps,
544
+ data = _this$asProps1.data,
545
+ offset = _this$asProps1.offset,
546
+ categories = _this$asProps1.categories,
547
+ size = _this$asProps1.size,
548
+ type = _this$asProps1.type;
464
549
  var radius = Math.min(size[0], size[1]) / 2 - offset;
465
550
  return {
466
551
  type: type,
@@ -476,11 +561,11 @@ var AxisRoot = /*#__PURE__*/function (_Component3) {
476
561
  value: function getLabelsProps(_ref18) {
477
562
  var _ref18$labelOffset = _ref18.labelOffset,
478
563
  labelOffset = _ref18$labelOffset === void 0 ? 10 : _ref18$labelOffset;
479
- var _this$asProps8 = this.asProps,
480
- offset = _this$asProps8.offset,
481
- categories = _this$asProps8.categories,
482
- textSize = _this$asProps8.textSize,
483
- angleOffset = _this$asProps8.angleOffset;
564
+ var _this$asProps10 = this.asProps,
565
+ offset = _this$asProps10.offset,
566
+ categories = _this$asProps10.categories,
567
+ textSize = _this$asProps10.textSize,
568
+ angleOffset = _this$asProps10.angleOffset;
484
569
  return {
485
570
  categories: categories,
486
571
  textSize: textSize,
@@ -504,14 +589,14 @@ var AxisRoot = /*#__PURE__*/function (_Component3) {
504
589
  key: "render",
505
590
  value: function render() {
506
591
  var _ref7;
507
- var _this$asProps9 = this.asProps,
508
- SAxis = _this$asProps9.Element,
509
- styles = _this$asProps9.styles,
510
- categories = _this$asProps9.categories,
511
- size = _this$asProps9.size,
512
- offset = _this$asProps9.offset,
513
- type = _this$asProps9.type,
514
- angleOffset = _this$asProps9.angleOffset;
592
+ var _this$asProps11 = this.asProps,
593
+ SAxis = _this$asProps11.Element,
594
+ styles = _this$asProps11.styles,
595
+ categories = _this$asProps11.categories,
596
+ size = _this$asProps11.size,
597
+ offset = _this$asProps11.offset,
598
+ type = _this$asProps11.type,
599
+ angleOffset = _this$asProps11.angleOffset;
515
600
  var activeLineIndex = this.state.activeLineIndex;
516
601
  var radius = Math.min(size[0], size[1]) / 2 - offset;
517
602
  var total = categories.length;
@@ -524,10 +609,10 @@ var AxisRoot = /*#__PURE__*/function (_Component3) {
524
609
  "render": 'path',
525
610
  "d": this.createLineRadial(radius, total)(categories)
526
611
  })), categories.map(function (_category, i) {
527
- var _getRadianPosition3 = getRadianPosition(i, radius, total, angleOffset),
528
- _getRadianPosition4 = _slicedToArray(_getRadianPosition3, 2),
529
- x = _getRadianPosition4[0],
530
- y = _getRadianPosition4[1];
612
+ var _getRadianPosition9 = getRadianPosition(i, radius, total, angleOffset),
613
+ _getRadianPosition0 = _slicedToArray(_getRadianPosition9, 2),
614
+ x = _getRadianPosition0[0],
615
+ y = _getRadianPosition0[1];
531
616
  var _sstyled$cn = sstyled(styles).cn('SAxisLine', {
532
617
  active: activeLineIndex === i
533
618
  }),
@@ -592,10 +677,10 @@ function AxisLabels(props) {
592
677
  angleOffset = props.angleOffset;
593
678
  var radius = Math.min(size[0], size[1]) / 2 - offset;
594
679
  return categories.map(function (category, i) {
595
- var _getRadianPosition5 = getRadianPosition(i, radius, categories.length, angleOffset),
596
- _getRadianPosition6 = _slicedToArray(_getRadianPosition5, 2),
597
- x = _getRadianPosition6[0],
598
- y = _getRadianPosition6[1];
680
+ var _getRadianPosition1 = getRadianPosition(i, radius, categories.length, angleOffset),
681
+ _getRadianPosition10 = _slicedToArray(_getRadianPosition1, 2),
682
+ x = _getRadianPosition10[0],
683
+ y = _getRadianPosition10[1];
599
684
  var _getLabelPlacement = getLabelPlacement(i, categories.length, angleOffset),
600
685
  _getLabelPlacement2 = _slicedToArray(_getLabelPlacement, 2),
601
686
  xDirection = _getLabelPlacement2[0],
@@ -641,32 +726,33 @@ function AxisLabels(props) {
641
726
  }
642
727
  var Hover = /*#__PURE__*/function (_Component4) {
643
728
  function Hover() {
644
- var _this3;
729
+ var _this4;
645
730
  _classCallCheck(this, Hover);
646
731
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
647
732
  args[_key3] = arguments[_key3];
648
733
  }
649
- _this3 = _callSuper(this, Hover, [].concat(args));
650
- _defineProperty(_this3, "state", {
734
+ _this4 = _callSuper(this, Hover, [].concat(args));
735
+ _defineProperty(_this4, "state", {
651
736
  index: null
652
737
  });
653
- _defineProperty(_this3, "virtualElement", canUseDOM() ? document.createElement('div') : {});
654
- _defineProperty(_this3, "unsubscribeMouseMoveRoot", null);
655
- _defineProperty(_this3, "unsubscribeMouseLeaveRoot", null);
656
- _defineProperty(_this3, "handlerMouseMoveRoot", trottle(function (e) {
657
- var _this3$asProps = _this3.asProps,
658
- eventEmitter = _this3$asProps.eventEmitter,
659
- size = _this3$asProps.size,
660
- rootRef = _this3$asProps.rootRef,
661
- patterns = _this3$asProps.patterns;
738
+ _defineProperty(_this4, "virtualElement", canUseDOM() ? document.createElement('div') : {});
739
+ _defineProperty(_this4, "unsubscribeMouseMoveRoot", null);
740
+ _defineProperty(_this4, "unsubscribeMouseLeaveRoot", null);
741
+ _defineProperty(_this4, "handlerMouseMoveRoot", trottle(function (e) {
742
+ var _this4$asProps = _this4.asProps,
743
+ eventEmitter = _this4$asProps.eventEmitter,
744
+ size = _this4$asProps.size,
745
+ rootRef = _this4$asProps.rootRef,
746
+ patterns = _this4$asProps.patterns,
747
+ getIndex = _this4$asProps.getIndex;
662
748
  var point = eventToPoint(e, rootRef.current);
663
749
  var diam = Math.min(size[0], size[1]);
664
750
  var centerX = point[0] - diam / 2;
665
751
  var centerY = point[1] - diam / 2;
666
752
  var clientX = e.clientX,
667
753
  clientY = e.clientY;
668
- var index = _this3.getIndex([centerX, centerY]);
669
- _this3.setState({
754
+ var index = getIndex([centerX, centerY]);
755
+ _this4.setState({
670
756
  index: index
671
757
  }, function () {
672
758
  eventEmitter.emit('setTooltipPosition', clientX, clientY);
@@ -677,14 +763,14 @@ var Hover = /*#__PURE__*/function (_Component4) {
677
763
  eventEmitter.emit('setTooltipVisible', index !== null);
678
764
  });
679
765
  }));
680
- _defineProperty(_this3, "handlerMouseLeaveRoot", trottle(function () {
681
- _this3.setState({
766
+ _defineProperty(_this4, "handlerMouseLeaveRoot", trottle(function () {
767
+ _this4.setState({
682
768
  index: null
683
769
  }, function () {
684
- _this3.asProps.eventEmitter.emit('setTooltipVisible', false);
770
+ _this4.asProps.eventEmitter.emit('setTooltipVisible', false);
685
771
  });
686
772
  }));
687
- return _this3;
773
+ return _this4;
688
774
  }
689
775
  _inherits(Hover, _Component4);
690
776
  return _createClass(Hover, [{
@@ -703,64 +789,6 @@ var Hover = /*#__PURE__*/function (_Component4) {
703
789
  };
704
790
  };
705
791
  }
706
- }, {
707
- key: "getPolygon",
708
- value: function getPolygon(index) {
709
- var _this$asProps0 = this.asProps,
710
- categories = _this$asProps0.categories,
711
- size = _this$asProps0.size,
712
- offset = _this$asProps0.offset,
713
- angleOffset = _this$asProps0.angleOffset;
714
- var total = categories.length;
715
- var diam = Math.min(size[0], size[1]);
716
- var radius = diam / 2 - offset;
717
- var prevIndex = (index - 1 + total) % total;
718
- var nextIndex = (index + 1 + total) % total;
719
- var _getRadianPosition7 = getRadianPosition(prevIndex, radius, total, angleOffset),
720
- _getRadianPosition8 = _slicedToArray(_getRadianPosition7, 2),
721
- prevX1 = _getRadianPosition8[0],
722
- prevY1 = _getRadianPosition8[1];
723
- var _getRadianPosition9 = getRadianPosition(index, radius, total, angleOffset),
724
- _getRadianPosition0 = _slicedToArray(_getRadianPosition9, 2),
725
- x = _getRadianPosition0[0],
726
- y = _getRadianPosition0[1];
727
- var _getRadianPosition1 = getRadianPosition(nextIndex, radius, total, angleOffset),
728
- _getRadianPosition10 = _slicedToArray(_getRadianPosition1, 2),
729
- nextX1 = _getRadianPosition10[0],
730
- nextY1 = _getRadianPosition10[1];
731
- return [[0, 0], [(prevX1 + x) / 2, (prevY1 + y) / 2], [x, y], [(nextX1 + x) / 2, (nextY1 + y) / 2]];
732
- }
733
- }, {
734
- key: "getPie",
735
- value: function getPie(index) {
736
- var _this$asProps1 = this.asProps,
737
- categories = _this$asProps1.categories,
738
- size = _this$asProps1.size,
739
- offset = _this$asProps1.offset,
740
- angleOffset = _this$asProps1.angleOffset;
741
- var angle = Math.PI * 2 / categories.length;
742
- var radius = Math.min(size[0], size[1]) / 2 - offset;
743
- return [index * angle - angle / 2 - angleOffset, (index + 1) * angle - angle / 2 - angleOffset, radius];
744
- }
745
- }, {
746
- key: "getIndex",
747
- value: function getIndex(point) {
748
- var _this4 = this;
749
- var _this$asProps10 = this.asProps,
750
- categories = _this$asProps10.categories,
751
- type = _this$asProps10.type;
752
- var index;
753
- if (type === 'circle') {
754
- index = categories.findIndex(function (_c, i) {
755
- return pieContains(_this4.getPie(i), point);
756
- });
757
- } else {
758
- index = categories.findIndex(function (_c, i) {
759
- return polygonContains(_this4.getPolygon(i), point);
760
- });
761
- }
762
- return index === -1 ? null : index;
763
- }
764
792
  }, {
765
793
  key: "componentDidMount",
766
794
  value: function componentDidMount() {
@@ -785,19 +813,21 @@ var Hover = /*#__PURE__*/function (_Component4) {
785
813
  }, {
786
814
  key: "render",
787
815
  value: function render() {
788
- var _this$asProps11 = this.asProps,
789
- styles = _this$asProps11.styles,
790
- type = _this$asProps11.type;
816
+ var _this$asProps12 = this.asProps,
817
+ styles = _this$asProps12.styles,
818
+ type = _this$asProps12.type,
819
+ getPie = _this$asProps12.getPie,
820
+ getPolygon = _this$asProps12.getPolygon;
791
821
  var index = this.state.index;
792
822
  var SPieRect = this.Element;
793
823
  if (index !== null) {
794
824
  if (type === 'circle') {
795
825
  var _ref0;
796
- var _this$getPie = this.getPie(index),
797
- _this$getPie2 = _slicedToArray(_this$getPie, 3),
798
- startAngle = _this$getPie2[0],
799
- endAngle = _this$getPie2[1],
800
- radius = _this$getPie2[2];
826
+ var _getPie = getPie(index),
827
+ _getPie2 = _slicedToArray(_getPie, 3),
828
+ startAngle = _getPie2[0],
829
+ endAngle = _getPie2[1],
830
+ radius = _getPie2[2];
801
831
  var circle = arc().innerRadius(0).outerRadius(radius).startAngle(startAngle).endAngle(endAngle);
802
832
  return _ref0 = sstyled(styles), /*#__PURE__*/React.createElement(SPieRect, _ref0.cn("SPieRect", {
803
833
  "render": 'path',
@@ -807,7 +837,7 @@ var Hover = /*#__PURE__*/function (_Component4) {
807
837
  var _ref1;
808
838
  return _ref1 = sstyled(styles), /*#__PURE__*/React.createElement(SPieRect, _ref1.cn("SPieRect", {
809
839
  "render": 'path',
810
- "d": line()(this.getPolygon(index))
840
+ "d": line()(getPolygon(index))
811
841
  }));
812
842
  }
813
843
  }