@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.
- package/CHANGELOG.md +25 -0
- package/lib/cjs/Area.js +55 -30
- package/lib/cjs/Area.js.map +1 -1
- package/lib/cjs/Axis.js +14 -14
- package/lib/cjs/Bar.js +16 -16
- package/lib/cjs/Bubble.js +28 -15
- package/lib/cjs/Bubble.js.map +1 -1
- package/lib/cjs/CompactHorizontalBar.js +31 -19
- package/lib/cjs/CompactHorizontalBar.js.map +1 -1
- package/lib/cjs/Donut.js +31 -16
- package/lib/cjs/Donut.js.map +1 -1
- package/lib/cjs/Dots.js +24 -10
- package/lib/cjs/Dots.js.map +1 -1
- package/lib/cjs/HorizontalBar.js +16 -16
- package/lib/cjs/Hover.js +3 -3
- package/lib/cjs/Line.js +51 -25
- package/lib/cjs/Line.js.map +1 -1
- package/lib/cjs/Plot.js +3 -3
- package/lib/cjs/Radar.js +206 -176
- package/lib/cjs/Radar.js.map +1 -1
- package/lib/cjs/RadialTree.js +12 -12
- package/lib/cjs/Reference.js +12 -12
- package/lib/cjs/ScatterPlot.js +22 -10
- package/lib/cjs/ScatterPlot.js.map +1 -1
- package/lib/cjs/Tooltip.js +9 -9
- package/lib/cjs/Venn.js +32 -15
- package/lib/cjs/Venn.js.map +1 -1
- package/lib/cjs/a11y/PlotA11yModule.js +2 -2
- package/lib/cjs/a11y/PlotA11yView.js +2 -2
- package/lib/cjs/component/Chart/AreaChart.js +6 -3
- package/lib/cjs/component/Chart/AreaChart.js.map +1 -1
- package/lib/cjs/component/Chart/AreaChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/BubbleChart.js +2 -0
- package/lib/cjs/component/Chart/BubbleChart.js.map +1 -1
- package/lib/cjs/component/Chart/BubbleChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/DonutChart.js +3 -1
- package/lib/cjs/component/Chart/DonutChart.js.map +1 -1
- package/lib/cjs/component/Chart/DonutChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/LineChart.js +4 -2
- package/lib/cjs/component/Chart/LineChart.js.map +1 -1
- package/lib/cjs/component/Chart/LineChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/RadarChart.js +3 -1
- package/lib/cjs/component/Chart/RadarChart.js.map +1 -1
- package/lib/cjs/component/Chart/RadarChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/ScatterPlotChart.js +3 -1
- package/lib/cjs/component/Chart/ScatterPlotChart.js.map +1 -1
- package/lib/cjs/component/Chart/ScatterPlotChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/VennChart.js +6 -2
- package/lib/cjs/component/Chart/VennChart.js.map +1 -1
- package/lib/cjs/component/Chart/VennChart.type.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +17 -17
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +6 -6
- package/lib/cjs/types/Area.d.js.map +1 -1
- package/lib/cjs/types/Bubble.d.js.map +1 -1
- package/lib/cjs/types/Donut.d.js.map +1 -1
- package/lib/cjs/types/Line.d.js.map +1 -1
- package/lib/cjs/types/Radar.d.js.map +1 -1
- package/lib/cjs/types/ScatterPlot.d.js.map +1 -1
- package/lib/es6/Area.js +56 -31
- package/lib/es6/Area.js.map +1 -1
- package/lib/es6/Axis.js +14 -14
- package/lib/es6/Bar.js +16 -16
- package/lib/es6/Bubble.js +28 -15
- package/lib/es6/Bubble.js.map +1 -1
- package/lib/es6/CompactHorizontalBar.js +31 -19
- package/lib/es6/CompactHorizontalBar.js.map +1 -1
- package/lib/es6/Donut.js +31 -16
- package/lib/es6/Donut.js.map +1 -1
- package/lib/es6/Dots.js +24 -10
- package/lib/es6/Dots.js.map +1 -1
- package/lib/es6/HorizontalBar.js +16 -16
- package/lib/es6/Hover.js +3 -3
- package/lib/es6/Line.js +52 -26
- package/lib/es6/Line.js.map +1 -1
- package/lib/es6/Plot.js +3 -3
- package/lib/es6/Radar.js +206 -176
- package/lib/es6/Radar.js.map +1 -1
- package/lib/es6/RadialTree.js +12 -12
- package/lib/es6/Reference.js +12 -12
- package/lib/es6/ScatterPlot.js +22 -10
- package/lib/es6/ScatterPlot.js.map +1 -1
- package/lib/es6/Tooltip.js +9 -9
- package/lib/es6/Venn.js +32 -15
- package/lib/es6/Venn.js.map +1 -1
- package/lib/es6/a11y/PlotA11yModule.js +2 -2
- package/lib/es6/a11y/PlotA11yView.js +2 -2
- package/lib/es6/component/Chart/AreaChart.js +6 -3
- package/lib/es6/component/Chart/AreaChart.js.map +1 -1
- package/lib/es6/component/Chart/AreaChart.type.js.map +1 -1
- package/lib/es6/component/Chart/BubbleChart.js +2 -0
- package/lib/es6/component/Chart/BubbleChart.js.map +1 -1
- package/lib/es6/component/Chart/BubbleChart.type.js.map +1 -1
- package/lib/es6/component/Chart/DonutChart.js +3 -1
- package/lib/es6/component/Chart/DonutChart.js.map +1 -1
- package/lib/es6/component/Chart/DonutChart.type.js.map +1 -1
- package/lib/es6/component/Chart/LineChart.js +4 -2
- package/lib/es6/component/Chart/LineChart.js.map +1 -1
- package/lib/es6/component/Chart/LineChart.type.js.map +1 -1
- package/lib/es6/component/Chart/RadarChart.js +3 -1
- package/lib/es6/component/Chart/RadarChart.js.map +1 -1
- package/lib/es6/component/Chart/RadarChart.type.js.map +1 -1
- package/lib/es6/component/Chart/ScatterPlotChart.js +3 -1
- package/lib/es6/component/Chart/ScatterPlotChart.js.map +1 -1
- package/lib/es6/component/Chart/ScatterPlotChart.type.js.map +1 -1
- package/lib/es6/component/Chart/VennChart.js +6 -2
- package/lib/es6/component/Chart/VennChart.js.map +1 -1
- package/lib/es6/component/Chart/VennChart.type.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +17 -17
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +6 -6
- package/lib/es6/types/Area.d.js.map +1 -1
- package/lib/es6/types/Bubble.d.js.map +1 -1
- package/lib/es6/types/Donut.d.js.map +1 -1
- package/lib/es6/types/Line.d.js.map +1 -1
- package/lib/es6/types/Radar.d.js.map +1 -1
- package/lib/es6/types/ScatterPlot.d.js.map +1 -1
- package/lib/esm/Area.mjs +33 -17
- package/lib/esm/Axis.mjs +15 -15
- package/lib/esm/Bar.mjs +17 -17
- package/lib/esm/Bubble.mjs +28 -16
- package/lib/esm/CompactHorizontalBar.mjs +31 -20
- package/lib/esm/Donut.mjs +32 -18
- package/lib/esm/Dots.mjs +21 -11
- package/lib/esm/HorizontalBar.mjs +17 -17
- package/lib/esm/Hover.mjs +4 -4
- package/lib/esm/Line.mjs +32 -15
- package/lib/esm/Plot.mjs +4 -4
- package/lib/esm/Radar.mjs +119 -96
- package/lib/esm/RadialTree.mjs +13 -13
- package/lib/esm/Reference.mjs +13 -13
- package/lib/esm/ScatterPlot.mjs +23 -11
- package/lib/esm/Tooltip.mjs +10 -10
- package/lib/esm/Venn.mjs +31 -16
- package/lib/esm/a11y/PlotA11yModule.mjs +3 -3
- package/lib/esm/a11y/PlotA11yView.mjs +3 -3
- package/lib/esm/component/Chart/AreaChart.mjs +5 -3
- package/lib/esm/component/Chart/BubbleChart.mjs +2 -0
- package/lib/esm/component/Chart/DonutChart.mjs +2 -1
- package/lib/esm/component/Chart/LineChart.mjs +3 -2
- package/lib/esm/component/Chart/RadarChart.mjs +2 -1
- package/lib/esm/component/Chart/ScatterPlotChart.mjs +2 -1
- package/lib/esm/component/Chart/VennChart.mjs +4 -2
- package/lib/esm/component/ChartLegend/LegendFlex/LegendFlex.mjs +5 -5
- package/lib/esm/component/ChartLegend/LegendItem/LegendItem.mjs +18 -18
- package/lib/esm/component/ChartLegend/LegendTable/LegendTable.mjs +7 -7
- package/lib/types/Area.d.ts +2 -0
- package/lib/types/Bubble.d.ts +2 -0
- package/lib/types/Donut.d.ts +2 -0
- package/lib/types/Line.d.ts +2 -0
- package/lib/types/Radar.d.ts +2 -0
- package/lib/types/ScatterPlot.d.ts +2 -0
- package/lib/types/component/Chart/AreaChart.type.d.ts +2 -0
- package/lib/types/component/Chart/BubbleChart.type.d.ts +2 -0
- package/lib/types/component/Chart/DonutChart.type.d.ts +4 -1
- package/lib/types/component/Chart/LineChart.type.d.ts +2 -0
- package/lib/types/component/Chart/RadarChart.type.d.ts +2 -0
- package/lib/types/component/Chart/ScatterPlotChart.type.d.ts +2 -0
- package/lib/types/component/Chart/VennChart.type.d.ts +4 -1
- 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__*/".
|
|
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": "
|
|
29
|
-
"__SAxisLine": "
|
|
30
|
-
"__SAxisTick": "
|
|
31
|
-
"_active": "
|
|
32
|
-
"__SAxisLabel": "
|
|
33
|
-
"_xDirection": "
|
|
34
|
-
"--xDirection": "--
|
|
35
|
-
"_yDirection": "
|
|
36
|
-
"--yDirection": "--
|
|
37
|
-
"__SPolygon": "
|
|
38
|
-
"_color": "
|
|
39
|
-
"--color": "--
|
|
40
|
-
"_pattern": "
|
|
41
|
-
"--pattern": "--
|
|
42
|
-
"__SPolygonDot": "
|
|
43
|
-
"_transparent": "
|
|
44
|
-
"__SPolygonLine": "
|
|
45
|
-
"__SPieRect": "
|
|
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$
|
|
223
|
-
Children = _this$
|
|
224
|
-
styles = _this$
|
|
225
|
-
size = _this$
|
|
226
|
-
data = _this$
|
|
227
|
-
offset = _this$
|
|
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$
|
|
272
|
-
data = _this$
|
|
273
|
-
scale = _this$
|
|
274
|
-
color = _this$
|
|
275
|
-
resolveColor = _this$
|
|
276
|
-
transparent = _this$
|
|
277
|
-
dataKey = _this$
|
|
278
|
-
dataHintsHandler = _this$
|
|
279
|
-
angleOffset = _this$
|
|
280
|
-
patterns = _this$
|
|
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$
|
|
297
|
-
d3 = _this$
|
|
298
|
-
data = _this$
|
|
299
|
-
color = _this$
|
|
300
|
-
resolveColor = _this$
|
|
301
|
-
transparent = _this$
|
|
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$
|
|
315
|
-
SPolygon = _this$
|
|
316
|
-
styles = _this$
|
|
317
|
-
d3 = _this$
|
|
318
|
-
data = _this$
|
|
319
|
-
color = _this$
|
|
320
|
-
resolveColor = _this$
|
|
321
|
-
fill = _this$
|
|
322
|
-
uid = _this$
|
|
323
|
-
patterns = _this$
|
|
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
|
|
389
|
-
|
|
390
|
-
cx =
|
|
391
|
-
cy =
|
|
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
|
|
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
|
-
|
|
431
|
-
_defineProperty(
|
|
432
|
-
_defineProperty(
|
|
515
|
+
_this3 = _callSuper(this, AxisRoot, [].concat(args));
|
|
516
|
+
_defineProperty(_this3, "unsubscribeTooltipVisible", null);
|
|
517
|
+
_defineProperty(_this3, "state", {
|
|
433
518
|
activeLineIndex: null
|
|
434
519
|
});
|
|
435
|
-
_defineProperty(
|
|
520
|
+
_defineProperty(_this3, "handleTooltipRenderingProps", function (_anchorProps, _ref16) {
|
|
436
521
|
var index = _ref16.index;
|
|
437
|
-
|
|
522
|
+
_this3.setState({
|
|
438
523
|
activeLineIndex: index
|
|
439
524
|
});
|
|
440
525
|
});
|
|
441
|
-
return
|
|
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$
|
|
459
|
-
data = _this$
|
|
460
|
-
offset = _this$
|
|
461
|
-
categories = _this$
|
|
462
|
-
size = _this$
|
|
463
|
-
type = _this$
|
|
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$
|
|
480
|
-
offset = _this$
|
|
481
|
-
categories = _this$
|
|
482
|
-
textSize = _this$
|
|
483
|
-
angleOffset = _this$
|
|
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$
|
|
508
|
-
SAxis = _this$
|
|
509
|
-
styles = _this$
|
|
510
|
-
categories = _this$
|
|
511
|
-
size = _this$
|
|
512
|
-
offset = _this$
|
|
513
|
-
type = _this$
|
|
514
|
-
angleOffset = _this$
|
|
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
|
|
528
|
-
|
|
529
|
-
x =
|
|
530
|
-
y =
|
|
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
|
|
596
|
-
|
|
597
|
-
x =
|
|
598
|
-
y =
|
|
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
|
|
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
|
-
|
|
650
|
-
_defineProperty(
|
|
734
|
+
_this4 = _callSuper(this, Hover, [].concat(args));
|
|
735
|
+
_defineProperty(_this4, "state", {
|
|
651
736
|
index: null
|
|
652
737
|
});
|
|
653
|
-
_defineProperty(
|
|
654
|
-
_defineProperty(
|
|
655
|
-
_defineProperty(
|
|
656
|
-
_defineProperty(
|
|
657
|
-
var
|
|
658
|
-
eventEmitter =
|
|
659
|
-
size =
|
|
660
|
-
rootRef =
|
|
661
|
-
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 =
|
|
669
|
-
|
|
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(
|
|
681
|
-
|
|
766
|
+
_defineProperty(_this4, "handlerMouseLeaveRoot", trottle(function () {
|
|
767
|
+
_this4.setState({
|
|
682
768
|
index: null
|
|
683
769
|
}, function () {
|
|
684
|
-
|
|
770
|
+
_this4.asProps.eventEmitter.emit('setTooltipVisible', false);
|
|
685
771
|
});
|
|
686
772
|
}));
|
|
687
|
-
return
|
|
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$
|
|
789
|
-
styles = _this$
|
|
790
|
-
type = _this$
|
|
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
|
|
797
|
-
|
|
798
|
-
startAngle =
|
|
799
|
-
endAngle =
|
|
800
|
-
radius =
|
|
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()(
|
|
840
|
+
"d": line()(getPolygon(index))
|
|
811
841
|
}));
|
|
812
842
|
}
|
|
813
843
|
}
|