@automattic/charts 0.4.0 → 0.5.0
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/CHANGELOG.md +5 -0
- package/dist/cjs/components/bar-chart/bar-chart.js +2 -0
- package/dist/cjs/components/bar-chart/bar-chart.js.map +1 -0
- package/dist/cjs/components/bar-chart/bar-chart.module.scss.js +2 -0
- package/dist/cjs/components/bar-chart/bar-chart.module.scss.js.map +1 -0
- package/dist/cjs/components/grid-control/grid-control.js +2 -0
- package/dist/cjs/components/grid-control/grid-control.js.map +1 -0
- package/dist/cjs/components/grid-control/grid-control.module.scss.js +2 -0
- package/dist/cjs/components/grid-control/grid-control.module.scss.js.map +1 -0
- package/dist/cjs/components/legend/base-legend.js +2 -0
- package/dist/cjs/components/legend/base-legend.js.map +1 -0
- package/dist/cjs/components/legend/legend.module.scss.js +2 -0
- package/dist/cjs/components/legend/legend.module.scss.js.map +1 -0
- package/dist/cjs/components/line-chart/line-chart.js +2 -0
- package/dist/cjs/components/line-chart/line-chart.js.map +1 -0
- package/dist/cjs/components/line-chart/line-chart.module.scss.js +2 -0
- package/dist/cjs/components/line-chart/line-chart.module.scss.js.map +1 -0
- package/dist/cjs/components/pie-chart/pie-chart.js +2 -0
- package/dist/cjs/components/pie-chart/pie-chart.js.map +1 -0
- package/dist/cjs/components/pie-chart/pie-chart.module.scss.js +2 -0
- package/dist/cjs/components/pie-chart/pie-chart.module.scss.js.map +1 -0
- package/dist/cjs/components/pie-semi-circle-chart/pie-semi-circle-chart.js +2 -0
- package/dist/cjs/components/pie-semi-circle-chart/pie-semi-circle-chart.js.map +1 -0
- package/dist/cjs/components/pie-semi-circle-chart/pie-semi-circle-chart.module.scss.js +2 -0
- package/dist/cjs/components/pie-semi-circle-chart/pie-semi-circle-chart.module.scss.js.map +1 -0
- package/dist/cjs/components/shared/with-responsive.js +2 -0
- package/dist/cjs/components/shared/with-responsive.js.map +1 -0
- package/dist/cjs/components/tooltip/base-tooltip.js +2 -0
- package/dist/cjs/components/tooltip/base-tooltip.js.map +1 -0
- package/dist/cjs/components/tooltip/base-tooltip.module.scss.js +2 -0
- package/dist/cjs/components/tooltip/base-tooltip.module.scss.js.map +1 -0
- package/dist/cjs/hooks/use-chart-mouse-handler.js +2 -0
- package/dist/cjs/hooks/use-chart-mouse-handler.js.map +1 -0
- package/dist/cjs/index.css +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/providers/theme/theme-provider.js +2 -0
- package/dist/cjs/providers/theme/theme-provider.js.map +1 -0
- package/dist/cjs/providers/theme/themes.js +2 -0
- package/dist/cjs/providers/theme/themes.js.map +1 -0
- package/dist/mjs/components/bar-chart/bar-chart.js +2 -0
- package/dist/mjs/components/bar-chart/bar-chart.js.map +1 -0
- package/dist/mjs/components/bar-chart/bar-chart.module.scss.js +2 -0
- package/dist/mjs/components/bar-chart/bar-chart.module.scss.js.map +1 -0
- package/dist/mjs/components/grid-control/grid-control.js +2 -0
- package/dist/mjs/components/grid-control/grid-control.js.map +1 -0
- package/dist/mjs/components/grid-control/grid-control.module.scss.js +2 -0
- package/dist/mjs/components/grid-control/grid-control.module.scss.js.map +1 -0
- package/dist/mjs/components/legend/base-legend.js +2 -0
- package/dist/mjs/components/legend/base-legend.js.map +1 -0
- package/dist/mjs/components/legend/legend.module.scss.js +2 -0
- package/dist/mjs/components/legend/legend.module.scss.js.map +1 -0
- package/dist/mjs/components/line-chart/line-chart.js +2 -0
- package/dist/mjs/components/line-chart/line-chart.js.map +1 -0
- package/dist/mjs/components/line-chart/line-chart.module.scss.js +2 -0
- package/dist/mjs/components/line-chart/line-chart.module.scss.js.map +1 -0
- package/dist/mjs/components/pie-chart/pie-chart.js +2 -0
- package/dist/mjs/components/pie-chart/pie-chart.js.map +1 -0
- package/dist/mjs/components/pie-chart/pie-chart.module.scss.js +2 -0
- package/dist/mjs/components/pie-chart/pie-chart.module.scss.js.map +1 -0
- package/dist/mjs/components/pie-semi-circle-chart/pie-semi-circle-chart.js +2 -0
- package/dist/mjs/components/pie-semi-circle-chart/pie-semi-circle-chart.js.map +1 -0
- package/dist/mjs/components/pie-semi-circle-chart/pie-semi-circle-chart.module.scss.js +2 -0
- package/dist/mjs/components/pie-semi-circle-chart/pie-semi-circle-chart.module.scss.js.map +1 -0
- package/dist/mjs/components/shared/with-responsive.js +2 -0
- package/dist/mjs/components/shared/with-responsive.js.map +1 -0
- package/dist/mjs/components/tooltip/base-tooltip.js +2 -0
- package/dist/mjs/components/tooltip/base-tooltip.js.map +1 -0
- package/dist/mjs/components/tooltip/base-tooltip.module.scss.js +2 -0
- package/dist/mjs/components/tooltip/base-tooltip.module.scss.js.map +1 -0
- package/dist/mjs/hooks/use-chart-mouse-handler.js +2 -0
- package/dist/mjs/hooks/use-chart-mouse-handler.js.map +1 -0
- package/dist/mjs/index.css +1 -0
- package/dist/mjs/index.js +1 -1
- package/dist/mjs/index.js.map +1 -1
- package/dist/mjs/providers/theme/theme-provider.js +2 -0
- package/dist/mjs/providers/theme/theme-provider.js.map +1 -0
- package/dist/mjs/providers/theme/themes.js +2 -0
- package/dist/mjs/providers/theme/themes.js.map +1 -0
- package/package.json +3 -3
- package/rollup.config.mjs +27 -92
- package/src/components/pie-semi-circle-chart/pie-semi-circle-chart.tsx +3 -1
- package/dist/cjs/components/bar-chart/index.js +0 -2
- package/dist/cjs/components/bar-chart/index.js.map +0 -1
- package/dist/cjs/components/bar-chart/style.css +0 -95
- package/dist/cjs/components/grid-control/index.js +0 -2
- package/dist/cjs/components/grid-control/index.js.map +0 -1
- package/dist/cjs/components/grid-control/style.css +0 -95
- package/dist/cjs/components/legend/index.js +0 -2
- package/dist/cjs/components/legend/index.js.map +0 -1
- package/dist/cjs/components/legend/style.css +0 -95
- package/dist/cjs/components/line-chart/index.js +0 -2
- package/dist/cjs/components/line-chart/index.js.map +0 -1
- package/dist/cjs/components/line-chart/style.css +0 -95
- package/dist/cjs/components/pie-chart/index.js +0 -2
- package/dist/cjs/components/pie-chart/index.js.map +0 -1
- package/dist/cjs/components/pie-chart/style.css +0 -95
- package/dist/cjs/components/pie-semi-circle-chart/index.js +0 -2
- package/dist/cjs/components/pie-semi-circle-chart/index.js.map +0 -1
- package/dist/cjs/components/pie-semi-circle-chart/style.css +0 -95
- package/dist/cjs/components/tooltip/index.js +0 -2
- package/dist/cjs/components/tooltip/index.js.map +0 -1
- package/dist/cjs/components/tooltip/style.css +0 -95
- package/dist/cjs/package.json +0 -3
- package/dist/cjs/providers/theme/index.js +0 -2
- package/dist/cjs/providers/theme/index.js.map +0 -1
- package/dist/cjs/providers/theme/style.css +0 -95
- package/dist/cjs/style.css +0 -95
- package/dist/mjs/components/bar-chart/index.js +0 -2
- package/dist/mjs/components/bar-chart/index.js.map +0 -1
- package/dist/mjs/components/bar-chart/style.css +0 -95
- package/dist/mjs/components/grid-control/index.js +0 -2
- package/dist/mjs/components/grid-control/index.js.map +0 -1
- package/dist/mjs/components/grid-control/style.css +0 -95
- package/dist/mjs/components/legend/index.js +0 -2
- package/dist/mjs/components/legend/index.js.map +0 -1
- package/dist/mjs/components/legend/style.css +0 -95
- package/dist/mjs/components/line-chart/index.js +0 -2
- package/dist/mjs/components/line-chart/index.js.map +0 -1
- package/dist/mjs/components/line-chart/style.css +0 -95
- package/dist/mjs/components/pie-chart/index.js +0 -2
- package/dist/mjs/components/pie-chart/index.js.map +0 -1
- package/dist/mjs/components/pie-chart/style.css +0 -95
- package/dist/mjs/components/pie-semi-circle-chart/index.js +0 -2
- package/dist/mjs/components/pie-semi-circle-chart/index.js.map +0 -1
- package/dist/mjs/components/pie-semi-circle-chart/style.css +0 -95
- package/dist/mjs/components/tooltip/index.js +0 -2
- package/dist/mjs/components/tooltip/index.js.map +0 -1
- package/dist/mjs/components/tooltip/style.css +0 -95
- package/dist/mjs/package.json +0 -3
- package/dist/mjs/providers/theme/index.js +0 -2
- package/dist/mjs/providers/theme/index.js.map +0 -1
- package/dist/mjs/providers/theme/style.css +0 -95
- package/dist/mjs/style.css +0 -95
- package/tools/fixup.sh +0 -11
package/dist/mjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{AxisLeft as l,AxisBottom as i}from"@visx/axis";import{localPoint as o}from"@visx/event";import{Group as r}from"@visx/group";import{scaleOrdinal as n,scaleBand as s,scaleLinear as c}from"@visx/scale";import{Bar as d,Pie as h}from"@visx/shape";import{useTooltip as m}from"@visx/tooltip";import p from"clsx";import{createContext as g,useContext as u,useCallback as v}from"react";import{GridRows as _,GridColumns as b}from"@visx/grid";import{LegendOrdinal as f}from"@visx/legend";import{useParentSize as x}from"@visx/responsive";import{LinearGradient as y}from"@visx/gradient";import{buildChartTheme as w,XYChart as N,AnimatedGrid as k,AnimatedAxis as L,AnimatedLineSeries as T,AnimatedAreaSeries as M,Tooltip as D}from"@visx/xychart";import C from"@visx/shape/lib/shapes/Pie";import{Text as S}from"@visx/text";const F={backgroundColor:"#FFFFFF",labelBackgroundColor:"#FFFFFF",colors:["#98C8DF","#006DAB","#A6DC80","#1F9828","#FF8C8F"],gridStyles:{stroke:"#787C82",strokeWidth:1},tickLength:0,gridColor:"",gridColorDark:""},A=g(F),O=()=>u(A),z=({theme:t={},children:a})=>{const l={...F,...t};return e(A.Provider,{value:l,children:a})};var $="grid-control-module__grid-control__KOnZN";const I=({width:a,height:l,xScale:i,yScale:o,gridVisibility:r="x",top:n=0})=>t("g",{transform:`translate(0, ${n})`,className:$,children:[r.includes("x")&&e(_,{scale:i,width:a}),r.includes("y")&&e(b,{scale:o,height:l})]});var P={"legend--horizontal":"legend-module__legend--horizontal__IUN13","legend--vertical":"legend-module__legend--vertical__Scfzo","legend-item":"legend-module__legend-item__feemn","legend-item-swatch":"legend-module__legend-item-swatch__nRyXf","legend-item-label":"legend-module__legend-item-label__ksx6I","legend-item-value":"legend-module__legend-item-value__d9x1j"};const R={horizontal:"row",vertical:"column"},V=({items:a,className:l,orientation:i="horizontal"})=>{const o=n({domain:a.map((e=>e.label)),range:a.map((e=>e.color))});return e("div",{className:p(P.legend,P[`legend--${i}`],l),role:"list",children:e(f,{scale:o,direction:R[i],shape:"rect",shapeWidth:16,shapeHeight:16,className:P["legend-items"],children:l=>e("div",{className:P[`legend--${i}`],children:l.map((l=>t("div",{className:P["legend-item"],children:[e("svg",{width:16,height:16,children:e("rect",{width:16,height:16,fill:l.value,className:P["legend-item-swatch"]})}),t("span",{className:P["legend-item-label"],children:[l.text,a.find((e=>e.label===l.text))?.value&&e("span",{className:P["legend-item-value"],children:a.find((e=>e.label===l.text))?.value})]})]},l.text)))})})})};function B(t,a){const{maxWidth:l=1200,aspectRatio:i=.5,debounceTime:o=50}=a||{};return function(a){const{parentRef:r,width:n}=x({debounceTime:o,enableDebounceLeadingCall:!0,initialSize:{width:600,height:400}}),s=n?Math.min(n,l):600,c=s*i;return e("div",{ref:r,style:{width:"100%",minHeight:`${c}px`},children:e(t,{width:s,height:c,size:s,...a})})}}var K="base-tooltip-module__tooltip__OfX6n";const W=({data:e})=>t(a,{children:[e?.label,": ",e?.valueDisplay||e?.value]}),j=({data:t,top:a,left:l,component:i=W,children:o,className:r})=>e("div",{className:K,style:{top:a,left:l},role:"tooltip",children:o||t&&e(i,{data:t,className:r})});var q={"bar-chart":"bar-chart-module__bar-chart__lmYNi","bar-chart-legend":"bar-chart-module__bar-chart-legend__vgKKq"};const Y=({data:a,margin:n={top:20,right:20,bottom:40,left:40},withTooltips:h=!1,showLegend:g=!1,legendOrientation:u="horizontal",className:_,gridVisibility:b="x",width:f,height:x=400})=>{const y=O(),{tooltipOpen:w,tooltipLeft:N,tooltipTop:k,tooltipData:L,hideTooltip:T,showTooltip:M}=m(),D=v(((e,t,a,l,i)=>{const r=o(e);r&&M({tooltipData:{value:t,xLabel:a,yLabel:l,seriesIndex:i},tooltipLeft:r.x,tooltipTop:r.y-10})}),[M]),C=v((()=>{T()}),[T]);if(!a?.length)return e("div",{className:p("bar-chart-empty",q["bat-chart-empty"]),children:"Empty..."});const S=n,F=f-S.left-S.right,A=x-S.top-S.bottom,z=a[0].data?.map((e=>e?.label||"")),$=s({range:[0,F],domain:z,padding:.2}),P=s({range:[0,$.bandwidth()],domain:a.map(((e,t)=>t.toString())),padding:.1}),R=c({range:[A,0],domain:[0,Math.max(...a.map((e=>Math.max(...e.data.map((e=>e?.value||0))))))]}),B=a.map(((e,t)=>({label:e.label,value:"",color:y.colors[t%y.colors.length]})));return t("div",{className:p("bar-chart",_,q["bar-chart"]),children:[e("svg",{width:f,height:x,children:t(r,{left:S.left,top:S.top,children:[e(I,{width:F,height:A,xScale:$,yScale:R,gridVisibility:b}),a.map(((t,a)=>e(r,{children:t.data.map((l=>{const i=$(l?.label||"");if(void 0===i)return null;const o=P.bandwidth(),r=i+(P(a.toString())??0);return e(d,{x:r,y:R(l.value),width:o,height:A-(R(l.value)??0),fill:y.colors[a%y.colors.length],onMouseMove:h?e=>D(e,l.value,l?.label||"",t.label,a):void 0,onMouseLeave:h?C:void 0},`bar-${a}-${l.label}`)}))},a))),e(l,{scale:R}),e(i,{scale:$,top:A})]})}),h&&w&&L&&e(j,{top:k||0,left:N||0,children:t("div",{children:[e("div",{children:L.yLabel}),t("div",{children:[L.xLabel,": ",L.value]})]})}),g&&e(V,{items:B,orientation:u,className:q["bar-chart-legend"]})]})};Y.displayName="BarChart";var E=B(Y),G={"line-chart":"line-chart-module__line-chart__ITM3d","line-chart__tooltip":"line-chart-module__line-chart__tooltip__aqcme","line-chart__tooltip-date":"line-chart-module__line-chart__tooltip-date__4Dzab","line-chart__tooltip-row":"line-chart-module__line-chart__tooltip-row__6A37G","line-chart__tooltip-label":"line-chart-module__line-chart__tooltip-label__IvnFF"};const X=({tooltipData:a})=>{const l=a?.nearestDatum?.datum;if(!l)return null;const i=Object.entries(a?.datumByKey||{}).map((([e,{datum:t}])=>({key:e,value:t.value}))).sort(((e,t)=>t.value-e.value));return t("div",{className:G["line-chart__tooltip"],children:[e("div",{className:G["line-chart__tooltip-date"],children:l.date.toLocaleDateString()}),i.map((a=>t("div",{className:G["line-chart__tooltip-row"],children:[t("span",{className:G["line-chart__tooltip-label"],children:[a.key,":"]}),e("span",{className:G["line-chart__tooltip-value"],children:a.value})]},a.key)))]})},H=e=>new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"});var Z=B((({data:l,width:i,height:o,margin:r={top:20,right:20,bottom:40,left:40},className:n,withTooltips:s=!0,showLegend:c=!1,legendOrientation:d="horizontal",withGradientFill:h=!1,options:m={}})=>{const g=O();if(!l?.length)return e("div",{className:p("line-chart-empty",G["line-chart-empty"]),children:"Empty..."});const u=l.map(((e,t)=>({label:e.label,value:"",color:g.colors[t%g.colors.length]}))),v={xAccessor:e=>e.date,yAccessor:e=>e.value},_=w({backgroundColor:g.backgroundColor,colors:g.colors,gridStyles:g.gridStyles,tickLength:g?.tickLength||0,gridColor:g?.gridColor||"",gridColorDark:g?.gridColorDark||""});return t("div",{className:p("line-chart",G["line-chart"],n),children:[t(N,{theme:_,width:i,height:o,margin:r,xScale:{type:"time"},yScale:{type:"linear",nice:!0},children:[e(k,{columns:!1,numTicks:4}),e(L,{orientation:"bottom",numTicks:5,tickFormat:H,...m?.axis?.x}),e(L,{orientation:"left",numTicks:4,...m?.axis?.y}),l.map(((l,i)=>{const o=l.options?.stroke??_.colors[i%_.colors.length];return t(a,{children:[e(y,{id:`area-gradient-${i+1}`,from:o,to:"white",toOpacity:.1,...l.options?.gradient}),e(T,{dataKey:l?.label,data:l.data,...v,stroke:o,strokeWidth:2},l?.label),h&&e(M,{dataKey:l?.label,data:l.data,...v,stroke:o,strokeWidth:0,fill:`url(#area-gradient-${i+1})`,renderLine:!1},l?.label)]})})),s&&e(D,{snapTooltipToDatumX:!0,snapTooltipToDatumY:!0,showSeriesGlyphs:!0,renderTooltip:X})]}),c&&e(V,{items:u,orientation:d,className:G["line-chart-legend"]})]})}));const Q=({withTooltips:e})=>{const{tooltipOpen:t,tooltipLeft:a,tooltipTop:l,tooltipData:i,hideTooltip:r,showTooltip:n}=m();return{onMouseMove:v(((t,a)=>{if(!e)return;const l=o(t);l&&n({tooltipData:a,tooltipLeft:l.x,tooltipTop:l.y-10})}),[e,n]),onMouseLeave:v((()=>{e&&r()}),[e,r]),tooltipOpen:t,tooltipData:i||null,tooltipLeft:a,tooltipTop:l}};var U={"pie-chart":"pie-chart-module__pie-chart__R12Vh"};const J=({data:a,withTooltips:l=!1,className:i,showLegend:o,legendOrientation:n,size:s,thickness:c=1,padding:d=20,gapScale:m=0,cornerScale:g=0})=>{const u=O(),{onMouseMove:v,onMouseLeave:_,tooltipOpen:b,tooltipData:f,tooltipLeft:x,tooltipTop:y}=Q({withTooltips:l}),{isValid:w,message:N}=(e=>{if(!e.length)return{isValid:!1,message:"No data available"};if(e.some((e=>e.percentage<0||e.value<0)))return{isValid:!1,message:"Invalid data: Negative values are not allowed"};const t=e.reduce(((e,t)=>e+t.percentage),0);return Math.abs(t-100)>.01?{isValid:!1,message:"Invalid percentage total: Must equal 100"}:{isValid:!0,message:""}})(a);if(!w)return e("div",{className:p("pie-chart",U["pie-chart"],i),children:e("div",{className:U["error-message"],children:N})});const k=s,L=s,T=Math.min(k,L)/2,M=k/2,D=L/2,C=m*(2*Math.PI/a.length),S=T-d,A=S*(1-c),z=(S-A)/2,$=g?Math.min(g*S,z):0,I=a.map(((e,t)=>({...e,index:t}))),P={value:e=>e.value,fill:e=>e?.color||u.colors[e.index]},R=a.map(((e,t)=>({label:e.label,value:e.value.toString(),color:u.colors[t%u.colors.length]})));return t("div",{className:p("pie-chart",U["pie-chart"],i),children:[e("svg",{viewBox:`0 0 ${s} ${s}`,preserveAspectRatio:"xMidYMid meet",children:e(r,{top:D,left:M,children:e(h,{data:I,pieValue:P.value,outerRadius:S,innerRadius:A,padAngle:C,cornerRadius:$,children:a=>a.arcs.map(((i,o)=>{const[r,n]=a.path.centroid(i),s=i.endAngle-i.startAngle>=.25,c=e=>v(e,i.data),d={d:a.path(i)||"",fill:P.fill(i.data)};return l&&(d.onMouseMove=c,d.onMouseLeave=_),t("g",{children:[e("path",{...d}),s&&e("text",{x:r,y:n,dy:".33em",fill:u.labelBackgroundColor||F.labelBackgroundColor,fontSize:12,textAnchor:"middle",pointerEvents:"none",children:i.data.label})]},`arc-${o}`)}))})})}),o&&e(V,{items:R,orientation:n,className:U["pie-chart-legend"]}),l&&b&&f&&e(j,{data:f,top:y||0,left:x||0,style:{transform:"translate(-50%, -100%)"}})]})};J.displayName="PieChart";var ee=B(J),te="pie-semi-circle-chart-module__pie-semi-circle-chart__r5jk9",ae="pie-semi-circle-chart-module__pie-semi-circle-chart-legend__c8W1Y",le="pie-semi-circle-chart-module__label__nPqOg",ie="pie-semi-circle-chart-module__note__LpBZQ";const oe=({data:a,size:l=500,label:i,note:n,className:s,withTooltips:c=!1,clockwise:d=!0,thickness:h=.4,showLegend:g,legendOrientation:u})=>{const _=O(),{tooltipOpen:b,tooltipLeft:f,tooltipTop:x,tooltipData:y,hideTooltip:w,showTooltip:N}=m(),k=l/2,L=l/2,T=l/2,M=T*(1-h+.03),D=a.map(((e,t)=>({...e,index:t}))),F=d?-Math.PI/2:Math.PI/2,A=d?Math.PI/2:-Math.PI/2,z={value:e=>e.value,sort:(e,t)=>t.value-e.value,fill:e=>e.color||_.colors[e.index%_.colors.length]},$=v(((e,t)=>{const a=o(e);a&&N({tooltipData:t.data,tooltipLeft:a.x,tooltipTop:a.y-10})}),[N]),I=v((()=>{w()}),[w]),P=v((e=>t=>{$(t,e)}),[$]),R=a.map(((e,t)=>({label:e.label,value:e.valueDisplay||e.value.toString(),color:z.fill({...e,index:t})})));return t("div",{className:p("pie-semi-circle-chart",te,s),children:[e("svg",{viewBox:`0 0 ${l} ${L}`,children:t(r,{top:k,left:k,children:[e(C,{data:D,pieValue:z.value,outerRadius:T,innerRadius:M,cornerRadius:3,padAngle:.03,startAngle:F,endAngle:A,pieSort:z.sort,children:t=>t.arcs.map((a=>e("g",{onMouseMove:P(a),onMouseLeave:I,children:e("path",{d:t.path(a)||"",fill:z.fill(a.data)})},a.data.label)))}),t(r,{children:[e(S,{textAnchor:"middle",verticalAnchor:"start",y:-40,className:le,children:i}),e(S,{textAnchor:"middle",verticalAnchor:"start",y:-20,className:ie,children:n})]})]})}),c&&b&&y&&e(j,{data:{label:y.label,value:y.value,valueDisplay:y.valueDisplay},top:x||0,left:f||0}),g&&e(V,{items:R,orientation:u,className:ae})]})};oe.displayName="PieSemiCircleChart";var re=B(oe);export{E as BarChart,j as BaseTooltip,V as Legend,Z as LineChart,ee as PieChart,re as PieSemiCircleChart,z as ThemeProvider,Q as useChartMouseHandler};
|
|
1
|
+
export{default as BarChart}from"./components/bar-chart/bar-chart.js";export{default as LineChart}from"./components/line-chart/line-chart.js";export{default as PieChart}from"./components/pie-chart/pie-chart.js";export{default as PieSemiCircleChart}from"./components/pie-semi-circle-chart/pie-semi-circle-chart.js";export{BaseTooltip}from"./components/tooltip/base-tooltip.js";export{BaseLegend as Legend}from"./components/legend/base-legend.js";export{ThemeProvider}from"./providers/theme/theme-provider.js";export{default as useChartMouseHandler}from"./hooks/use-chart-mouse-handler.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/mjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/providers/theme/themes.ts","../../src/providers/theme/theme-provider.tsx","../../src/components/grid-control/grid-control.tsx","../../src/components/legend/base-legend.tsx","../../src/components/shared/with-responsive.tsx","../../src/components/tooltip/base-tooltip.tsx","../../src/components/bar-chart/bar-chart.tsx","../../src/components/line-chart/line-chart.tsx","../../src/hooks/use-chart-mouse-handler.ts","../../src/components/pie-chart/pie-chart.tsx","../../src/components/pie-semi-circle-chart/pie-semi-circle-chart.tsx"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null],"names":["defaultTheme","backgroundColor","labelBackgroundColor","colors","gridStyles","stroke","strokeWidth","tickLength","gridColor","gridColorDark","ThemeContext","createContext","useChartTheme","useContext","ThemeProvider","theme","children","mergedTheme","_jsx","Provider","value","GridControl","width","height","xScale","yScale","gridVisibility","top","_jsxs","transform","className","styles","includes","GridRows","scale","GridColumns","orientationToFlexDirection","horizontal","vertical","BaseLegend","items","orientation","legendScale","scaleOrdinal","domain","map","item","label","range","color","clsx","legend","role","LegendOrdinal","direction","shape","shapeWidth","shapeHeight","labels","fill","text","find","withResponsive","WrappedComponent","config","maxWidth","aspectRatio","debounceTime","props","parentRef","parentWidth","useParentSize","enableDebounceLeadingCall","initialSize","containerWidth","Math","min","containerHeight","ref","style","minHeight","size","DefaultTooltipContent","data","_Fragment","valueDisplay","BaseTooltip","left","component","Component","BarChart","margin","right","bottom","withTooltips","showLegend","legendOrientation","tooltipOpen","tooltipLeft","tooltipTop","tooltipData","hideTooltip","showTooltip","useTooltip","handleMouseMove","useCallback","event","xLabel","yLabel","seriesIndex","coords","localPoint","x","y","handleMouseLeave","length","margins","xMax","yMax","d","scaleBand","padding","innerScale","bandwidth","_","i","toString","scaleLinear","max","series","legendItems","group","index","Group","xPos","undefined","barWidth","barX","Bar","onMouseMove","onMouseLeave","AxisLeft","AxisBottom","Legend","displayName","barChart","renderTooltip","nearestDatum","datum","tooltipPoints","Object","entries","datumByKey","key","sort","a","b","date","toLocaleDateString","point","formatDateTick","Date","month","day","lineChart","withGradientFill","options","providerTheme","accessors","xAccessor","yAccessor","buildChartTheme","XYChart","type","nice","AnimatedGrid","columns","numTicks","AnimatedAxis","tickFormat","axis","seriesData","LinearGradient","id","from","to","toOpacity","gradient","AnimatedLineSeries","dataKey","AnimatedAreaSeries","renderLine","Tooltip","snapTooltipToDatumX","snapTooltipToDatumY","showSeriesGlyphs","useChartMouseHandler","PieChart","thickness","gapScale","cornerScale","isValid","message","some","percentage","totalPercentage","reduce","sum","abs","validateData","radius","centerX","centerY","padAngle","PI","outerRadius","innerRadius","maxCornerRadius","cornerRadius","dataWithIndex","viewBox","preserveAspectRatio","Pie","pieValue","pie","arcs","arc","centroidX","centroidY","path","centroid","hasSpaceForLabel","endAngle","startAngle","pathProps","dy","fontSize","textAnchor","pointerEvents","pieChart","PieSemiCircleChart","note","clockwise","handleArcMouseMove","pieSort","Text","verticalAnchor","pieSemiCircleChart"],"mappings":"82BAKA,MAAMA,EAA2B,CAChCC,gBAAiB,UACjBC,qBAAsB,UACtBC,OAAQ,CAAE,UAAW,UAAW,UAAW,UAAW,WACtDC,WAAY,CACXC,OAAQ,UACRC,YAAa,GAEdC,WAAY,EACZC,UAAW,GACXC,cAAe,ICRVC,EAAeC,EAA6BX,GAM5CY,EAAgB,IACPC,EAAYH,GAgBrBI,EAA0C,EAAIC,QAAQ,CAAE,EAAEC,eAC/D,MAAMC,EAAc,IAAKjB,KAAiBe,GAC1C,OAAOG,EAACR,EAAaS,SAAQ,CAACC,MAAQH,EAAWD,SAAKA,GAAkC,mDC3BzF,MAAMK,EAAqC,EAC1CC,QACAC,SACAC,SACAC,SACAC,iBAAiB,IACjBC,MAAM,KAGLC,EAAG,IAAA,CAAAC,UAAY,gBAAiBF,KAAUG,UAAYC,EAAwBf,SAAA,CAC3EU,EAAeM,SAAU,MAASd,EAACe,EAAQ,CAACC,MAAQV,EAASF,MAAQA,IACrEI,EAAeM,SAAU,MAASd,EAACiB,EAAW,CAACD,MAAQT,EAASF,OAASA,yXCD9E,MAAMa,EAA6B,CAClCC,WAAY,MACZC,SAAU,UAGEC,EAAgC,EAC5CC,QACAV,YACAW,cAAc,iBAEd,MAAMC,EAAcC,EAAc,CACjCC,OAAQJ,EAAMK,KAAKC,GAAQA,EAAKC,QAChCC,MAAOR,EAAMK,KAAKC,GAAQA,EAAKG,UAGhC,OACC/B,SACCY,UAAYoB,EAAMnB,EAAOoB,OAAQpB,EAAQ,WAAYU,KAAkBX,GACvEsB,KAAK,OAELpC,SAAAE,EAACmC,EACA,CAAAnB,MAAQQ,EACRY,UAAYlB,EAA4BK,GACxCc,MAAM,OACNC,WAAa,GACbC,YAA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3B,MAAOgF,EAAYhF,MACnBiE,aAAce,EAAYf,cAE3B1D,IAAMwE,GAAc,EACpBZ,KAAOW,GAAe,IAItBH,GACD7E,EAAC6H,EACA,CAAAvG,MAAQ0F,EACRzF,YAAcuD,EACdlE,UAAYC,OAId,EAGHiN,GAAmBhG,YAAc,qBACjC,IAAeuG,GAAAzL,EAA2CkL"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{createContext as e,useContext as t}from"react";import{defaultTheme as o}from"./themes.js";const m=e(o),i=()=>t(m),c=({theme:e={},children:t})=>{const i={...o,...e};return r(m.Provider,{value:i,children:t})};export{c as ThemeProvider,i as useChartTheme};
|
|
2
|
+
//# sourceMappingURL=theme-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-provider.js","sources":["../../../../src/providers/theme/theme-provider.tsx"],"sourcesContent":[null],"names":["ThemeContext","createContext","defaultTheme","useChartTheme","useContext","ThemeProvider","theme","children","mergedTheme","_jsx","Provider","value"],"mappings":"yIAOA,MAAMA,EAAeC,EAA6BC,GAM5CC,EAAgB,IACPC,EAAYJ,GAgBrBK,EAA0C,EAAIC,QAAQ,CAAE,EAAEC,eAC/D,MAAMC,EAAc,IAAKN,KAAiBI,GAC1C,OAAOG,EAACT,EAAaU,SAAQ,CAACC,MAAQH,EAAWD,SAAKA,GAAkC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themes.js","sources":["../../../../src/providers/theme/themes.ts"],"sourcesContent":[null],"names":["defaultTheme","backgroundColor","labelBackgroundColor","colors","gridStyles","stroke","strokeWidth","tickLength","gridColor","gridColorDark"],"mappings":"AAKA,MAAMA,EAA2B,CAChCC,gBAAiB,UACjBC,qBAAsB,UACtBC,OAAQ,CAAE,UAAW,UAAW,UAAW,UAAW,WACtDC,WAAY,CACXC,OAAQ,UACRC,YAAa,GAEdC,WAAY,EACZC,UAAW,GACXC,cAAe"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/charts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Display charts within Automattic products.",
|
|
5
5
|
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/charts/#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"compile-ts": "tsc --pretty",
|
|
22
22
|
"clean-build": "rm -rf dist/",
|
|
23
23
|
"build": "pnpm run build:prod",
|
|
24
|
-
"build:prod": "pnpm run clean && rollup -c --environment NODE_ENV:production
|
|
24
|
+
"build:prod": "pnpm run clean && rollup -c --environment NODE_ENV:production",
|
|
25
25
|
"build:dev": "rollup -c --environment NODE_ENV:development",
|
|
26
|
-
"build:webpack": "pnpm run clean-build && webpack --config webpack.config.cjs --mode production &&
|
|
26
|
+
"build:webpack": "pnpm run clean-build && webpack --config webpack.config.cjs --mode production && pnpm run build:types",
|
|
27
27
|
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types"
|
|
28
28
|
},
|
|
29
29
|
"main": "./dist/cjs/index.js",
|
package/rollup.config.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// Import necessary plugins for building the library
|
|
2
1
|
import commonjs from '@rollup/plugin-commonjs';
|
|
3
2
|
import json from '@rollup/plugin-json';
|
|
4
3
|
import resolve from '@rollup/plugin-node-resolve';
|
|
@@ -9,61 +8,44 @@ import dts from 'rollup-plugin-dts';
|
|
|
9
8
|
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
|
|
10
9
|
import postcss from 'rollup-plugin-postcss';
|
|
11
10
|
|
|
12
|
-
// Common plugins used across all build configurations
|
|
13
|
-
const commonPlugins = [
|
|
14
|
-
// Automatically externalize peer dependencies
|
|
15
|
-
peerDepsExternal( {
|
|
16
|
-
includeDependencies: true,
|
|
17
|
-
} ),
|
|
18
|
-
// Locate and bundle third-party dependencies from node_modules
|
|
19
|
-
resolve( {
|
|
20
|
-
preferBuiltins: true,
|
|
21
|
-
extensions: [ '.tsx', '.ts', '.js', '.jsx' ],
|
|
22
|
-
} ),
|
|
23
|
-
// Convert CommonJS modules to ES6
|
|
24
|
-
commonjs(),
|
|
25
|
-
// Allow importing JSON files
|
|
26
|
-
json(),
|
|
27
|
-
// Process SCSS/CSS modules
|
|
28
|
-
postcss( {
|
|
29
|
-
// Configure CSS modules with scoped names
|
|
30
|
-
modules: {
|
|
31
|
-
generateScopedName: '[name]__[local]__[hash:base64:5]',
|
|
32
|
-
},
|
|
33
|
-
extract: 'style.css',
|
|
34
|
-
autoModules: false,
|
|
35
|
-
use: [ 'sass' ],
|
|
36
|
-
} ),
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
// Main bundle configuration for the entire library
|
|
40
11
|
const mainConfig = {
|
|
41
|
-
// Entry point for the bundle
|
|
42
12
|
input: 'src/index.ts',
|
|
43
|
-
// Output configuration for different module formats
|
|
44
13
|
output: [
|
|
45
14
|
{
|
|
46
|
-
|
|
47
|
-
format: 'cjs',
|
|
15
|
+
dir: './dist/cjs/',
|
|
16
|
+
format: 'cjs',
|
|
17
|
+
preserveModules: true,
|
|
18
|
+
preserveModulesRoot: 'src',
|
|
48
19
|
sourcemap: true,
|
|
49
|
-
sourcemapPathTransform: relativeSourcePath => {
|
|
50
|
-
return `/@automattic/charts/${ relativeSourcePath }`;
|
|
51
|
-
},
|
|
20
|
+
sourcemapPathTransform: relativeSourcePath => `/@automattic/charts/${ relativeSourcePath }`,
|
|
52
21
|
},
|
|
53
22
|
{
|
|
54
|
-
|
|
55
|
-
format: 'esm',
|
|
23
|
+
dir: './dist/mjs/',
|
|
24
|
+
format: 'esm',
|
|
25
|
+
preserveModules: true,
|
|
26
|
+
preserveModulesRoot: 'src',
|
|
56
27
|
sourcemap: true,
|
|
57
28
|
},
|
|
58
29
|
],
|
|
59
|
-
// Mark all dependencies as external to avoid bundling them
|
|
60
30
|
external: [ 'react', 'react-dom', /^@visx\/.*/, '@react-spring/web', 'clsx', 'tslib' ],
|
|
61
31
|
plugins: [
|
|
62
|
-
|
|
63
|
-
|
|
32
|
+
peerDepsExternal( { includeDependencies: true } ),
|
|
33
|
+
resolve( {
|
|
34
|
+
preferBuiltins: true,
|
|
35
|
+
extensions: [ '.tsx', '.ts', '.js', '.jsx' ],
|
|
36
|
+
} ),
|
|
37
|
+
commonjs(),
|
|
38
|
+
json(),
|
|
39
|
+
postcss( {
|
|
40
|
+
extract: true, // Generate individual CSS files
|
|
41
|
+
autoModules: true, // Automatically handle .module.scss as CSS modules
|
|
42
|
+
modules: true, // Enable CSS modules
|
|
43
|
+
use: [ 'sass' ], // Enable SCSS support
|
|
44
|
+
minimize: true, // Minify the CSS
|
|
45
|
+
} ),
|
|
64
46
|
typescript( {
|
|
65
47
|
tsconfig: './tsconfig.json',
|
|
66
|
-
declaration: false,
|
|
48
|
+
declaration: false,
|
|
67
49
|
sourceMap: true,
|
|
68
50
|
compilerOptions: {
|
|
69
51
|
verbatimModuleSyntax: true,
|
|
@@ -71,7 +53,6 @@ const mainConfig = {
|
|
|
71
53
|
} ),
|
|
72
54
|
terser(),
|
|
73
55
|
],
|
|
74
|
-
// Handle circular dependencies warning
|
|
75
56
|
onwarn( warning, warn ) {
|
|
76
57
|
if ( warning.code === 'CIRCULAR_DEPENDENCY' ) {
|
|
77
58
|
return;
|
|
@@ -80,55 +61,10 @@ const mainConfig = {
|
|
|
80
61
|
},
|
|
81
62
|
};
|
|
82
63
|
|
|
83
|
-
// List of components to build individually
|
|
84
|
-
const components = [
|
|
85
|
-
'components/bar-chart',
|
|
86
|
-
'components/line-chart',
|
|
87
|
-
'components/pie-chart',
|
|
88
|
-
'components/pie-semi-circle-chart',
|
|
89
|
-
'components/tooltip',
|
|
90
|
-
'components/legend',
|
|
91
|
-
'components/grid-control',
|
|
92
|
-
'providers/theme',
|
|
93
|
-
];
|
|
94
|
-
|
|
95
|
-
// Generate individual bundles for each component
|
|
96
|
-
const componentConfigs = components.map( component => ( {
|
|
97
|
-
// Component entry point - try both .tsx and .ts extensions
|
|
98
|
-
input: `src/${ component }/index`,
|
|
99
|
-
// Output both ESM and CJS formats
|
|
100
|
-
output: [
|
|
101
|
-
{
|
|
102
|
-
file: `dist/mjs/${ component }/index.js`,
|
|
103
|
-
format: 'esm',
|
|
104
|
-
sourcemap: true,
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
file: `dist/cjs/${ component }/index.js`,
|
|
108
|
-
format: 'cjs',
|
|
109
|
-
sourcemap: true,
|
|
110
|
-
},
|
|
111
|
-
],
|
|
112
|
-
// Same external config as main bundle
|
|
113
|
-
external: [ 'react', 'react-dom', /^@visx\/.*/, '@react-spring/web', 'clsx', 'tslib' ],
|
|
114
|
-
plugins: [
|
|
115
|
-
...commonPlugins,
|
|
116
|
-
typescript( {
|
|
117
|
-
tsconfig: './tsconfig.json',
|
|
118
|
-
declaration: false,
|
|
119
|
-
sourceMap: true,
|
|
120
|
-
compilerOptions: {
|
|
121
|
-
verbatimModuleSyntax: true,
|
|
122
|
-
},
|
|
123
|
-
} ),
|
|
124
|
-
terser(),
|
|
125
|
-
],
|
|
126
|
-
} ) );
|
|
127
|
-
|
|
128
64
|
// Configuration for generating TypeScript declaration files
|
|
129
|
-
const
|
|
65
|
+
const dtsConfig = {
|
|
130
66
|
input: 'src/index.ts',
|
|
131
|
-
output: [ { file: 'dist/index.d.ts'
|
|
67
|
+
output: [ { file: 'dist/index.d.ts' } ],
|
|
132
68
|
plugins: [
|
|
133
69
|
dts( {
|
|
134
70
|
respectExternal: true,
|
|
@@ -138,5 +74,4 @@ const typesConfig = {
|
|
|
138
74
|
external: [ /\.scss$/, /\.css$/, 'react', /@types\/.*/, /^@visx\/.*/, 'react/jsx-runtime' ],
|
|
139
75
|
};
|
|
140
76
|
|
|
141
|
-
|
|
142
|
-
export default defineConfig( [ mainConfig, ...componentConfigs, typesConfig ] );
|
|
77
|
+
export default defineConfig( [ mainConfig, dtsConfig ] );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { localPoint } from '@visx/event';
|
|
2
2
|
import { Group } from '@visx/group';
|
|
3
|
-
import
|
|
3
|
+
import { Pie } from '@visx/shape';
|
|
4
4
|
import { Text } from '@visx/text';
|
|
5
5
|
import { useTooltip } from '@visx/tooltip';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -11,6 +11,8 @@ import { withResponsive } from '../shared/with-responsive';
|
|
|
11
11
|
import { BaseTooltip } from '../tooltip';
|
|
12
12
|
import styles from './pie-semi-circle-chart.module.scss';
|
|
13
13
|
import type { BaseChartProps, DataPointPercentage } from '../../types';
|
|
14
|
+
import type { PieArcDatum } from '@visx/shape/lib/shapes/Pie';
|
|
15
|
+
|
|
14
16
|
interface PieSemiCircleChartProps extends BaseChartProps< DataPointPercentage[] > {
|
|
15
17
|
/**
|
|
16
18
|
* Size of the chart in pixels
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),l=require("@visx/axis"),t=require("@visx/event"),a=require("@visx/group"),i=require("@visx/scale"),r=require("@visx/shape"),s=require("@visx/tooltip"),o=require("clsx"),n=require("react"),d=require("@visx/grid"),c=require("@visx/legend"),h=require("@visx/responsive");const g=n.createContext({backgroundColor:"#FFFFFF",labelBackgroundColor:"#FFFFFF",colors:["#98C8DF","#006DAB","#A6DC80","#1F9828","#FF8C8F"],gridStyles:{stroke:"#787C82",strokeWidth:1},tickLength:0,gridColor:"",gridColorDark:""});var m="grid-control-module__grid-control__KOnZN";const u=({width:l,height:t,xScale:a,yScale:i,gridVisibility:r="x",top:s=0})=>e.jsxs("g",{transform:`translate(0, ${s})`,className:m,children:[r.includes("x")&&e.jsx(d.GridRows,{scale:a,width:l}),r.includes("y")&&e.jsx(d.GridColumns,{scale:i,height:t})]});var x={"legend--horizontal":"legend-module__legend--horizontal__IUN13","legend--vertical":"legend-module__legend--vertical__Scfzo","legend-item":"legend-module__legend-item__feemn","legend-item-swatch":"legend-module__legend-item-swatch__nRyXf","legend-item-label":"legend-module__legend-item-label__ksx6I","legend-item-value":"legend-module__legend-item-value__d9x1j"};const p={horizontal:"row",vertical:"column"},v=({items:l,className:t,orientation:a="horizontal"})=>{const r=i.scaleOrdinal({domain:l.map((e=>e.label)),range:l.map((e=>e.color))});return e.jsx("div",{className:o(x.legend,x[`legend--${a}`],t),role:"list",children:e.jsx(c.LegendOrdinal,{scale:r,direction:p[a],shape:"rect",shapeWidth:16,shapeHeight:16,className:x["legend-items"],children:t=>e.jsx("div",{className:x[`legend--${a}`],children:t.map((t=>e.jsxs("div",{className:x["legend-item"],children:[e.jsx("svg",{width:16,height:16,children:e.jsx("rect",{width:16,height:16,fill:t.value,className:x["legend-item-swatch"]})}),e.jsxs("span",{className:x["legend-item-label"],children:[t.text,l.find((e=>e.label===t.text))?.value&&e.jsx("span",{className:x["legend-item-value"],children:l.find((e=>e.label===t.text))?.value})]})]},t.text)))})})})};var b="base-tooltip-module__tooltip__OfX6n";const _=({data:l})=>e.jsxs(e.Fragment,{children:[l?.label,": ",l?.valueDisplay||l?.value]}),j=({data:l,top:t,left:a,component:i=_,children:r,className:s})=>e.jsx("div",{className:b,style:{top:t,left:a},role:"tooltip",children:r||l&&e.jsx(i,{data:l,className:s})});var f={"bar-chart":"bar-chart-module__bar-chart__lmYNi","bar-chart-legend":"bar-chart-module__bar-chart-legend__vgKKq"};const w=({data:d,margin:c={top:20,right:20,bottom:40,left:40},withTooltips:h=!1,showLegend:m=!1,legendOrientation:x="horizontal",className:p,gridVisibility:b="x",width:_,height:w=400})=>{const N=n.useContext(g),{tooltipOpen:y,tooltipLeft:F,tooltipTop:C,tooltipData:q,hideTooltip:L,showTooltip:S}=s.useTooltip(),k=n.useCallback(((e,l,a,i,r)=>{const s=t.localPoint(e);s&&S({tooltipData:{value:l,xLabel:a,yLabel:i,seriesIndex:r},tooltipLeft:s.x,tooltipTop:s.y-10})}),[S]),z=n.useCallback((()=>{L()}),[L]);if(!d?.length)return e.jsx("div",{className:o("bar-chart-empty",f["bat-chart-empty"]),children:"Empty..."});const B=c,D=_-B.left-B.right,T=w-B.top-B.bottom,M=d[0].data?.map((e=>e?.label||"")),O=i.scaleBand({range:[0,D],domain:M,padding:.2}),$=i.scaleBand({range:[0,O.bandwidth()],domain:d.map(((e,l)=>l.toString())),padding:.1}),A=i.scaleLinear({range:[T,0],domain:[0,Math.max(...d.map((e=>Math.max(...e.data.map((e=>e?.value||0))))))]}),G=d.map(((e,l)=>({label:e.label,value:"",color:N.colors[l%N.colors.length]})));return e.jsxs("div",{className:o("bar-chart",p,f["bar-chart"]),children:[e.jsx("svg",{width:_,height:w,children:e.jsxs(a.Group,{left:B.left,top:B.top,children:[e.jsx(u,{width:D,height:T,xScale:O,yScale:A,gridVisibility:b}),d.map(((l,t)=>e.jsx(a.Group,{children:l.data.map((a=>{const i=O(a?.label||"");if(void 0===i)return null;const s=$.bandwidth(),o=i+($(t.toString())??0);return e.jsx(r.Bar,{x:o,y:A(a.value),width:s,height:T-(A(a.value)??0),fill:N.colors[t%N.colors.length],onMouseMove:h?e=>k(e,a.value,a?.label||"",l.label,t):void 0,onMouseLeave:h?z:void 0},`bar-${t}-${a.label}`)}))},t))),e.jsx(l.AxisLeft,{scale:A}),e.jsx(l.AxisBottom,{scale:O,top:T})]})}),h&&y&&q&&e.jsx(j,{top:C||0,left:F||0,children:e.jsxs("div",{children:[e.jsx("div",{children:q.yLabel}),e.jsxs("div",{children:[q.xLabel,": ",q.value]})]})}),m&&e.jsx(v,{items:G,orientation:x,className:f["bar-chart-legend"]})]})};w.displayName="BarChart";var N=function(l,t){const{maxWidth:a=1200,aspectRatio:i=.5,debounceTime:r=50}=t||{};return function(t){const{parentRef:s,width:o}=h.useParentSize({debounceTime:r,enableDebounceLeadingCall:!0,initialSize:{width:600,height:400}}),n=o?Math.min(o,a):600,d=n*i;return e.jsx("div",{ref:s,style:{width:"100%",minHeight:`${d}px`},children:e.jsx(l,{width:n,height:d,size:n,...t})})}}(w);exports.BarChart=N;
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/providers/theme/themes.ts","../../../../src/providers/theme/theme-provider.tsx","../../../../src/components/grid-control/grid-control.tsx","../../../../src/components/legend/base-legend.tsx","../../../../src/components/tooltip/base-tooltip.tsx","../../../../src/components/bar-chart/bar-chart.tsx","../../../../src/components/shared/with-responsive.tsx"],"sourcesContent":[null,null,null,null,null,null,null],"names":["ThemeContext","createContext","backgroundColor","labelBackgroundColor","colors","gridStyles","stroke","strokeWidth","tickLength","gridColor","gridColorDark","GridControl","width","height","xScale","yScale","gridVisibility","top","_jsxs","transform","className","styles","children","includes","_jsx","GridRows","scale","GridColumns","orientationToFlexDirection","horizontal","vertical","BaseLegend","items","orientation","legendScale","scaleOrdinal","domain","map","item","label","range","color","clsx","legend","role","LegendOrdinal","direction","shape","shapeWidth","shapeHeight","labels","jsx","fill","value","text","find","DefaultTooltipContent","data","jsxs","_Fragment","Fragment","valueDisplay","BaseTooltip","left","component","Component","style","BarChart","margin","right","bottom","withTooltips","showLegend","legendOrientation","theme","useContext","tooltipOpen","tooltipLeft","tooltipTop","tooltipData","hideTooltip","showTooltip","useTooltip","handleMouseMove","useCallback","event","xLabel","yLabel","seriesIndex","coords","localPoint","x","y","handleMouseLeave","length","margins","xMax","yMax","d","scaleBand","padding","innerScale","bandwidth","_","i","toString","scaleLinear","Math","max","series","legendItems","group","index","Group","xPos","undefined","barWidth","barX","Bar","onMouseMove","onMouseLeave","AxisLeft","AxisBottom","Legend","displayName","barChart","WrappedComponent","config","maxWidth","aspectRatio","debounceTime","props","parentRef","parentWidth","useParentSize","enableDebounceLeadingCall","initialSize","containerWidth","min","containerHeight","ref","minHeight","size","withResponsive"],"mappings":"4T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,SAA0BI,GAChC,MAAMC,UAAEA,EAAWxH,MAAOyH,GAAgBC,EAAAA,cAAe,CACxDJ,eACAK,2BAA2B,EAC3BC,YAAa,CAAE5H,MAAO,IAAKC,OAAQ,OAI9B4H,EAAiBJ,EAAc1B,KAAK+B,IAAKL,EAAaL,GAAa,IACnEW,EAAkBF,EAAiBR,EAEzC,OACCzG,EACC2B,IAAA,MAAA,CAAAyF,IAAMR,EACNlE,MAAQ,CACPtD,MAAO,OACPiI,UAAW,GAAIF,OACfrH,SAEDE,MAACsG,EAAgB,CAChBlH,MAAQ6H,EACR5H,OAAS8H,EACTG,KAAOL,KACAN,KAIX,CACD,CDoHeY,CAAiC5E"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
.pie-chart-module__pie-chart__R12Vh {
|
|
2
|
-
position: relative;
|
|
3
|
-
}
|
|
4
|
-
.line-chart-module__line-chart__ITM3d {
|
|
5
|
-
position: relative;
|
|
6
|
-
}
|
|
7
|
-
.line-chart-module__line-chart__tooltip__aqcme {
|
|
8
|
-
background: #fff;
|
|
9
|
-
padding: 0.5rem;
|
|
10
|
-
}
|
|
11
|
-
.line-chart-module__line-chart__tooltip-date__4Dzab {
|
|
12
|
-
font-weight: bold;
|
|
13
|
-
padding-bottom: 10px;
|
|
14
|
-
}
|
|
15
|
-
.line-chart-module__line-chart__tooltip-row__6A37G {
|
|
16
|
-
display: flex;
|
|
17
|
-
align-items: center;
|
|
18
|
-
padding: 4px 0;
|
|
19
|
-
justify-content: space-between;
|
|
20
|
-
}
|
|
21
|
-
.line-chart-module__line-chart__tooltip-label__IvnFF {
|
|
22
|
-
font-weight: 500;
|
|
23
|
-
padding-right: 1rem;
|
|
24
|
-
}
|
|
25
|
-
.pie-semi-circle-chart-module__pie-semi-circle-chart__r5jk9 {
|
|
26
|
-
position: relative;
|
|
27
|
-
text-align: center;
|
|
28
|
-
}
|
|
29
|
-
.pie-semi-circle-chart-module__pie-semi-circle-chart-legend__c8W1Y {
|
|
30
|
-
margin-top: 1rem;
|
|
31
|
-
}
|
|
32
|
-
.pie-semi-circle-chart-module__pie-semi-circle-chart__r5jk9 .pie-semi-circle-chart-module__label__nPqOg {
|
|
33
|
-
margin-bottom: 0px;
|
|
34
|
-
font-weight: 600;
|
|
35
|
-
font-size: 16px;
|
|
36
|
-
}
|
|
37
|
-
.pie-semi-circle-chart-module__pie-semi-circle-chart__r5jk9 .pie-semi-circle-chart-module__note__LpBZQ {
|
|
38
|
-
margin-top: 0px;
|
|
39
|
-
font-size: 14px;
|
|
40
|
-
}
|
|
41
|
-
.grid-control-module__grid-control__KOnZN .visx-line {
|
|
42
|
-
stroke: #d7d6d6;
|
|
43
|
-
stroke-width: 1px;
|
|
44
|
-
shape-rendering: crispEdges;
|
|
45
|
-
}
|
|
46
|
-
.legend-module__legend--horizontal__IUN13 {
|
|
47
|
-
display: flex;
|
|
48
|
-
flex-direction: row;
|
|
49
|
-
flex-wrap: wrap;
|
|
50
|
-
gap: 16px;
|
|
51
|
-
}
|
|
52
|
-
.legend-module__legend--vertical__Scfzo {
|
|
53
|
-
display: flex;
|
|
54
|
-
flex-direction: column;
|
|
55
|
-
gap: 8px;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.legend-module__legend-item__feemn {
|
|
59
|
-
display: flex;
|
|
60
|
-
align-items: center;
|
|
61
|
-
gap: 8px;
|
|
62
|
-
font-size: 0.875rem;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.legend-module__legend-item-swatch__nRyXf {
|
|
66
|
-
border-radius: 2px;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.legend-module__legend-item-label__ksx6I {
|
|
70
|
-
color: var(--jp-gray-80, #2c3338);
|
|
71
|
-
display: flex;
|
|
72
|
-
align-items: center;
|
|
73
|
-
gap: 0.5rem;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.legend-module__legend-item-value__d9x1j {
|
|
77
|
-
font-weight: 500;
|
|
78
|
-
}
|
|
79
|
-
.base-tooltip-module__tooltip__OfX6n {
|
|
80
|
-
padding: 0.5rem;
|
|
81
|
-
background-color: rgba(0, 0, 0, 0.85);
|
|
82
|
-
color: white;
|
|
83
|
-
border-radius: 4px;
|
|
84
|
-
font-size: 14px;
|
|
85
|
-
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
86
|
-
position: absolute;
|
|
87
|
-
pointer-events: none;
|
|
88
|
-
transform: translate(-50%, -100%);
|
|
89
|
-
}
|
|
90
|
-
.bar-chart-module__bar-chart__lmYNi {
|
|
91
|
-
position: relative;
|
|
92
|
-
}
|
|
93
|
-
.bar-chart-module__bar-chart-legend__vgKKq {
|
|
94
|
-
margin-top: 1rem;
|
|
95
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var r=require("react/jsx-runtime"),i=require("@visx/grid");require("react");var e="grid-control-module__grid-control__KOnZN";exports.GridControl=({width:s,height:t,xScale:l,yScale:a,gridVisibility:c="x",top:d=0})=>r.jsxs("g",{transform:`translate(0, ${d})`,className:e,children:[c.includes("x")&&r.jsx(i.GridRows,{scale:l,width:s}),c.includes("y")&&r.jsx(i.GridColumns,{scale:a,height:t})]});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/grid-control/grid-control.tsx"],"sourcesContent":[null],"names":["width","height","xScale","yScale","gridVisibility","top","_jsxs","transform","className","styles","children","includes","_jsx","GridRows","scale","GridColumns"],"mappings":"8JAK2C,EAC1CA,QACAC,SACAC,SACAC,SACAC,iBAAiB,IACjBC,MAAM,KAGLC,EAAAA,KAAG,IAAA,CAAAC,UAAY,gBAAiBF,KAAUG,UAAYC,EAAwBC,SAAA,CAC3EN,EAAeO,SAAU,MAASC,MAACC,EAAAA,SAAQ,CAACC,MAAQZ,EAASF,MAAQA,IACrEI,EAAeO,SAAU,MAASC,MAACG,EAAWA,YAAA,CAACD,MAAQX,EAASF,OAASA"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
.bar-chart-module__bar-chart__lmYNi {
|
|
2
|
-
position: relative;
|
|
3
|
-
}
|
|
4
|
-
.bar-chart-module__bar-chart-legend__vgKKq {
|
|
5
|
-
margin-top: 1rem;
|
|
6
|
-
}
|
|
7
|
-
.pie-chart-module__pie-chart__R12Vh {
|
|
8
|
-
position: relative;
|
|
9
|
-
}
|
|
10
|
-
.line-chart-module__line-chart__ITM3d {
|
|
11
|
-
position: relative;
|
|
12
|
-
}
|
|
13
|
-
.line-chart-module__line-chart__tooltip__aqcme {
|
|
14
|
-
background: #fff;
|
|
15
|
-
padding: 0.5rem;
|
|
16
|
-
}
|
|
17
|
-
.line-chart-module__line-chart__tooltip-date__4Dzab {
|
|
18
|
-
font-weight: bold;
|
|
19
|
-
padding-bottom: 10px;
|
|
20
|
-
}
|
|
21
|
-
.line-chart-module__line-chart__tooltip-row__6A37G {
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
padding: 4px 0;
|
|
25
|
-
justify-content: space-between;
|
|
26
|
-
}
|
|
27
|
-
.line-chart-module__line-chart__tooltip-label__IvnFF {
|
|
28
|
-
font-weight: 500;
|
|
29
|
-
padding-right: 1rem;
|
|
30
|
-
}
|
|
31
|
-
.base-tooltip-module__tooltip__OfX6n {
|
|
32
|
-
padding: 0.5rem;
|
|
33
|
-
background-color: rgba(0, 0, 0, 0.85);
|
|
34
|
-
color: white;
|
|
35
|
-
border-radius: 4px;
|
|
36
|
-
font-size: 14px;
|
|
37
|
-
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
38
|
-
position: absolute;
|
|
39
|
-
pointer-events: none;
|
|
40
|
-
transform: translate(-50%, -100%);
|
|
41
|
-
}
|
|
42
|
-
.legend-module__legend--horizontal__IUN13 {
|
|
43
|
-
display: flex;
|
|
44
|
-
flex-direction: row;
|
|
45
|
-
flex-wrap: wrap;
|
|
46
|
-
gap: 16px;
|
|
47
|
-
}
|
|
48
|
-
.legend-module__legend--vertical__Scfzo {
|
|
49
|
-
display: flex;
|
|
50
|
-
flex-direction: column;
|
|
51
|
-
gap: 8px;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.legend-module__legend-item__feemn {
|
|
55
|
-
display: flex;
|
|
56
|
-
align-items: center;
|
|
57
|
-
gap: 8px;
|
|
58
|
-
font-size: 0.875rem;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.legend-module__legend-item-swatch__nRyXf {
|
|
62
|
-
border-radius: 2px;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.legend-module__legend-item-label__ksx6I {
|
|
66
|
-
color: var(--jp-gray-80, #2c3338);
|
|
67
|
-
display: flex;
|
|
68
|
-
align-items: center;
|
|
69
|
-
gap: 0.5rem;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.legend-module__legend-item-value__d9x1j {
|
|
73
|
-
font-weight: 500;
|
|
74
|
-
}
|
|
75
|
-
.pie-semi-circle-chart-module__pie-semi-circle-chart__r5jk9 {
|
|
76
|
-
position: relative;
|
|
77
|
-
text-align: center;
|
|
78
|
-
}
|
|
79
|
-
.pie-semi-circle-chart-module__pie-semi-circle-chart-legend__c8W1Y {
|
|
80
|
-
margin-top: 1rem;
|
|
81
|
-
}
|
|
82
|
-
.pie-semi-circle-chart-module__pie-semi-circle-chart__r5jk9 .pie-semi-circle-chart-module__label__nPqOg {
|
|
83
|
-
margin-bottom: 0px;
|
|
84
|
-
font-weight: 600;
|
|
85
|
-
font-size: 16px;
|
|
86
|
-
}
|
|
87
|
-
.pie-semi-circle-chart-module__pie-semi-circle-chart__r5jk9 .pie-semi-circle-chart-module__note__LpBZQ {
|
|
88
|
-
margin-top: 0px;
|
|
89
|
-
font-size: 14px;
|
|
90
|
-
}
|
|
91
|
-
.grid-control-module__grid-control__KOnZN .visx-line {
|
|
92
|
-
stroke: #d7d6d6;
|
|
93
|
-
stroke-width: 1px;
|
|
94
|
-
shape-rendering: crispEdges;
|
|
95
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),l=require("@visx/legend"),a=require("@visx/scale"),n=require("clsx");require("react");var i={"legend--horizontal":"legend-module__legend--horizontal__IUN13","legend--vertical":"legend-module__legend--vertical__Scfzo","legend-item":"legend-module__legend-item__feemn","legend-item-swatch":"legend-module__legend-item-swatch__nRyXf","legend-item-label":"legend-module__legend-item-label__ksx6I","legend-item-value":"legend-module__legend-item-value__d9x1j"};const d={horizontal:"row",vertical:"column"};exports.Legend=({items:t,className:s,orientation:r="horizontal"})=>{const c=a.scaleOrdinal({domain:t.map((e=>e.label)),range:t.map((e=>e.color))});return e.jsx("div",{className:n(i.legend,i[`legend--${r}`],s),role:"list",children:e.jsx(l.LegendOrdinal,{scale:c,direction:d[r],shape:"rect",shapeWidth:16,shapeHeight:16,className:i["legend-items"],children:l=>e.jsx("div",{className:i[`legend--${r}`],children:l.map((l=>e.jsxs("div",{className:i["legend-item"],children:[e.jsx("svg",{width:16,height:16,children:e.jsx("rect",{width:16,height:16,fill:l.value,className:i["legend-item-swatch"]})}),e.jsxs("span",{className:i["legend-item-label"],children:[l.text,t.find((e=>e.label===l.text))?.value&&e.jsx("span",{className:i["legend-item-value"],children:t.find((e=>e.label===l.text))?.value})]})]},l.text)))})})})};
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/legend/base-legend.tsx"],"sourcesContent":[null],"names":["orientationToFlexDirection","horizontal","vertical","items","className","orientation","legendScale","scaleOrdinal","domain","map","item","label","range","color","_jsx","clsx","styles","legend","role","children","LegendOrdinal","scale","direction","shape","shapeWidth","shapeHeight","labels","_jsxs","jsx","width","height","fill","value","text","find"],"mappings":"wfAeA,MAAMA,EAA6B,CAClCC,WAAY,MACZC,SAAU,yBAGkC,EAC5CC,QACAC,YACAC,cAAc,iBAEd,MAAMC,EAAcC,EAAAA,aAAc,CACjCC,OAAQL,EAAMM,KAAKC,GAAQA,EAAKC,QAChCC,MAAOT,EAAMM,KAAKC,GAAQA,EAAKG,UAGhC,OACCC,aACCV,UAAYW,EAAMC,EAAOC,OAAQD,EAAQ,WAAYX,KAAkBD,GACvEc,KAAK,OAELC,SAAAL,EAAAA,IAACM,EAAAA,cACA,CAAAC,MAAQf,EACRgB,UAAYtB,EAA4BK,GACxCkB,MAAM,OACNC,WAAa,GACbC,YAAc,GACdrB,UAAYY,EAAQ,yBAElBU,GACDZ,EAAAA,WAAKV,UAAYY,EAAQ,WAAYX,KAAgBc,SAClDO,EAAOjB,KAAKE,GACbgB,EAAAA,YAAwBvB,UAAYY,EAAQ,eAC3CG,SAAA,CAAAL,EAAAc,IAAA,MAAA,CAAKC,MAAQ,GAAKC,OAAS,YAC1BhB,EACCc,IAAA,OAAA,CAAAC,MAAQ,GACRC,OAAS,GACTC,KAAOpB,EAAMqB,MACb5B,UAAYY,EAAQ,0BAGtBW,EAAAA,aAAMvB,UAAYY,EAAQ,qBACvBG,SAAA,CAAAR,EAAMsB,KACN9B,EAAM+B,MAAMxB,GAAQA,EAAKC,QAAUA,EAAMsB,QAAQD,OAClDlB,EAAMc,IAAA,OAAA,CAAAxB,UAAYY,EAAQ,qBAAqBG,SAC5ChB,EAAM+B,MAAMxB,GAAQA,EAAKC,QAAUA,EAAMsB,QAAQD,aAb5CrB,EAAMsB,aAuBrB"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
.bar-chart-module__bar-chart__lmYNi {
|
|
2
|
-
position: relative;
|
|
3
|
-
}
|
|
4
|
-
.bar-chart-module__bar-chart-legend__vgKKq {
|
|
5
|
-
margin-top: 1rem;
|
|
6
|
-
}
|
|
7
|
-
.pie-chart-module__pie-chart__R12Vh {
|
|
8
|
-
position: relative;
|
|
9
|
-
}
|
|
10
|
-
.line-chart-module__line-chart__ITM3d {
|
|
11
|
-
position: relative;
|
|
12
|
-
}
|
|
13
|
-
.line-chart-module__line-chart__tooltip__aqcme {
|
|
14
|
-
background: #fff;
|
|
15
|
-
padding: 0.5rem;
|
|
16
|
-
}
|
|
17
|
-
.line-chart-module__line-chart__tooltip-date__4Dzab {
|
|
18
|
-
font-weight: bold;
|
|
19
|
-
padding-bottom: 10px;
|
|
20
|
-
}
|
|
21
|
-
.line-chart-module__line-chart__tooltip-row__6A37G {
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
padding: 4px 0;
|
|
25
|
-
justify-content: space-between;
|
|
26
|
-
}
|
|
27
|
-
.line-chart-module__line-chart__tooltip-label__IvnFF {
|
|
28
|
-
font-weight: 500;
|
|
29
|
-
padding-right: 1rem;
|
|
30
|
-
}
|
|
31
|
-
.base-tooltip-module__tooltip__OfX6n {
|
|
32
|
-
padding: 0.5rem;
|
|
33
|
-
background-color: rgba(0, 0, 0, 0.85);
|
|
34
|
-
color: white;
|
|
35
|
-
border-radius: 4px;
|
|
36
|
-
font-size: 14px;
|
|
37
|
-
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
38
|
-
position: absolute;
|
|
39
|
-
pointer-events: none;
|
|
40
|
-
transform: translate(-50%, -100%);
|
|
41
|
-
}
|
|
42
|
-
.pie-semi-circle-chart-module__pie-semi-circle-chart__r5jk9 {
|
|
43
|
-
position: relative;
|
|
44
|
-
text-align: center;
|
|
45
|
-
}
|
|
46
|
-
.pie-semi-circle-chart-module__pie-semi-circle-chart-legend__c8W1Y {
|
|
47
|
-
margin-top: 1rem;
|
|
48
|
-
}
|
|
49
|
-
.pie-semi-circle-chart-module__pie-semi-circle-chart__r5jk9 .pie-semi-circle-chart-module__label__nPqOg {
|
|
50
|
-
margin-bottom: 0px;
|
|
51
|
-
font-weight: 600;
|
|
52
|
-
font-size: 16px;
|
|
53
|
-
}
|
|
54
|
-
.pie-semi-circle-chart-module__pie-semi-circle-chart__r5jk9 .pie-semi-circle-chart-module__note__LpBZQ {
|
|
55
|
-
margin-top: 0px;
|
|
56
|
-
font-size: 14px;
|
|
57
|
-
}
|
|
58
|
-
.grid-control-module__grid-control__KOnZN .visx-line {
|
|
59
|
-
stroke: #d7d6d6;
|
|
60
|
-
stroke-width: 1px;
|
|
61
|
-
shape-rendering: crispEdges;
|
|
62
|
-
}
|
|
63
|
-
.legend-module__legend--horizontal__IUN13 {
|
|
64
|
-
display: flex;
|
|
65
|
-
flex-direction: row;
|
|
66
|
-
flex-wrap: wrap;
|
|
67
|
-
gap: 16px;
|
|
68
|
-
}
|
|
69
|
-
.legend-module__legend--vertical__Scfzo {
|
|
70
|
-
display: flex;
|
|
71
|
-
flex-direction: column;
|
|
72
|
-
gap: 8px;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.legend-module__legend-item__feemn {
|
|
76
|
-
display: flex;
|
|
77
|
-
align-items: center;
|
|
78
|
-
gap: 8px;
|
|
79
|
-
font-size: 0.875rem;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.legend-module__legend-item-swatch__nRyXf {
|
|
83
|
-
border-radius: 2px;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.legend-module__legend-item-label__ksx6I {
|
|
87
|
-
color: var(--jp-gray-80, #2c3338);
|
|
88
|
-
display: flex;
|
|
89
|
-
align-items: center;
|
|
90
|
-
gap: 0.5rem;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.legend-module__legend-item-value__d9x1j {
|
|
94
|
-
font-weight: 500;
|
|
95
|
-
}
|