Liferay.Loader.define("data-engine-js-components-web@1.0.75/js/custom/form-report/components/chart/bar/MultiBarChart",["module","exports","require","liferay!frontend-js-react-web$react","frontend-js-recharts$recharts","../../../utils/colors","../../../utils/data","../../../utils/ellipsize","../TooltipContent","./CustomizedAxisTick"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function({data:t,field:r,height:s,structure:d,width:f}){const[h,y]=(0,l.useState)(null),[g,w]=(0,l.useState)(!0),b=e=>r.rows[e]?r.rows[e].value:void 0,v=(({columns:e,rows:t})=>({columns:e.filter((e=>(0,o.getColumnLabel)(e,r))).sort(((e,t)=>r.columns[e].index-r.columns[t].index)),rows:t.filter((e=>b(e))).sort(((e,t)=>r.rows[e].index-r.rows[t].index))}))(d),{columns:E}=v;return t=v?(({columns:e,rows:r})=>{const l=[];return r.map((r=>{const a={label:b(r),name:r};e.map((e=>{a[e]=t[r]&&t[r][e]?t[r][e]:0})),l.push(a)})),l})(v):t,l.default.createElement("div",{className:"lfr-de-recharts",style:{display:"flex",height:"100%",minHeight:"500px",width:"100%"}},l.default.createElement(a.ResponsiveContainer,{height:s||"100%",width:f||"100%"},l.default.createElement(a.BarChart,{data:t,layout:"horizontal",margin:{bottom:20,left:20,right:20,top:20},onMouseMove:({activeTooltipIndex:e,isTooltipActive:t})=>{t?(y(e),w(!1)):(y(null),w(!0))}},l.default.createElement(a.XAxis,{axisLine:{stroke:e},dataKey:"label",interval:0,tick:l.default.createElement(c.default,{ticksNumber:d.rows.length}),tickLine:!1}),l.default.createElement(a.YAxis,{axisLine:{stroke:m},tickLine:!1,type:"number"}),l.default.createElement(a.Tooltip,{content:l.default.createElement(u.default,{field:r,roundBullet:!1}),cursor:!1}),E.map(((e,r)=>l.default.createElement(a.Bar,{dataKey:e,fill:(0,n.default)(r),key:"bar-".concat(r)},t.map(((e,t)=>l.default.createElement(a.Cell,{fillOpacity:h===t||g?1:.5,key:"cell-".concat(t)})))))),l.default.createElement(a.Legend,{content:e=>{const{payload:t}=e;return l.default.createElement("ul",{className:"bar-legend"},t.map(((e,t)=>{const a=(0,o.getColumnLabel)(e.value,r);return l.default.createElement("li",{key:"item-".concat(t)},l.default.createElement("svg",{height:"12",width:"12"},l.default.createElement("rect",{fill:e.color,height:"12",width:"12"})),l.default.createElement("span",null,a&&a.length>p?(0,i.default)(a,p):a))})))},iconType:"square",verticalAlign:"top"}))))};var l=f(r("liferay!frontend-js-react-web$react")),a=r("frontend-js-recharts$recharts"),n=f(r("../../../utils/colors")),o=r("../../../utils/data"),i=s(r("../../../utils/ellipsize")),u=s(r("../TooltipContent")),c=s(r("./CustomizedAxisTick"));function s(e){return e&&e.__esModule?e:{default:e}}function d(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return d=function(){return e},e}function f(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=d();if(t&&t.has(e))return t.get(e);var r={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var n=l?Object.getOwnPropertyDescriptor(e,a):null;n&&(n.get||n.set)?Object.defineProperty(r,a,n):r[a]=e[a]}return r.default=e,t&&t.set(e,r),r}const{blueDark:e,gray:m}=n.NAMED_COLORS,p=44}}));
//# sourceMappingURL=MultiBarChart.js.map