@oliasoft-open-source/charts-library 5.5.0-beta-3 → 5.5.0-beta-5
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-Cvup177w.js → Color-AVL7NMMY-m0fFC0hS.js} +1 -1
- package/dist/assets/{DocsRenderer-PQXLIZUC-C8oenzCg.js → DocsRenderer-PQXLIZUC-BhZrnj-x.js} +2 -2
- package/dist/assets/bar-chart.stories-BFArxuxM.js +145 -0
- package/dist/assets/client-SlPkUNtY.js +1 -0
- package/dist/assets/{components-Bhnu9xjs.js → components-Bt9IMQSt.js} +1 -1
- package/dist/assets/{get-draggableData-Ci7DAhgp.js → get-draggableData-ByrVhmD5.js} +2 -2
- package/dist/assets/{iframe-DmiD_XLI.js → iframe-DW2UQNc3.js} +5 -5
- package/dist/assets/{legend-DLSpTR0Q.js → legend-C6YWwRpu.js} +7 -7
- package/dist/assets/{legend-context-0FoVt6TR.js → legend-context-C2Dt3PJx.js} +3 -3
- package/dist/assets/line-chart-CNmqtXk-.js +1 -0
- package/dist/assets/{line-chart.stories-SIfsugaw.js → line-chart.stories-Cnj5uyTo.js} +1 -1
- package/dist/assets/line-chart.test-case.stories-ClCgTJUJ.js +1545 -0
- package/dist/assets/pie-chart.stories-BVUTCp0_.js +45 -0
- package/dist/assets/{react-18-DVWhm1ZL.js → react-18-CFvwF0kt.js} +1 -1
- package/dist/assets/{react-CG8Fu59u.js → react-BLWr6Eyx.js} +1 -1
- package/dist/assets/scatter-chart.stories-CZod9JAT.js +41 -0
- package/dist/common/helpers/callout-helpers/callout-helpers.d.ts +2 -2
- package/dist/common/helpers/get-chart-from-ctx.d.ts +1 -0
- package/dist/common/plugins/annotation-dragger-plugin/annotation-position-storage.d.ts +7 -0
- package/dist/common/plugins/annotation-dragger-plugin/event-helpers.d.ts +1 -1
- package/dist/iframe.html +1 -1
- package/dist/index.js +114 -45
- package/dist/index.json +1 -1
- package/dist/line-chart/hooks/use-chart-options.d.ts +4 -1
- package/dist/project.json +1 -1
- package/dist/src/components/common/helpers/callout-helpers/callout-helpers.d.ts +2 -2
- package/dist/src/components/common/helpers/get-chart-from-ctx.d.ts +1 -0
- package/dist/src/components/common/plugins/annotation-dragger-plugin/annotation-position-storage.d.ts +7 -0
- package/dist/src/components/common/plugins/annotation-dragger-plugin/event-helpers.d.ts +1 -1
- package/dist/src/components/line-chart/hooks/use-chart-options.d.ts +4 -1
- package/package.json +1 -1
- package/dist/assets/bar-chart.stories-De78SDiD.js +0 -145
- package/dist/assets/client-DsbWhmXk.js +0 -1
- package/dist/assets/line-chart-VpvCvObG.js +0 -1
- package/dist/assets/line-chart.test-case.stories-B9eK7kjq.js +0 -430
- package/dist/assets/pie-chart.stories-CHMHYc28.js +0 -45
- package/dist/assets/scatter-chart.stories-HJi4Ssg8.js +0 -41
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import{_t as e,at as t,dt as n}from"./iframe-DmiD_XLI.js";import{At as r,B as i,C as a,Ct as o,F as s,G as c,K as l,L as u,M as d,Mt as f,Nt as p,Ot as m,Pt as h,R as ee,b as g,et as _,g as v,h as y,ht as b,it as te,j as ne,mt as re,n as ie,p as ae,wt as oe,x as se,y as ce,yt as le}from"./legend-context-0FoVt6TR.js";import{J as ue,Y as de,d as fe,f as pe,g as me,i as he,p as ge,q as _e,r as ve,t as ye}from"./legend-DLSpTR0Q.js";import{n as be,t as xe}from"./bar-chart-const-D_44J3Hs.js";var x=e(n(),1);const S=(e,t)=>{let n={};return t?(Math.abs(e)<1e-4||Math.abs(e)>1e7)&&(n={roundScientificCoefficient:3}):n={scientific:!1},_(te(e),n)};var C=(e,t)=>{if(t?.tooltip?.showLabelsInTooltips){let{label:t}=e[0]?.dataset??{};return t}},w=(e,t)=>{let{raw:n,dataset:r}=e??{},i=n?.label,a=t?.tooltip?.scientificNotation;return`${i??r?.label} ( x: ${S(n?.x,a)} , y: ${S(n?.y,a)} )`};const T=e=>({enabled:e?.tooltip?.enabled,callbacks:{title:t=>C(t,e),label:t=>w(t,e)},backgroundColor:e?.tooltip?.backgroundColor,displayColors:e?.tooltip?.displayColors,padding:7});var E=({options:e,axisType:t=a.X,currentScale:n})=>{let r=ce(e.direction),i=n||e?.axes?.[t]?.[0],o=r&&t===a.Y||!r&&t===a.X,s=i?.gridLines||{};return{type:d.Linear,position:i?.position,beginAtZero:e?.additionalAxesOptions?.beginAtZero,reverse:(()=>t===(r?a.Y:a.X)?e?.additionalAxesOptions?.reverse:!1)(),suggestedMax:e?.additionalAxesOptions?.suggestedMax,suggestedMin:e?.additionalAxesOptions?.suggestedMin,min:o?e?.additionalAxesOptions?.min:void 0,max:o?e?.additionalAxesOptions?.max:void 0,title:{display:!!i?.label?.length||!!i?.unit?.length,text:i?.label||i?.unit,padding:0},ticks:(()=>{let n=e?.additionalAxesOptions;return{stepSize:i?.stepSize??(t===a.Y?n?.stepSize:void 0),includeBounds:!1,font:{size:12}}})(),grid:{...s}}};const D=e=>({x:E({options:e,axisType:a.X}),y:E({options:e,axisType:a.Y})}),O=(e,t)=>{let{data:n,options:r}=e,{interactions:a,chartStyling:o}=r,[c,l]=(0,x.useState)(!1),{legend:u,customLegendPlugin:d,legendClick:f}=pe({chartRef:t,options:r}),{state:p}=ge(),{annotation:m}=p,h=(e=>e.map((e,t)=>{let{borderWidth:n=1}=e??{},r=parseFloat(String(n))||1,a=i[t],o=e.borderColor??a,s=e.backgroundColor??a;return{...e,borderWidth:r,borderColor:o,backgroundColor:s}}))(n.datasets),g=(e,t,n)=>{n.resetZoom()},_=(e,t)=>{if(c&&!t?.length&&(l(!1),a.onUnhover&&a.onUnhover(e)),!c&&t?.length&&(l(!0),a.onHover)){let{index:n,datasetIndex:r}=t[0];a.onHover(e,r,n,h)}};return{generatedDatasets:h,scatterOptions:{onClick:g,onHover:_,...o,interactions:{onLegendClick:f,onHover:_},scales:D(e?.options),animation:o.performanceMode?{duration:s.NO}:{duration:s.FAST,onComplete:a?.onAnimationComplete},plugins:{legend:{...u,display:!1,events:[]},customLegendPlugin:d,title:v(r),annotation:fe(m),chartAreaBorder:{borderColor:ee},datalabels:{display:r.graph.showDataLabels},tooltip:T(r)}}}};let k=function(e){return e[e.TopToBottom=0]=`TopToBottom`,e[e.BottomToTop=1]=`BottomToTop`,e[e.LeftToRight=2]=`LeftToRight`,e[e.RightToLeft=3]=`RightToLeft`,e[e.TopLeftToBottomRight=4]=`TopLeftToBottomRight`,e[e.BottomRightToTopLeft=5]=`BottomRightToTopLeft`,e[e.BottomLeftToTopRight=6]=`BottomLeftToTopRight`,e[e.TopRightToBottomLeft=7]=`TopRightToBottomLeft`,e}({});var A=e=>({display:e?.display??!1,gradientColors:e?.gradientColors??l,direction:e?.direction??k.BottomLeftToTopRight}),j=e=>({width:e?.width??`auto`,height:e?.height??`auto`,maintainAspectRatio:e?.maintainAspectRatio||!1,staticChartHeight:e?.staticChartHeight||!1,performanceMode:e?.performanceMode??!0,gradient:A(e?.gradient)}),M=e=>({enabled:e?.enabled??!0,tooltips:e?.tooltips??!0,showLabelsInTooltips:e?.showLabelsInTooltips||!1,backgroundColor:e?.backgroundColor||`#333`,displayColors:e?.displayColors||!1,scientificNotation:e?.scientificNotation??!0}),Se=e=>({showMinorGridlines:e?.showMinorGridlines??!1,showDataLabels:e?.showDataLabels??!1}),Ce=e=>({display:e?.display??!0,useDataset:e?.useDataset||!1,position:e?.position||ne.BottomLeft,align:e?.align||se.Center}),we=e=>({enableZoom:e?.enableZoom||!1,enablePan:e?.enablePan||!1}),Te=e=>({onLegendClick:e?.onLegendClick,onHover:e?.onHover,onUnhover:e?.onUnhover,onAnimationComplete:e?.onAnimationComplete}),Ee=e=>({labels:e?.labels||[],datasets:e?.datasets||[]}),De=e=>e?e.map(e=>({...e,display:e?.display??!0})):[],Oe=e=>({showAnnotations:e?.showAnnotations??!0,controlAnnotation:e?.controlAnnotation||!1,annotationsData:De(e?.annotationsData)}),ke=e=>({x:e?.x||[{}],y:e?.y||[{}]}),Ae=e=>({reverse:e?.reverse||!1,stacked:e?.stacked||!1,beginAtZero:e?.beginAtZero??!0,stepSize:e?.stepSize,suggestedMin:e?.suggestedMin,suggestedMax:e?.suggestedMax,min:e?.min,max:e?.max});const N=e=>{let t=e?.chart||{},n=t?.options||{};return{testId:t?.testId??null,data:Ee(t?.data),options:{title:n?.title||``,axes:ke(n?.axes),additionalAxesOptions:Ae(n?.additionalAxesOptions),direction:n?.direction||ve.VERTICAL,chartStyling:j(n?.chartStyling),tooltip:M(n?.tooltip),graph:Se(n?.graph),legend:Ce(n?.legend),annotations:Oe(n?.annotations),chartOptions:we(n?.chartOptions),interactions:Te(n?.interactions)}}};var je=(e,t)=>{switch(e){case k.TopToBottom:return[t.left,t.top,t.left,t.bottom];case k.BottomToTop:return[t.left,t.bottom,t.left,t.top];case k.LeftToRight:return[t.left,t.top,t.right,t.top];case k.RightToLeft:return[t.right,t.top,t.left,t.top];case k.TopLeftToBottomRight:return[t.left,t.top,t.right,t.bottom];case k.BottomRightToTopLeft:return[t.right,t.bottom,t.left,t.top];case k.BottomLeftToTopRight:return[t.left,t.bottom,t.right,t.top];case k.TopRightToBottomLeft:return[t.right,t.top,t.left,t.bottom];default:return[t.left,t.bottom,t.right,t.top]}};const Me={id:`gradientBackgroundPlugin`,beforeDraw:e=>{let{ctx:t,chartArea:n,options:r}=e;if(!t||!n)return;let{display:i=!1,gradientColors:a,direction:o=k.BottomLeftToTopRight}=r?.gradient??{};if(!i||!a||a.length===0)return;let[s,c,l,u]=je(o,n),d=t.createLinearGradient(s,c,l,u);a.forEach(({offset:e,color:t})=>{d.addColorStop(e,t)}),t.save(),t.globalCompositeOperation=`destination-over`,t.fillStyle=d,t.fillRect(n.left,n.top,n.right-n.left,n.bottom-n.top),t.restore()}};var P={chart:`_chart_1qlu1_1`,canvas:`_canvas_1qlu1_11`,fixedHeight:`_fixedHeight_1qlu1_20`,stretchHeight:`_stretchHeight_1qlu1_26`,squareAspectRatio:`_squareAspectRatio_1qlu1_32`,zoomForm:`_zoomForm_1qlu1_43`,zoomReset:`_zoomReset_1qlu1_51`,help:`_help_1qlu1_54`,autoWeight:`_autoWeight_1qlu1_58`},F=e(t(),1);oe.register(m,r,o,f,h,p,b,re,de,Me);var Ne=e=>{g();let t=(0,x.useRef)(null),n=N(e),{options:r,testId:i}=n,{scatterOptions:a,generatedDatasets:o}=O(n,t);return(0,F.jsx)(`div`,{className:ae(r.chartStyling,P),style:{width:r.chartStyling.width,height:r.chartStyling.height},"data-testid":i,children:(0,F.jsx)(_e,{backend:ue,context:window,children:(0,F.jsxs)(`div`,{className:P.canvas,id:`canvas`,children:[(0,F.jsx)(le,{ref:t,data:{datasets:o},options:a,plugins:y(r.graph,r.legend)}),!!o.length&&(0,F.jsx)(ye,{chartRef:t,legendConfig:{options:r,generatedDatasets:o,chartType:he.SCATTER}})]})})})},I=e=>{let{options:t}=N(e);return(0,F.jsx)(ie,{options:t,children:(0,F.jsx)(Ne,{...e})})};I.__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:``}}};var L=[`label 1`,`label 2`,`label 3`],R={label:`Dataset 1`,data:[{x:1,y:5},{x:3,y:7},{x:6,y:2},{x:8,y:6},{x:9,y:4}]},z={label:`Dataset 2`,data:[{x:1,y:3},{x:4,y:5},{x:7,y:9},{x:10,y:2},{x:12,y:7}]},Pe={label:`Dataset 3`,data:[{x:2,y:8},{x:5,y:6},{x:8,y:10},{x:11,y:5},{x:14,y:9}]},B={label:`Dataset 4`,data:[{x:2,y:8},{x:14,y:9}]},Fe={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`}]},Ie={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`}]},Le={label:`Dataset Decimals`,data:[{x:4.30021321123002,y:2.30021321123005},{x:5.12321321000003,y:3.23213210000037}]},V={data:{labels:L,datasets:[R]}},Re={data:{labels:L,datasets:[R]},options:{chartStyling:{height:300,width:700}}},ze={data:{labels:L,datasets:[R,z,Pe]}},Be={data:{labels:L,datasets:[R]},options:{title:`With Data Labels`,graph:{showDataLabels:!0}}},Ve={data:{labels:L,datasets:[R,z,Le]},options:{title:`With Tooltips`,tooltip:{title:`Tooltip`,showLabelsInTooltips:!0}}},He={data:{labels:L,datasets:[{...R,backgroundColor:`red`,borderColor:`red`}]}},Ue={data:{labels:L,datasets:[R]},options:{title:`With Annotation`,annotations:{showAnnotations:!0,annotationsData:[{annotationAxis:`y`,label:`Horizontal Annotation`,value:2.5,color:`rgba(96, 32, 196, 0.5)`}]}}},We={data:{labels:L,datasets:[R,z,B]},options:{title:`With Axes Labels`,axes:{x:[{label:`x axis`}],y:[{label:`y axis`}]}}},Ge={...V,options:{title:`With Gradient`,chartStyling:{gradient:{display:!0}}}},H={data:{datasets:[Fe,Ie,B]},options:{title:`With datapoint label showing when hovered`,tooltip:{showLabelsInTooltips:!0}}},Ke={title:`ScatterChart`,component:I,args:{chart:V}},U=e=>(0,F.jsx)(I,{...e});const W=U.bind({});W.args={chart:V};const G=U.bind({});G.args={chart:Re};const K=U.bind({});K.args={chart:ze};const q=U.bind({});q.args={chart:Be};const J=U.bind({});J.args={chart:Ve};const Y=U.bind({});Y.args={chart:Ue};const X=U.bind({});X.args={chart:We};const Z=U.bind({});Z.args={chart:Ge};const Q=U.bind({});Q.args={chart:H};const $=U.bind({});$.args={chart:He},W.parameters={...W.parameters,docs:{...W.parameters?.docs,source:{originalSource:`args => {
|
|
2
|
-
return <ScatterChart
|
|
3
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
4
|
-
{...args} />;
|
|
5
|
-
}`,...W.parameters?.docs?.source}}},G.parameters={...G.parameters,docs:{...G.parameters?.docs,source:{originalSource:`args => {
|
|
6
|
-
return <ScatterChart
|
|
7
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
8
|
-
{...args} />;
|
|
9
|
-
}`,...G.parameters?.docs?.source}}},K.parameters={...K.parameters,docs:{...K.parameters?.docs,source:{originalSource:`args => {
|
|
10
|
-
return <ScatterChart
|
|
11
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
12
|
-
{...args} />;
|
|
13
|
-
}`,...K.parameters?.docs?.source}}},q.parameters={...q.parameters,docs:{...q.parameters?.docs,source:{originalSource:`args => {
|
|
14
|
-
return <ScatterChart
|
|
15
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
16
|
-
{...args} />;
|
|
17
|
-
}`,...q.parameters?.docs?.source}}},J.parameters={...J.parameters,docs:{...J.parameters?.docs,source:{originalSource:`args => {
|
|
18
|
-
return <ScatterChart
|
|
19
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
20
|
-
{...args} />;
|
|
21
|
-
}`,...J.parameters?.docs?.source}}},Y.parameters={...Y.parameters,docs:{...Y.parameters?.docs,source:{originalSource:`args => {
|
|
22
|
-
return <ScatterChart
|
|
23
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
24
|
-
{...args} />;
|
|
25
|
-
}`,...Y.parameters?.docs?.source}}},X.parameters={...X.parameters,docs:{...X.parameters?.docs,source:{originalSource:`args => {
|
|
26
|
-
return <ScatterChart
|
|
27
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
28
|
-
{...args} />;
|
|
29
|
-
}`,...X.parameters?.docs?.source}}},Z.parameters={...Z.parameters,docs:{...Z.parameters?.docs,source:{originalSource:`args => {
|
|
30
|
-
return <ScatterChart
|
|
31
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
32
|
-
{...args} />;
|
|
33
|
-
}`,...Z.parameters?.docs?.source}}},Q.parameters={...Q.parameters,docs:{...Q.parameters?.docs,source:{originalSource:`args => {
|
|
34
|
-
return <ScatterChart
|
|
35
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
36
|
-
{...args} />;
|
|
37
|
-
}`,...Q.parameters?.docs?.source}}},$.parameters={...$.parameters,docs:{...$.parameters?.docs,source:{originalSource:`args => {
|
|
38
|
-
return <ScatterChart
|
|
39
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
40
|
-
{...args} />;
|
|
41
|
-
}`,...$.parameters?.docs?.source}}};const qe=[`Default`,`StyledChart`,`MultipleDatasets`,`WithDataLabels`,`WithTooltips`,`WithAnnotation`,`WithAxesLabels`,`WithGradient`,`WithDatapointsHavingLabel`,`CustomPointColor`];export{$ as CustomPointColor,W as Default,K as MultipleDatasets,G as StyledChart,Y as WithAnnotation,X as WithAxesLabels,q as WithDataLabels,Q as WithDatapointsHavingLabel,Z as WithGradient,J as WithTooltips,qe as __namedExportsOrder,Ke as default};
|