@undp/data-viz 1.4.12 → 1.4.14
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.
- package/dist/AreaChart.cjs +1 -1
- package/dist/AreaChart.cjs.map +1 -1
- package/dist/AreaChart.js +25 -24
- package/dist/AreaChart.js.map +1 -1
- package/dist/BarGraph.cjs +1 -1
- package/dist/BarGraph.cjs.map +1 -1
- package/dist/BarGraph.js +638 -632
- package/dist/BarGraph.js.map +1 -1
- package/dist/BeeSwarmChart.cjs +1 -1
- package/dist/BeeSwarmChart.cjs.map +1 -1
- package/dist/BeeSwarmChart.js +134 -132
- package/dist/BeeSwarmChart.js.map +1 -1
- package/dist/BiVariateChoroplethMap.cjs +1 -1
- package/dist/BiVariateChoroplethMap.cjs.map +1 -1
- package/dist/BiVariateChoroplethMap.js +35 -34
- package/dist/BiVariateChoroplethMap.js.map +1 -1
- package/dist/BulletChart.cjs +1 -1
- package/dist/BulletChart.cjs.map +1 -1
- package/dist/BulletChart.js +226 -224
- package/dist/BulletChart.js.map +1 -1
- package/dist/ButterflyChart.cjs +1 -1
- package/dist/ButterflyChart.cjs.map +1 -1
- package/dist/ButterflyChart.js +48 -47
- package/dist/ButterflyChart.js.map +1 -1
- package/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.cjs.map +1 -1
- package/dist/ChoroplethMap.js +56 -55
- package/dist/ChoroplethMap.js.map +1 -1
- package/dist/CirclePackingGraph.cjs +1 -1
- package/dist/CirclePackingGraph.js +1 -1
- package/dist/DataCards.cjs +3 -3
- package/dist/DataCards.cjs.map +1 -1
- package/dist/DataCards.js +2 -1
- package/dist/DataCards.js.map +1 -1
- package/dist/DataTable.cjs +1 -1
- package/dist/DataTable.cjs.map +1 -1
- package/dist/DataTable.js +9 -8
- package/dist/DataTable.js.map +1 -1
- package/dist/DifferenceLineChart.cjs +1 -1
- package/dist/DifferenceLineChart.cjs.map +1 -1
- package/dist/DifferenceLineChart.js +1 -0
- package/dist/DifferenceLineChart.js.map +1 -1
- package/dist/DonutChart.cjs +1 -1
- package/dist/DonutChart.cjs.map +1 -1
- package/dist/DonutChart.js +77 -76
- package/dist/DonutChart.js.map +1 -1
- package/dist/DotDensityMap.cjs +1 -1
- package/dist/DotDensityMap.cjs.map +1 -1
- package/dist/DotDensityMap.js +1 -0
- package/dist/DotDensityMap.js.map +1 -1
- package/dist/{DropdownSelect-CeHog_ih.js → DropdownSelect-CtOKZHD0.js} +22 -20
- package/dist/{DropdownSelect-CeHog_ih.js.map → DropdownSelect-CtOKZHD0.js.map} +1 -1
- package/dist/{DropdownSelect-BmE5JaeE.cjs → DropdownSelect-DBDM64B5.cjs} +2 -2
- package/dist/{DropdownSelect-BmE5JaeE.cjs.map → DropdownSelect-DBDM64B5.cjs.map} +1 -1
- package/dist/DualAxisLineChart.cjs +1 -1
- package/dist/DualAxisLineChart.cjs.map +1 -1
- package/dist/DualAxisLineChart.d.ts +3 -1
- package/dist/DualAxisLineChart.js +265 -261
- package/dist/DualAxisLineChart.js.map +1 -1
- package/dist/DumbbellChart.cjs +1 -1
- package/dist/DumbbellChart.cjs.map +1 -1
- package/dist/DumbbellChart.js +216 -214
- package/dist/DumbbellChart.js.map +1 -1
- package/dist/GeoHubCompareMaps.cjs +1 -1
- package/dist/GeoHubCompareMaps.cjs.map +1 -1
- package/dist/GeoHubCompareMaps.js +1 -0
- package/dist/GeoHubCompareMaps.js.map +1 -1
- package/dist/GeoHubMap.cjs +1 -1
- package/dist/GeoHubMap.cjs.map +1 -1
- package/dist/GeoHubMap.js +29 -28
- package/dist/GeoHubMap.js.map +1 -1
- package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
- package/dist/GeoHubMapWithLayerSelection.cjs.map +1 -1
- package/dist/GeoHubMapWithLayerSelection.js +34 -33
- package/dist/GeoHubMapWithLayerSelection.js.map +1 -1
- package/dist/{GraphEl-s3ctz7oA.js → GraphEl-N6vuMRw_.js} +6 -2
- package/dist/GraphEl-N6vuMRw_.js.map +1 -0
- package/dist/GraphEl-Zl0W-LK9.cjs +2 -0
- package/dist/GraphEl-Zl0W-LK9.cjs.map +1 -0
- package/dist/GriddedGraphs.cjs +1 -1
- package/dist/GriddedGraphs.d.ts +1 -0
- package/dist/GriddedGraphs.js +2 -2
- package/dist/GriddedGraphsFromConfig.d.ts +1 -0
- package/dist/HeatMap.cjs +1 -1
- package/dist/HeatMap.cjs.map +1 -1
- package/dist/HeatMap.js +55 -54
- package/dist/HeatMap.js.map +1 -1
- package/dist/Histogram.cjs +1 -1
- package/dist/Histogram.js +1 -1
- package/dist/LineChartWithConfidenceInterval.cjs +1 -1
- package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
- package/dist/LineChartWithConfidenceInterval.js +22 -21
- package/dist/LineChartWithConfidenceInterval.js.map +1 -1
- package/dist/MultiGraphDashboard.cjs +1 -1
- package/dist/MultiGraphDashboard.d.ts +1 -0
- package/dist/MultiGraphDashboard.js +1 -1
- package/dist/MultiGraphDashboardFromConfig.d.ts +1 -0
- package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.js +1 -1
- package/dist/MultiLineAltChart.cjs +1 -1
- package/dist/MultiLineAltChart.cjs.map +1 -1
- package/dist/MultiLineAltChart.js +34 -33
- package/dist/MultiLineAltChart.js.map +1 -1
- package/dist/MultiLineChart.cjs +1 -1
- package/dist/MultiLineChart.cjs.map +1 -1
- package/dist/MultiLineChart.js +72 -71
- package/dist/MultiLineChart.js.map +1 -1
- package/dist/ParetoChart.cjs +1 -1
- package/dist/ParetoChart.cjs.map +1 -1
- package/dist/ParetoChart.d.ts +4 -0
- package/dist/ParetoChart.js +317 -312
- package/dist/ParetoChart.js.map +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +1 -0
- package/dist/PerformanceIntensiveMultiGraphDashboard.js +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +1 -0
- package/dist/PerformanceIntensiveScrollStory.d.ts +1 -0
- package/dist/RadarChart.cjs +1 -1
- package/dist/RadarChart.cjs.map +1 -1
- package/dist/RadarChart.js +27 -26
- package/dist/RadarChart.js.map +1 -1
- package/dist/SankeyChart.cjs +1 -1
- package/dist/SankeyChart.cjs.map +1 -1
- package/dist/SankeyChart.js +30 -29
- package/dist/SankeyChart.js.map +1 -1
- package/dist/ScatterPlot.cjs +1 -1
- package/dist/ScatterPlot.cjs.map +1 -1
- package/dist/ScatterPlot.js +119 -118
- package/dist/ScatterPlot.js.map +1 -1
- package/dist/ScrollStory.d.ts +1 -0
- package/dist/SimpleLineChart.cjs +1 -1
- package/dist/SimpleLineChart.cjs.map +1 -1
- package/dist/SimpleLineChart.js +16 -15
- package/dist/SimpleLineChart.js.map +1 -1
- package/dist/SingleGraphDashboard.cjs +1 -1
- package/dist/SingleGraphDashboard.d.ts +1 -0
- package/dist/SingleGraphDashboard.js +2 -2
- package/dist/SingleGraphDashboardFromConfig.d.ts +1 -0
- package/dist/SingleGraphDashboardGeoHubMaps.d.ts +1 -0
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +1 -0
- package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.d.ts +1 -0
- package/dist/SingleGraphDashboardThreeDGraphs.js +1 -1
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +1 -0
- package/dist/SlopeChart.cjs +1 -1
- package/dist/SlopeChart.cjs.map +1 -1
- package/dist/SlopeChart.js +46 -45
- package/dist/SlopeChart.js.map +1 -1
- package/dist/SparkLine.cjs +1 -1
- package/dist/SparkLine.cjs.map +1 -1
- package/dist/SparkLine.js +12 -11
- package/dist/SparkLine.js.map +1 -1
- package/dist/StripChart.cjs +1 -1
- package/dist/StripChart.cjs.map +1 -1
- package/dist/StripChart.js +81 -79
- package/dist/StripChart.js.map +1 -1
- package/dist/ThreeDGlobe.cjs +1 -1
- package/dist/ThreeDGlobe.cjs.map +1 -1
- package/dist/ThreeDGlobe.js +1 -0
- package/dist/ThreeDGlobe.js.map +1 -1
- package/dist/TreeMapGraph.cjs +1 -1
- package/dist/TreeMapGraph.cjs.map +1 -1
- package/dist/TreeMapGraph.js +114 -113
- package/dist/TreeMapGraph.js.map +1 -1
- package/dist/Types.d.ts +1 -0
- package/dist/UnitChart.cjs +1 -1
- package/dist/UnitChart.cjs.map +1 -1
- package/dist/UnitChart.js +10 -9
- package/dist/UnitChart.js.map +1 -1
- package/dist/{index-CZLvTu6p.cjs → index-BbNoLJ_w.cjs} +2 -2
- package/dist/{index-CZLvTu6p.cjs.map → index-BbNoLJ_w.cjs.map} +1 -1
- package/dist/{index-DGAaLNu9.js → index-Bc5VF70V.js} +46 -45
- package/dist/{index-DGAaLNu9.js.map → index-Bc5VF70V.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/GraphEl-OzC-icbr.cjs +0 -2
- package/dist/GraphEl-OzC-icbr.cjs.map +0 -1
- package/dist/GraphEl-s3ctz7oA.js.map +0 -1
package/dist/AreaChart.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),h=require("react"),m=require("./parse-hMnG_lRV.cjs"),de=require("./index-BzeLQvXk.cjs"),ue=require("./index-C21TvELx.cjs"),he=require("./numberFormattingFunction-02t-wJta.cjs"),fe=require("./Tooltip-n8z5bfav.cjs"),Z=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),me=require("./customArea-CK768gCn.cjs"),ye=require("./AxisTitle-CK9YeovX.cjs"),je=require("./Axis-DE7dSn1_.cjs"),ve=require("./XTicksAndGridLines-CCzXIV8d.cjs"),we=require("./ReferenceLine-CFVBBN__.cjs"),Re=require("./YTicksAndGridLines-DBDuz6vb.cjs"),Ee=require("./index-DNj994Pv.cjs"),Ae=require("./time-Byw_jYQ7.cjs"),Ce=require("./linear-BVckp9RD.cjs"),be=require("./area-D3Qx7k7K.cjs"),Oe=require("./line-DHV4JwCR.cjs"),ee=require("./step-BZ3C8QFW.cjs"),qe=require("./select-Bnfk0lJx.cjs"),Ne=require("./init-DU0ybBc_.cjs"),Se=require("./pointer-Dkq5NV1q.cjs"),$e=require("./use-in-view-sQJZ_xDO.cjs"),te=require("./proxy-BHRoeZgd.cjs"),ke=require("./index-BW8iNx7E.cjs"),Le=require("./GraphFooter.cjs"),Te=require("./GraphHeader.cjs"),De=require("./ColorLegend.cjs"),Me=require("./Colors.cjs"),Fe=require("./EmptyState-d8_8SxeW.cjs");function He(se){const{data:w,width:R,height:q,colors:G,dateFormat:o,noOfXTicks:N,rightMargin:l,leftMargin:f,topMargin:ie,bottomMargin:re,yAxisTitle:P,tooltip:D,onSeriesMouseOver:p,highlightAreaSettings:oe,refValues:V,minValue:I,maxValue:Y,rtl:W,annotations:ne,customHighlightAreaSettings:ae,noOfYTicks:S,prefix:M,suffix:F,curveType:$,styles:g,classNames:d,precision:k,customLayers:H,animate:y}=se,E=h.useRef(null),j=$e.useInView(E,{once:y.once,amount:y.amount}),le=$==="linear"?Oe.curveLinear:$==="step"?ee.curveStep:$==="stepAfter"?ee.stepAfter:$==="stepBefore"?ee.stepBefore:ee.monotoneX,[b,X]=h.useState(void 0),[U,B]=h.useState(void 0),[_,z]=h.useState(void 0),c={top:ie,bottom:re,left:P?f+30:f,right:l},J=h.useRef(null),i=de.sortBy(w.map(e=>({...e,date:m.parse(`${e.date}`,o,new Date)})),"date"),A=oe.map(e=>({...e,coordinates:[e.coordinates[0]===null?null:m.parse(`${e.coordinates[0]}`,o,new Date),e.coordinates[1]===null?null:m.parse(`${e.coordinates[1]}`,o,new Date)]})),ce=ae.map(e=>({...e,coordinates:e.coordinates.map((n,a)=>a%2===0?m.parse(`${n}`,o,new Date):n)})),xe=i[0].y.map((e,n)=>i.map(a=>({date:a.date,y0:n===0?0:ue.sum(a.y.filter((T,O)=>O<n)),y1:ue.sum(a.y.filter((T,O)=>O<=n))}))),v=R-c.left-c.right,x=q-c.top-c.bottom,K=i[0].date,Q=i[i.length-1].date,u=Z.checkIfNullOrUndefined(I)?0:I,C=Z.checkIfNullOrUndefined(Y)?Math.max(...w.map(e=>ue.sum(e.y)||0)):Y,r=Ae.time().domain([K,Q]).range([0,v]),s=Ce.linear().domain([u,C]).range([x,0]).nice(),L=be.area().x(e=>r(e.date)).y0(e=>s(e.y0)).y1(e=>s(e.y1)).curve(le),pe=s.ticks(S),ge=r.ticks(N);return h.useEffect(()=>{const e=a=>{const T=i[Ne.bisectCenter(i.map(O=>O.date),r.invert(Se.pointer(a)[0]),0)];X(T||i[i.length-1]),p?.(T||i[i.length-1]),z(a.clientY),B(a.clientX)},n=()=>{X(void 0),B(void 0),z(void 0),p?.(void 0)};qe.select(J.current).on("mousemove",e).on("mouseout",n),p?.(void 0)},[r,i,p]),t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(te.motion.svg,{width:`${R}px`,height:`${q}px`,viewBox:`0 0 ${R} ${q}`,direction:"ltr",ref:E,children:t.jsxRuntimeExports.jsx(ke.AnimatePresence,{children:t.jsxRuntimeExports.jsxs(te.motion.g,{transform:`translate(${c.left},${c.top})`,children:[t.jsxRuntimeExports.jsx(Ee.HighlightArea,{areaSettings:A,width:v,height:x,scale:r,animate:y,isInView:j}),t.jsxRuntimeExports.jsx(me.CustomArea,{animate:y,areaSettings:ce,scaleX:r,scaleY:s,isInView:j}),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx(Re.YTicksAndGridLines,{values:pe.filter(e=>e!==0),y:pe.filter(e=>e!==0).map(e=>s(e)),x1:0-f,x2:v+c.right,styles:{gridLines:g?.yAxis?.gridLines,labels:g?.yAxis?.labels},classNames:{gridLines:d?.yAxis?.gridLines,labels:d?.yAxis?.labels},suffix:F,prefix:M,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:k}),t.jsxRuntimeExports.jsx(je.Axis,{y1:s(u<0?0:u),y2:s(u<0?0:u),x1:0-f,x2:v+c.right,label:he.numberFormattingFunction(u<0?0:u,"NA",k,M,F),labelPos:{x:0-f,dx:0,dy:C<0?"1em":-5,y:s(u<0?0:u)},classNames:{axis:d?.xAxis?.axis,label:d?.yAxis?.labels},styles:{axis:g?.xAxis?.axis,label:g?.yAxis?.labels}}),t.jsxRuntimeExports.jsx(ye.AxisTitle,{x:0-f-15,y:x/2,style:g?.yAxis?.title,className:d?.yAxis?.title,text:P,rotate90:!0})]}),t.jsxRuntimeExports.jsx(ve.XTicksAndGridLines,{values:ge.map(e=>m.format(e,o)),x:ge.map(e=>r(e)),y1:0,y2:x,styles:{gridLines:g?.xAxis?.gridLines,labels:g?.xAxis?.labels},classNames:{gridLines:t.mo("opacity-0",d?.xAxis?.gridLines),labels:t.mo("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[8px] sm:text-[9px] md:text-[10px] lg:text-xs",d?.xAxis?.labels)},suffix:F,prefix:M,labelType:"primary",showGridLines:!0,precision:k}),H.filter(e=>e.position==="before").map(e=>e.layer),t.jsxRuntimeExports.jsxs(te.motion.g,{children:[xe.map((e,n)=>t.jsxRuntimeExports.jsx(te.motion.path,{d:L(e),exit:{opacity:0,transition:{duration:y.duration}},variants:{initial:{d:L(e.map(a=>({...a,y0:0,y1:0}))),opacity:0},whileInView:{d:L(e),opacity:1,transition:{duration:y.duration}}},initial:"initial",animate:j?"whileInView":"initial",style:{fill:G[n],opacity:.8}},n)),b?t.jsxRuntimeExports.jsx("line",{y1:0,y2:x,x1:r(b.date),x2:r(b.date),className:t.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",d?.mouseOverLine),style:g?.mouseOverLine}):null]}),V?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:V.map((e,n)=>t.jsxRuntimeExports.jsx(we.RefLineY,{text:e.text,color:e.color,y:s(e.value),x1:0-f,x2:v+c.right,classNames:e.classNames,styles:e.styles,animate:y,isInView:j},n))}):null,t.jsxRuntimeExports.jsx("g",{children:ne.map((e,n)=>{const a=me.getLineEndPoint({x:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0),y:e.yCoordinate?s(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8},{x:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date)):0,y:e.yCoordinate?s(e.yCoordinate):0},Z.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius),T=e.showConnector?{y1:a.y,x1:a.x,y2:e.yCoordinate?s(e.yCoordinate)+(e.yOffset||0):0+(e.yOffset||0),x2:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0),cx:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date)):0,cy:e.yCoordinate?s(e.yCoordinate):0,circleRadius:Z.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius,strokeWidth:e.showConnector===!0?2:Math.min(e.showConnector||0,1)}:void 0,O={y:e.yCoordinate?s(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8,x:W?0:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0),width:W?e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0):v+c.right-(e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0)),maxWidth:e.maxWidth,fontWeight:e.fontWeight,align:e.align};return t.jsxRuntimeExports.jsx(me.Annotation,{color:e.color,connectorsSettings:T,labelSettings:O,text:e.text,classNames:e.classNames,styles:e.styles,animate:y,isInView:j},n)})}),H.filter(e=>e.position==="after").map(e=>e.layer),t.jsxRuntimeExports.jsx("rect",{ref:J,style:{fill:"none",pointerEvents:"all"},width:v,height:x})]})})}),b&&D&&U&&_?t.jsxRuntimeExports.jsx(fe.Tooltip,{data:b,body:D,xPos:U,yPos:_,backgroundStyle:g?.tooltip,className:d?.tooltip}):null]})}function Ge(se){const{data:w,graphTitle:R,colors:q=Me.Colors.light.categoricalColors.colors,sources:G,graphDescription:o,height:N,width:l,footNote:f,noOfXTicks:ie=10,dateFormat:re="yyyy",colorDomain:P,padding:D,backgroundColor:p=!1,colorLegendTitle:oe,leftMargin:V=50,rightMargin:I=20,topMargin:Y=20,bottomMargin:W=25,highlightAreaSettings:ne=[],tooltip:ae,relativeHeight:S,onSeriesMouseOver:M,refValues:F=[],graphID:$,minValue:g,maxValue:d,graphDownload:k=!1,dataDownload:H=!1,showColorScale:y=!0,language:E="en",minHeight:j=0,annotations:le=[],customHighlightAreaSettings:b=[],theme:X="light",ariaLabel:U,yAxisTitle:B,noOfYTicks:_=5,prefix:z="",suffix:c="",curveType:J="curve",styles:i,classNames:A,precision:ce=2,customLayers:xe=[],animate:v=!1}=se,[x,K]=h.useState(0),[Q,u]=h.useState(0),C=h.useRef(null),r=h.useRef(null);return h.useEffect(()=>{const s=new ResizeObserver(L=>{K(l||L[0].target.clientWidth||620),u(N||L[0].target.clientHeight||480)});return C.current&&(u(C.current.clientHeight||480),K(C.current.clientWidth||620),l||s.observe(C.current)),()=>s.disconnect()},[l,N]),t.jsxRuntimeExports.jsx("div",{className:`${X||"light"} flex ${l?"w-fit grow-0":"w-full grow"}`,dir:E==="he"||E==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${p?p===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${E||"en"}`,A?.graphContainer),style:{...i?.graphContainer||{},...p&&p!==!0?{backgroundColor:p}:{}},id:$,ref:r,"aria-label":U||`${R?`The graph shows ${R}. `:""}This is a stacked area chart that shows trends over time.${o?` ${o}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:p?D||"1rem":D||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[R||o||k||H?t.jsxRuntimeExports.jsx(Te.GraphHeader,{styles:{title:i?.title,description:i?.description},classNames:{title:A?.title,description:A?.description},graphTitle:R,graphDescription:o,width:l,graphDownload:k?r.current:void 0,dataDownload:H?w.map(s=>s.data).filter(s=>s!==void 0).length>0?w.map(s=>s.data).filter(s=>s!==void 0):w.filter(s=>s!==void 0):null}):null,t.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:w.length===0?t.jsxRuntimeExports.jsx(Fe.EmptyState,{}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[y!==!1?t.jsxRuntimeExports.jsx(De.ColorLegend,{colorDomain:P,colors:q,colorLegendTitle:oe,showNAColor:!1}):null,t.jsxRuntimeExports.jsx("div",{className:"w-full grow leading-0",ref:C,"aria-label":"Graph area",children:(l||x)&&(N||Q)?t.jsxRuntimeExports.jsx(He,{data:w,colors:q,width:l||x,height:Math.max(j,N||(S?j?(l||x)*S>j?(l||x)*S:j:(l||x)*S:Q)),dateFormat:re,noOfXTicks:ie,leftMargin:V,rightMargin:I,topMargin:Y,bottomMargin:W,tooltip:ae,onSeriesMouseOver:M,highlightAreaSettings:ne,refValues:F,minValue:g,maxValue:d,rtl:E==="he"||E==="ar",annotations:le,customHighlightAreaSettings:b,yAxisTitle:B,noOfYTicks:_,prefix:z,suffix:c,curveType:J,styles:i,classNames:A,precision:ce,customLayers:xe,animate:v===!0?{duration:.5,once:!0,amount:.5}:v||{duration:0,once:!0,amount:0}}):null})]})}),G||f?t.jsxRuntimeExports.jsx(Le.GraphFooter,{styles:{footnote:i?.footnote,source:i?.source},classNames:{footnote:A?.footnote,source:A?.source},sources:G,footNote:f,width:l}):null]})})})})}exports.AreaChart=Ge;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),h=require("react"),m=require("./parse-hMnG_lRV.cjs"),de=require("./index-BzeLQvXk.cjs"),ue=require("./index-C21TvELx.cjs"),he=require("./numberFormattingFunction-02t-wJta.cjs"),fe=require("./Tooltip-n8z5bfav.cjs"),Z=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),me=require("./customArea-CK768gCn.cjs"),ye=require("./AxisTitle-CK9YeovX.cjs"),je=require("./Axis-DE7dSn1_.cjs"),ve=require("./XTicksAndGridLines-CCzXIV8d.cjs"),we=require("./ReferenceLine-CFVBBN__.cjs"),Re=require("./YTicksAndGridLines-DBDuz6vb.cjs"),Ee=require("./index-DNj994Pv.cjs"),Ae=require("./time-Byw_jYQ7.cjs"),Ce=require("./linear-BVckp9RD.cjs"),be=require("./area-D3Qx7k7K.cjs"),Oe=require("./line-DHV4JwCR.cjs"),ee=require("./step-BZ3C8QFW.cjs"),qe=require("./select-Bnfk0lJx.cjs"),Ne=require("./init-DU0ybBc_.cjs"),Se=require("./pointer-Dkq5NV1q.cjs"),$e=require("./use-in-view-sQJZ_xDO.cjs"),te=require("./proxy-BHRoeZgd.cjs"),ke=require("./index-BW8iNx7E.cjs"),Le=require("./GraphFooter.cjs"),Te=require("./GraphHeader.cjs"),De=require("./ColorLegend.cjs"),Me=require("./Colors.cjs"),Fe=require("./EmptyState-d8_8SxeW.cjs");function He(se){const{data:w,width:R,height:q,colors:G,dateFormat:o,noOfXTicks:N,rightMargin:a,leftMargin:f,topMargin:ie,bottomMargin:re,yAxisTitle:P,tooltip:D,onSeriesMouseOver:p,highlightAreaSettings:oe,refValues:V,minValue:I,maxValue:Y,rtl:W,annotations:ne,customHighlightAreaSettings:ae,noOfYTicks:S,prefix:M,suffix:F,curveType:$,styles:g,classNames:d,precision:k,customLayers:H,animate:y}=se,E=h.useRef(null),j=$e.useInView(E,{once:y.once,amount:y.amount}),le=$==="linear"?Oe.curveLinear:$==="step"?ee.curveStep:$==="stepAfter"?ee.stepAfter:$==="stepBefore"?ee.stepBefore:ee.monotoneX,[b,X]=h.useState(void 0),[U,B]=h.useState(void 0),[_,z]=h.useState(void 0),c={top:ie,bottom:re,left:P?f+30:f,right:a},J=h.useRef(null),i=de.sortBy(w.map(e=>({...e,date:m.parse(`${e.date}`,o,new Date)})),"date"),A=oe.map(e=>({...e,coordinates:[e.coordinates[0]===null?null:m.parse(`${e.coordinates[0]}`,o,new Date),e.coordinates[1]===null?null:m.parse(`${e.coordinates[1]}`,o,new Date)]})),ce=ae.map(e=>({...e,coordinates:e.coordinates.map((n,l)=>l%2===0?m.parse(`${n}`,o,new Date):n)})),xe=i[0].y.map((e,n)=>i.map(l=>({date:l.date,y0:n===0?0:ue.sum(l.y.filter((T,O)=>O<n)),y1:ue.sum(l.y.filter((T,O)=>O<=n))}))),v=R-c.left-c.right,x=q-c.top-c.bottom,K=i[0].date,Q=i[i.length-1].date,u=Z.checkIfNullOrUndefined(I)?0:I,C=Z.checkIfNullOrUndefined(Y)?Math.max(...w.map(e=>ue.sum(e.y)||0)):Y,r=Ae.time().domain([K,Q]).range([0,v]),s=Ce.linear().domain([u,C]).range([x,0]).nice(),L=be.area().x(e=>r(e.date)).y0(e=>s(e.y0)).y1(e=>s(e.y1)).curve(le),pe=s.ticks(S),ge=r.ticks(N);return h.useEffect(()=>{const e=l=>{const T=i[Ne.bisectCenter(i.map(O=>O.date),r.invert(Se.pointer(l)[0]),0)];X(T||i[i.length-1]),p?.(T||i[i.length-1]),z(l.clientY),B(l.clientX)},n=()=>{X(void 0),B(void 0),z(void 0),p?.(void 0)};qe.select(J.current).on("mousemove",e).on("mouseout",n),p?.(void 0)},[r,i,p]),t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(te.motion.svg,{width:`${R}px`,height:`${q}px`,viewBox:`0 0 ${R} ${q}`,direction:"ltr",ref:E,children:t.jsxRuntimeExports.jsx(ke.AnimatePresence,{children:t.jsxRuntimeExports.jsxs(te.motion.g,{transform:`translate(${c.left},${c.top})`,children:[t.jsxRuntimeExports.jsx(Ee.HighlightArea,{areaSettings:A,width:v,height:x,scale:r,animate:y,isInView:j}),t.jsxRuntimeExports.jsx(me.CustomArea,{animate:y,areaSettings:ce,scaleX:r,scaleY:s,isInView:j}),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx(Re.YTicksAndGridLines,{values:pe.filter(e=>e!==0),y:pe.filter(e=>e!==0).map(e=>s(e)),x1:0-f,x2:v+c.right,styles:{gridLines:g?.yAxis?.gridLines,labels:g?.yAxis?.labels},classNames:{gridLines:d?.yAxis?.gridLines,labels:d?.yAxis?.labels},suffix:F,prefix:M,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:k}),t.jsxRuntimeExports.jsx(je.Axis,{y1:s(u<0?0:u),y2:s(u<0?0:u),x1:0-f,x2:v+c.right,label:he.numberFormattingFunction(u<0?0:u,"NA",k,M,F),labelPos:{x:0-f,dx:0,dy:C<0?"1em":-5,y:s(u<0?0:u)},classNames:{axis:d?.xAxis?.axis,label:d?.yAxis?.labels},styles:{axis:g?.xAxis?.axis,label:g?.yAxis?.labels}}),t.jsxRuntimeExports.jsx(ye.AxisTitle,{x:0-f-15,y:x/2,style:g?.yAxis?.title,className:d?.yAxis?.title,text:P,rotate90:!0})]}),t.jsxRuntimeExports.jsx(ve.XTicksAndGridLines,{values:ge.map(e=>m.format(e,o)),x:ge.map(e=>r(e)),y1:0,y2:x,styles:{gridLines:g?.xAxis?.gridLines,labels:g?.xAxis?.labels},classNames:{gridLines:t.mo("opacity-0",d?.xAxis?.gridLines),labels:t.mo("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[8px] sm:text-[9px] md:text-[10px] lg:text-xs",d?.xAxis?.labels)},suffix:F,prefix:M,labelType:"primary",showGridLines:!0,precision:k}),H.filter(e=>e.position==="before").map(e=>e.layer),t.jsxRuntimeExports.jsxs(te.motion.g,{children:[xe.map((e,n)=>t.jsxRuntimeExports.jsx(te.motion.path,{d:L(e),exit:{opacity:0,transition:{duration:y.duration}},variants:{initial:{d:L(e.map(l=>({...l,y0:0,y1:0}))),opacity:0},whileInView:{d:L(e),opacity:1,transition:{duration:y.duration}}},initial:"initial",animate:j?"whileInView":"initial",style:{fill:G[n],opacity:.8}},n)),b?t.jsxRuntimeExports.jsx("line",{y1:0,y2:x,x1:r(b.date),x2:r(b.date),className:t.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",d?.mouseOverLine),style:g?.mouseOverLine}):null]}),V?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:V.map((e,n)=>t.jsxRuntimeExports.jsx(we.RefLineY,{text:e.text,color:e.color,y:s(e.value),x1:0-f,x2:v+c.right,classNames:e.classNames,styles:e.styles,animate:y,isInView:j},n))}):null,t.jsxRuntimeExports.jsx("g",{children:ne.map((e,n)=>{const l=me.getLineEndPoint({x:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0),y:e.yCoordinate?s(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8},{x:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date)):0,y:e.yCoordinate?s(e.yCoordinate):0},Z.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius),T=e.showConnector?{y1:l.y,x1:l.x,y2:e.yCoordinate?s(e.yCoordinate)+(e.yOffset||0):0+(e.yOffset||0),x2:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0),cx:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date)):0,cy:e.yCoordinate?s(e.yCoordinate):0,circleRadius:Z.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius,strokeWidth:e.showConnector===!0?2:Math.min(e.showConnector||0,1)}:void 0,O={y:e.yCoordinate?s(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8,x:W?0:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0),width:W?e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0):v+c.right-(e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0)),maxWidth:e.maxWidth,fontWeight:e.fontWeight,align:e.align};return t.jsxRuntimeExports.jsx(me.Annotation,{color:e.color,connectorsSettings:T,labelSettings:O,text:e.text,classNames:e.classNames,styles:e.styles,animate:y,isInView:j},n)})}),H.filter(e=>e.position==="after").map(e=>e.layer),t.jsxRuntimeExports.jsx("rect",{ref:J,style:{fill:"none",pointerEvents:"all"},width:v,height:x})]})})}),b&&D&&U&&_?t.jsxRuntimeExports.jsx(fe.Tooltip,{data:b,body:D,xPos:U,yPos:_,backgroundStyle:g?.tooltip,className:d?.tooltip}):null]})}function Ge(se){const{data:w,graphTitle:R,colors:q=Me.Colors.light.categoricalColors.colors,sources:G,graphDescription:o,height:N,width:a,footNote:f,noOfXTicks:ie=10,dateFormat:re="yyyy",colorDomain:P,padding:D,backgroundColor:p=!1,colorLegendTitle:oe,leftMargin:V=50,rightMargin:I=20,topMargin:Y=20,bottomMargin:W=25,highlightAreaSettings:ne=[],tooltip:ae,relativeHeight:S,onSeriesMouseOver:M,refValues:F=[],graphID:$,minValue:g,maxValue:d,graphDownload:k=!1,dataDownload:H=!1,showColorScale:y=!0,language:E="en",minHeight:j=0,annotations:le=[],customHighlightAreaSettings:b=[],theme:X="light",ariaLabel:U,yAxisTitle:B,noOfYTicks:_=5,prefix:z="",suffix:c="",curveType:J="curve",styles:i,classNames:A,precision:ce=2,customLayers:xe=[],animate:v=!1}=se,[x,K]=h.useState(0),[Q,u]=h.useState(0),C=h.useRef(null),r=h.useRef(null);return h.useEffect(()=>{const s=new ResizeObserver(L=>{K(a||L[0].target.clientWidth||620),u(N||L[0].target.clientHeight||480)});return C.current&&(u(C.current.clientHeight||480),K(C.current.clientWidth||620),a||s.observe(C.current)),()=>s.disconnect()},[a,N]),t.jsxRuntimeExports.jsx("div",{className:`${X||"light"} flex ${a?"w-fit grow-0":"w-full grow"}`,dir:E==="he"||E==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${p?p===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${E||"en"}`,a?"w-fit":"w-full",A?.graphContainer),style:{...i?.graphContainer||{},...p&&p!==!0?{backgroundColor:p}:{}},id:$,ref:r,"aria-label":U||`${R?`The graph shows ${R}. `:""}This is a stacked area chart that shows trends over time.${o?` ${o}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:p?D||"1rem":D||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[R||o||k||H?t.jsxRuntimeExports.jsx(Te.GraphHeader,{styles:{title:i?.title,description:i?.description},classNames:{title:A?.title,description:A?.description},graphTitle:R,graphDescription:o,width:a,graphDownload:k?r.current:void 0,dataDownload:H?w.map(s=>s.data).filter(s=>s!==void 0).length>0?w.map(s=>s.data).filter(s=>s!==void 0):w.filter(s=>s!==void 0):null}):null,t.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:w.length===0?t.jsxRuntimeExports.jsx(Fe.EmptyState,{}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[y!==!1?t.jsxRuntimeExports.jsx(De.ColorLegend,{colorDomain:P,colors:q,colorLegendTitle:oe,showNAColor:!1}):null,t.jsxRuntimeExports.jsx("div",{className:"w-full grow leading-0",ref:C,"aria-label":"Graph area",children:(a||x)&&(N||Q)?t.jsxRuntimeExports.jsx(He,{data:w,colors:q,width:a||x,height:Math.max(j,N||(S?j?(a||x)*S>j?(a||x)*S:j:(a||x)*S:Q)),dateFormat:re,noOfXTicks:ie,leftMargin:V,rightMargin:I,topMargin:Y,bottomMargin:W,tooltip:ae,onSeriesMouseOver:M,highlightAreaSettings:ne,refValues:F,minValue:g,maxValue:d,rtl:E==="he"||E==="ar",annotations:le,customHighlightAreaSettings:b,yAxisTitle:B,noOfYTicks:_,prefix:z,suffix:c,curveType:J,styles:i,classNames:A,precision:ce,customLayers:xe,animate:v===!0?{duration:.5,once:!0,amount:.5}:v||{duration:0,once:!0,amount:0}}):null})]})}),G||f?t.jsxRuntimeExports.jsx(Le.GraphFooter,{styles:{footnote:i?.footnote,source:i?.source},classNames:{footnote:A?.footnote,source:A?.source},sources:G,footNote:f,width:a}):null]})})})})}exports.AreaChart=Ge;
|
|
2
2
|
//# sourceMappingURL=AreaChart.cjs.map
|
package/dist/AreaChart.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AreaChart.cjs","sources":["../src/Components/Graphs/StackedAreaChart/Graph.tsx","../src/Components/Graphs/StackedAreaChart/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\nimport {\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 sortBy from 'lodash.sortby';\r\nimport sum from 'lodash.sum';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\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 MultiLineChartDataType,\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 { XTicksAndGridLines } from '@/Components/Elements/Axes/XTicksAndGridLines';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\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: MultiLineChartDataType[];\r\n colors: string[];\r\n width: number;\r\n height: number;\r\n dateFormat: string;\r\n noOfXTicks: number;\r\n rightMargin: number;\r\n leftMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n yAxisTitle?: string;\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 rtl: boolean;\r\n annotations: AnnotationSettingsDataType[];\r\n customHighlightAreaSettings: CustomHighlightAreaSettingsDataType[];\r\n noOfYTicks: number;\r\n prefix: string;\r\n suffix: string;\r\n curveType: CurveTypes;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n animate: AnimateDataType;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n colors,\r\n dateFormat,\r\n noOfXTicks,\r\n rightMargin,\r\n leftMargin,\r\n topMargin,\r\n bottomMargin,\r\n yAxisTitle,\r\n tooltip,\r\n onSeriesMouseOver,\r\n highlightAreaSettings,\r\n refValues,\r\n minValue,\r\n maxValue,\r\n rtl,\r\n annotations,\r\n customHighlightAreaSettings,\r\n noOfYTicks,\r\n prefix,\r\n suffix,\r\n curveType,\r\n styles,\r\n classNames,\r\n precision,\r\n customLayers,\r\n animate,\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 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 = sortBy(\r\n data.map(d => ({\r\n ...d,\r\n date: parse(`${d.date}`, dateFormat, new Date()),\r\n })),\r\n 'date',\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 dataArray = dataFormatted[0].y.map((_d, i) => {\r\n return dataFormatted.map(el => ({\r\n date: el.date,\r\n y0: i === 0 ? 0 : sum(el.y.filter((_element, k) => k < i)),\r\n y1: sum(el.y.filter((_element, k) => k <= i)),\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 = dataFormatted[0].date;\r\n const maxYear = dataFormatted[dataFormatted.length - 1].date;\r\n const minParam = checkIfNullOrUndefined(minValue) ? 0 : (minValue as number);\r\n const maxParam: number = checkIfNullOrUndefined(maxValue)\r\n ? Math.max(...data.map(d => sum(d.y) || 0))\r\n : (maxValue as number);\r\n\r\n const x = scaleTime().domain([minYear, maxYear]).range([0, graphWidth]);\r\n const y = scaleLinear().domain([minParam, maxParam]).range([graphHeight, 0]).nice();\r\n\r\n const areaShape = area()\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .x((d: any) => x(d.date))\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .y0((d: any) => y(d.y0))\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .y1((d: any) => y(d.y1))\r\n .curve(curve);\r\n const yTicks = y.ticks(noOfYTicks);\r\n const xTicks = x.ticks(noOfXTicks);\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 onSeriesMouseOver?.(undefined);\r\n }, [x, dataFormatted, onSeriesMouseOver]);\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 <AnimatePresence>\r\n <motion.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 animate={animate}\r\n areaSettings={customHighlightAreaSettingsFormatted}\r\n scaleX={x}\r\n scaleY={y}\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 dx: 0,\r\n dy: maxParam < 0 ? '1em' : -5,\r\n y: y(minParam < 0 ? 0 : minParam),\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 <XTicksAndGridLines\r\n values={xTicks.map(d => format(d, dateFormat))}\r\n x={xTicks.map(d => x(d))}\r\n y1={0}\r\n y2={graphHeight}\r\n styles={{\r\n gridLines: styles?.xAxis?.gridLines,\r\n labels: styles?.xAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: cn('opacity-0', classNames?.xAxis?.gridLines),\r\n labels: cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[8px] sm:text-[9px] md:text-[10px] lg:text-xs',\r\n classNames?.xAxis?.labels,\r\n ),\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='primary'\r\n showGridLines\r\n precision={precision}\r\n />\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <motion.g>\r\n {dataArray.map((d, i) => {\r\n return (\r\n <motion.path\r\n key={i}\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d={areaShape(d as any) as string}\r\n exit={{\r\n opacity: 0,\r\n transition: { duration: animate.duration },\r\n }}\r\n variants={{\r\n initial: {\r\n d: areaShape(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.map(el => ({ ...el, y0: 0, y1: 0 })) as any,\r\n ) as string as string,\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d: areaShape(d as any) as string,\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 style={{\r\n fill: colors[i],\r\n opacity: 0.8,\r\n }}\r\n />\r\n );\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 </motion.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 cx: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n cy: d.yCoordinate ? y(d.yCoordinate as number) : 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 {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 </motion.g>\r\n </AnimatePresence>\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 {\r\n AnnotationSettingsDataType,\r\n AreaChartDataType,\r\n CustomHighlightAreaSettingsDataType,\r\n Languages,\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 { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { ColorLegend } from '@/Components/Elements/ColorLegend';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: AreaChartDataType[];\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 /** array of colors for different lines and areas */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain: 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 /** 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 /** 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 /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\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 /** 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 /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\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 AreaChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors = Colors.light.categoricalColors.colors,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote,\r\n noOfXTicks = 10,\r\n dateFormat = 'yyyy',\r\n colorDomain,\r\n padding,\r\n backgroundColor = false,\r\n colorLegendTitle,\r\n leftMargin = 50,\r\n rightMargin = 20,\r\n topMargin = 20,\r\n bottomMargin = 25,\r\n highlightAreaSettings = [],\r\n tooltip,\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n refValues = [],\r\n graphID,\r\n minValue,\r\n maxValue,\r\n graphDownload = false,\r\n dataDownload = false,\r\n showColorScale = true,\r\n language = 'en',\r\n minHeight = 0,\r\n annotations = [],\r\n customHighlightAreaSettings = [],\r\n theme = 'light',\r\n ariaLabel,\r\n yAxisTitle,\r\n noOfYTicks = 5,\r\n prefix = '',\r\n suffix = '',\r\n curveType = 'curve',\r\n styles,\r\n classNames,\r\n precision = 2,\r\n customLayers = [],\r\n animate = false,\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 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 stacked area chart that shows trends 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 {showColorScale !== false ? (\r\n <ColorLegend\r\n colorDomain={colorDomain}\r\n colors={colors}\r\n colorLegendTitle={colorLegendTitle}\r\n showNAColor={false}\r\n />\r\n ) : null}\r\n <div className='w-full grow leading-0' ref={graphDiv} aria-label='Graph area'>\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n colors={colors}\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 dateFormat={dateFormat}\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 onSeriesMouseOver={onSeriesMouseOver}\r\n highlightAreaSettings={highlightAreaSettings}\r\n refValues={refValues}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n rtl={language === 'he' || language === 'ar'}\r\n annotations={annotations}\r\n customHighlightAreaSettings={customHighlightAreaSettings}\r\n yAxisTitle={yAxisTitle}\r\n noOfYTicks={noOfYTicks}\r\n prefix={prefix}\r\n suffix={suffix}\r\n curveType={curveType}\r\n styles={styles}\r\n classNames={classNames}\r\n precision={precision}\r\n customLayers={customLayers}\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 />\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","colors","dateFormat","noOfXTicks","rightMargin","leftMargin","topMargin","bottomMargin","yAxisTitle","tooltip","onSeriesMouseOver","highlightAreaSettings","refValues","minValue","maxValue","rtl","annotations","customHighlightAreaSettings","noOfYTicks","prefix","suffix","curveType","styles","classNames","precision","customLayers","animate","svgRef","useRef","isInView","useInView","curve","curveLinear","curveStep","curveStepAfter","curveStepBefore","curveMonotoneX","mouseOverData","setMouseOverData","useState","eventX","setEventX","eventY","setEventY","margin","MouseoverRectRef","dataFormatted","sortBy","d","parse","highlightAreaSettingsFormatted","customHighlightAreaSettingsFormatted","el","j","dataArray","_d","i","sum","_element","k","graphWidth","graphHeight","minYear","maxYear","minParam","checkIfNullOrUndefined","maxParam","x","scaleTime","y","scaleLinear","areaShape","area","yTicks","xTicks","useEffect","mousemove","event","selectedData","bisectCenter","pointer","mouseout","select","jsxs","Fragment","jsx","motion","AnimatePresence","HighlightArea","CustomArea","YTicksAndGridLines","Axis","numberFormattingFunction","AxisTitle","XTicksAndGridLines","format","cn","RefLineY","endPoints","getLineEndPoint","connectorSettings","labelSettings","Annotation","Tooltip","AreaChart","graphTitle","Colors","sources","graphDescription","footNote","colorDomain","padding","backgroundColor","colorLegendTitle","relativeHeight","graphID","graphDownload","dataDownload","showColorScale","language","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","ColorLegend","GraphFooter"],"mappings":"ktCA8EO,SAASA,GAAMC,GAAc,CAClC,KAAM,CACJ,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,OAAAC,EACA,WAAAC,EACA,WAAAC,EACA,YAAAC,EACA,WAAAC,EACA,UAAAC,GACA,aAAAC,GACA,WAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,sBAAAC,GACA,UAAAC,EACA,SAAAC,EACA,SAAAC,EACA,IAAAC,EACA,YAAAC,GACA,4BAAAC,GACA,WAAAC,EACA,O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6H,GACjCxC,EAAAA,kBAAAA,IAACzF,GAAA,CACC,KAAAE,EACA,OAAAG,EACA,MAAOF,GAAS4H,EAChB,OAAQ,KAAK,IACXH,EACAxH,IACGkH,EACGM,GACGzH,GAAS4H,GAAYT,EAAiBM,GACpCzH,GAAS4H,GAAYT,EACtBM,GACDzH,GAAS4H,GAAYT,EACxBW,EAAA,EAER,WAAA3H,GACA,WAAAC,GACA,WAAAE,EACA,YAAAD,EACA,UAAAE,EACA,aAAAC,EACA,QAAAE,GACA,kBAAAC,EACA,sBAAAC,GACA,UAAAC,EACA,SAAAC,EACA,SAAAC,EACA,IAAKyG,IAAa,MAAQA,IAAa,KACvC,YAAAvG,GACA,4BAAAC,EACA,WAAAT,EACA,WAAAU,EACA,OAAAC,EACA,OAAAC,EACA,UAAAC,EACA,OAAAC,EACA,WAAAC,EACA,UAAAC,GACA,aAAAC,GACA,QACEC,IAAY,GACR,CAAE,SAAU,GAAK,KAAM,GAAM,OAAQ,EAAA,EACrCA,GAAW,CAAE,SAAU,EAAG,KAAM,GAAM,OAAQ,CAAA,CAAE,CAAA,EAGtD,IAAA,CACN,CAAA,CAAA,CACF,CAAA,CAEJ,EACCiF,GAAWE,EACVxB,EAAAA,kBAAAA,IAACiD,GAAAA,YAAA,CACC,OAAQ,CAAE,SAAUhH,GAAQ,SAAU,OAAQA,GAAQ,MAAA,EACtD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAAoF,EACA,SAAAE,EACA,MAAA9G,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
|
|
1
|
+
{"version":3,"file":"AreaChart.cjs","sources":["../src/Components/Graphs/StackedAreaChart/Graph.tsx","../src/Components/Graphs/StackedAreaChart/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\nimport {\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 sortBy from 'lodash.sortby';\r\nimport sum from 'lodash.sum';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\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 MultiLineChartDataType,\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 { XTicksAndGridLines } from '@/Components/Elements/Axes/XTicksAndGridLines';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\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: MultiLineChartDataType[];\r\n colors: string[];\r\n width: number;\r\n height: number;\r\n dateFormat: string;\r\n noOfXTicks: number;\r\n rightMargin: number;\r\n leftMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n yAxisTitle?: string;\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 rtl: boolean;\r\n annotations: AnnotationSettingsDataType[];\r\n customHighlightAreaSettings: CustomHighlightAreaSettingsDataType[];\r\n noOfYTicks: number;\r\n prefix: string;\r\n suffix: string;\r\n curveType: CurveTypes;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n animate: AnimateDataType;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n colors,\r\n dateFormat,\r\n noOfXTicks,\r\n rightMargin,\r\n leftMargin,\r\n topMargin,\r\n bottomMargin,\r\n yAxisTitle,\r\n tooltip,\r\n onSeriesMouseOver,\r\n highlightAreaSettings,\r\n refValues,\r\n minValue,\r\n maxValue,\r\n rtl,\r\n annotations,\r\n customHighlightAreaSettings,\r\n noOfYTicks,\r\n prefix,\r\n suffix,\r\n curveType,\r\n styles,\r\n classNames,\r\n precision,\r\n customLayers,\r\n animate,\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 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 = sortBy(\r\n data.map(d => ({\r\n ...d,\r\n date: parse(`${d.date}`, dateFormat, new Date()),\r\n })),\r\n 'date',\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 dataArray = dataFormatted[0].y.map((_d, i) => {\r\n return dataFormatted.map(el => ({\r\n date: el.date,\r\n y0: i === 0 ? 0 : sum(el.y.filter((_element, k) => k < i)),\r\n y1: sum(el.y.filter((_element, k) => k <= i)),\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 = dataFormatted[0].date;\r\n const maxYear = dataFormatted[dataFormatted.length - 1].date;\r\n const minParam = checkIfNullOrUndefined(minValue) ? 0 : (minValue as number);\r\n const maxParam: number = checkIfNullOrUndefined(maxValue)\r\n ? Math.max(...data.map(d => sum(d.y) || 0))\r\n : (maxValue as number);\r\n\r\n const x = scaleTime().domain([minYear, maxYear]).range([0, graphWidth]);\r\n const y = scaleLinear().domain([minParam, maxParam]).range([graphHeight, 0]).nice();\r\n\r\n const areaShape = area()\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .x((d: any) => x(d.date))\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .y0((d: any) => y(d.y0))\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .y1((d: any) => y(d.y1))\r\n .curve(curve);\r\n const yTicks = y.ticks(noOfYTicks);\r\n const xTicks = x.ticks(noOfXTicks);\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 onSeriesMouseOver?.(undefined);\r\n }, [x, dataFormatted, onSeriesMouseOver]);\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 <AnimatePresence>\r\n <motion.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 animate={animate}\r\n areaSettings={customHighlightAreaSettingsFormatted}\r\n scaleX={x}\r\n scaleY={y}\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 dx: 0,\r\n dy: maxParam < 0 ? '1em' : -5,\r\n y: y(minParam < 0 ? 0 : minParam),\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 <XTicksAndGridLines\r\n values={xTicks.map(d => format(d, dateFormat))}\r\n x={xTicks.map(d => x(d))}\r\n y1={0}\r\n y2={graphHeight}\r\n styles={{\r\n gridLines: styles?.xAxis?.gridLines,\r\n labels: styles?.xAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: cn('opacity-0', classNames?.xAxis?.gridLines),\r\n labels: cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[8px] sm:text-[9px] md:text-[10px] lg:text-xs',\r\n classNames?.xAxis?.labels,\r\n ),\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='primary'\r\n showGridLines\r\n precision={precision}\r\n />\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <motion.g>\r\n {dataArray.map((d, i) => {\r\n return (\r\n <motion.path\r\n key={i}\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d={areaShape(d as any) as string}\r\n exit={{\r\n opacity: 0,\r\n transition: { duration: animate.duration },\r\n }}\r\n variants={{\r\n initial: {\r\n d: areaShape(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.map(el => ({ ...el, y0: 0, y1: 0 })) as any,\r\n ) as string as string,\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d: areaShape(d as any) as string,\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 style={{\r\n fill: colors[i],\r\n opacity: 0.8,\r\n }}\r\n />\r\n );\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 </motion.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 cx: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n cy: d.yCoordinate ? y(d.yCoordinate as number) : 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 {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 </motion.g>\r\n </AnimatePresence>\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 {\r\n AnnotationSettingsDataType,\r\n AreaChartDataType,\r\n CustomHighlightAreaSettingsDataType,\r\n Languages,\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 { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { ColorLegend } from '@/Components/Elements/ColorLegend';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: AreaChartDataType[];\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 /** array of colors for different lines and areas */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain: 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 /** 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 /** 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 /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\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 /** 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 /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\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 AreaChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors = Colors.light.categoricalColors.colors,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote,\r\n noOfXTicks = 10,\r\n dateFormat = 'yyyy',\r\n colorDomain,\r\n padding,\r\n backgroundColor = false,\r\n colorLegendTitle,\r\n leftMargin = 50,\r\n rightMargin = 20,\r\n topMargin = 20,\r\n bottomMargin = 25,\r\n highlightAreaSettings = [],\r\n tooltip,\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n refValues = [],\r\n graphID,\r\n minValue,\r\n maxValue,\r\n graphDownload = false,\r\n dataDownload = false,\r\n showColorScale = true,\r\n language = 'en',\r\n minHeight = 0,\r\n annotations = [],\r\n customHighlightAreaSettings = [],\r\n theme = 'light',\r\n ariaLabel,\r\n yAxisTitle,\r\n noOfYTicks = 5,\r\n prefix = '',\r\n suffix = '',\r\n curveType = 'curve',\r\n styles,\r\n classNames,\r\n precision = 2,\r\n customLayers = [],\r\n animate = false,\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 stacked area chart that shows trends 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 {showColorScale !== false ? (\r\n <ColorLegend\r\n colorDomain={colorDomain}\r\n colors={colors}\r\n colorLegendTitle={colorLegendTitle}\r\n showNAColor={false}\r\n />\r\n ) : null}\r\n <div className='w-full grow leading-0' ref={graphDiv} aria-label='Graph area'>\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n colors={colors}\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 dateFormat={dateFormat}\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 onSeriesMouseOver={onSeriesMouseOver}\r\n highlightAreaSettings={highlightAreaSettings}\r\n refValues={refValues}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n rtl={language === 'he' || language === 'ar'}\r\n annotations={annotations}\r\n customHighlightAreaSettings={customHighlightAreaSettings}\r\n yAxisTitle={yAxisTitle}\r\n noOfYTicks={noOfYTicks}\r\n prefix={prefix}\r\n suffix={suffix}\r\n curveType={curveType}\r\n styles={styles}\r\n classNames={classNames}\r\n precision={precision}\r\n customLayers={customLayers}\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 />\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","colors","dateFormat","noOfXTicks","rightMargin","leftMargin","topMargin","bottomMargin","yAxisTitle","tooltip","onSeriesMouseOver","highlightAreaSettings","refValues","minValue","maxValue","rtl","annotations","customHighlightAreaSettings","noOfYTicks","prefix","suffix","curveType","styles","classNames","precision","customLayers","animate","svgRef","useRef","isInView","useInView","curve","curveLinear","curveStep","curveStepAfter","curveStepBefore","curveMonotoneX","mouseOverData","setMouseOverData","useState","eventX","setEventX","eventY","setEventY","margin","MouseoverRectRef","dataFormatted","sortBy","d","parse","highlightAreaSettingsFormatted","customHighlightAreaSettingsFormatted","el","j","dataArray","_d","i","sum","_element","k","graphWidth","graphHeight","minYear","maxYear","minParam","checkIfNullOrUndefined","maxParam","x","scaleTime","y","scaleLinear","areaShape","area","yTicks","xTicks","useEffect","mousemove","event","selectedData","bisectCenter","pointer","mouseout","select","jsxs","Fragment","jsx","motion","AnimatePresence","HighlightArea","CustomArea","YTicksAndGridLines","Axis","numberFormattingFunction","AxisTitle","XTicksAndGridLines","format","cn","RefLineY","endPoints","getLineEndPoint","connectorSettings","labelSettings","Annotation","Tooltip","AreaChart","graphTitle","Colors","sources","graphDescription","footNote","colorDomain","padding","backgroundColor","colorLegendTitle","relativeHeight","graphID","graphDownload","dataDownload","showColorScale","language","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","ColorLegend","GraphFooter"],"mappings":"ktCA8EO,SAASA,GAAMC,GAAc,CAClC,KAAM,CACJ,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,OAAAC,EACA,WAAAC,EACA,WAAAC,EACA,YAAAC,EACA,WAAAC,EACA,UAAAC,GACA,aAAAC,GACA,WAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,sBAAAC,GACA,UAAAC,EACA,SAAAC,EACA,SAAAC,EACA,IAAAC,EACA,YAAAC,GACA,4BAAAC,GACA,WAAAC,EACA,OAAAC,EACA,OAAAC,EACA,UAAAC,EACA,OAAAC,EACA,WAAAC,EACA,UAAAC,EACA,aAAAC,EACA,QAAAC,CAAA,EACE7B,GACE8B,EAASC,EAAAA,OAAO,IAAI,EACpBC,EAAWC,GAAAA,UAAUH,EAAQ,CACjC,KAAMD,EAAQ,KACd,OAAQA,EAAQ,MAAA,CACjB,EACKK,GACJV,IAAc,SACVW,GAAAA,YACAX,IAAc,OACZY,GAAAA,UACAZ,IAAc,YACZa,GAAAA,UACAb,IAAc,aACZc,GAAAA,WACAC,GAAAA,UAEN,CAACC,EAAeC,CAAgB,EAAIC,EAAAA,SAAc,MAAS,EAC3D,CAACC,EAAQC,CAAS,EAAIF,EAAAA,SAA6B,MAAS,EAC5D,CAACG,EAAQC,CAAS,EAAIJ,EAAAA,SAA6B,MAAS,EAC5DK,EAAS,CACb,IAAKtC,GACL,OAAQC,GACR,KAAMC,EAAaH,EAAa,GAAKA,EACrC,MAAOD,CAAA,EAEHyC,EAAmBjB,EAAAA,OAAO,IAAI,EAC9BkB,EAAgBC,GAAAA,OACpBjD,EAAK,IAAIkD,IAAM,CACb,GAAGA,EACH,KAAMC,EAAAA,MAAM,GAAGD,EAAE,IAAI,GAAI9C,EAAY,IAAI,IAAM,CAAA,EAC/C,EACF,MAAA,EAEIgD,EAAiCvC,GAAsB,IAAIqC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H,GAAQ,SAAU,OAAQA,GAAQ,MAAA,EACtD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAAoF,EACA,SAAAE,EACA,MAAA9G,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
|
package/dist/AreaChart.js
CHANGED
|
@@ -37,7 +37,7 @@ function ze(oe) {
|
|
|
37
37
|
colors: V,
|
|
38
38
|
dateFormat: i,
|
|
39
39
|
noOfXTicks: D,
|
|
40
|
-
rightMargin:
|
|
40
|
+
rightMargin: n,
|
|
41
41
|
leftMargin: u,
|
|
42
42
|
topMargin: se,
|
|
43
43
|
bottomMargin: ie,
|
|
@@ -67,7 +67,7 @@ function ze(oe) {
|
|
|
67
67
|
top: se,
|
|
68
68
|
bottom: ie,
|
|
69
69
|
left: W ? u + 30 : u,
|
|
70
|
-
right:
|
|
70
|
+
right: n
|
|
71
71
|
}, J = ae(null), o = de(
|
|
72
72
|
w.map((e) => ({
|
|
73
73
|
...e,
|
|
@@ -83,21 +83,21 @@ function ze(oe) {
|
|
|
83
83
|
})), me = le.map((e) => ({
|
|
84
84
|
...e,
|
|
85
85
|
coordinates: e.coordinates.map(
|
|
86
|
-
(r,
|
|
86
|
+
(r, l) => l % 2 === 0 ? h(`${r}`, i, /* @__PURE__ */ new Date()) : r
|
|
87
87
|
)
|
|
88
|
-
})), xe = o[0].y.map((e, r) => o.map((
|
|
89
|
-
date:
|
|
90
|
-
y0: r === 0 ? 0 : fe(
|
|
91
|
-
y1: fe(
|
|
88
|
+
})), xe = o[0].y.map((e, r) => o.map((l) => ({
|
|
89
|
+
date: l.date,
|
|
90
|
+
y0: r === 0 ? 0 : fe(l.y.filter((M, $) => $ < r)),
|
|
91
|
+
y1: fe(l.y.filter((M, $) => $ <= r))
|
|
92
92
|
}))), v = A - c.left - c.right, m = N - c.top - c.bottom, K = o[0].date, Q = o[o.length - 1].date, x = Z(E) ? 0 : E, j = Z(G) ? Math.max(...w.map((e) => fe(e.y) || 0)) : G, s = Le().domain([K, Q]).range([0, v]), a = ke().domain([x, j]).range([m, 0]).nice(), T = Se().x((e) => s(e.date)).y0((e) => a(e.y0)).y1((e) => a(e.y1)).curve(ce), ge = a.ticks(L), pe = s.ticks(D);
|
|
93
93
|
return he(() => {
|
|
94
|
-
const e = (
|
|
94
|
+
const e = (l) => {
|
|
95
95
|
const M = o[Pe(
|
|
96
96
|
o.map(($) => $.date),
|
|
97
|
-
s.invert(Ve(
|
|
97
|
+
s.invert(Ve(l)[0]),
|
|
98
98
|
0
|
|
99
99
|
)];
|
|
100
|
-
B(M || o[o.length - 1]), f?.(M || o[o.length - 1]), q(
|
|
100
|
+
B(M || o[o.length - 1]), f?.(M || o[o.length - 1]), q(l.clientY), z(l.clientX);
|
|
101
101
|
}, r = () => {
|
|
102
102
|
B(void 0), z(void 0), q(void 0), f?.(void 0);
|
|
103
103
|
};
|
|
@@ -238,7 +238,7 @@ function ze(oe) {
|
|
|
238
238
|
initial: {
|
|
239
239
|
d: T(
|
|
240
240
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
241
|
-
e.map((
|
|
241
|
+
e.map((l) => ({ ...l, y0: 0, y1: 0 }))
|
|
242
242
|
),
|
|
243
243
|
opacity: 0
|
|
244
244
|
},
|
|
@@ -289,7 +289,7 @@ function ze(oe) {
|
|
|
289
289
|
r
|
|
290
290
|
)) }) : null,
|
|
291
291
|
/* @__PURE__ */ t.jsx("g", { children: ne.map((e, r) => {
|
|
292
|
-
const
|
|
292
|
+
const l = Ae(
|
|
293
293
|
{
|
|
294
294
|
x: e.xCoordinate ? s(h(`${e.xCoordinate}`, i, /* @__PURE__ */ new Date())) + (e.xOffset || 0) : 0 + (e.xOffset || 0),
|
|
295
295
|
y: e.yCoordinate ? a(e.yCoordinate) + (e.yOffset || 0) - 8 : 0 + (e.yOffset || 0) - 8
|
|
@@ -300,8 +300,8 @@ function ze(oe) {
|
|
|
300
300
|
},
|
|
301
301
|
Z(e.connectorRadius) ? 3.5 : e.connectorRadius
|
|
302
302
|
), M = e.showConnector ? {
|
|
303
|
-
y1:
|
|
304
|
-
x1:
|
|
303
|
+
y1: l.y,
|
|
304
|
+
x1: l.x,
|
|
305
305
|
y2: e.yCoordinate ? a(e.yCoordinate) + (e.yOffset || 0) : 0 + (e.yOffset || 0),
|
|
306
306
|
x2: e.xCoordinate ? s(h(`${e.xCoordinate}`, i, /* @__PURE__ */ new Date())) + (e.xOffset || 0) : 0 + (e.xOffset || 0),
|
|
307
307
|
cx: e.xCoordinate ? s(h(`${e.xCoordinate}`, i, /* @__PURE__ */ new Date())) : 0,
|
|
@@ -368,7 +368,7 @@ function Ot(oe) {
|
|
|
368
368
|
sources: V,
|
|
369
369
|
graphDescription: i,
|
|
370
370
|
height: D,
|
|
371
|
-
width:
|
|
371
|
+
width: n,
|
|
372
372
|
footNote: u,
|
|
373
373
|
noOfXTicks: se = 10,
|
|
374
374
|
dateFormat: ie = "yyyy",
|
|
@@ -410,19 +410,20 @@ function Ot(oe) {
|
|
|
410
410
|
} = oe, [m, K] = P(0), [Q, x] = P(0), j = ae(null), s = ae(null);
|
|
411
411
|
return he(() => {
|
|
412
412
|
const a = new ResizeObserver((T) => {
|
|
413
|
-
K(
|
|
413
|
+
K(n || T[0].target.clientWidth || 620), x(D || T[0].target.clientHeight || 480);
|
|
414
414
|
});
|
|
415
|
-
return j.current && (x(j.current.clientHeight || 480), K(j.current.clientWidth || 620),
|
|
416
|
-
}, [
|
|
415
|
+
return j.current && (x(j.current.clientHeight || 480), K(j.current.clientWidth || 620), n || a.observe(j.current)), () => a.disconnect();
|
|
416
|
+
}, [n, D]), /* @__PURE__ */ t.jsx(
|
|
417
417
|
"div",
|
|
418
418
|
{
|
|
419
|
-
className: `${B || "light"} flex ${
|
|
419
|
+
className: `${B || "light"} flex ${n ? "w-fit grow-0" : "w-full grow"}`,
|
|
420
420
|
dir: C === "he" || C === "ar" ? "rtl" : void 0,
|
|
421
421
|
children: /* @__PURE__ */ t.jsx(
|
|
422
422
|
"div",
|
|
423
423
|
{
|
|
424
424
|
className: te(
|
|
425
425
|
`${f ? f === !0 ? "bg-primary-gray-200 dark:bg-primary-gray-650 " : "" : "bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${C || "en"}`,
|
|
426
|
+
n ? "w-fit" : "w-full",
|
|
426
427
|
b?.graphContainer
|
|
427
428
|
),
|
|
428
429
|
style: {
|
|
@@ -451,7 +452,7 @@ function Ot(oe) {
|
|
|
451
452
|
},
|
|
452
453
|
graphTitle: A,
|
|
453
454
|
graphDescription: i,
|
|
454
|
-
width:
|
|
455
|
+
width: n,
|
|
455
456
|
graphDownload: S ? s.current : void 0,
|
|
456
457
|
dataDownload: Y ? w.map((a) => a.data).filter((a) => a !== void 0).length > 0 ? w.map((a) => a.data).filter((a) => a !== void 0) : w.filter((a) => a !== void 0) : null
|
|
457
458
|
}
|
|
@@ -466,15 +467,15 @@ function Ot(oe) {
|
|
|
466
467
|
showNAColor: !1
|
|
467
468
|
}
|
|
468
469
|
) : null,
|
|
469
|
-
/* @__PURE__ */ t.jsx("div", { className: "w-full grow leading-0", ref: j, "aria-label": "Graph area", children: (
|
|
470
|
+
/* @__PURE__ */ t.jsx("div", { className: "w-full grow leading-0", ref: j, "aria-label": "Graph area", children: (n || m) && (D || Q) ? /* @__PURE__ */ t.jsx(
|
|
470
471
|
ze,
|
|
471
472
|
{
|
|
472
473
|
data: w,
|
|
473
474
|
colors: N,
|
|
474
|
-
width:
|
|
475
|
+
width: n || m,
|
|
475
476
|
height: Math.max(
|
|
476
477
|
y,
|
|
477
|
-
D || (L ? y ? (
|
|
478
|
+
D || (L ? y ? (n || m) * L > y ? (n || m) * L : y : (n || m) * L : Q)
|
|
478
479
|
),
|
|
479
480
|
dateFormat: ie,
|
|
480
481
|
noOfXTicks: se,
|
|
@@ -514,7 +515,7 @@ function Ot(oe) {
|
|
|
514
515
|
},
|
|
515
516
|
sources: V,
|
|
516
517
|
footNote: u,
|
|
517
|
-
width:
|
|
518
|
+
width: n
|
|
518
519
|
}
|
|
519
520
|
) : null
|
|
520
521
|
] })
|