Liferay.Loader.define("data-engine-js-components-web@1.0.87/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 MultiBarChart({data:t,field:r,height:f,structure:p,width:m}){const[h,g]=(0,a.useState)(null),[y,w]=(0,a.useState)(!0),getRowLabel=e=>r.rows[e]?r.rows[e].value:void 0,b=(({columns:e,rows:t})=>({columns:e.filter((e=>(0,i.getColumnLabel)(e,r))).sort(((e,t)=>r.columns[e].index-r.columns[t].index)),rows:t.filter((e=>getRowLabel(e))).sort(((e,t)=>r.rows[e].index-r.rows[t].index))}))(p),{columns:v}=b;return t=b?(({columns:e,rows:r})=>{const a=[];return r.map((r=>{const l={label:getRowLabel(r),name:r};e.map((e=>{l[e]=t[r]&&t[r][e]?t[r][e]:0})),a.push(l)})),a})(b):t,a.default.createElement("div",{className:"lfr-de-recharts",style:{display:"flex",height:"100%",minHeight:"500px",width:"100%"}},a.default.createElement(l.ResponsiveContainer,{height:f||"100%",width:m||"100%"},a.default.createElement(l.BarChart,{data:t,layout:"horizontal",margin:{bottom:20,left:20,right:20,top:20},onMouseMove:({activeTooltipIndex:e,isTooltipActive:t})=>{t?(g(e),w(!1)):(g(null),w(!0))}},a.default.createElement(l.XAxis,{axisLine:{stroke:e},dataKey:"label",interval:0,tick:a.default.createElement(c.default,{ticksNumber:p.rows.length}),tickLine:!1}),a.default.createElement(l.YAxis,{axisLine:{stroke:s},tickLine:!1,type:"number"}),a.default.createElement(l.Tooltip,{content:a.default.createElement(u.default,{field:r,roundBullet:!1}),cursor:!1}),v.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||y?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,i.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>d?(0,o.default)(l,d):l))})))},iconType:"square",verticalAlign:"top"}))))};var a=_interopRequireWildcard(r("liferay!frontend-js-react-web$react")),l=r("frontend-js-recharts$recharts"),n=_interopRequireWildcard(r("../../../utils/colors")),i=r("../../../utils/data"),o=_interopRequireDefault(r("../../../utils/ellipsize")),u=_interopRequireDefault(r("../TooltipContent")),c=_interopRequireDefault(r("./CustomizedAxisTick"));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={},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:s}=n.NAMED_COLORS,d=44}}));
//# sourceMappingURL=MultiBarChart.js.map