@oliasoft-open-source/charts-library 5.2.1-beta-8 → 5.2.1-beta-10
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/assets/Color-AVL7NMMY-CqDJ8ZOT.js +1 -0
- package/dist/assets/DocsRenderer-PQXLIZUC-D_u5u9z2.js +2 -0
- package/dist/assets/bar-chart-const-D_44J3Hs.js +1 -0
- package/dist/assets/bar-chart.stories-xE70f9TR.js +145 -0
- package/dist/assets/client-Ciqut_YX.js +1 -0
- package/dist/assets/components-9epRxl4J.js +1 -0
- package/dist/assets/get-custom-legend-plugin-example-CGyRL0oI.js +1 -0
- package/dist/assets/get-draggableData-BVJ5iVjR.js +2 -0
- package/dist/assets/iframe-DwZM_ZTV.js +2349 -0
- package/dist/assets/legend-DX1GE7eL.js +1266 -0
- package/dist/assets/legend-context-EFDEFPqT.js +47 -0
- package/dist/assets/line-chart-DA2zDhY7.js +1 -0
- package/dist/assets/line-chart.stories-2jpvKnZZ.js +1162 -0
- package/dist/assets/{line-chart.test-case.stories-BherIy2k.js → line-chart.test-case.stories-BtymlJdg.js} +4 -4
- package/dist/assets/pie-chart.stories-BitiqvNU.js +45 -0
- package/dist/assets/preload-helper-Dr7BywEQ.js +1 -0
- package/dist/assets/react-18-DuDr_33m.js +1 -0
- package/dist/assets/react-6r188Yvx.js +1 -0
- package/dist/assets/scatter-chart.stories-Dx00FKXF.js +41 -0
- package/dist/iframe.html +2 -2
- package/dist/index.js +10678 -4955
- package/dist/project.json +1 -1
- package/dist/vite-inject-mocker-entry.js +8 -18
- package/package.json +2 -2
- package/dist/assets/Color-AVL7NMMY-CS12GsAp.js +0 -1
- package/dist/assets/DocsRenderer-PQXLIZUC-GzKWCIKM.js +0 -2
- package/dist/assets/bar-chart-const-Cgj9sgUU.js +0 -1
- package/dist/assets/bar-chart.stories-DiVXSfzm.js +0 -136
- package/dist/assets/client-YjsYyvlT.js +0 -1
- package/dist/assets/get-custom-legend-plugin-example-DoKp_ti3.js +0 -1
- package/dist/assets/get-draggableData-C4lfrQc8.js +0 -2
- package/dist/assets/iframe-DCxgzTof.js +0 -2359
- package/dist/assets/index-C0sntNAo.js +0 -1
- package/dist/assets/legend-CkDoV6Ma.js +0 -1372
- package/dist/assets/legend-context-Byc4ADTV.js +0 -68
- package/dist/assets/line-chart-B8LdJRW7.js +0 -1
- package/dist/assets/line-chart.stories-DMNBRfTA.js +0 -1162
- package/dist/assets/pie-chart.stories-CqXDaxxI.js +0 -45
- package/dist/assets/preload-helper-PPVm8Dsz.js +0 -1
- package/dist/assets/react-18-2D2yOiaU.js +0 -1
- package/dist/assets/scatter-chart.stories-CzHmKRFZ.js +0 -41
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import{r as F,j as I}from"./iframe-DCxgzTof.js";import{e as q,P as X,b as A,g as Y,T as J,j as U,k as K,o as z,p as Q,t as tt,u as et,ab as at,ac as st,s as rt,C as nt,y as ot,F as it,G as lt,ad as dt,I as ct,J as pt,K as ut,M as gt,N as ht,O as bt}from"./legend-context-Byc4ADTV.js";import{D as mt,a as ft}from"./bar-chart-const-Cgj9sgUU.js";import"./preload-helper-PPVm8Dsz.js";const Ct="_chart_1jdnu_1",xt="_fixedHeight_1jdnu_13",Dt="_stretchHeight_1jdnu_19",N={chart:Ct,fixedHeight:xt,stretchHeight:Dt},St=t=>({width:t?.width,height:t?.height,maintainAspectRatio:t?.maintainAspectRatio||!1,staticChartHeight:t?.staticChartHeight||!1,performanceMode:t?.performanceMode??!0}),Lt=t=>({tooltips:t?.tooltips??!0,showLabelsInTooltips:t?.showLabelsInTooltips||!1,scientificNotation:t?.scientificNotation??!0}),Pt=t=>({showDataLabels:t?.showDataLabels||!1,stacked:t?.stacked||!1,cutout:t?.cutout||0}),yt=t=>({display:t?.display??!0,useDataset:t?.useDataset||!1,position:t?.position||X.Bottom,align:t?.align||q.Center}),_t=t=>({enableZoom:t?.enableZoom||!1,enablePan:t?.enablePan||!1}),It=t=>({onLegendClick:t?.onLegendClick,onHover:t?.onHover,onUnhover:t?.onUnhover}),Tt=t=>({labels:t?.labels||[],datasets:t?.datasets||[]}),B=t=>{const l=t?.chart||{},o=l?.options||{};return{testId:l?.testId??null,data:Tt(l?.data),options:{title:o?.title||"",chartStyling:St(o?.chartStyling),tooltip:Lt(o?.tooltip),graph:Pt(o?.graph),legend:yt(o?.legend),chartOptions:_t(o?.chartOptions),interactions:It(o?.interactions)}}},vt=t=>{const[l,o]=F.useState(!1),{data:i,options:a}=t,T=(d=>{const e=[...d];if(a.graph.stacked){const s={label:e?.[0]?.label??"",backgroundColor:[],borderColor:"",borderWidth:Number(e[0].borderWidth)||1,data:[],borderDash:[]};return i.labels.map((c,n)=>{e.map((g,h)=>{s.data.push(g.data[n]);const{backgroundColor:f}=g,{borderColor:k}=g;s.backgroundColor.push((Array.isArray(f)?f[n%(k?.length||1)]:f)||A[n]+`${99-10*h}`),s.borderColor=k??""})}),[s]}return e.map((s,c)=>{const{borderWidth:n="1"}=s??{},g=parseFloat(String(n))||1,h=A[c],f=s.borderColor||h,k=s.backgroundColor||Y(A);return{...s,borderWidth:g,borderColor:f,backgroundColor:k}})})(i.datasets),j=()=>a.title!==""?{display:!0,text:t.options.title}:{},v=(d,e,r)=>{const{chart:s}=r??{};if(e&&s){const{index:c=0}=e;if(s.toggleDataVisibility(c),s.update(),a.interactions?.onLegendClick){const n=s.isDatasetVisible(c);a.interactions.onLegendClick(e.text,!n)}}};return{generatedDatasets:T,getTitle:j,legendClick:v,onClick:(d,e,r)=>{r.resetZoom()},onHover:(d,e)=>{if(l&&!e?.length&&(o(!1),a.interactions.onUnhover&&a.interactions.onUnhover(d)),!l&&e?.length&&(o(!0),a.interactions.onHover)){const{index:r,datasetIndex:s}=e[0],c=T;a.interactions.onHover(d,s,r,c)}},getDatalabels:()=>a.graph.showDataLabels?{display:"auto",align:"center",anchor:"center",formatter:(d,e)=>{if(e.chart.getDatasetMeta(a.graph.stacked?0:e.datasetIndex).data[e.dataIndex].hidden)return"";const r=e.dataset.data[e.dataIndex],s=r?.label||(typeof r=="number"?r:Array.isArray(r)?r.reduce((n,g,h)=>h===0?`${n} ${g}`:`${n}, ${g}`,""):"");return typeof r=="number"?Number.isInteger(s)?s:s.toFixed(2):s}}:{display:!1},getLegend:()=>({position:a.legend.position,display:a.legend.display,align:a.legend.align,labels:{boxHeight:6,boxWidth:6,usePointStyle:!0,filter:d=>a.legend.useDataset?!i.datasets[d.index]?.hideLegend:!0},onClick:v}),getToolTips:()=>{const d=e=>{let r={};return a?.tooltip?.scientificNotation?(Math.abs(e)<mt||Math.abs(e)>ft)&&(r={roundScientificCoefficient:3}):r={scientific:!1},z(Q(e),r)};return{callbacks:{title:e=>{const{dataIndex:r}=e[0],s=a.graph.stacked?parseInt(String(r/i.labels.length)):r;return`${i.labels[s]}`},label:e=>{const{dataIndex:r}=e,s=a.graph.stacked?r%i.datasets.length:e.datasetIndex,c=i.datasets.length>1?`${i.datasets[s]?.label}: `:"",n=e.dataset.data[r],g=typeof n=="object"?`${n.value||""} ${a.tooltip.showLabelsInTooltips&&n.label?"("+n.label+")":""}`:n,h=i?.yUnit?`[${i?.yUnit}]`:"";return`${c} ${d(g)} ${h}`}},padding:K,boxWidth:U,boxHeight:U,boxPadding:J,usePointStyle:!0}}}};nt.register(ot,it,lt,dt,ct,pt,ut,gt,ht,bt);const kt=t=>{et();const l=B(t),o=F.useRef(null),{data:i,options:a,testId:M}=l,{generatedDatasets:T,getTitle:j,onClick:v,onHover:$,getDatalabels:E,getLegend:W,getToolTips:R}=vt(l);return I.jsx("div",{className:at(N.chart,!a.chartStyling.width||!a.chartStyling.height?a.chartStyling.staticChartHeight?N.fixedHeight:N.stretchHeight:""),style:{width:a.chartStyling.width||"auto",height:a.chartStyling.height||"auto"},"data-testid":M,children:I.jsx(st,{ref:o,data:{datasets:T,labels:a.graph.stacked?void 0:i.labels},options:{cutout:a.graph.cutout,onClick:v,responsive:!0,maintainAspectRatio:a.chartStyling.maintainAspectRatio,animation:a.chartStyling.performanceMode?!1:{duration:rt.FAST},hover:{mode:"nearest",intersect:!0},onHover:$,plugins:{annotation:!1,title:j(),datalabels:E(),tooltip:R(),legend:W()}}})})},w=t=>{const{options:l}=B(t);return I.jsx(tt,{options:l,children:I.jsx(kt,{...t})})};w.__docgenInfo={description:"",methods:[],displayName:"PieChartWithLegend",props:{chart:{required:!0,tsType:{name:"IPieChartData"},description:""},testId:{required:!1,tsType:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},description:""}}};const p=["label 1","label 2","label 3"],m={label:"data1",data:[3,8,7]},G={label:"data2",data:[1,2,3]},V={label:"data3",data:[5,0,4]},Ot={label:"spacing data",offset:40,data:[3,8,7]},Ht={label:"hover data",data:[3,8,7],hoverOffset:40},Z={label:"data",data:[{value:210,label:"label"},{value:333,label:"labal"},{value:248,label:"lebel"}]},jt={label:"data",data:[210,333,248]},At={data:{labels:p,datasets:[m]}},Nt={data:{labels:p,datasets:[m,G,V]}},wt={data:{labels:p,datasets:[m,G,V]},options:{title:"Stacked",graph:{stacked:!0}}},Mt={data:{labels:p,datasets:[Z]},options:{title:"With custom datalabels",graph:{showDataLabels:!0}}},$t={data:{labels:p,datasets:[jt]},options:{title:"With value as datalabels",graph:{showDataLabels:!0}}},Et={data:{labels:p,datasets:[Z]},options:{title:"With datalabels in tooltips",tooltip:{showLabelsInTooltips:!0}}},Wt={data:{labels:p,datasets:[Ht]},options:{title:"Hover offset"}},Rt={data:{labels:p,datasets:[Ot]},options:{title:"Segment offset"}},Ut={data:{labels:p,datasets:[m]},options:{chartStyling:{performanceMode:!1}}},Ft={data:{labels:p,datasets:[m]},options:{title:"Cutout 50%",graph:{cutout:"50%"}}},Bt={data:{labels:p,datasets:[m]},options:{title:"Cutout 20 pixels",graph:{cutout:20}}},Yt={title:"PieChart",component:w,args:{chart:At}},u=t=>I.jsx(w,{...t}),O=u.bind({}),C=u.bind({});C.args={chart:Nt};const x=u.bind({});x.args={chart:wt};const D=u.bind({});D.args={chart:Mt};const S=u.bind({});S.args={chart:$t};const L=u.bind({});L.args={chart:Et};const P=u.bind({});P.args={chart:Ut};const y=u.bind({});y.args={chart:Ft};const _=u.bind({});_.args={chart:Bt};const b=u.bind({});b.args={chart:Wt};const H=u.bind({});b.args={chart:Rt};O.parameters={...O.parameters,docs:{...O.parameters?.docs,source:{originalSource:`args => {
|
|
2
|
-
return <PieChart
|
|
3
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
4
|
-
{...args} />;
|
|
5
|
-
}`,...O.parameters?.docs?.source}}};C.parameters={...C.parameters,docs:{...C.parameters?.docs,source:{originalSource:`args => {
|
|
6
|
-
return <PieChart
|
|
7
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
8
|
-
{...args} />;
|
|
9
|
-
}`,...C.parameters?.docs?.source}}};x.parameters={...x.parameters,docs:{...x.parameters?.docs,source:{originalSource:`args => {
|
|
10
|
-
return <PieChart
|
|
11
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
12
|
-
{...args} />;
|
|
13
|
-
}`,...x.parameters?.docs?.source}}};D.parameters={...D.parameters,docs:{...D.parameters?.docs,source:{originalSource:`args => {
|
|
14
|
-
return <PieChart
|
|
15
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
16
|
-
{...args} />;
|
|
17
|
-
}`,...D.parameters?.docs?.source}}};S.parameters={...S.parameters,docs:{...S.parameters?.docs,source:{originalSource:`args => {
|
|
18
|
-
return <PieChart
|
|
19
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
20
|
-
{...args} />;
|
|
21
|
-
}`,...S.parameters?.docs?.source}}};L.parameters={...L.parameters,docs:{...L.parameters?.docs,source:{originalSource:`args => {
|
|
22
|
-
return <PieChart
|
|
23
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
24
|
-
{...args} />;
|
|
25
|
-
}`,...L.parameters?.docs?.source}}};P.parameters={...P.parameters,docs:{...P.parameters?.docs,source:{originalSource:`args => {
|
|
26
|
-
return <PieChart
|
|
27
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
28
|
-
{...args} />;
|
|
29
|
-
}`,...P.parameters?.docs?.source}}};y.parameters={...y.parameters,docs:{...y.parameters?.docs,source:{originalSource:`args => {
|
|
30
|
-
return <PieChart
|
|
31
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
32
|
-
{...args} />;
|
|
33
|
-
}`,...y.parameters?.docs?.source}}};_.parameters={..._.parameters,docs:{..._.parameters?.docs,source:{originalSource:`args => {
|
|
34
|
-
return <PieChart
|
|
35
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
36
|
-
{...args} />;
|
|
37
|
-
}`,..._.parameters?.docs?.source}}};b.parameters={...b.parameters,docs:{...b.parameters?.docs,source:{originalSource:`args => {
|
|
38
|
-
return <PieChart
|
|
39
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
40
|
-
{...args} />;
|
|
41
|
-
}`,...b.parameters?.docs?.source}}};H.parameters={...H.parameters,docs:{...H.parameters?.docs,source:{originalSource:`args => {
|
|
42
|
-
return <PieChart
|
|
43
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
44
|
-
{...args} />;
|
|
45
|
-
}`,...H.parameters?.docs?.source}}};const Jt=["Default","MultipleSets","MultipleSetsStacked","Datalabels","DatalabelsValues","DatalabelsInTooltips","Animated","Doughnut","DoughnutFixedCutout","HoverOffset","SegmentOffset"];export{P as Animated,D as Datalabels,L as DatalabelsInTooltips,S as DatalabelsValues,O as Default,y as Doughnut,_ as DoughnutFixedCutout,b as HoverOffset,C as MultipleSets,x as MultipleSetsStacked,H as SegmentOffset,Jt as __namedExportsOrder,Yt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const p="modulepreload",y=function(u,i){return new URL(u,i).href},v={},w=function(i,a,f){let d=Promise.resolve();if(a&&a.length>0){let E=function(e){return Promise.all(e.map(o=>Promise.resolve(o).then(s=>({status:"fulfilled",value:s}),s=>({status:"rejected",reason:s}))))};const r=document.getElementsByTagName("link"),t=document.querySelector("meta[property=csp-nonce]"),m=t?.nonce||t?.getAttribute("nonce");d=E(a.map(e=>{if(e=y(e,f),e in v)return;v[e]=!0;const o=e.endsWith(".css"),s=o?'[rel="stylesheet"]':"";if(f)for(let c=r.length-1;c>=0;c--){const l=r[c];if(l.href===e&&(!o||l.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${e}"]${s}`))return;const n=document.createElement("link");if(n.rel=o?"stylesheet":p,o||(n.as="script"),n.crossOrigin="",n.href=e,m&&n.setAttribute("nonce",m),document.head.appendChild(n),o)return new Promise((c,l)=>{n.addEventListener("load",c),n.addEventListener("error",()=>l(new Error(`Unable to preload CSS for ${e}`)))})}))}function h(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&h(t.reason);return i().catch(h)})};export{w as _};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s}from"./iframe-DCxgzTof.js";import{c as l}from"./client-YjsYyvlT.js";import"./preload-helper-PPVm8Dsz.js";var n=new Map;function m(){return globalThis.IS_REACT_ACT_ENVIRONMENT}var a=({callback:e,children:r})=>{let t=s.useRef();return s.useLayoutEffect(()=>{t.current!==e&&(t.current=e,e())},[e]),r};typeof Promise.withResolvers>"u"&&(Promise.withResolvers=()=>{let e=null,r=null;return{promise:new Promise((t,o)=>{e=t,r=o}),resolve:e,reject:r}});var v=async(e,r,t)=>{let o=await c(r,t);if(m()){o.render(e);return}let{promise:i,resolve:u}=Promise.withResolvers();return o.render(s.createElement(a,{callback:u},e)),i},f=(e,r)=>{let t=n.get(e);t&&(t.unmount(),n.delete(e))},c=async(e,r)=>{let t=n.get(e);return t||(t=l.createRoot(e,r),n.set(e,t)),t};export{v as renderElement,f as unmountElement};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import{r as Z,j as p}from"./iframe-DCxgzTof.js";import{o as G,p as tt,i as et,d,S as at,D as st,q as ot,B as nt,s as E,b as rt,e as it,P as lt,ae as ct,f as q,t as dt,u as pt,v as gt,af as ut,x as ht,C as mt,y as bt,z as xt,F as ft,I as Ct,J as Tt,K as yt,N as St,O as Lt}from"./legend-context-Byc4ADTV.js";import{a as Rt,u as Ot,t as Dt,K as _t,V as vt,D as Wt,H as Bt,L as At,C as wt,b as It}from"./legend-CkDoV6Ma.js";import{D as kt,a as Ht}from"./bar-chart-const-Cgj9sgUU.js";import"./preload-helper-PPVm8Dsz.js";const U=(t,e)=>{let a={};return e?(Math.abs(t)<kt||Math.abs(t)>Ht)&&(a={roundScientificCoefficient:3}):a={scientific:!1},G(tt(t),a)},jt=(t,e)=>{if(e?.tooltip?.showLabelsInTooltips){const a=t[0],{label:s}=a?.dataset??{};return s}},Mt=(t,e)=>{const{raw:a,dataset:s}=t??{},o=a?.label,n=e?.tooltip?.scientificNotation;return`${o??s?.label} ( x: ${U(a?.x,n)} , y: ${U(a?.y,n)} )`},Nt=t=>({enabled:t?.tooltip?.enabled,callbacks:{title:e=>jt(e,t),label:e=>Mt(e,t)},backgroundColor:t?.tooltip?.backgroundColor,displayColors:t?.tooltip?.displayColors,padding:7}),z=({options:t,axisType:e=d.X,currentScale:a})=>{const s=et(t.direction),o=a||t?.axes?.[e]?.[0],n=s&&e===d.Y||!s&&e===d.X,r=o?.gridLines||{},m=()=>{const h=s?d.Y:d.X;return e===h?t?.additionalAxesOptions?.reverse:!1},b=()=>{const h=t?.additionalAxesOptions;return{...{stepSize:o?.stepSize??(e===d.Y?h?.stepSize:void 0)},includeBounds:!1,font:{size:st}}};return{type:at.Linear,position:o?.position,beginAtZero:t?.additionalAxesOptions?.beginAtZero,reverse:m(),suggestedMax:t?.additionalAxesOptions?.suggestedMax,suggestedMin:t?.additionalAxesOptions?.suggestedMin,min:n?t?.additionalAxesOptions?.min:void 0,max:n?t?.additionalAxesOptions?.max:void 0,title:{display:!!o?.label?.length||!!o?.unit?.length,text:o?.label||o?.unit,padding:0},ticks:b(),grid:{...r}}},Pt=t=>{const e=z({options:t,axisType:d.X}),a=z({options:t,axisType:d.Y});return{x:e,y:a}},Et=(t,e)=>{const{data:a,options:s}=t,{interactions:o,chartStyling:n}=s,[r,m]=Z.useState(!1),{legend:b,customLegendPlugin:h,legendClick:W}=Rt({chartRef:e,options:s}),{state:w}=Ot(),{annotation:B}=w,A=(x=>x.map((c,f)=>{const{borderWidth:I=_t}=c??{},J=parseFloat(String(I))||1,P=rt[f],K=c.borderColor??P,Q=c.backgroundColor??P;return{...c,borderWidth:J,borderColor:K,backgroundColor:Q}}))(a.datasets),X=(x,c,f)=>{f.resetZoom()},N=(x,c)=>{if(r&&!c?.length&&(m(!1),o.onUnhover&&o.onUnhover(x)),!r&&c?.length&&(m(!0),o.onHover)){const{index:f,datasetIndex:I}=c[0];o.onHover(x,I,f,A)}},$={onClick:X,onHover:N,...n,interactions:{onLegendClick:W,onHover:N},scales:Pt(t?.options),animation:n.performanceMode?{duration:E.NO}:{duration:E.FAST,onComplete:o?.onAnimationComplete},plugins:{legend:{...b,display:!1,events:[]},customLegendPlugin:h,title:ot(s),annotation:Dt(B),chartAreaBorder:{borderColor:nt},datalabels:{display:s.graph.showDataLabels},tooltip:Nt(s)}};return{generatedDatasets:A,scatterOptions:$}};var i=(t=>(t[t.TopToBottom=0]="TopToBottom",t[t.BottomToTop=1]="BottomToTop",t[t.LeftToRight=2]="LeftToRight",t[t.RightToLeft=3]="RightToLeft",t[t.TopLeftToBottomRight=4]="TopLeftToBottomRight",t[t.BottomRightToTopLeft=5]="BottomRightToTopLeft",t[t.BottomLeftToTopRight=6]="BottomLeftToTopRight",t[t.TopRightToBottomLeft=7]="TopRightToBottomLeft",t))(i||{});const qt=t=>({display:t?.display??!1,gradientColors:t?.gradientColors??ct,direction:t?.direction??i.BottomLeftToTopRight}),Ut=t=>({width:t?.width??q,height:t?.height??q,maintainAspectRatio:t?.maintainAspectRatio||!1,staticChartHeight:t?.staticChartHeight||!1,performanceMode:t?.performanceMode??!0,gradient:qt(t?.gradient)}),zt=t=>({enabled:t?.enabled??!0,tooltips:t?.tooltips??!0,showLabelsInTooltips:t?.showLabelsInTooltips||!1,backgroundColor:t?.backgroundColor||"#333",displayColors:t?.displayColors||!1,scientificNotation:t?.scientificNotation??!0}),Ft=t=>({showMinorGridlines:t?.showMinorGridlines??!1,showDataLabels:t?.showDataLabels??!1}),Zt=t=>({display:t?.display??!0,useDataset:t?.useDataset||!1,position:t?.position||lt.BottomLeft,align:t?.align||it.Center}),Yt=t=>({enableZoom:t?.enableZoom||!1,enablePan:t?.enablePan||!1}),Vt=t=>({onLegendClick:t?.onLegendClick,onHover:t?.onHover,onUnhover:t?.onUnhover,onAnimationComplete:t?.onAnimationComplete}),Xt=t=>({labels:t?.labels||[],datasets:t?.datasets||[]}),$t=t=>t?t.map(e=>({...e,display:e?.display??!0})):[],Jt=t=>({showAnnotations:t?.showAnnotations??!0,controlAnnotation:t?.controlAnnotation||!1,annotationsData:$t(t?.annotationsData)}),Kt=t=>({x:t?.x||[{}],y:t?.y||[{}]}),Qt=t=>({reverse:t?.reverse||!1,stacked:t?.stacked||!1,beginAtZero:t?.beginAtZero??!0,stepSize:t?.stepSize,suggestedMin:t?.suggestedMin,suggestedMax:t?.suggestedMax,min:t?.min,max:t?.max}),Y=t=>{const e=t?.chart||{},a=e?.options||{};return{testId:e?.testId??null,data:Xt(e?.data),options:{title:a?.title||"",axes:Kt(a?.axes),additionalAxesOptions:Qt(a?.additionalAxesOptions),direction:a?.direction||vt.VERTICAL,chartStyling:Ut(a?.chartStyling),tooltip:zt(a?.tooltip),graph:Ft(a?.graph),legend:Zt(a?.legend),annotations:Jt(a?.annotations),chartOptions:Yt(a?.chartOptions),interactions:Vt(a?.interactions)}}},Gt=(t,e)=>{switch(t){case i.TopToBottom:return[e.left,e.top,e.left,e.bottom];case i.BottomToTop:return[e.left,e.bottom,e.left,e.top];case i.LeftToRight:return[e.left,e.top,e.right,e.top];case i.RightToLeft:return[e.right,e.top,e.left,e.top];case i.TopLeftToBottomRight:return[e.left,e.top,e.right,e.bottom];case i.BottomRightToTopLeft:return[e.right,e.bottom,e.left,e.top];case i.BottomLeftToTopRight:return[e.left,e.bottom,e.right,e.top];case i.TopRightToBottomLeft:return[e.right,e.top,e.left,e.bottom];default:return[e.left,e.bottom,e.right,e.top]}},te={id:"gradientBackgroundPlugin",beforeDraw:t=>{const{ctx:e,chartArea:a,options:s}=t;if(!e||!a)return;const o=s?.gradient,{display:n=!1,gradientColors:r,direction:m=i.BottomLeftToTopRight}=o??{};if(!n||!r||r.length===0)return;const[b,h,W,w]=Gt(m,a),B=e.createLinearGradient(b,h,W,w);r.forEach(({offset:M,color:A})=>{B.addColorStop(M,A)}),e.save(),e.globalCompositeOperation="destination-over",e.fillStyle=B,e.fillRect(a.left,a.top,a.right-a.left,a.bottom-a.top),e.restore()}},ee="_chart_1qlu1_1",ae="_canvas_1qlu1_11",se="_fixedHeight_1qlu1_20",oe="_stretchHeight_1qlu1_26",ne="_squareAspectRatio_1qlu1_32",F={chart:ee,canvas:ae,fixedHeight:se,stretchHeight:oe,squareAspectRatio:ne};mt.register(bt,xt,ft,Ct,Tt,yt,St,Lt,It,te);const re=t=>{pt();const e=Z.useRef(null),a=Y(t),{options:s,testId:o}=a,{scatterOptions:n,generatedDatasets:r}=Et(a,e);return p.jsx("div",{className:gt(s.chartStyling,F),style:{width:s.chartStyling.width,height:s.chartStyling.height},"data-testid":o,children:p.jsx(Wt,{backend:Bt,context:window,children:p.jsxs("div",{className:F.canvas,id:"canvas",children:[p.jsx(ut,{ref:e,data:{datasets:r},options:n,plugins:ht(s.graph,s.legend)}),!!r.length&&p.jsx(At,{chartRef:e,legendConfig:{options:s,generatedDatasets:r,chartType:wt.SCATTER}})]})})})},k=t=>{const{options:e}=Y(t);return p.jsx(dt,{options:e,children:p.jsx(re,{...t})})};k.__docgenInfo={description:"",methods:[],displayName:"ScatterChartWithLegend",props:{chart:{required:!0,tsType:{name:"IScatterChartData"},description:""},testId:{required:!1,tsType:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},description:""}}};const g=["label 1","label 2","label 3"],u={label:"Dataset 1",data:[{x:1,y:5},{x:3,y:7},{x:6,y:2},{x:8,y:6},{x:9,y:4}]},H={label:"Dataset 2",data:[{x:1,y:3},{x:4,y:5},{x:7,y:9},{x:10,y:2},{x:12,y:7}]},ie={label:"Dataset 3",data:[{x:2,y:8},{x:5,y:6},{x:8,y:10},{x:11,y:5},{x:14,y:9}]},V={label:"Dataset 4",data:[{x:2,y:8},{x:14,y:9}]},le={label:"Dataset 5",data:[{x:14,y:7,label:"Echo"},{x:3,y:18,label:"Lima"},{x:19,y:2,label:"Romeo"},{x:8,y:11,label:"Charlie"},{x:12,y:9,label:"Oscar"}]},ce={label:"Dataset 6",data:[{x:15,y:3,label:"Hotel"},{x:9,y:14,label:"Tango"},{x:4,y:17,label:"Whiskey"},{x:11,y:7,label:"Juliet"},{x:13,y:1,label:"Zulu"}]},de={label:"Dataset Decimals",data:[{x:4.30021321123002,y:2.30021321123005},{x:5.12321321000003,y:3.23213210000037}]},j={data:{labels:g,datasets:[u]}},pe={data:{labels:g,datasets:[u]},options:{chartStyling:{height:300,width:700}}},ge={data:{labels:g,datasets:[u,H,ie]}},ue={data:{labels:g,datasets:[u]},options:{title:"With Data Labels",graph:{showDataLabels:!0}}},he={data:{labels:g,datasets:[u,H,de]},options:{title:"With Tooltips",tooltip:{title:"Tooltip",showLabelsInTooltips:!0}}},me={data:{labels:g,datasets:[{...u,backgroundColor:"red",borderColor:"red"}]}},be={data:{labels:g,datasets:[u]},options:{title:"With Annotation",annotations:{showAnnotations:!0,annotationsData:[{annotationAxis:"y",label:"Horizontal Annotation",value:2.5,color:"rgba(96, 32, 196, 0.5)"}]}}},xe={data:{labels:g,datasets:[u,H,V]},options:{title:"With Axes Labels",axes:{x:[{label:"x axis"}],y:[{label:"y axis"}]}}},fe={...j,options:{title:"With Gradient",chartStyling:{gradient:{display:!0}}}},Ce={data:{datasets:[le,ce,V]},options:{title:"With datapoint label showing when hovered",tooltip:{showLabelsInTooltips:!0}}},Oe={title:"ScatterChart",component:k,args:{chart:j}},l=t=>p.jsx(k,{...t}),C=l.bind({});C.args={chart:j};const T=l.bind({});T.args={chart:pe};const y=l.bind({});y.args={chart:ge};const S=l.bind({});S.args={chart:ue};const L=l.bind({});L.args={chart:he};const R=l.bind({});R.args={chart:be};const O=l.bind({});O.args={chart:xe};const D=l.bind({});D.args={chart:fe};const _=l.bind({});_.args={chart:Ce};const v=l.bind({});v.args={chart:me};C.parameters={...C.parameters,docs:{...C.parameters?.docs,source:{originalSource:`args => {
|
|
2
|
-
return <ScatterChart
|
|
3
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
4
|
-
{...args} />;
|
|
5
|
-
}`,...C.parameters?.docs?.source}}};T.parameters={...T.parameters,docs:{...T.parameters?.docs,source:{originalSource:`args => {
|
|
6
|
-
return <ScatterChart
|
|
7
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
8
|
-
{...args} />;
|
|
9
|
-
}`,...T.parameters?.docs?.source}}};y.parameters={...y.parameters,docs:{...y.parameters?.docs,source:{originalSource:`args => {
|
|
10
|
-
return <ScatterChart
|
|
11
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
12
|
-
{...args} />;
|
|
13
|
-
}`,...y.parameters?.docs?.source}}};S.parameters={...S.parameters,docs:{...S.parameters?.docs,source:{originalSource:`args => {
|
|
14
|
-
return <ScatterChart
|
|
15
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
16
|
-
{...args} />;
|
|
17
|
-
}`,...S.parameters?.docs?.source}}};L.parameters={...L.parameters,docs:{...L.parameters?.docs,source:{originalSource:`args => {
|
|
18
|
-
return <ScatterChart
|
|
19
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
20
|
-
{...args} />;
|
|
21
|
-
}`,...L.parameters?.docs?.source}}};R.parameters={...R.parameters,docs:{...R.parameters?.docs,source:{originalSource:`args => {
|
|
22
|
-
return <ScatterChart
|
|
23
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
24
|
-
{...args} />;
|
|
25
|
-
}`,...R.parameters?.docs?.source}}};O.parameters={...O.parameters,docs:{...O.parameters?.docs,source:{originalSource:`args => {
|
|
26
|
-
return <ScatterChart
|
|
27
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
28
|
-
{...args} />;
|
|
29
|
-
}`,...O.parameters?.docs?.source}}};D.parameters={...D.parameters,docs:{...D.parameters?.docs,source:{originalSource:`args => {
|
|
30
|
-
return <ScatterChart
|
|
31
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
32
|
-
{...args} />;
|
|
33
|
-
}`,...D.parameters?.docs?.source}}};_.parameters={..._.parameters,docs:{..._.parameters?.docs,source:{originalSource:`args => {
|
|
34
|
-
return <ScatterChart
|
|
35
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
36
|
-
{...args} />;
|
|
37
|
-
}`,..._.parameters?.docs?.source}}};v.parameters={...v.parameters,docs:{...v.parameters?.docs,source:{originalSource:`args => {
|
|
38
|
-
return <ScatterChart
|
|
39
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
40
|
-
{...args} />;
|
|
41
|
-
}`,...v.parameters?.docs?.source}}};const De=["Default","StyledChart","MultipleDatasets","WithDataLabels","WithTooltips","WithAnnotation","WithAxesLabels","WithGradient","WithDatapointsHavingLabel","CustomPointColor"];export{v as CustomPointColor,C as Default,y as MultipleDatasets,T as StyledChart,R as WithAnnotation,O as WithAxesLabels,S as WithDataLabels,_ as WithDatapointsHavingLabel,D as WithGradient,L as WithTooltips,De as __namedExportsOrder,Oe as default};
|