@undp/data-viz 1.5.7 → 1.5.8

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.
Files changed (74) hide show
  1. package/dist/BarGraph.cjs +1 -1
  2. package/dist/BarGraph.cjs.map +1 -1
  3. package/dist/BarGraph.js +650 -648
  4. package/dist/BarGraph.js.map +1 -1
  5. package/dist/BulletChart.cjs +1 -1
  6. package/dist/BulletChart.cjs.map +1 -1
  7. package/dist/BulletChart.js +210 -208
  8. package/dist/BulletChart.js.map +1 -1
  9. package/dist/ButterflyChart.cjs +1 -1
  10. package/dist/ButterflyChart.cjs.map +1 -1
  11. package/dist/ButterflyChart.js +42 -40
  12. package/dist/ButterflyChart.js.map +1 -1
  13. package/dist/DifferenceLineChart.cjs +1 -1
  14. package/dist/DifferenceLineChart.cjs.map +1 -1
  15. package/dist/DifferenceLineChart.js +122 -120
  16. package/dist/DifferenceLineChart.js.map +1 -1
  17. package/dist/DualAxisLineChart.cjs +1 -1
  18. package/dist/DualAxisLineChart.cjs.map +1 -1
  19. package/dist/DualAxisLineChart.js +133 -113
  20. package/dist/DualAxisLineChart.js.map +1 -1
  21. package/dist/DumbbellChart.cjs +1 -1
  22. package/dist/DumbbellChart.cjs.map +1 -1
  23. package/dist/DumbbellChart.js +274 -274
  24. package/dist/DumbbellChart.js.map +1 -1
  25. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  26. package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
  27. package/dist/LineChartWithConfidenceInterval.js +194 -174
  28. package/dist/LineChartWithConfidenceInterval.js.map +1 -1
  29. package/dist/MultiLineAltChart.cjs +1 -1
  30. package/dist/MultiLineAltChart.cjs.map +1 -1
  31. package/dist/MultiLineAltChart.js +160 -161
  32. package/dist/MultiLineAltChart.js.map +1 -1
  33. package/dist/MultiLineChart.cjs +1 -1
  34. package/dist/MultiLineChart.cjs.map +1 -1
  35. package/dist/MultiLineChart.js +77 -66
  36. package/dist/MultiLineChart.js.map +1 -1
  37. package/dist/ParetoChart.cjs +1 -1
  38. package/dist/ParetoChart.cjs.map +1 -1
  39. package/dist/ParetoChart.js +166 -161
  40. package/dist/ParetoChart.js.map +1 -1
  41. package/dist/RadarChart.cjs +1 -1
  42. package/dist/RadarChart.cjs.map +1 -1
  43. package/dist/RadarChart.js +253 -241
  44. package/dist/RadarChart.js.map +1 -1
  45. package/dist/{RegressionLine-mH7UKOPi.js → RegressionLine-C2--oMQq.js} +10 -9
  46. package/dist/RegressionLine-C2--oMQq.js.map +1 -0
  47. package/dist/RegressionLine-Dj0GSiAp.cjs +2 -0
  48. package/dist/RegressionLine-Dj0GSiAp.cjs.map +1 -0
  49. package/dist/ScatterPlot.cjs +1 -1
  50. package/dist/ScatterPlot.cjs.map +1 -1
  51. package/dist/ScatterPlot.js +130 -129
  52. package/dist/ScatterPlot.js.map +1 -1
  53. package/dist/SimpleLineChart.cjs +1 -1
  54. package/dist/SimpleLineChart.cjs.map +1 -1
  55. package/dist/SimpleLineChart.js +43 -38
  56. package/dist/SimpleLineChart.js.map +1 -1
  57. package/dist/SlopeChart.cjs +1 -1
  58. package/dist/SlopeChart.cjs.map +1 -1
  59. package/dist/SlopeChart.js +113 -109
  60. package/dist/SlopeChart.js.map +1 -1
  61. package/dist/StripChart.cjs +1 -1
  62. package/dist/StripChart.cjs.map +1 -1
  63. package/dist/StripChart.js +282 -270
  64. package/dist/StripChart.js.map +1 -1
  65. package/dist/UnitChart.cjs +1 -1
  66. package/dist/UnitChart.cjs.map +1 -1
  67. package/dist/UnitChart.js +20 -21
  68. package/dist/UnitChart.js.map +1 -1
  69. package/dist/getCentroidCoordinates-Dfk6IqEG.js.map +1 -1
  70. package/dist/getCentroidCoordinates-DxTBqzp2.cjs.map +1 -1
  71. package/package.json +1 -1
  72. package/dist/RegressionLine-mH7UKOPi.js.map +0 -1
  73. package/dist/RegressionLine-xKdiJ8sw.cjs +0 -2
  74. package/dist/RegressionLine-xKdiJ8sw.cjs.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CHPV5EwG-DDoeWRVt.cjs"),p=require("react"),y=require("./parse-hMnG_lRV.cjs"),kt=require("./simple-statistics-xm8c0LQQ.cjs"),qt=require("./index-CQ3e6Ewi.cjs"),ot=require("./numberFormattingFunction-02t-wJta.cjs"),$t=require("./Tooltip-De16GWhY.cjs"),v=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),bt=require("./customArea-CK768gCn.cjs"),Ft=require("./AxisTitle-CK9YeovX.cjs"),Tt=require("./Axis-DE7dSn1_.cjs"),Wt=require("./ReferenceLine-CFVBBN__.cjs"),Ht=require("./RegressionLine-xKdiJ8sw.cjs"),Pt=require("./YTicksAndGridLines-DBDuz6vb.cjs"),Ut=require("./index-BYzIB5V6.cjs"),Yt=require("./time-Byw_jYQ7.cjs"),Gt=require("./linear-BVckp9RD.cjs"),lt=require("./line-DHV4JwCR.cjs"),ct=require("./step-BZ3C8QFW.cjs"),Xt=require("./area-D3Qx7k7K.cjs"),Bt=require("./select-Bnfk0lJx.cjs"),zt=require("./init-DU0ybBc_.cjs"),Jt=require("./pointer-Dkq5NV1q.cjs"),Kt=require("./use-in-view-sQJZ_xDO.cjs"),f=require("./proxy-BHRoeZgd.cjs"),Qt=require("./GraphFooter.cjs"),Zt=require("./GraphHeader.cjs"),xt=require("./Colors.cjs"),_t=require("./ColorLegend.cjs"),te=require("./EmptyState-d8_8SxeW.cjs");function ee(ut){const{data:A,width:M,height:$,lineColor:k,suffix:I,prefix:j,dateFormat:o,highlightAreaSettings:m,showValues:G,noOfXTicks:mt,rightMargin:ht,leftMargin:R,topMargin:C,bottomMargin:X,tooltip:B,onSeriesMouseOver:F,refValues:z,minValue:J,maxValue:K,animate:a,rtl:Q,strokeWidth:yt,showDots:D,annotations:pt,customHighlightAreaSettings:dt,regressionLine:T,showIntervalDots:gt,showIntervalValues:ft,intervalLineStrokeWidth:W,intervalLineColors:b,intervalAreaColor:jt,intervalAreaOpacity:wt,yAxisTitle:Z,noOfYTicks:vt,minDate:H,maxDate:P,curveType:L,styles:c,classNames:x,precision:N,customLayers:_}=ut,tt=p.useRef(null),l=Kt.useInView(tt,{once:a.once,amount:a.amount}),[u,Rt]=p.useState(!1);p.useEffect(()=>{if(l&&!u){const t=setTimeout(()=>{Rt(!0)},(a.duration+.5)*1e3);return()=>clearTimeout(t)}},[l,u,a.duration]);const S=L==="linear"?lt.curveLinear:L==="step"?ct.curveStep:L==="stepAfter"?ct.stepAfter:L==="stepBefore"?ct.stepBefore:ct.monotoneX,[V,et]=p.useState(void 0),[it,nt]=p.useState(void 0),[U,Y]=p.useState(void 0),d={top:C,bottom:X,left:Z?R+30:R,right:ht},E=p.useRef(null),n=qt.orderBy(A.filter(t=>!v.checkIfNullOrUndefined(t.y)).map(t=>({date:y.parse(`${t.date}`,o,new Date),y:t.y,yMin:v.checkIfNullOrUndefined(t.yMin)?t.y:t.yMin,yMax:v.checkIfNullOrUndefined(t.yMax)?t.y:t.yMax,data:t.data})),["date"],["asc"]),Et=m.map(t=>({...t,coordinates:[t.coordinates[0]===null?null:y.parse(`${t.coordinates[0]}`,o,new Date),t.coordinates[1]===null?null:y.parse(`${t.coordinates[1]}`,o,new Date)]})),Mt=dt.map(t=>({...t,coordinates:t.coordinates.map((g,O)=>O%2===0?y.parse(`${g}`,o,new Date):g)})),r=M-d.left-d.right,w=$-d.top-d.bottom,at=H?y.parse(`${H}`,o,new Date):n[0].date,st=P?y.parse(`${P}`,o,new Date):n[n.length-1].date,h=v.checkIfNullOrUndefined(J)?Math.min(...n.map(t=>Math.min(t.y,t.yMax,t.yMin)))?Math.min(...n.map(t=>Math.min(t.y,t.yMax,t.yMin)))>0?0:Math.min(...n.map(t=>Math.min(t.y,t.yMax,t.yMin))):0:J,q=Math.max(...n.map(t=>Math.max(t.y,t.yMax,t.yMin)))?Math.max(...n.map(t=>Math.max(t.y,t.yMax,t.yMin))):0,i=Yt.time().domain([at,st]).range([0,r]),s=Gt.linear().domain([h,v.checkIfNullOrUndefined(K)?q>0?q:0:K]).range([w,0]).nice(),Ot=lt.line().x(t=>i(t.date)).y(t=>s(t.y)).curve(S),At=lt.line().x(t=>i(t.date)).y(t=>s(t.yMin)).curve(S),It=lt.line().x(t=>i(t.date)).y(t=>s(t.yMax)).curve(S),Lt=Xt.area().x(t=>i(t.date)).y0(t=>s(t.yMin)).y1(t=>s(t.yMax)).curve(S),Nt=s.ticks(vt),Dt=i.ticks(mt);p.useEffect(()=>{const t=O=>{const rt=n[zt.bisectCenter(n.map(Ct=>Ct.date),i.invert(Jt.pointer(O)[0]),0)];et(rt||n[n.length-1]),F?.(rt||n[n.length-1]),Y(O.clientY),nt(O.clientX)},g=()=>{et(void 0),nt(void 0),Y(void 0),F?.(void 0)};Bt.select(E.current).on("mousemove",t).on("mouseout",g)},[i,n,F]);const St=kt.linearRegression(n.filter(t=>!v.checkIfNullOrUndefined(t.date)&&!v.checkIfNullOrUndefined(t.y)).map(t=>[i(t.date),s(t.y)])),Vt=kt.linearRegressionLine(St);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(f.motion.svg,{width:`${M}px`,height:`${$}px`,viewBox:`0 0 ${M} ${$}`,direction:"ltr",ref:tt,children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[e.jsxRuntimeExports.jsx(Ut.HighlightArea,{areaSettings:Et,width:r,height:w,scale:i,animate:a,isInView:l}),e.jsxRuntimeExports.jsx(bt.CustomArea,{areaSettings:Mt,scaleX:i,scaleY:s,animate:a,isInView:l}),e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(Pt.YTicksAndGridLines,{values:Nt.filter(t=>t!==0),y:Nt.filter(t=>t!==0).map(t=>s(t)),x1:0-R,x2:r+d.right,styles:{gridLines:c?.yAxis?.gridLines,labels:c?.yAxis?.labels},classNames:{gridLines:x?.yAxis?.gridLines,labels:x?.yAxis?.labels},suffix:I,prefix:j,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:N}),e.jsxRuntimeExports.jsx(Tt.Axis,{y1:s(h<0?0:h),y2:s(h<0?0:h),x1:0-R,x2:r+d.right,label:ot.numberFormattingFunction(h<0?0:h,"NA",N,j,I),labelPos:{x:0-R,y:s(h<0?0:h),dx:0,dy:q<0?"1em":-5},classNames:{axis:x?.xAxis?.axis,label:x?.yAxis?.labels},styles:{axis:c?.xAxis?.axis,label:c?.yAxis?.labels}}),e.jsxRuntimeExports.jsx(Ft.AxisTitle,{x:0-R+15,y:w/2,style:c?.yAxis?.title,className:x?.yAxis?.title,text:Z,rotate90:!0})]}),e.jsxRuntimeExports.jsx("g",{children:Dt.map((t,g)=>e.jsxRuntimeExports.jsx("g",{children:e.jsxRuntimeExports.jsx("text",{y:w,x:i(t),style:{textAnchor:"middle"},className:"fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs",dy:15,children:y.format(t,o)})},g))}),_.filter(t=>t.position==="before").map(t=>t.layer),e.jsxRuntimeExports.jsx(f.motion.path,{style:{fill:jt},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,d:Lt(n)||""},whileInView:{opacity:wt,d:Lt(n)||"",transition:{duration:a.duration}}},initial:"initial",animate:l?"whileInView":"initial"}),W?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(f.motion.path,{style:{stroke:b[0],fill:"none",strokeWidth:W},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{pathLength:0,d:At(n)||"",opacity:1},whileInView:{pathLength:1,d:At(n)||"",opacity:1,transition:{duration:a.duration}}},initial:"initial",animate:l?"whileInView":"initial"}),e.jsxRuntimeExports.jsx(f.motion.path,{style:{stroke:b[1],fill:"none",strokeWidth:W},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{pathLength:0,d:It(n)||"",opacity:1},whileInView:{pathLength:1,d:It(n)||"",opacity:1,transition:{duration:a.duration}}},initial:"initial",animate:l?"whileInView":"initial"})]}):null,e.jsxRuntimeExports.jsx(f.motion.path,{style:{stroke:k,fill:"none",strokeWidth:yt},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{pathLength:0,d:Ot(n)||"",opacity:1},whileInView:{pathLength:1,d:Ot(n)||"",opacity:1,transition:{duration:a.duration}}},initial:"initial",animate:l?"whileInView":"initial"}),V?e.jsxRuntimeExports.jsx("line",{y1:0,y2:w,x1:i(V.date),x2:i(V.date),className:e.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",x?.mouseOverLine),style:c?.mouseOverLine}):null,e.jsxRuntimeExports.jsx("g",{children:n.map((t,g)=>e.jsxRuntimeExports.jsx(f.motion.g,{children:v.checkIfNullOrUndefined(t.y)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[D?e.jsxRuntimeExports.jsx(f.motion.circle,{r:r/n.length<5?0:r/n.length<20?2:4,style:{fill:k},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,cx:i(t.date),cy:s(t.y)},whileInView:{opacity:1,transition:{duration:u?a.duration:.5,delay:u?0:a.duration},cx:i(t.date),cy:s(t.y)}},initial:"initial",animate:l?"whileInView":"initial"}):null,gt?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(f.motion.circle,{r:r/n.length<5?0:r/n.length<20?2:4,style:{fill:b[0]},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,cx:i(t.date),cy:s(t.yMin)},whileInView:{opacity:1,transition:{duration:u?a.duration:.5,delay:u?0:a.duration},cx:i(t.date),cy:s(t.yMin)}},initial:"initial",animate:l?"whileInView":"initial"}),e.jsxRuntimeExports.jsx(f.motion.circle,{r:r/n.length<5?0:r/n.length<20?2:4,style:{fill:b[1]},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,cx:i(t.date),cy:s(t.yMax)},whileInView:{opacity:1,transition:{duration:u?a.duration:.5,delay:u?0:a.duration},cx:i(t.date),cy:s(t.yMax)}},initial:"initial",animate:l?"whileInView":"initial"})]}):null,G?e.jsxRuntimeExports.jsx(f.motion.text,{dy:-8,style:{fill:k,textAnchor:"middle",...c?.graphObjectValues||{}},className:e.mo("graph-value text-xs font-bold",x?.graphObjectValues),exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,x:i(t.date),y:s(t.y)},whileInView:{opacity:1,x:i(t.date),y:s(t.y),transition:{duration:u?a.duration:.5,delay:u?0:a.duration}}},initial:"initial",animate:l?"whileInView":"initial",children:ot.numberFormattingFunction(t.y,"NA",N,j,I)}):null,ft?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(f.motion.text,{dy:"1em",style:{fill:b[0],textAnchor:"middle",...c?.graphObjectValues||{}},className:e.mo("text-xs font-bold",x?.graphObjectValues),exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,x:i(t.date),y:s(t.yMin)},whileInView:{opacity:1,x:i(t.date),y:s(t.yMin),transition:{duration:u?a.duration:.5,delay:u?0:a.duration}}},initial:"initial",animate:l?"whileInView":"initial",children:ot.numberFormattingFunction(t.yMin,"NA",N,j,I)}),e.jsxRuntimeExports.jsx(f.motion.text,{dy:-8,style:{fill:b[1],textAnchor:"middle",...c?.graphObjectValues||{}},className:e.mo("text-xs font-bold",x?.graphObjectValues),exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,x:i(t.date),y:s(t.yMax)},whileInView:{opacity:1,x:i(t.date),y:s(t.yMax),transition:{duration:u?a.duration:.5,delay:u?0:a.duration}}},initial:"initial",animate:l?"whileInView":"initial",children:ot.numberFormattingFunction(t.yMax,"NA",N,j,I)})]}):null]})},g))}),z?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:z.map((t,g)=>e.jsxRuntimeExports.jsx(Wt.RefLineY,{text:t.text,color:t.color,y:s(t.value),x1:0-R,x2:r+d.right,classNames:t.classNames,styles:t.styles,animate:a,isInView:l},g))}):null,e.jsxRuntimeExports.jsx("g",{children:pt.map((t,g)=>{const O=bt.getLineEndPoint({x:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),y:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0)-8:0+(t.yOffset||0)-8},{x:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date)):0,y:t.yCoordinate?s(t.yCoordinate):0},v.checkIfNullOrUndefined(t.connectorRadius)?3.5:t.connectorRadius),rt=t.showConnector?{y1:O.y,x1:O.x,y2:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0):0+(t.yOffset||0),x2:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),cy:t.yCoordinate?s(t.yCoordinate):0,cx:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date)):0,circleRadius:v.checkIfNullOrUndefined(t.connectorRadius)?3.5:t.connectorRadius,strokeWidth:t.showConnector===!0?2:Math.min(t.showConnector||0,1)}:void 0,Ct={y:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0)-8:0+(t.yOffset||0)-8,x:Q?0:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),width:Q?t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0):r+d.right-(t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0)),maxWidth:t.maxWidth,fontWeight:t.fontWeight,align:t.align};return e.jsxRuntimeExports.jsx(bt.Annotation,{color:t.color,connectorsSettings:rt,labelSettings:Ct,text:t.text,classNames:t.classNames,styles:t.styles,animate:a,isInView:l},g)})}),e.jsxRuntimeExports.jsx("g",{children:T?e.jsxRuntimeExports.jsx(Ht.RegressionLine,{x1:0,x2:r,y1:Vt(0),y2:Vt(r),graphHeight:w,graphWidth:r,className:x?.regLine,style:c?.regLine,color:typeof T=="string"?T:void 0,animate:a,isInView:l}):null}),_.filter(t=>t.position==="after").map(t=>t.layer),e.jsxRuntimeExports.jsx("rect",{ref:E,style:{fill:"none",pointerEvents:"all"},width:r,height:w})]})}),V&&B&&it&&U?e.jsxRuntimeExports.jsx($t.Tooltip,{data:V,body:B,xPos:it,yPos:U,backgroundStyle:c?.tooltip,className:x?.tooltip}):null]})}function ie(ut){const{data:A,graphTitle:M,suffix:$="",sources:k,prefix:I="",graphDescription:j,height:o,width:m,footNote:G,noOfXTicks:mt=10,dateFormat:ht="yyyy",showValues:R=!1,backgroundColor:C=!1,padding:X,lineColor:B,leftMargin:F=30,rightMargin:z=30,topMargin:J=20,bottomMargin:K=25,tooltip:a,refValues:Q=[],highlightAreaSettings:yt=[],relativeHeight:D,onSeriesMouseOver:pt,graphID:dt,minValue:T,maxValue:gt,regressionLine:ft=!1,showIntervalDots:W=!1,showIntervalValues:b=!1,intervalLineStrokeWidth:jt=0,intervalLineColors:wt=[xt.Colors.light.grays["gray-500"],xt.Colors.light.grays["gray-500"]],intervalAreaColor:Z=xt.Colors.primaryColors["blue-100"],intervalAreaOpacity:vt=.4,graphDownload:H=!1,dataDownload:P=!1,animate:L=!1,language:c="en",minHeight:x=0,strokeWidth:N=2,showDots:_=!0,annotations:tt=[],customHighlightAreaSettings:l=[],theme:u="light",ariaLabel:Rt,yAxisTitle:S,noOfYTicks:V=5,minDate:et,maxDate:it,colorLegendTitle:nt,colorLegendColors:U,colorLegendDomain:Y,curveType:d="curve",styles:E,classNames:n,precision:Et=2,customLayers:Mt=[]}=ut,[r,w]=p.useState(0),[at,st]=p.useState(0),h=p.useRef(null),q=p.useRef(null);return p.useEffect(()=>{const i=new ResizeObserver(s=>{w(m||s[0].target.clientWidth||620),st(o||s[0].target.clientHeight||480)});return h.current&&(st(h.current.clientHeight||480),w(h.current.clientWidth||620),m||i.observe(h.current)),()=>i.disconnect()},[m,o]),e.jsxRuntimeExports.jsx("div",{className:`${u||"light"} flex ${m?"w-fit grow-0":"w-full grow"}`,dir:c==="he"||c==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.mo(`${C?C===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${c||"en"}`,m?"w-fit":"w-full",n?.graphContainer),style:{...E?.graphContainer||{},...C&&C!==!0?{backgroundColor:C}:{}},id:dt,ref:q,"aria-label":Rt||`${M?`The graph shows ${M}. `:""}This is a line chart that highlights the difference between two datasets over time.${j?` ${j}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:C?X||"1rem":X||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[M||j||H||P?e.jsxRuntimeExports.jsx(Zt.GraphHeader,{styles:{title:E?.title,description:E?.description},classNames:{title:n?.title,description:n?.description},graphTitle:M,graphDescription:j,width:m,graphDownload:H?q.current:void 0,dataDownload:P?A.map(i=>i.data).filter(i=>i!==void 0).length>0?A.map(i=>i.data).filter(i=>i!==void 0):A.filter(i=>i!==void 0):null}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:A.length===0?e.jsxRuntimeExports.jsx(te.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[U&&Y?e.jsxRuntimeExports.jsx(_t.ColorLegend,{width:m,colorLegendTitle:nt,colors:U,colorDomain:Y,showNAColor:!1}):null,e.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:h,"aria-label":"Graph area",children:(m||r)&&(o||at)?e.jsxRuntimeExports.jsx(ee,{data:A,lineColor:B||xt.Colors.primaryColors["blue-600"],width:m||r,height:Math.max(x,o||(D?x?(m||r)*D>x?(m||r)*D:x:(m||r)*D:at)),suffix:$,prefix:I,dateFormat:ht,showValues:R,noOfXTicks:mt,leftMargin:F,rightMargin:z,topMargin:J,bottomMargin:K,tooltip:a,highlightAreaSettings:yt,onSeriesMouseOver:pt,refValues:Q,minValue:T,maxValue:gt,animate:L===!0?{duration:.5,once:!0,amount:.5}:L||{duration:0,once:!0,amount:0},rtl:c==="he"||c==="ar",strokeWidth:N,showDots:_,annotations:tt,customHighlightAreaSettings:l,regressionLine:ft,showIntervalDots:W,showIntervalValues:b,intervalLineStrokeWidth:jt,intervalLineColors:wt,intervalAreaColor:Z,intervalAreaOpacity:vt,yAxisTitle:S,noOfYTicks:V,minDate:et,maxDate:it,curveType:d,styles:E,classNames:n,precision:Et,customLayers:Mt}):null})]})}),k||G?e.jsxRuntimeExports.jsx(Qt.GraphFooter,{styles:{footnote:E?.footnote,source:E?.source},classNames:{footnote:n?.footnote,source:n?.source},sources:k,footNote:G,width:m}):null]})})})})}exports.LineChartWithConfidenceInterval=ie;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CHPV5EwG-DDoeWRVt.cjs"),p=require("react"),y=require("./parse-hMnG_lRV.cjs"),kt=require("./simple-statistics-xm8c0LQQ.cjs"),qt=require("./index-CQ3e6Ewi.cjs"),ot=require("./numberFormattingFunction-02t-wJta.cjs"),$t=require("./Tooltip-De16GWhY.cjs"),R=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),bt=require("./customArea-CK768gCn.cjs"),Ft=require("./AxisTitle-CK9YeovX.cjs"),Tt=require("./Axis-DE7dSn1_.cjs"),Wt=require("./ReferenceLine-CFVBBN__.cjs"),Ht=require("./RegressionLine-Dj0GSiAp.cjs"),Pt=require("./YTicksAndGridLines-DBDuz6vb.cjs"),Ut=require("./index-BYzIB5V6.cjs"),Yt=require("./time-Byw_jYQ7.cjs"),Gt=require("./linear-BVckp9RD.cjs"),lt=require("./line-DHV4JwCR.cjs"),ct=require("./step-BZ3C8QFW.cjs"),Xt=require("./area-D3Qx7k7K.cjs"),Bt=require("./select-Bnfk0lJx.cjs"),zt=require("./init-DU0ybBc_.cjs"),Jt=require("./pointer-Dkq5NV1q.cjs"),Kt=require("./use-in-view-sQJZ_xDO.cjs"),j=require("./proxy-BHRoeZgd.cjs"),Qt=require("./GraphFooter.cjs"),Zt=require("./GraphHeader.cjs"),xt=require("./Colors.cjs"),_t=require("./ColorLegend.cjs"),te=require("./EmptyState-d8_8SxeW.cjs");function ee(ut){const{data:A,width:C,height:$,lineColor:I,suffix:L,prefix:w,dateFormat:o,highlightAreaSettings:m,showValues:G,noOfXTicks:mt,rightMargin:ht,leftMargin:E,topMargin:b,bottomMargin:X,tooltip:B,onSeriesMouseOver:F,refValues:z,minValue:J,maxValue:K,animate:a,rtl:Q,strokeWidth:yt,showDots:D,annotations:pt,customHighlightAreaSettings:dt,regressionLine:T,showIntervalDots:gt,showIntervalValues:ft,intervalLineStrokeWidth:W,intervalLineColors:d,intervalAreaColor:jt,intervalAreaOpacity:wt,yAxisTitle:Z,noOfYTicks:vt,minDate:H,maxDate:P,curveType:N,styles:c,classNames:x,precision:V,customLayers:_}=ut,tt=p.useRef(null),l=Kt.useInView(tt,{once:a.once,amount:a.amount}),[u,Rt]=p.useState(!1);p.useEffect(()=>{if(l&&!u){const t=setTimeout(()=>{Rt(!0)},(a.duration+.5)*1e3);return()=>clearTimeout(t)}},[l,u,a.duration]);const S=N==="linear"?lt.curveLinear:N==="step"?ct.curveStep:N==="stepAfter"?ct.stepAfter:N==="stepBefore"?ct.stepBefore:ct.monotoneX,[k,et]=p.useState(void 0),[it,nt]=p.useState(void 0),[U,Y]=p.useState(void 0),g={top:b,bottom:X,left:Z?E+30:E,right:ht},M=p.useRef(null),n=qt.orderBy(A.filter(t=>!R.checkIfNullOrUndefined(t.y)).map(t=>({date:y.parse(`${t.date}`,o,new Date),y:t.y,yMin:R.checkIfNullOrUndefined(t.yMin)?t.y:t.yMin,yMax:R.checkIfNullOrUndefined(t.yMax)?t.y:t.yMax,data:t.data})),["date"],["asc"]),Et=m.map(t=>({...t,coordinates:[t.coordinates[0]===null?null:y.parse(`${t.coordinates[0]}`,o,new Date),t.coordinates[1]===null?null:y.parse(`${t.coordinates[1]}`,o,new Date)]})),Mt=dt.map(t=>({...t,coordinates:t.coordinates.map((f,O)=>O%2===0?y.parse(`${f}`,o,new Date):f)})),r=C-g.left-g.right,v=$-g.top-g.bottom,at=H?y.parse(`${H}`,o,new Date):n[0].date,st=P?y.parse(`${P}`,o,new Date):n[n.length-1].date,h=R.checkIfNullOrUndefined(J)?Math.min(...n.map(t=>Math.min(t.y,t.yMax,t.yMin)))?Math.min(...n.map(t=>Math.min(t.y,t.yMax,t.yMin)))>0?0:Math.min(...n.map(t=>Math.min(t.y,t.yMax,t.yMin))):0:J,q=Math.max(...n.map(t=>Math.max(t.y,t.yMax,t.yMin)))?Math.max(...n.map(t=>Math.max(t.y,t.yMax,t.yMin))):0,i=Yt.time().domain([at,st]).range([0,r]),s=Gt.linear().domain([h,R.checkIfNullOrUndefined(K)?q>0?q:0:K]).range([v,0]).nice(),Ot=lt.line().x(t=>i(t.date)).y(t=>s(t.y)).curve(S),At=lt.line().x(t=>i(t.date)).y(t=>s(t.yMin)).curve(S),It=lt.line().x(t=>i(t.date)).y(t=>s(t.yMax)).curve(S),Lt=Xt.area().x(t=>i(t.date)).y0(t=>s(t.yMin)).y1(t=>s(t.yMax)).curve(S),Nt=s.ticks(vt),Dt=i.ticks(mt);p.useEffect(()=>{const t=O=>{const rt=n[zt.bisectCenter(n.map(Ct=>Ct.date),i.invert(Jt.pointer(O)[0]),0)];et(rt||n[n.length-1]),F?.(rt||n[n.length-1]),Y(O.clientY),nt(O.clientX)},f=()=>{et(void 0),nt(void 0),Y(void 0),F?.(void 0)};Bt.select(M.current).on("mousemove",t).on("mouseout",f)},[i,n,F]);const St=kt.linearRegression(n.filter(t=>!R.checkIfNullOrUndefined(t.date)&&!R.checkIfNullOrUndefined(t.y)).map(t=>[i(t.date),s(t.y)])),Vt=kt.linearRegressionLine(St);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(j.motion.svg,{width:`${C}px`,height:`${$}px`,viewBox:`0 0 ${C} ${$}`,direction:"ltr",ref:tt,children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${g.left},${g.top})`,children:[e.jsxRuntimeExports.jsx(Ut.HighlightArea,{areaSettings:Et,width:r,height:v,scale:i,animate:a,isInView:l}),e.jsxRuntimeExports.jsx(bt.CustomArea,{areaSettings:Mt,scaleX:i,scaleY:s,animate:a,isInView:l}),e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(Pt.YTicksAndGridLines,{values:Nt.filter(t=>t!==0),y:Nt.filter(t=>t!==0).map(t=>s(t)),x1:0-E,x2:r+g.right,styles:{gridLines:c?.yAxis?.gridLines,labels:c?.yAxis?.labels},classNames:{gridLines:x?.yAxis?.gridLines,labels:x?.yAxis?.labels},suffix:L,prefix:w,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:V}),e.jsxRuntimeExports.jsx(Tt.Axis,{y1:s(h<0?0:h),y2:s(h<0?0:h),x1:0-E,x2:r+g.right,label:ot.numberFormattingFunction(h<0?0:h,"NA",V,w,L),labelPos:{x:0-E,y:s(h<0?0:h),dx:0,dy:q<0?"1em":-5},classNames:{axis:x?.xAxis?.axis,label:x?.yAxis?.labels},styles:{axis:c?.xAxis?.axis,label:c?.yAxis?.labels}}),e.jsxRuntimeExports.jsx(Ft.AxisTitle,{x:0-E+15,y:v/2,style:c?.yAxis?.title,className:x?.yAxis?.title,text:Z,rotate90:!0})]}),e.jsxRuntimeExports.jsx("g",{children:Dt.map((t,f)=>e.jsxRuntimeExports.jsx("g",{children:e.jsxRuntimeExports.jsx("text",{y:v,x:i(t),style:{textAnchor:"middle"},className:"fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs",dy:15,children:y.format(t,o)})},f))}),_.filter(t=>t.position==="before").map(t=>t.layer),e.jsxRuntimeExports.jsx(j.motion.path,{style:{fill:jt},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,d:Lt(n)||""},whileInView:{opacity:wt,d:Lt(n)||"",transition:{duration:a.duration}}},initial:"initial",animate:l?"whileInView":"initial"}),W?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(j.motion.path,{style:{stroke:d[0],fill:"none",strokeWidth:W},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{pathLength:0,d:At(n)||"",opacity:1},whileInView:{pathLength:1,d:At(n)||"",opacity:1,transition:{duration:a.duration}}},initial:"initial",animate:l?"whileInView":"initial"}),e.jsxRuntimeExports.jsx(j.motion.path,{style:{stroke:d[1],fill:"none",strokeWidth:W},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{pathLength:0,d:It(n)||"",opacity:1},whileInView:{pathLength:1,d:It(n)||"",opacity:1,transition:{duration:a.duration}}},initial:"initial",animate:l?"whileInView":"initial"})]}):null,e.jsxRuntimeExports.jsx(j.motion.path,{style:{stroke:I,fill:"none",strokeWidth:yt},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{pathLength:0,d:Ot(n)||"",opacity:1},whileInView:{pathLength:1,d:Ot(n)||"",opacity:1,transition:{duration:a.duration}}},initial:"initial",animate:l?"whileInView":"initial"}),k?e.jsxRuntimeExports.jsx("line",{y1:0,y2:v,x1:i(k.date),x2:i(k.date),className:e.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",x?.mouseOverLine),style:c?.mouseOverLine}):null,e.jsxRuntimeExports.jsx("g",{children:n.map((t,f)=>e.jsxRuntimeExports.jsx(j.motion.g,{children:R.checkIfNullOrUndefined(t.y)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[D?e.jsxRuntimeExports.jsx(j.motion.circle,{r:r/n.length<5?0:r/n.length<20?2:4,style:{fill:I},exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,cx:i(t.date),cy:s(t.y)},whileInView:{opacity:1,transition:{duration:u?a.duration:.5,delay:u?0:a.duration},cx:i(t.date),cy:s(t.y)}},initial:"initial",animate:l?"whileInView":"initial"}):null,gt?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(j.motion.circle,{r:r/n.length<5?0:r/n.length<20?2:4,exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,fill:d[0],cx:i(t.date),cy:s(t.yMin)},whileInView:{opacity:1,transition:{duration:u?a.duration:.5,delay:u?0:a.duration},cx:i(t.date),cy:s(t.yMin),fill:d[0]}},initial:"initial",animate:l?"whileInView":"initial"}),e.jsxRuntimeExports.jsx(j.motion.circle,{r:r/n.length<5?0:r/n.length<20?2:4,exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,fill:d[1],cx:i(t.date),cy:s(t.yMax)},whileInView:{opacity:1,fill:d[1],transition:{duration:u?a.duration:.5,delay:u?0:a.duration},cx:i(t.date),cy:s(t.yMax)}},initial:"initial",animate:l?"whileInView":"initial"})]}):null,G?e.jsxRuntimeExports.jsx(j.motion.text,{dy:-8,style:{textAnchor:"middle",...c?.graphObjectValues||{}},className:e.mo("graph-value text-xs font-bold",x?.graphObjectValues),exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,fill:I,x:i(t.date),y:s(t.y)},whileInView:{opacity:1,x:i(t.date),fill:I,y:s(t.y),transition:{duration:u?a.duration:.5,delay:u?0:a.duration}}},initial:"initial",animate:l?"whileInView":"initial",children:ot.numberFormattingFunction(t.y,"NA",V,w,L)}):null,ft?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(j.motion.text,{dy:"1em",style:{textAnchor:"middle",...c?.graphObjectValues||{}},className:e.mo("text-xs font-bold",x?.graphObjectValues),exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,fill:d[0],x:i(t.date),y:s(t.yMin)},whileInView:{opacity:1,x:i(t.date),y:s(t.yMin),fill:d[0],transition:{duration:u?a.duration:.5,delay:u?0:a.duration}}},initial:"initial",animate:l?"whileInView":"initial",children:ot.numberFormattingFunction(t.yMin,"NA",V,w,L)}),e.jsxRuntimeExports.jsx(j.motion.text,{dy:-8,style:{textAnchor:"middle",...c?.graphObjectValues||{}},className:e.mo("text-xs font-bold",x?.graphObjectValues),exit:{opacity:0,transition:{duration:a.duration}},variants:{initial:{opacity:0,fill:d[1],x:i(t.date),y:s(t.yMax)},whileInView:{opacity:1,fill:d[1],x:i(t.date),y:s(t.yMax),transition:{duration:u?a.duration:.5,delay:u?0:a.duration}}},initial:"initial",animate:l?"whileInView":"initial",children:ot.numberFormattingFunction(t.yMax,"NA",V,w,L)})]}):null]})},f))}),z?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:z.map((t,f)=>e.jsxRuntimeExports.jsx(Wt.RefLineY,{text:t.text,color:t.color,y:s(t.value),x1:0-E,x2:r+g.right,classNames:t.classNames,styles:t.styles,animate:a,isInView:l},f))}):null,e.jsxRuntimeExports.jsx("g",{children:pt.map((t,f)=>{const O=bt.getLineEndPoint({x:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),y:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0)-8:0+(t.yOffset||0)-8},{x:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date)):0,y:t.yCoordinate?s(t.yCoordinate):0},R.checkIfNullOrUndefined(t.connectorRadius)?3.5:t.connectorRadius),rt=t.showConnector?{y1:O.y,x1:O.x,y2:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0):0+(t.yOffset||0),x2:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),cy:t.yCoordinate?s(t.yCoordinate):0,cx:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date)):0,circleRadius:R.checkIfNullOrUndefined(t.connectorRadius)?3.5:t.connectorRadius,strokeWidth:t.showConnector===!0?2:Math.min(t.showConnector||0,1)}:void 0,Ct={y:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0)-8:0+(t.yOffset||0)-8,x:Q?0:t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),width:Q?t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0):r+g.right-(t.xCoordinate?i(y.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0)),maxWidth:t.maxWidth,fontWeight:t.fontWeight,align:t.align};return e.jsxRuntimeExports.jsx(bt.Annotation,{color:t.color,connectorsSettings:rt,labelSettings:Ct,text:t.text,classNames:t.classNames,styles:t.styles,animate:a,isInView:l},f)})}),e.jsxRuntimeExports.jsx("g",{children:T?e.jsxRuntimeExports.jsx(Ht.RegressionLine,{x1:0,x2:r,y1:Vt(0),y2:Vt(r),graphHeight:v,graphWidth:r,className:x?.regLine,style:c?.regLine,color:typeof T=="string"?T:void 0,animate:a,isInView:l}):null}),_.filter(t=>t.position==="after").map(t=>t.layer),e.jsxRuntimeExports.jsx("rect",{ref:M,style:{fill:"none",pointerEvents:"all"},width:r,height:v})]})}),k&&B&&it&&U?e.jsxRuntimeExports.jsx($t.Tooltip,{data:k,body:B,xPos:it,yPos:U,backgroundStyle:c?.tooltip,className:x?.tooltip}):null]})}function ie(ut){const{data:A,graphTitle:C,suffix:$="",sources:I,prefix:L="",graphDescription:w,height:o,width:m,footNote:G,noOfXTicks:mt=10,dateFormat:ht="yyyy",showValues:E=!1,backgroundColor:b=!1,padding:X,lineColor:B,leftMargin:F=30,rightMargin:z=30,topMargin:J=20,bottomMargin:K=25,tooltip:a,refValues:Q=[],highlightAreaSettings:yt=[],relativeHeight:D,onSeriesMouseOver:pt,graphID:dt,minValue:T,maxValue:gt,regressionLine:ft=!1,showIntervalDots:W=!1,showIntervalValues:d=!1,intervalLineStrokeWidth:jt=0,intervalLineColors:wt=[xt.Colors.light.grays["gray-500"],xt.Colors.light.grays["gray-500"]],intervalAreaColor:Z=xt.Colors.primaryColors["blue-100"],intervalAreaOpacity:vt=.4,graphDownload:H=!1,dataDownload:P=!1,animate:N=!1,language:c="en",minHeight:x=0,strokeWidth:V=2,showDots:_=!0,annotations:tt=[],customHighlightAreaSettings:l=[],theme:u="light",ariaLabel:Rt,yAxisTitle:S,noOfYTicks:k=5,minDate:et,maxDate:it,colorLegendTitle:nt,colorLegendColors:U,colorLegendDomain:Y,curveType:g="curve",styles:M,classNames:n,precision:Et=2,customLayers:Mt=[]}=ut,[r,v]=p.useState(0),[at,st]=p.useState(0),h=p.useRef(null),q=p.useRef(null);return p.useEffect(()=>{const i=new ResizeObserver(s=>{v(m||s[0].target.clientWidth||620),st(o||s[0].target.clientHeight||480)});return h.current&&(st(h.current.clientHeight||480),v(h.current.clientWidth||620),m||i.observe(h.current)),()=>i.disconnect()},[m,o]),e.jsxRuntimeExports.jsx("div",{className:`${u||"light"} flex ${m?"w-fit grow-0":"w-full grow"}`,dir:c==="he"||c==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.mo(`${b?b===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${c||"en"}`,m?"w-fit":"w-full",n?.graphContainer),style:{...M?.graphContainer||{},...b&&b!==!0?{backgroundColor:b}:{}},id:dt,ref:q,"aria-label":Rt||`${C?`The graph shows ${C}. `:""}This is a line chart that highlights the difference between two datasets over time.${w?` ${w}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:b?X||"1rem":X||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[C||w||H||P?e.jsxRuntimeExports.jsx(Zt.GraphHeader,{styles:{title:M?.title,description:M?.description},classNames:{title:n?.title,description:n?.description},graphTitle:C,graphDescription:w,width:m,graphDownload:H?q.current:void 0,dataDownload:P?A.map(i=>i.data).filter(i=>i!==void 0).length>0?A.map(i=>i.data).filter(i=>i!==void 0):A.filter(i=>i!==void 0):null}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:A.length===0?e.jsxRuntimeExports.jsx(te.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[U&&Y?e.jsxRuntimeExports.jsx(_t.ColorLegend,{width:m,colorLegendTitle:nt,colors:U,colorDomain:Y,showNAColor:!1}):null,e.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:h,"aria-label":"Graph area",children:(m||r)&&(o||at)?e.jsxRuntimeExports.jsx(ee,{data:A,lineColor:B||xt.Colors.primaryColors["blue-600"],width:m||r,height:Math.max(x,o||(D?x?(m||r)*D>x?(m||r)*D:x:(m||r)*D:at)),suffix:$,prefix:L,dateFormat:ht,showValues:E,noOfXTicks:mt,leftMargin:F,rightMargin:z,topMargin:J,bottomMargin:K,tooltip:a,highlightAreaSettings:yt,onSeriesMouseOver:pt,refValues:Q,minValue:T,maxValue:gt,animate:N===!0?{duration:.5,once:!0,amount:.5}:N||{duration:0,once:!0,amount:0},rtl:c==="he"||c==="ar",strokeWidth:V,showDots:_,annotations:tt,customHighlightAreaSettings:l,regressionLine:ft,showIntervalDots:W,showIntervalValues:d,intervalLineStrokeWidth:jt,intervalLineColors:wt,intervalAreaColor:Z,intervalAreaOpacity:vt,yAxisTitle:S,noOfYTicks:k,minDate:et,maxDate:it,curveType:g,styles:M,classNames:n,precision:Et,customLayers:Mt}):null})]})}),I||G?e.jsxRuntimeExports.jsx(Qt.GraphFooter,{styles:{footnote:M?.footnote,source:M?.source},classNames:{footnote:n?.footnote,source:n?.source},sources:I,footNote:G,width:m}):null]})})})})}exports.LineChartWithConfidenceInterval=ie;
2
2
  //# sourceMappingURL=LineChartWithConfidenceInterval.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"LineChartWithConfidenceInterval.cjs","sources":["../src/Components/Graphs/LineCharts/LineChartWithConfidenceInterval/Graph.tsx","../src/Components/Graphs/LineCharts/LineChartWithConfidenceInterval/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\nimport {\r\n line,\r\n curveMonotoneX,\r\n area,\r\n curveLinear,\r\n curveStep,\r\n curveStepAfter,\r\n curveStepBefore,\r\n} from 'd3-shape';\r\nimport { scaleLinear, scaleTime } from 'd3-scale';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { bisectCenter } from 'd3-array';\r\nimport { pointer, select } from 'd3-selection';\r\nimport { linearRegression, linearRegressionLine } from 'simple-statistics';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { motion, useInView } from 'motion/react';\r\nimport orderBy from 'lodash.orderby';\r\n\r\nimport {\r\n AnimateDataType,\r\n AnnotationSettingsDataType,\r\n ClassNameObject,\r\n CurveTypes,\r\n CustomHighlightAreaSettingsDataType,\r\n CustomLayerDataType,\r\n HighlightAreaSettingsDataType,\r\n LineChartWithConfidenceIntervalDataType,\r\n ReferenceDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { getLineEndPoint } from '@/Utils/getLineEndPoint';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\r\nimport { RegressionLine } from '@/Components/Elements/RegressionLine';\r\nimport { Annotation } from '@/Components/Elements/Annotations';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\nimport { CustomArea } from '@/Components/Elements/HighlightArea/customArea';\r\nimport { HighlightArea } from '@/Components/Elements/HighlightArea';\r\n\r\ninterface Props {\r\n data: LineChartWithConfidenceIntervalDataType[];\r\n lineColor: string;\r\n width: number;\r\n height: number;\r\n suffix: string;\r\n prefix: string;\r\n dateFormat: string;\r\n showValues?: boolean;\r\n noOfXTicks: number;\r\n rightMargin: number;\r\n leftMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n refValues: ReferenceDataType[];\r\n highlightAreaSettings: HighlightAreaSettingsDataType[];\r\n maxValue?: number;\r\n minValue?: number;\r\n animate: AnimateDataType;\r\n rtl: boolean;\r\n strokeWidth: number;\r\n showDots: boolean;\r\n annotations: AnnotationSettingsDataType[];\r\n customHighlightAreaSettings: CustomHighlightAreaSettingsDataType[];\r\n regressionLine: boolean | string;\r\n showIntervalDots: boolean;\r\n showIntervalValues: boolean;\r\n intervalLineStrokeWidth: number;\r\n intervalLineColors: [string, string];\r\n intervalAreaColor: string;\r\n intervalAreaOpacity: number;\r\n yAxisTitle?: string;\r\n noOfYTicks: number;\r\n minDate?: string | number;\r\n maxDate?: string | number;\r\n curveType: CurveTypes;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\ninterface FormattedDataType {\r\n y: number;\r\n date: Date;\r\n yMin: number;\r\n yMax: number;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n lineColor,\r\n suffix,\r\n prefix,\r\n dateFormat,\r\n highlightAreaSettings,\r\n showValues,\r\n noOfXTicks,\r\n rightMargin,\r\n leftMargin,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n refValues,\r\n minValue,\r\n maxValue,\r\n animate,\r\n rtl,\r\n strokeWidth,\r\n showDots,\r\n annotations,\r\n customHighlightAreaSettings,\r\n regressionLine,\r\n showIntervalDots,\r\n showIntervalValues,\r\n intervalLineStrokeWidth,\r\n intervalLineColors,\r\n intervalAreaColor,\r\n intervalAreaOpacity,\r\n yAxisTitle,\r\n noOfYTicks,\r\n minDate,\r\n maxDate,\r\n curveType,\r\n styles,\r\n classNames,\r\n precision,\r\n customLayers,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const [hasAnimatedOnce, setHasAnimatedOnce] = useState(false);\r\n\r\n useEffect(() => {\r\n if (isInView && !hasAnimatedOnce) {\r\n const timeout = setTimeout(\r\n () => {\r\n setHasAnimatedOnce(true);\r\n },\r\n (animate.duration + 0.5) * 1000,\r\n );\r\n return () => clearTimeout(timeout);\r\n }\r\n }, [isInView, hasAnimatedOnce, animate.duration]);\r\n const curve =\r\n curveType === 'linear'\r\n ? curveLinear\r\n : curveType === 'step'\r\n ? curveStep\r\n : curveType === 'stepAfter'\r\n ? curveStepAfter\r\n : curveType === 'stepBefore'\r\n ? curveStepBefore\r\n : curveMonotoneX;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: yAxisTitle ? leftMargin + 30 : leftMargin,\r\n right: rightMargin,\r\n };\r\n const MouseoverRectRef = useRef(null);\r\n const dataFormatted: FormattedDataType[] = orderBy(\r\n data\r\n .filter(d => !checkIfNullOrUndefined(d.y))\r\n .map(d => ({\r\n date: parse(`${d.date}`, dateFormat, new Date()),\r\n y: d.y as number,\r\n yMin: checkIfNullOrUndefined(d.yMin) ? (d.y as number) : (d.yMin as number),\r\n yMax: checkIfNullOrUndefined(d.yMax) ? (d.y as number) : (d.yMax as number),\r\n data: d.data,\r\n })),\r\n ['date'],\r\n ['asc'],\r\n );\r\n const highlightAreaSettingsFormatted = highlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: [\r\n d.coordinates[0] === null ? null : parse(`${d.coordinates[0]}`, dateFormat, new Date()),\r\n d.coordinates[1] === null ? null : parse(`${d.coordinates[1]}`, dateFormat, new Date()),\r\n ],\r\n }));\r\n const customHighlightAreaSettingsFormatted = customHighlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: d.coordinates.map((el, j) =>\r\n j % 2 === 0 ? parse(`${el}`, dateFormat, new Date()) : (el as number),\r\n ),\r\n }));\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const minYear = minDate ? parse(`${minDate}`, dateFormat, new Date()) : dataFormatted[0].date;\r\n const maxYear = maxDate\r\n ? parse(`${maxDate}`, dateFormat, new Date())\r\n : dataFormatted[dataFormatted.length - 1].date;\r\n const minParam: number = !checkIfNullOrUndefined(minValue)\r\n ? (minValue as number)\r\n : Math.min(...dataFormatted.map(d => Math.min(d.y, d.yMax, d.yMin)))\r\n ? Math.min(...dataFormatted.map(d => Math.min(d.y, d.yMax, d.yMin))) > 0\r\n ? 0\r\n : Math.min(...dataFormatted.map(d => Math.min(d.y, d.yMax, d.yMin)))\r\n : 0;\r\n const maxParam: number = Math.max(...dataFormatted.map(d => Math.max(d.y, d.yMax, d.yMin)))\r\n ? Math.max(...dataFormatted.map(d => Math.max(d.y, d.yMax, d.yMin)))\r\n : 0;\r\n const x = scaleTime().domain([minYear, maxYear]).range([0, graphWidth]);\r\n const y = scaleLinear()\r\n .domain([\r\n minParam,\r\n checkIfNullOrUndefined(maxValue) ? (maxParam > 0 ? maxParam : 0) : (maxValue as number),\r\n ])\r\n .range([graphHeight, 0])\r\n .nice();\r\n\r\n const lineShape = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y))\r\n .curve(curve);\r\n\r\n const lineShapeMin = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.yMin))\r\n .curve(curve);\r\n\r\n const lineShapeMax = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.yMax))\r\n .curve(curve);\r\n\r\n const areaShape = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y0(d => y(d.yMin))\r\n .y1(d => y(d.yMax))\r\n .curve(curve);\r\n\r\n const yTicks = y.ticks(noOfYTicks);\r\n\r\n const xTicks = x.ticks(noOfXTicks);\r\n\r\n useEffect(() => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mousemove = (event: any) => {\r\n const selectedData =\r\n dataFormatted[\r\n bisectCenter(\r\n dataFormatted.map(d => d.date),\r\n x.invert(pointer(event)[0]),\r\n 0,\r\n )\r\n ];\r\n setMouseOverData(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n onSeriesMouseOver?.(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n };\r\n const mouseout = () => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n };\r\n select(MouseoverRectRef.current).on('mousemove', mousemove).on('mouseout', mouseout);\r\n }, [x, dataFormatted, onSeriesMouseOver]);\r\n const regressionLineParam = linearRegression(\r\n dataFormatted\r\n .filter(d => !checkIfNullOrUndefined(d.date) && !checkIfNullOrUndefined(d.y))\r\n .map(d => [x(d.date), y(d.y as number)]),\r\n );\r\n const predict = linearRegressionLine(regressionLineParam);\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n <HighlightArea\r\n areaSettings={highlightAreaSettingsFormatted}\r\n width={graphWidth}\r\n height={graphHeight}\r\n scale={x}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <CustomArea\r\n areaSettings={customHighlightAreaSettingsFormatted}\r\n scaleX={x}\r\n scaleY={y}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <g>\r\n <YTicksAndGridLines\r\n values={yTicks.filter(d => d !== 0)}\r\n y={yTicks.filter(d => d !== 0).map(d => y(d))}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n styles={{\r\n gridLines: styles?.yAxis?.gridLines,\r\n labels: styles?.yAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: classNames?.yAxis?.gridLines,\r\n labels: classNames?.yAxis?.labels,\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='secondary'\r\n showGridLines\r\n labelPos='vertical'\r\n precision={precision}\r\n />\r\n <Axis\r\n y1={y(minParam < 0 ? 0 : minParam)}\r\n y2={y(minParam < 0 ? 0 : minParam)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n label={numberFormattingFunction(\r\n minParam < 0 ? 0 : minParam,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n labelPos={{\r\n x: 0 - leftMargin,\r\n y: y(minParam < 0 ? 0 : minParam),\r\n dx: 0,\r\n dy: maxParam < 0 ? '1em' : -5,\r\n }}\r\n classNames={{\r\n axis: classNames?.xAxis?.axis,\r\n label: classNames?.yAxis?.labels,\r\n }}\r\n styles={{\r\n axis: styles?.xAxis?.axis,\r\n label: styles?.yAxis?.labels,\r\n }}\r\n />\r\n <AxisTitle\r\n x={0 - leftMargin + 15}\r\n y={graphHeight / 2}\r\n style={styles?.yAxis?.title}\r\n className={classNames?.yAxis?.title}\r\n text={yAxisTitle}\r\n rotate90\r\n />\r\n </g>\r\n <g>\r\n {xTicks.map((d, i) => (\r\n <g key={i}>\r\n <text\r\n y={graphHeight}\r\n x={x(d)}\r\n style={{ textAnchor: 'middle' }}\r\n className='fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs'\r\n dy={15}\r\n >\r\n {format(d, dateFormat)}\r\n </text>\r\n </g>\r\n ))}\r\n </g>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <motion.path\r\n style={{\r\n fill: intervalAreaColor,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, d: areaShape(dataFormatted) || '' },\r\n whileInView: {\r\n opacity: intervalAreaOpacity,\r\n d: areaShape(dataFormatted) || '',\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {intervalLineStrokeWidth ? (\r\n <>\r\n <motion.path\r\n style={{\r\n stroke: intervalLineColors[0],\r\n fill: 'none',\r\n strokeWidth: intervalLineStrokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n pathLength: 0,\r\n d: lineShapeMin(dataFormatted) || '',\r\n opacity: 1,\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShapeMin(dataFormatted) || '',\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n <motion.path\r\n style={{\r\n stroke: intervalLineColors[1],\r\n fill: 'none',\r\n strokeWidth: intervalLineStrokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n pathLength: 0,\r\n d: lineShapeMax(dataFormatted) || '',\r\n opacity: 1,\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShapeMax(dataFormatted) || '',\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n </>\r\n ) : null}\r\n <motion.path\r\n style={{\r\n stroke: lineColor,\r\n fill: 'none',\r\n strokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n pathLength: 0,\r\n d: lineShape(dataFormatted) || '',\r\n opacity: 1,\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShape(dataFormatted) || '',\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {mouseOverData ? (\r\n <line\r\n y1={0}\r\n y2={graphHeight}\r\n x1={x(mouseOverData.date)}\r\n x2={x(mouseOverData.date)}\r\n className={cn(\r\n 'undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100',\r\n classNames?.mouseOverLine,\r\n )}\r\n style={styles?.mouseOverLine}\r\n />\r\n ) : null}\r\n <g>\r\n {dataFormatted.map((d, i) => (\r\n <motion.g key={i}>\r\n {!checkIfNullOrUndefined(d.y) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n style={{ fill: lineColor }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(d.date), cy: y(d.y) },\r\n whileInView: {\r\n opacity: 1,\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n cx: x(d.date),\r\n cy: y(d.y),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n ) : null}\r\n {showIntervalDots ? (\r\n <>\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n style={{ fill: intervalLineColors[0] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(d.date), cy: y(d.yMin) },\r\n whileInView: {\r\n opacity: 1,\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n cx: x(d.date),\r\n cy: y(d.yMin),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n style={{ fill: intervalLineColors[1] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(d.date), cy: y(d.yMax) },\r\n whileInView: {\r\n opacity: 1,\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n cx: x(d.date),\r\n cy: y(d.yMax),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n </>\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n dy={-8}\r\n style={{\r\n fill: lineColor,\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, x: x(d.date), y: y(d.y) },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d.date),\r\n y: y(d.y),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(d.y, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n {showIntervalValues ? (\r\n <>\r\n <motion.text\r\n dy='1em'\r\n style={{\r\n fill: intervalLineColors[0],\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn('text-xs font-bold', classNames?.graphObjectValues)}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, x: x(d.date), y: y(d.yMin) },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d.date),\r\n y: y(d.yMin),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(d.yMin, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n <motion.text\r\n dy={-8}\r\n style={{\r\n fill: intervalLineColors[1],\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn('text-xs font-bold', classNames?.graphObjectValues)}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, x: x(d.date), y: y(d.yMax) },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d.date),\r\n y: y(d.yMax),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(d.yMax, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n </>\r\n ) : null}\r\n </>\r\n ) : null}\r\n </motion.g>\r\n ))}\r\n </g>\r\n {refValues ? (\r\n <>\r\n {refValues.map((el, i) => (\r\n <RefLineY\r\n key={i}\r\n text={el.text}\r\n color={el.color}\r\n y={y(el.value as number)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n classNames={el.classNames}\r\n styles={el.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ))}\r\n </>\r\n ) : null}\r\n <g>\r\n {annotations.map((d, i) => {\r\n const endPoints = getLineEndPoint(\r\n {\r\n x: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n },\r\n {\r\n x: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n y: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n },\r\n checkIfNullOrUndefined(d.connectorRadius) ? 3.5 : (d.connectorRadius as number),\r\n );\r\n const connectorSettings = d.showConnector\r\n ? {\r\n y1: endPoints.y,\r\n x1: endPoints.x,\r\n y2: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0)\r\n : 0 + (d.yOffset || 0),\r\n x2: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n cy: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n cx: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n circleRadius: checkIfNullOrUndefined(d.connectorRadius)\r\n ? 3.5\r\n : (d.connectorRadius as number),\r\n strokeWidth: d.showConnector === true ? 2 : Math.min(d.showConnector || 0, 1),\r\n }\r\n : undefined;\r\n const labelSettings = {\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n x: rtl\r\n ? 0\r\n : d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n width: rtl\r\n ? d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)\r\n : graphWidth +\r\n margin.right -\r\n (d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)),\r\n maxWidth: d.maxWidth,\r\n fontWeight: d.fontWeight,\r\n align: d.align,\r\n };\r\n return (\r\n <Annotation\r\n key={i}\r\n color={d.color}\r\n connectorsSettings={connectorSettings}\r\n labelSettings={labelSettings}\r\n text={d.text}\r\n classNames={d.classNames}\r\n styles={d.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n );\r\n })}\r\n </g>\r\n <g>\r\n {regressionLine ? (\r\n <RegressionLine\r\n x1={0}\r\n x2={graphWidth}\r\n y1={predict(0)}\r\n y2={predict(graphWidth)}\r\n graphHeight={graphHeight}\r\n graphWidth={graphWidth}\r\n className={classNames?.regLine}\r\n style={styles?.regLine}\r\n color={typeof regressionLine === 'string' ? regressionLine : undefined}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ) : null}\r\n </g>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n <rect\r\n ref={MouseoverRectRef}\r\n style={{\r\n fill: 'none',\r\n pointerEvents: 'all',\r\n }}\r\n width={graphWidth}\r\n height={graphHeight}\r\n />\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport {\r\n AnnotationSettingsDataType,\r\n CustomHighlightAreaSettingsDataType,\r\n Languages,\r\n LineChartWithConfidenceIntervalDataType,\r\n ReferenceDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n HighlightAreaSettingsDataType,\r\n CurveTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { ColorLegend } from '@/Components/Elements/ColorLegend';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: LineChartWithConfidenceIntervalDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Colors of the line */\r\n lineColor?: string;\r\n /** Colors of the interval area */\r\n intervalAreaColor?: string;\r\n /** Colors of the top and bottom lines of the interval */\r\n intervalLineColors?: [string, string];\r\n /** Colors for the legend */\r\n colorLegendColors?: string[];\r\n /** Domain of colors for the legend */\r\n colorLegendDomain?: string[];\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n /** Maximum value for the chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n /** Reference values for comparison */\r\n refValues?: ReferenceDataType[];\r\n /** Maximum value of the date for the chart */\r\n maxDate?: string | number;\r\n /** Minimum value of the date for the chart */\r\n minDate?: string | number;\r\n /** No. of ticks on the x-axis */\r\n noOfXTicks?: number;\r\n /** No. of ticks on the y-axis */\r\n noOfYTicks?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of values of the interval area */\r\n showIntervalValues?: boolean;\r\n /** Toggle visibility of dots on the line */\r\n showDots?: boolean;\r\n /** Toggle visibility of dots on the line of te interval area */\r\n showIntervalDots?: boolean;\r\n /** Stroke width of the line */\r\n strokeWidth?: number;\r\n /** Stroke width of the lines of the interval area */\r\n intervalLineStrokeWidth?: number;\r\n /** Opacity of the interval area */\r\n intervalAreaOpacity?: number;\r\n /** Toggle the initial animation of the line. If the type is number then it uses the number as the time in seconds for animation. */\r\n animate?: boolean | AnimateDataType;\r\n /** Format of the date in the data object. Available formats can be found [here](https://date-fns.org/docs/format) */\r\n dateFormat?: string;\r\n /** Title for the Y-axis */\r\n yAxisTitle?: string;\r\n /** Annotations on the chart */\r\n annotations?: AnnotationSettingsDataType[];\r\n /** Highlighted area(square) on the chart */\r\n highlightAreaSettings?: HighlightAreaSettingsDataType[];\r\n /** Highlighted area(custom shape) on the chart */\r\n customHighlightAreaSettings?: CustomHighlightAreaSettingsDataType[];\r\n /** Toggles the visibility of the regression line for the data. If the type is string then string is use to define the color of the line. */\r\n regressionLine?: boolean | string;\r\n /** Curve type for the line */\r\n curveType?: CurveTypes;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function LineChartWithConfidenceInterval(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n graphDescription,\r\n height,\r\n width,\r\n footNote,\r\n noOfXTicks = 10,\r\n dateFormat = 'yyyy',\r\n showValues = false,\r\n backgroundColor = false,\r\n padding,\r\n lineColor,\r\n leftMargin = 30,\r\n rightMargin = 30,\r\n topMargin = 20,\r\n bottomMargin = 25,\r\n tooltip,\r\n refValues = [],\r\n highlightAreaSettings = [],\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n graphID,\r\n minValue,\r\n maxValue,\r\n regressionLine = false,\r\n showIntervalDots = false,\r\n showIntervalValues = false,\r\n intervalLineStrokeWidth = 0,\r\n intervalLineColors = [Colors.light.grays['gray-500'], Colors.light.grays['gray-500']],\r\n intervalAreaColor = Colors.primaryColors['blue-100'],\r\n intervalAreaOpacity = 0.4,\r\n graphDownload = false,\r\n dataDownload = false,\r\n animate = false,\r\n language = 'en',\r\n minHeight = 0,\r\n strokeWidth = 2,\r\n showDots = true,\r\n annotations = [],\r\n customHighlightAreaSettings = [],\r\n theme = 'light',\r\n ariaLabel,\r\n yAxisTitle,\r\n noOfYTicks = 5,\r\n minDate,\r\n maxDate,\r\n colorLegendTitle,\r\n colorLegendColors,\r\n colorLegendDomain,\r\n curveType = 'curve',\r\n styles,\r\n classNames,\r\n precision = 2,\r\n customLayers = [],\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a line chart that highlights the difference between two datasets over time.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {colorLegendColors && colorLegendDomain ? (\r\n <ColorLegend\r\n width={width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={colorLegendColors}\r\n colorDomain={colorLegendDomain}\r\n showNAColor={false}\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n lineColor={lineColor || Colors.primaryColors['blue-600']}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n suffix={suffix}\r\n prefix={prefix}\r\n dateFormat={dateFormat}\r\n showValues={showValues}\r\n noOfXTicks={noOfXTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n tooltip={tooltip}\r\n highlightAreaSettings={highlightAreaSettings}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n refValues={refValues}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n rtl={language === 'he' || language === 'ar'}\r\n strokeWidth={strokeWidth}\r\n showDots={showDots}\r\n annotations={annotations}\r\n customHighlightAreaSettings={customHighlightAreaSettings}\r\n regressionLine={regressionLine}\r\n showIntervalDots={showIntervalDots}\r\n showIntervalValues={showIntervalValues}\r\n intervalLineStrokeWidth={intervalLineStrokeWidth}\r\n intervalLineColors={intervalLineColors}\r\n intervalAreaColor={intervalAreaColor}\r\n intervalAreaOpacity={intervalAreaOpacity}\r\n yAxisTitle={yAxisTitle}\r\n noOfYTicks={noOfYTicks}\r\n minDate={minDate}\r\n maxDate={maxDate}\r\n curveType={curveType}\r\n styles={styles}\r\n classNames={classNames}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","width","height","lineColor","suffix","prefix","dateFormat","highlightAreaSettings","showValues","noOfXTicks","rightMargin","leftMargin","topMargin","bottomMargin","tooltip","onSeriesMouseOver","refValues","minValue","maxValue","animate","rtl","strokeWidth","showDots","annotations","customHighlightAreaSettings","regressionLine","showIntervalDots","showIntervalValues","intervalLineStrokeWidth","intervalLineColors","intervalAreaColor","intervalAreaOpacity","yAxisTitle","noOfYTicks","minDate","maxDate","curveType","styles","classNames","precision","customLayers","svgRef","useRef","isInView","useInView","hasAnimatedOnce","setHasAnimatedOnce","useState","useEffect","timeout","curve","curveLinear","curveStep","curveStepAfter","curveStepBefore","curveMonotoneX","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","margin","MouseoverRectRef","dataFormatted","orderBy","d","checkIfNullOrUndefined","parse","highlightAreaSettingsFormatted","customHighlightAreaSettingsFormatted","el","j","graphWidth","graphHeight","minYear","maxYear","minParam","maxParam","x","scaleTime","y","scaleLinear","lineShape","line","lineShapeMin","lineShapeMax","areaShape","area","yTicks","xTicks","mousemove","event","selectedData","bisectCenter","pointer","mouseout","select","regressionLineParam","linearRegression","predict","linearRegressionLine","jsxs","Fragment","jsx","motion","HighlightArea","CustomArea","YTicksAndGridLines","Axis","numberFormattingFunction","AxisTitle","i","format","cn","RefLineY","endPoints","getLineEndPoint","connectorSettings","labelSettings","Annotation","RegressionLine","Tooltip","LineChartWithConfidenceInterval","graphTitle","sources","graphDescription","footNote","backgroundColor","padding","relativeHeight","graphID","Colors","graphDownload","dataDownload","language","minHeight","theme","ariaLabel","colorLegendTitle","colorLegendColors","colorLegendDomain","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","ColorLegend","GraphFooter"],"mappings":"srCAiGO,SAASA,GAAMC,GAAc,CAClC,KAAM,CACJ,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,UAAAC,EACA,OAAAC,EACA,OAAAC,EACA,WAAAC,EACA,sBAAAC,EACA,WAAAC,EACA,WAAAC,GACA,YAAAC,GACA,WAAAC,EACA,UAAAC,EACA,aAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,UAAAC,EACA,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CAGN"}
1
+ {"version":3,"file":"LineChartWithConfidenceInterval.cjs","sources":["../src/Components/Graphs/LineCharts/LineChartWithConfidenceInterval/Graph.tsx","../src/Components/Graphs/LineCharts/LineChartWithConfidenceInterval/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\nimport {\r\n line,\r\n curveMonotoneX,\r\n area,\r\n curveLinear,\r\n curveStep,\r\n curveStepAfter,\r\n curveStepBefore,\r\n} from 'd3-shape';\r\nimport { scaleLinear, scaleTime } from 'd3-scale';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { bisectCenter } from 'd3-array';\r\nimport { pointer, select } from 'd3-selection';\r\nimport { linearRegression, linearRegressionLine } from 'simple-statistics';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { motion, useInView } from 'motion/react';\r\nimport orderBy from 'lodash.orderby';\r\n\r\nimport {\r\n AnimateDataType,\r\n AnnotationSettingsDataType,\r\n ClassNameObject,\r\n CurveTypes,\r\n CustomHighlightAreaSettingsDataType,\r\n CustomLayerDataType,\r\n HighlightAreaSettingsDataType,\r\n LineChartWithConfidenceIntervalDataType,\r\n ReferenceDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { getLineEndPoint } from '@/Utils/getLineEndPoint';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\r\nimport { RegressionLine } from '@/Components/Elements/RegressionLine';\r\nimport { Annotation } from '@/Components/Elements/Annotations';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\nimport { CustomArea } from '@/Components/Elements/HighlightArea/customArea';\r\nimport { HighlightArea } from '@/Components/Elements/HighlightArea';\r\n\r\ninterface Props {\r\n data: LineChartWithConfidenceIntervalDataType[];\r\n lineColor: string;\r\n width: number;\r\n height: number;\r\n suffix: string;\r\n prefix: string;\r\n dateFormat: string;\r\n showValues?: boolean;\r\n noOfXTicks: number;\r\n rightMargin: number;\r\n leftMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n refValues: ReferenceDataType[];\r\n highlightAreaSettings: HighlightAreaSettingsDataType[];\r\n maxValue?: number;\r\n minValue?: number;\r\n animate: AnimateDataType;\r\n rtl: boolean;\r\n strokeWidth: number;\r\n showDots: boolean;\r\n annotations: AnnotationSettingsDataType[];\r\n customHighlightAreaSettings: CustomHighlightAreaSettingsDataType[];\r\n regressionLine: boolean | string;\r\n showIntervalDots: boolean;\r\n showIntervalValues: boolean;\r\n intervalLineStrokeWidth: number;\r\n intervalLineColors: [string, string];\r\n intervalAreaColor: string;\r\n intervalAreaOpacity: number;\r\n yAxisTitle?: string;\r\n noOfYTicks: number;\r\n minDate?: string | number;\r\n maxDate?: string | number;\r\n curveType: CurveTypes;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\ninterface FormattedDataType {\r\n y: number;\r\n date: Date;\r\n yMin: number;\r\n yMax: number;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n lineColor,\r\n suffix,\r\n prefix,\r\n dateFormat,\r\n highlightAreaSettings,\r\n showValues,\r\n noOfXTicks,\r\n rightMargin,\r\n leftMargin,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n refValues,\r\n minValue,\r\n maxValue,\r\n animate,\r\n rtl,\r\n strokeWidth,\r\n showDots,\r\n annotations,\r\n customHighlightAreaSettings,\r\n regressionLine,\r\n showIntervalDots,\r\n showIntervalValues,\r\n intervalLineStrokeWidth,\r\n intervalLineColors,\r\n intervalAreaColor,\r\n intervalAreaOpacity,\r\n yAxisTitle,\r\n noOfYTicks,\r\n minDate,\r\n maxDate,\r\n curveType,\r\n styles,\r\n classNames,\r\n precision,\r\n customLayers,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const [hasAnimatedOnce, setHasAnimatedOnce] = useState(false);\r\n\r\n useEffect(() => {\r\n if (isInView && !hasAnimatedOnce) {\r\n const timeout = setTimeout(\r\n () => {\r\n setHasAnimatedOnce(true);\r\n },\r\n (animate.duration + 0.5) * 1000,\r\n );\r\n return () => clearTimeout(timeout);\r\n }\r\n }, [isInView, hasAnimatedOnce, animate.duration]);\r\n const curve =\r\n curveType === 'linear'\r\n ? curveLinear\r\n : curveType === 'step'\r\n ? curveStep\r\n : curveType === 'stepAfter'\r\n ? curveStepAfter\r\n : curveType === 'stepBefore'\r\n ? curveStepBefore\r\n : curveMonotoneX;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: yAxisTitle ? leftMargin + 30 : leftMargin,\r\n right: rightMargin,\r\n };\r\n const MouseoverRectRef = useRef(null);\r\n const dataFormatted: FormattedDataType[] = orderBy(\r\n data\r\n .filter(d => !checkIfNullOrUndefined(d.y))\r\n .map(d => ({\r\n date: parse(`${d.date}`, dateFormat, new Date()),\r\n y: d.y as number,\r\n yMin: checkIfNullOrUndefined(d.yMin) ? (d.y as number) : (d.yMin as number),\r\n yMax: checkIfNullOrUndefined(d.yMax) ? (d.y as number) : (d.yMax as number),\r\n data: d.data,\r\n })),\r\n ['date'],\r\n ['asc'],\r\n );\r\n const highlightAreaSettingsFormatted = highlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: [\r\n d.coordinates[0] === null ? null : parse(`${d.coordinates[0]}`, dateFormat, new Date()),\r\n d.coordinates[1] === null ? null : parse(`${d.coordinates[1]}`, dateFormat, new Date()),\r\n ],\r\n }));\r\n const customHighlightAreaSettingsFormatted = customHighlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: d.coordinates.map((el, j) =>\r\n j % 2 === 0 ? parse(`${el}`, dateFormat, new Date()) : (el as number),\r\n ),\r\n }));\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const minYear = minDate ? parse(`${minDate}`, dateFormat, new Date()) : dataFormatted[0].date;\r\n const maxYear = maxDate\r\n ? parse(`${maxDate}`, dateFormat, new Date())\r\n : dataFormatted[dataFormatted.length - 1].date;\r\n const minParam: number = !checkIfNullOrUndefined(minValue)\r\n ? (minValue as number)\r\n : Math.min(...dataFormatted.map(d => Math.min(d.y, d.yMax, d.yMin)))\r\n ? Math.min(...dataFormatted.map(d => Math.min(d.y, d.yMax, d.yMin))) > 0\r\n ? 0\r\n : Math.min(...dataFormatted.map(d => Math.min(d.y, d.yMax, d.yMin)))\r\n : 0;\r\n const maxParam: number = Math.max(...dataFormatted.map(d => Math.max(d.y, d.yMax, d.yMin)))\r\n ? Math.max(...dataFormatted.map(d => Math.max(d.y, d.yMax, d.yMin)))\r\n : 0;\r\n const x = scaleTime().domain([minYear, maxYear]).range([0, graphWidth]);\r\n const y = scaleLinear()\r\n .domain([\r\n minParam,\r\n checkIfNullOrUndefined(maxValue) ? (maxParam > 0 ? maxParam : 0) : (maxValue as number),\r\n ])\r\n .range([graphHeight, 0])\r\n .nice();\r\n\r\n const lineShape = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y))\r\n .curve(curve);\r\n\r\n const lineShapeMin = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.yMin))\r\n .curve(curve);\r\n\r\n const lineShapeMax = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.yMax))\r\n .curve(curve);\r\n\r\n const areaShape = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y0(d => y(d.yMin))\r\n .y1(d => y(d.yMax))\r\n .curve(curve);\r\n\r\n const yTicks = y.ticks(noOfYTicks);\r\n\r\n const xTicks = x.ticks(noOfXTicks);\r\n\r\n useEffect(() => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mousemove = (event: any) => {\r\n const selectedData =\r\n dataFormatted[\r\n bisectCenter(\r\n dataFormatted.map(d => d.date),\r\n x.invert(pointer(event)[0]),\r\n 0,\r\n )\r\n ];\r\n setMouseOverData(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n onSeriesMouseOver?.(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n };\r\n const mouseout = () => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n };\r\n select(MouseoverRectRef.current).on('mousemove', mousemove).on('mouseout', mouseout);\r\n }, [x, dataFormatted, onSeriesMouseOver]);\r\n const regressionLineParam = linearRegression(\r\n dataFormatted\r\n .filter(d => !checkIfNullOrUndefined(d.date) && !checkIfNullOrUndefined(d.y))\r\n .map(d => [x(d.date), y(d.y as number)]),\r\n );\r\n const predict = linearRegressionLine(regressionLineParam);\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n <HighlightArea\r\n areaSettings={highlightAreaSettingsFormatted}\r\n width={graphWidth}\r\n height={graphHeight}\r\n scale={x}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <CustomArea\r\n areaSettings={customHighlightAreaSettingsFormatted}\r\n scaleX={x}\r\n scaleY={y}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <g>\r\n <YTicksAndGridLines\r\n values={yTicks.filter(d => d !== 0)}\r\n y={yTicks.filter(d => d !== 0).map(d => y(d))}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n styles={{\r\n gridLines: styles?.yAxis?.gridLines,\r\n labels: styles?.yAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: classNames?.yAxis?.gridLines,\r\n labels: classNames?.yAxis?.labels,\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='secondary'\r\n showGridLines\r\n labelPos='vertical'\r\n precision={precision}\r\n />\r\n <Axis\r\n y1={y(minParam < 0 ? 0 : minParam)}\r\n y2={y(minParam < 0 ? 0 : minParam)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n label={numberFormattingFunction(\r\n minParam < 0 ? 0 : minParam,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n labelPos={{\r\n x: 0 - leftMargin,\r\n y: y(minParam < 0 ? 0 : minParam),\r\n dx: 0,\r\n dy: maxParam < 0 ? '1em' : -5,\r\n }}\r\n classNames={{\r\n axis: classNames?.xAxis?.axis,\r\n label: classNames?.yAxis?.labels,\r\n }}\r\n styles={{\r\n axis: styles?.xAxis?.axis,\r\n label: styles?.yAxis?.labels,\r\n }}\r\n />\r\n <AxisTitle\r\n x={0 - leftMargin + 15}\r\n y={graphHeight / 2}\r\n style={styles?.yAxis?.title}\r\n className={classNames?.yAxis?.title}\r\n text={yAxisTitle}\r\n rotate90\r\n />\r\n </g>\r\n <g>\r\n {xTicks.map((d, i) => (\r\n <g key={i}>\r\n <text\r\n y={graphHeight}\r\n x={x(d)}\r\n style={{ textAnchor: 'middle' }}\r\n className='fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs'\r\n dy={15}\r\n >\r\n {format(d, dateFormat)}\r\n </text>\r\n </g>\r\n ))}\r\n </g>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <motion.path\r\n style={{\r\n fill: intervalAreaColor,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, d: areaShape(dataFormatted) || '' },\r\n whileInView: {\r\n opacity: intervalAreaOpacity,\r\n d: areaShape(dataFormatted) || '',\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {intervalLineStrokeWidth ? (\r\n <>\r\n <motion.path\r\n style={{\r\n stroke: intervalLineColors[0],\r\n fill: 'none',\r\n strokeWidth: intervalLineStrokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n pathLength: 0,\r\n d: lineShapeMin(dataFormatted) || '',\r\n opacity: 1,\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShapeMin(dataFormatted) || '',\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n <motion.path\r\n style={{\r\n stroke: intervalLineColors[1],\r\n fill: 'none',\r\n strokeWidth: intervalLineStrokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n pathLength: 0,\r\n d: lineShapeMax(dataFormatted) || '',\r\n opacity: 1,\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShapeMax(dataFormatted) || '',\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n </>\r\n ) : null}\r\n <motion.path\r\n style={{\r\n stroke: lineColor,\r\n fill: 'none',\r\n strokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n pathLength: 0,\r\n d: lineShape(dataFormatted) || '',\r\n opacity: 1,\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShape(dataFormatted) || '',\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {mouseOverData ? (\r\n <line\r\n y1={0}\r\n y2={graphHeight}\r\n x1={x(mouseOverData.date)}\r\n x2={x(mouseOverData.date)}\r\n className={cn(\r\n 'undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100',\r\n classNames?.mouseOverLine,\r\n )}\r\n style={styles?.mouseOverLine}\r\n />\r\n ) : null}\r\n <g>\r\n {dataFormatted.map((d, i) => (\r\n <motion.g key={i}>\r\n {!checkIfNullOrUndefined(d.y) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n style={{ fill: lineColor }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(d.date), cy: y(d.y) },\r\n whileInView: {\r\n opacity: 1,\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n cx: x(d.date),\r\n cy: y(d.y),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n ) : null}\r\n {showIntervalDots ? (\r\n <>\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n fill: intervalLineColors[0],\r\n cx: x(d.date),\r\n cy: y(d.yMin),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n cx: x(d.date),\r\n cy: y(d.yMin),\r\n fill: intervalLineColors[0],\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n fill: intervalLineColors[1],\r\n cx: x(d.date),\r\n cy: y(d.yMax),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n fill: intervalLineColors[1],\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n cx: x(d.date),\r\n cy: y(d.yMax),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n </>\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n dy={-8}\r\n style={{\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, fill: lineColor, x: x(d.date), y: y(d.y) },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d.date),\r\n fill: lineColor,\r\n y: y(d.y),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(d.y, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n {showIntervalValues ? (\r\n <>\r\n <motion.text\r\n dy='1em'\r\n style={{\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn('text-xs font-bold', classNames?.graphObjectValues)}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n fill: intervalLineColors[0],\r\n x: x(d.date),\r\n y: y(d.yMin),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d.date),\r\n y: y(d.yMin),\r\n fill: intervalLineColors[0],\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(d.yMin, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n <motion.text\r\n dy={-8}\r\n style={{\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn('text-xs font-bold', classNames?.graphObjectValues)}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n fill: intervalLineColors[1],\r\n x: x(d.date),\r\n y: y(d.yMax),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n fill: intervalLineColors[1],\r\n x: x(d.date),\r\n y: y(d.yMax),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(d.yMax, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n </>\r\n ) : null}\r\n </>\r\n ) : null}\r\n </motion.g>\r\n ))}\r\n </g>\r\n {refValues ? (\r\n <>\r\n {refValues.map((el, i) => (\r\n <RefLineY\r\n key={i}\r\n text={el.text}\r\n color={el.color}\r\n y={y(el.value as number)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n classNames={el.classNames}\r\n styles={el.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ))}\r\n </>\r\n ) : null}\r\n <g>\r\n {annotations.map((d, i) => {\r\n const endPoints = getLineEndPoint(\r\n {\r\n x: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n },\r\n {\r\n x: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n y: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n },\r\n checkIfNullOrUndefined(d.connectorRadius) ? 3.5 : (d.connectorRadius as number),\r\n );\r\n const connectorSettings = d.showConnector\r\n ? {\r\n y1: endPoints.y,\r\n x1: endPoints.x,\r\n y2: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0)\r\n : 0 + (d.yOffset || 0),\r\n x2: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n cy: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n cx: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n circleRadius: checkIfNullOrUndefined(d.connectorRadius)\r\n ? 3.5\r\n : (d.connectorRadius as number),\r\n strokeWidth: d.showConnector === true ? 2 : Math.min(d.showConnector || 0, 1),\r\n }\r\n : undefined;\r\n const labelSettings = {\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n x: rtl\r\n ? 0\r\n : d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n width: rtl\r\n ? d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)\r\n : graphWidth +\r\n margin.right -\r\n (d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)),\r\n maxWidth: d.maxWidth,\r\n fontWeight: d.fontWeight,\r\n align: d.align,\r\n };\r\n return (\r\n <Annotation\r\n key={i}\r\n color={d.color}\r\n connectorsSettings={connectorSettings}\r\n labelSettings={labelSettings}\r\n text={d.text}\r\n classNames={d.classNames}\r\n styles={d.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n );\r\n })}\r\n </g>\r\n <g>\r\n {regressionLine ? (\r\n <RegressionLine\r\n x1={0}\r\n x2={graphWidth}\r\n y1={predict(0)}\r\n y2={predict(graphWidth)}\r\n graphHeight={graphHeight}\r\n graphWidth={graphWidth}\r\n className={classNames?.regLine}\r\n style={styles?.regLine}\r\n color={typeof regressionLine === 'string' ? regressionLine : undefined}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ) : null}\r\n </g>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n <rect\r\n ref={MouseoverRectRef}\r\n style={{\r\n fill: 'none',\r\n pointerEvents: 'all',\r\n }}\r\n width={graphWidth}\r\n height={graphHeight}\r\n />\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport {\r\n AnnotationSettingsDataType,\r\n CustomHighlightAreaSettingsDataType,\r\n Languages,\r\n LineChartWithConfidenceIntervalDataType,\r\n ReferenceDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n HighlightAreaSettingsDataType,\r\n CurveTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { ColorLegend } from '@/Components/Elements/ColorLegend';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: LineChartWithConfidenceIntervalDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Colors of the line */\r\n lineColor?: string;\r\n /** Colors of the interval area */\r\n intervalAreaColor?: string;\r\n /** Colors of the top and bottom lines of the interval */\r\n intervalLineColors?: [string, string];\r\n /** Colors for the legend */\r\n colorLegendColors?: string[];\r\n /** Domain of colors for the legend */\r\n colorLegendDomain?: string[];\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n /** Maximum value for the chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n /** Reference values for comparison */\r\n refValues?: ReferenceDataType[];\r\n /** Maximum value of the date for the chart */\r\n maxDate?: string | number;\r\n /** Minimum value of the date for the chart */\r\n minDate?: string | number;\r\n /** No. of ticks on the x-axis */\r\n noOfXTicks?: number;\r\n /** No. of ticks on the y-axis */\r\n noOfYTicks?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of values of the interval area */\r\n showIntervalValues?: boolean;\r\n /** Toggle visibility of dots on the line */\r\n showDots?: boolean;\r\n /** Toggle visibility of dots on the line of te interval area */\r\n showIntervalDots?: boolean;\r\n /** Stroke width of the line */\r\n strokeWidth?: number;\r\n /** Stroke width of the lines of the interval area */\r\n intervalLineStrokeWidth?: number;\r\n /** Opacity of the interval area */\r\n intervalAreaOpacity?: number;\r\n /** Toggle the initial animation of the line. If the type is number then it uses the number as the time in seconds for animation. */\r\n animate?: boolean | AnimateDataType;\r\n /** Format of the date in the data object. Available formats can be found [here](https://date-fns.org/docs/format) */\r\n dateFormat?: string;\r\n /** Title for the Y-axis */\r\n yAxisTitle?: string;\r\n /** Annotations on the chart */\r\n annotations?: AnnotationSettingsDataType[];\r\n /** Highlighted area(square) on the chart */\r\n highlightAreaSettings?: HighlightAreaSettingsDataType[];\r\n /** Highlighted area(custom shape) on the chart */\r\n customHighlightAreaSettings?: CustomHighlightAreaSettingsDataType[];\r\n /** Toggles the visibility of the regression line for the data. If the type is string then string is use to define the color of the line. */\r\n regressionLine?: boolean | string;\r\n /** Curve type for the line */\r\n curveType?: CurveTypes;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function LineChartWithConfidenceInterval(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n graphDescription,\r\n height,\r\n width,\r\n footNote,\r\n noOfXTicks = 10,\r\n dateFormat = 'yyyy',\r\n showValues = false,\r\n backgroundColor = false,\r\n padding,\r\n lineColor,\r\n leftMargin = 30,\r\n rightMargin = 30,\r\n topMargin = 20,\r\n bottomMargin = 25,\r\n tooltip,\r\n refValues = [],\r\n highlightAreaSettings = [],\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n graphID,\r\n minValue,\r\n maxValue,\r\n regressionLine = false,\r\n showIntervalDots = false,\r\n showIntervalValues = false,\r\n intervalLineStrokeWidth = 0,\r\n intervalLineColors = [Colors.light.grays['gray-500'], Colors.light.grays['gray-500']],\r\n intervalAreaColor = Colors.primaryColors['blue-100'],\r\n intervalAreaOpacity = 0.4,\r\n graphDownload = false,\r\n dataDownload = false,\r\n animate = false,\r\n language = 'en',\r\n minHeight = 0,\r\n strokeWidth = 2,\r\n showDots = true,\r\n annotations = [],\r\n customHighlightAreaSettings = [],\r\n theme = 'light',\r\n ariaLabel,\r\n yAxisTitle,\r\n noOfYTicks = 5,\r\n minDate,\r\n maxDate,\r\n colorLegendTitle,\r\n colorLegendColors,\r\n colorLegendDomain,\r\n curveType = 'curve',\r\n styles,\r\n classNames,\r\n precision = 2,\r\n customLayers = [],\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a line chart that highlights the difference between two datasets over time.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {colorLegendColors && colorLegendDomain ? (\r\n <ColorLegend\r\n width={width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={colorLegendColors}\r\n colorDomain={colorLegendDomain}\r\n showNAColor={false}\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n lineColor={lineColor || Colors.primaryColors['blue-600']}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n suffix={suffix}\r\n prefix={prefix}\r\n dateFormat={dateFormat}\r\n showValues={showValues}\r\n noOfXTicks={noOfXTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n tooltip={tooltip}\r\n highlightAreaSettings={highlightAreaSettings}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n refValues={refValues}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n rtl={language === 'he' || language === 'ar'}\r\n strokeWidth={strokeWidth}\r\n showDots={showDots}\r\n annotations={annotations}\r\n customHighlightAreaSettings={customHighlightAreaSettings}\r\n regressionLine={regressionLine}\r\n showIntervalDots={showIntervalDots}\r\n showIntervalValues={showIntervalValues}\r\n intervalLineStrokeWidth={intervalLineStrokeWidth}\r\n intervalLineColors={intervalLineColors}\r\n intervalAreaColor={intervalAreaColor}\r\n intervalAreaOpacity={intervalAreaOpacity}\r\n yAxisTitle={yAxisTitle}\r\n noOfYTicks={noOfYTicks}\r\n minDate={minDate}\r\n maxDate={maxDate}\r\n curveType={curveType}\r\n styles={styles}\r\n classNames={classNames}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","width","height","lineColor","suffix","prefix","dateFormat","highlightAreaSettings","showValues","noOfXTicks","rightMargin","leftMargin","topMargin","bottomMargin","tooltip","onSeriesMouseOver","refValues","minValue","maxValue","animate","rtl","strokeWidth","showDots","annotations","customHighlightAreaSettings","regressionLine","showIntervalDots","showIntervalValues","intervalLineStrokeWidth","intervalLineColors","intervalAreaColor","intervalAreaOpacity","yAxisTitle","noOfYTicks","minDate","maxDate","curveType","styles","classNames","precision","customLayers","svgRef","useRef","isInView","useInView","hasAnimatedOnce","setHasAnimatedOnce","useState","useEffect","timeout","curve","curveLinear","curveStep","curveStepAfter","curveStepBefore","curveMonotoneX","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","margin","MouseoverRectRef","dataFormatted","orderBy","d","checkIfNullOrUndefined","parse","highlightAreaSettingsFormatted","customHighlightAreaSettingsFormatted","el","j","graphWidth","graphHeight","minYear","maxYear","minParam","maxParam","x","scaleTime","y","scaleLinear","lineShape","line","lineShapeMin","lineShapeMax","areaShape","area","yTicks","xTicks","mousemove","event","selectedData","bisectCenter","pointer","mouseout","select","regressionLineParam","linearRegression","predict","linearRegressionLine","jsxs","Fragment","jsx","motion","HighlightArea","CustomArea","YTicksAndGridLines","Axis","numberFormattingFunction","AxisTitle","i","format","cn","RefLineY","endPoints","getLineEndPoint","connectorSettings","labelSettings","Annotation","RegressionLine","Tooltip","LineChartWithConfidenceInterval","graphTitle","sources","graphDescription","footNote","backgroundColor","padding","relativeHeight","graphID","Colors","graphDownload","dataDownload","language","minHeight","theme","ariaLabel","colorLegendTitle","colorLegendColors","colorLegendDomain","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","ColorLegend","GraphFooter"],"mappings":"srCAiGO,SAASA,GAAMC,GAAc,CAClC,KAAM,CACJ,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,UAAAC,EACA,OAAAC,EACA,OAAAC,EACA,WAAAC,EACA,sBAAAC,EACA,WAAAC,EACA,WAAAC,GACA,YAAAC,GACA,WAAAC,EACA,UAAAC,EACA,aAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,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