@easyv/charts 1.4.26 → 1.4.28
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.
|
@@ -22,6 +22,7 @@ var _formatter = require("../formatter");
|
|
|
22
22
|
var _piechartModule = _interopRequireDefault(require("../css/piechart.module.css"));
|
|
23
23
|
var _hooks = require("../hooks");
|
|
24
24
|
var _PieTooltip = require("./PieTooltip");
|
|
25
|
+
var _utils2 = require("@easyv/utils/lib/common/utils");
|
|
25
26
|
var _excluded = ["startAngle", "endAngle", "antiClockwise"],
|
|
26
27
|
_excluded2 = ["padAngle", "innerRadius", "outerRadius", "cornerRadius", "startAngle", "endAngle"],
|
|
27
28
|
_excluded3 = ["formatter"],
|
|
@@ -592,7 +593,11 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
|
|
|
592
593
|
},
|
|
593
594
|
mousePos: mousePos
|
|
594
595
|
}), /*#__PURE__*/_react["default"].createElement(_.Legend, (0, _extends2["default"])({}, legend, {
|
|
595
|
-
series: _arcs
|
|
596
|
+
series: _arcs.map(function (arc) {
|
|
597
|
+
return _objectSpread(_objectSpread({}, arc), {}, {
|
|
598
|
+
percent: arc.percent.toFixed(legendPrecision)
|
|
599
|
+
});
|
|
600
|
+
}),
|
|
596
601
|
formatter: formatter,
|
|
597
602
|
judge: judgeData
|
|
598
603
|
}))) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_.ChartContainer, {
|
|
@@ -736,7 +741,11 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
|
|
|
736
741
|
},
|
|
737
742
|
mousePos: mousePos
|
|
738
743
|
}), /*#__PURE__*/_react["default"].createElement(_.Legend, (0, _extends2["default"])({}, legend, {
|
|
739
|
-
series: _arcs
|
|
744
|
+
series: _arcs.map(function (arc) {
|
|
745
|
+
return _objectSpread(_objectSpread({}, arc), {}, {
|
|
746
|
+
percent: arc.percent.toFixed(legendPrecision)
|
|
747
|
+
});
|
|
748
|
+
}),
|
|
740
749
|
formatter: formatter,
|
|
741
750
|
judge: judgeData
|
|
742
751
|
})));
|
|
@@ -32,6 +32,7 @@ var PieTooltip = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
32
32
|
percentageFont = _props$config$tip$dat3.fontStyle,
|
|
33
33
|
percentageSuffix = _props$config$tip$dat3.suffix,
|
|
34
34
|
percentageSuffixIsShow = _props$config$tip$dat3.suffix.show,
|
|
35
|
+
precision = _props$config$tip$dat3.precision,
|
|
35
36
|
image = _props$config$tip.image,
|
|
36
37
|
margin = _props$config$tip.margin,
|
|
37
38
|
_props$config$tip$siz = _props$config$tip.size,
|
|
@@ -87,7 +88,7 @@ var PieTooltip = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
87
88
|
style: (0, _utils.getFontStyle)(valueFont)
|
|
88
89
|
}, y, valueSuffixIsShow && renderSuffix(valueSuffix)), percentageIsShow && /*#__PURE__*/_react["default"].createElement("span", {
|
|
89
90
|
style: (0, _utils.getFontStyle)(percentageFont)
|
|
90
|
-
}, percent, percentageSuffixIsShow && renderSuffix(percentageSuffix)));
|
|
91
|
+
}, Number(percent).toFixed(precision), percentageSuffixIsShow && renderSuffix(percentageSuffix)));
|
|
91
92
|
};
|
|
92
93
|
var mouseX = mousePos.x,
|
|
93
94
|
mouseY = mousePos.y;
|
package/package.json
CHANGED
|
@@ -34,6 +34,7 @@ import { pieLegendFormatter as legendFormatter } from "../formatter";
|
|
|
34
34
|
import ringCss from "../css/piechart.module.css";
|
|
35
35
|
import { useAiDataOfPie } from "../hooks";
|
|
36
36
|
import { PieTooltip } from "./PieTooltip";
|
|
37
|
+
import { toFixed } from '@easyv/utils/lib/common/utils';
|
|
37
38
|
|
|
38
39
|
const PI = Math.PI;
|
|
39
40
|
|
|
@@ -619,7 +620,7 @@ const Component = memo(
|
|
|
619
620
|
)}
|
|
620
621
|
<Legend
|
|
621
622
|
{...legend}
|
|
622
|
-
series={_arcs}
|
|
623
|
+
series={_arcs.map((arc)=>({...arc,percent:arc.percent.toFixed(legendPrecision)}))}
|
|
623
624
|
formatter={formatter}
|
|
624
625
|
judge={judgeData}
|
|
625
626
|
/>
|
|
@@ -855,7 +856,7 @@ const Component = memo(
|
|
|
855
856
|
)}
|
|
856
857
|
<Legend
|
|
857
858
|
{...legend}
|
|
858
|
-
series={_arcs}
|
|
859
|
+
series={_arcs.map((arc)=>({...arc,percent:arc.percent.toFixed(legendPrecision)}))}
|
|
859
860
|
formatter={formatter}
|
|
860
861
|
judge={judgeData}
|
|
861
862
|
/>
|
|
@@ -9,7 +9,7 @@ export const PieTooltip = memo((props) => {
|
|
|
9
9
|
tip: {
|
|
10
10
|
data: { lineHeight, iconSize, name,
|
|
11
11
|
value: { show: valueIsShow, fontStyle: valueFont, suffix: valueSuffix,suffix:{show:valueSuffixIsShow} },
|
|
12
|
-
percentage: { show: percentageIsShow, fontStyle: percentageFont, suffix: percentageSuffix,suffix:{show:percentageSuffixIsShow} },
|
|
12
|
+
percentage: { show: percentageIsShow, fontStyle: percentageFont, suffix: percentageSuffix,suffix:{show:percentageSuffixIsShow},precision },
|
|
13
13
|
},
|
|
14
14
|
image,
|
|
15
15
|
margin,
|
|
@@ -77,7 +77,7 @@ export const PieTooltip = memo((props) => {
|
|
|
77
77
|
{valueSuffixIsShow && renderSuffix(valueSuffix)}
|
|
78
78
|
</span>}
|
|
79
79
|
{percentageIsShow && <span style={getFontStyle(percentageFont)}>
|
|
80
|
-
{percent}
|
|
80
|
+
{Number(percent).toFixed(precision)}
|
|
81
81
|
{percentageSuffixIsShow && renderSuffix(percentageSuffix)}
|
|
82
82
|
</span>}
|
|
83
83
|
</dd>
|