Liferay.Loader.define("data-engine-js-components-web@1.0.107/js/custom/form-report/components/chart/pie/PieChart",["module","exports","require","liferay!frontend-js-react-web$react","frontend-js-recharts$recharts","../../../utils/colors","../../../utils/data","../Legend","../TooltipContent"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function PieChart({data:t,height:r,totalEntries:d,width:s}){const[f,p]=(0,n.useState)(null),[h,g]=(0,n.useState)(!0),handleOnMouseOut=()=>{p(null)},handleOnMouseOver=e=>{p(e)};return n.default.createElement("div",{className:"lfr-de-recharts pie-chart",style:{height:"100%",width:"100%"}},n.default.createElement(a.ResponsiveContainer,{height:r||"100%",width:s||"70%"},n.default.createElement(a.PieChart,null,n.default.createElement(a.Pie,{activeIndex:f,activeShape:({cx:e,cy:t,endAngle:r,innerRadius:i,outerRadius:u,startAngle:o})=>(g(!1),n.default.createElement("g",null,n.default.createElement(a.Sector,{cx:e,cy:t,endAngle:r,fill:(0,l.default)(f),innerRadius:i,onMouseOut:handleOnMouseOut,outerRadius:u+5,startAngle:o}))),cx:"50%",cy:"50%",data:t,dataKey:"count",endAngle:-270,innerRadius:"60%",isAnimationActive:h,label:({cx:t,cy:r,innerRadius:a,midAngle:l,outerRadius:u,percent:o})=>{const d=a+.5*(u-a),s=t+d*Math.cos(-l*c),f=r+d*Math.sin(-l*c);return n.default.createElement("text",{dominantBaseline:"central",fill:e,textAnchor:"middle",x:s,y:f},(0,i.roundPercentage)(o))},labelLine:!1,nameKey:"label",onMouseOver:(e,t)=>handleOnMouseOver(t),outerRadius:"100%",paddingAngle:0,startAngle:90},t.map(((e,t)=>n.default.createElement(a.Cell,{fill:(0,l.default)(t),fillOpacity:null!==f&&f!==t?.5:1,key:t})))),n.default.createElement(a.Tooltip,{content:n.default.createElement(o.default,{showBullet:!0,showHeader:!1,totalEntries:d})}))),n.default.createElement(u.default,{activeIndex:f,data:t,onMouseOut:handleOnMouseOut,onMouseOver:handleOnMouseOver}))};var n=_interopRequireWildcard(r("liferay!frontend-js-react-web$react")),a=r("frontend-js-recharts$recharts"),l=_interopRequireWildcard(r("../../../utils/colors")),i=r("../../../utils/data"),u=_interopRequireDefault(r("../Legend")),o=_interopRequireDefault(r("../TooltipContent"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var l=n?Object.getOwnPropertyDescriptor(e,a):null;l&&(l.get||l.set)?Object.defineProperty(r,a,l):r[a]=e[a]}return r.default=e,t&&t.set(e,r),r}const{black:e}=l.NAMED_COLORS,c=Math.PI/180}}));
//# sourceMappingURL=PieChart.js.map