Liferay.Loader.define("data-engine-js-components-web@1.0.55/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,a.useState)(null),[b,w]=(0,a.useState)(!0),g=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=>g(e))).sort(((e,t)=>r.rows[e].index-r.rows[t].index))}))(d),{columns:E}=v;return t=v?(({columns:e,rows:r})=>{const a=[];return r.map((r=>{const l={label:g(r),name:r};e.map((e=>{l[e]=t[r]&&t[r][e]?t[r][e]:0})),a.push(l)})),a})(v):t,a.default.createElement("div",{className:"custom-chart-size multi-bar-chart"},a.default.createElement(l.ResponsiveContainer,{height:s||"99%",width:f||"99%"},a.default.createElement(l.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))}},a.default.createElement(l.XAxis,{axisLine:{stroke:e},dataKey:"label",interval:0,tick:a.default.createElement(c.default,{ticksNumber:d.rows.length}),tickLine:!1}),a.default.createElement(l.YAxis,{axisLine:{stroke:m},tickLine:!1,type:"number"}),a.default.createElement(l.Tooltip,{content:a.default.createElement(u.default,{field:r,roundBullet:!1}),cursor:!1}),E.map(((e,r)=>a.default.createElement(l.Bar,{dataKey:e,fill:(0,n.default)(r),key:"bar-".concat(r)},t.map(((e,t)=>a.default.createElement(l.Cell,{fillOpacity:h===t||b?1:.5,key:"cell-".concat(t)})))))),a.default.createElement(l.Legend,{content:e=>{const{payload:t}=e;return a.default.createElement("ul",{className:"bar-legend"},t.map(((e,t)=>{const l=(0,o.getColumnLabel)(e.value,r);return a.default.createElement("li",{key:"item-".concat(t)},a.default.createElement("svg",{height:"12",width:"12"},a.default.createElement("rect",{fill:e.color,height:"12",width:"12"})),a.default.createElement("span",null,l&&l.length>p?(0,i.default)(l,p):l))})))},iconType:"square",verticalAlign:"top"}))))};var a=f(r("liferay!frontend-js-react-web$react")),l=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={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var n=a?Object.getOwnPropertyDescriptor(e,l):null;n&&(n.get||n.set)?Object.defineProperty(r,l,n):r[l]=e[l]}return r.default=e,t&&t.set(e,r),r}const{blueDark:e,gray:m}=n.NAMED_COLORS,p=44}}));
//# sourceMappingURL=MultiBarChart.js.map