win-chart 3.0.2 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/bun/index.js +5 -0
  2. package/dist/bun/index.js.map +25 -0
  3. package/dist/bun/types/components/ChartWrapper.d.ts +1 -0
  4. package/dist/bun/types/components/EarthChart.d.ts +15 -0
  5. package/dist/bun/types/components/GanttChart.d.ts +8 -0
  6. package/dist/bun/types/components/WinChart.d.ts +2 -0
  7. package/dist/bun/types/components/__tests__/Playground.test.d.ts +1 -0
  8. package/dist/bun/types/components/__tests__/WinChart.test.d.ts +1 -0
  9. package/dist/bun/types/index.d.ts +8 -0
  10. package/dist/bun/types/types/index.d.ts +126 -0
  11. package/dist/bun/types/utils/const.d.ts +14 -0
  12. package/dist/bun/types/utils/data.d.ts +20 -0
  13. package/dist/bun/types/utils/earthMockData.d.ts +7 -0
  14. package/dist/bun/types/utils/getAreaSpec.d.ts +14 -0
  15. package/dist/bun/types/utils/getBarSpec.d.ts +14 -0
  16. package/dist/bun/types/utils/getChartOptions.d.ts +7 -0
  17. package/dist/bun/types/utils/getColumnSpec.d.ts +14 -0
  18. package/dist/bun/types/utils/getDualSpec.d.ts +14 -0
  19. package/dist/bun/types/utils/getFunnelSpec.d.ts +8 -0
  20. package/dist/bun/types/utils/getLineSpec.d.ts +8 -0
  21. package/dist/bun/types/utils/getPieSpec.d.ts +13 -0
  22. package/dist/bun/types/utils/getRadarSpec.d.ts +7 -0
  23. package/dist/bun/types/utils/tool.d.ts +140 -0
  24. package/dist/cjs/components/__tests__/Playground.test.cjs +90 -0
  25. package/dist/cjs/components/__tests__/WinChart.test.cjs +112 -0
  26. package/dist/cjs/stories/WinChart.stories.cjs +524 -0
  27. package/dist/cjs/utils/const.cjs +21 -0
  28. package/dist/cjs/utils/getAreaSpec.cjs +2 -18
  29. package/dist/cjs/utils/getBarSpec.cjs +7 -21
  30. package/dist/cjs/utils/getColumnSpec.cjs +3 -18
  31. package/dist/cjs/utils/getDualSpec.cjs +3 -24
  32. package/dist/cjs/utils/getFunnelSpec.cjs +2 -3
  33. package/dist/cjs/utils/getLineSpec.cjs +2 -9
  34. package/dist/cjs/utils/getPieSpec.cjs +3 -6
  35. package/dist/cjs/utils/getRadarSpec.cjs +1 -3
  36. package/dist/cjs/utils/tool.cjs +7 -4
  37. package/dist/esm/components/__tests__/Playground.test.js +84 -0
  38. package/dist/esm/components/__tests__/WinChart.test.js +106 -0
  39. package/dist/esm/stories/WinChart.stories.js +466 -0
  40. package/dist/esm/utils/const.js +16 -1
  41. package/dist/esm/utils/getAreaSpec.js +3 -19
  42. package/dist/esm/utils/getBarSpec.js +8 -22
  43. package/dist/esm/utils/getColumnSpec.js +3 -18
  44. package/dist/esm/utils/getDualSpec.js +3 -24
  45. package/dist/esm/utils/getFunnelSpec.js +2 -3
  46. package/dist/esm/utils/getLineSpec.js +2 -9
  47. package/dist/esm/utils/getPieSpec.js +3 -6
  48. package/dist/esm/utils/getRadarSpec.js +2 -4
  49. package/dist/esm/utils/tool.js +7 -4
  50. package/dist/types/components/__tests__/Playground.test.d.ts +1 -0
  51. package/dist/types/components/__tests__/WinChart.test.d.ts +1 -0
  52. package/dist/types/index.d.ts +1 -1
  53. package/dist/types/types/index.d.ts +1 -2
  54. package/dist/types/utils/const.d.ts +6 -0
  55. package/dist/types/utils/getDualSpec.d.ts +1 -0
  56. package/dist/types/utils/tool.d.ts +2 -1
  57. package/package.json +28 -6
@@ -0,0 +1,5 @@
1
+ import*as Vf from"echarts";import{styled as ul}from"styled-components";var $=ul.div`
2
+ height: 100%;
3
+ `;import{useRef as yl,useEffect as g,useState as bl}from"react";var I;((d)=>{d.MINI_AREA="mini-area";d.AREA="area";d.DUAL_LINE_BAR="dual-line-bar";d.STACK_DUAL_LINE_BAR="stack-dual-line-bar";d.COLUMN="column";d.STACK_COLUMN="stack-column";d.LINE="line";d.BAR="bar";d.STACK_BAR="stack-bar";d.FUNNEL="funnel";d.PIE="pie";d.CYCLE="cycle";d.RADAR="radar"})(I||={});var Y=["#3D84FF","#00DCF0","#FCBC26","#00DB75","#BDB8FF","#40B4FF","#FFA101","#90ABE0","#6EE67A","#6B84FF","#FA6B69"],G={grid:{top:24,left:0,right:12,bottom:32,containLabel:!0},color:Y,legend:{itemWidth:10,itemHeight:10,bottom:0,type:"scroll",icon:"circle"}},x={trigger:"axis",axisPointer:{type:"cross",crossStyle:{color:"#999"},label:{backgroundColor:"#999"}}},v={trigger:"item"};import{graphic as xl}from"echarts";import{rgba as M}from"polished";function _(l){return Array.isArray(l)&&l.length>0}var Z=(l,f=2)=>typeof l==="number"?`${Number((l*100).toFixed(f))}%`:"-%";function R(l){if(Array.isArray(l))return[...new Set(l)];return[]}var N=(l)=>{if(Array.isArray(l)&&l.length!==0)return l.reduce((f,c)=>{let o=Number(c);return f+(!Object.is(o,NaN)?o:0)},0);return 0};var q=(l,f="desc")=>{if(Array.isArray(l)&&f==="asc")return JSON.parse(JSON.stringify(l)).sort((o,e)=>o.value-e.value);if(Array.isArray(l)&&f==="desc")return JSON.parse(JSON.stringify(l)).sort((o,e)=>e.value-o.value);return l},F=(l)=>{let f=[...l.data??[],...l.extraData??[]];return R(f.map((c)=>c.label))},z=(l)=>{return R(l.data?.filter((f)=>!!f.type).map((f)=>f.type))??[]},V=(l)=>{return R(l.extraData?.filter((f)=>!!f.type).map((f)=>f.type))??[]},S=(l,f)=>{let c=[...l.data??[],...l.extraData??[]];return F(l).map((o)=>{return c.find((e)=>e.type===f&&e.label===o)?.value??0})},m=(l)=>{return l.showLabel?{show:!0,formatter:"{c}",position:"top",showSymbol:!0}:{show:!1}},J=(l,f)=>{let c=l.xAxisLabelLength;if(typeof c==="number"&&f.length>c)return`${f.slice(0,c)}...`;return f},k=(l)=>{return{boundaryGap:!0,axisTick:{alignWithLabel:!0},data:F(l),axisLabel:{rotate:l.xAxisLabelRotate,formatter:(f)=>J(l,f)}}},A=(l,f)=>{return new xl.LinearGradient(0,0,0,1,[{offset:0,color:M(f,0.5)},{offset:1,color:l.theme==="dark"?M("gray",0.1):"#fff"}])},zl=(l,f)=>{if(f==="asc")l.sort((c,o)=>{return c.value-o.value});else if(f==="desc")l.sort((c,o)=>{return o.value-c.value});return l},D=(l,f)=>{return l.sort((c,o)=>{let e=f.indexOf(c.label),b=f.indexOf(o.label);return e-b}),l},L=(l)=>{let{data:f,extraData:c,sort:o}=l;if(f&&o){let e=zl([...f],o),b=R(e.map((W)=>W.label)),u=D(e,b),E=D([...c??[]],b);return{...l,data:u,extraData:E}}return l};function K(l,f){let c=null;return function(...o){clearTimeout(c),c=setTimeout(()=>{l.apply(globalThis,o)},f)}}var O=(l,f)=>{if(_(l.series)&&_(f))f.forEach((c)=>{l.series=l.series.map((o)=>({...o,...o.name===c.name&&c}))});return l},X=(l)=>{return l.theme==="dark"?"rgba(255, 255, 255, 0.7)":"rgba(0, 0, 0, 0.7)"};function T(l,f){let c=l.reduce((o,e)=>{let{label:b,value:u}=e;if(o[b]===void 0)o[b]=0;if(u)o[b]+=Number(u);return o},{});if(f&&f.length>0)return f.map((o)=>{let e=c[o]||0;return parseFloat(e.toFixed(2))});return Object.values(c).map((o)=>parseFloat(o.toFixed(2)))}var h=(l)=>{let f=z(l),c=l.color;return{color:c,grid:{top:4,left:0,right:0,bottom:0,containLabel:!0},tooltip:x,legend:{show:!1},xAxis:{show:!1,boundaryGap:!1,data:F(l)},yAxis:{show:!1,min:l.yStart?.at(0)},series:[...f.map((o,e)=>{let b=c?.[e]??Y[e];return{name:o,type:"line",smooth:!0,lineStyle:{width:2},showSymbol:!1,areaStyle:{opacity:0.8,color:A(l,b)},emphasis:{focus:"series"},label:m(l),data:S(l,o)}})]}},i=(l)=>{let f=z(l);return{tooltip:x,legend:{bottom:0,type:"scroll"},xAxis:k(l),yAxis:{min:l.yStart?.at(0)},series:[...f.map((c,o)=>{let e=Y[o];return{name:c,type:"line",smooth:!0,lineStyle:{width:2},areaStyle:{opacity:0.8,color:A(l,e)},emphasis:{focus:"series"},showSymbol:l.showLabel,label:m(l),data:S(l,c)}})]}};var r=(l)=>{let f=z(l),c=V(l);return{tooltip:x,legend:{bottom:0,type:"scroll"},xAxis:{...k(l),axisPointer:{type:"shadow"}},yAxis:[{alignTicks:!0,min:l.yStart?.[0]},{alignTicks:!0,min:l.yStart?.[1]}],series:[...f.map((o)=>({name:o,type:"bar",barGap:"30%",barCategoryGap:"30%",barMaxWidth:8,label:m(l),data:S(l,o).map((e)=>({value:e,itemStyle:{borderRadius:e>0?[500,500,0,0]:[0,0,500,500]}}))})),...c.map((o)=>({name:o,type:"line",smooth:!0,yAxisIndex:1,showSymbol:!1,label:m(l),data:S(l,o)}))]}},s=(l)=>{let f=z(l),c=V(l);return{tooltip:x,legend:{bottom:0,type:"scroll"},xAxis:{...k(l),axisPointer:{type:"shadow"}},yAxis:[{alignTicks:!0,min:l.yStart?.[0]},{alignTicks:!0,min:l.yStart?.[1]}],series:[...f.map((o)=>({name:o,type:"bar",stack:"total",barGap:"30%",barCategoryGap:"30%",barMaxWidth:8,label:m(l),data:S(l,o)})),...c.map((o)=>({name:o,type:"line",smooth:!0,yAxisIndex:1,showSymbol:!1,label:m(l),data:S(l,o)}))]}};var t=(l)=>{let f=N(l.data?.map((c)=>c.value));return{tooltip:v,legend:{bottom:0,type:"scroll"},series:[{top:-30,type:"pie",radius:"50%",data:q(l.data)?.map((c)=>({value:c.value,name:l.reserveValueWithLabelType?c.label:c.type})),label:{show:!0,fontSize:12,color:X(l),position:"outside",formatter:(c)=>{return Z(c.value/(f||1))}},emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]}},w=(l)=>{let f=N(l.data?.map((c)=>c.value));return{tooltip:v,legend:{bottom:0,type:"scroll"},series:[{top:-30,type:"pie",radius:["60%","48%"],data:q(l.data,l.sort)?.map((c)=>({value:c.value,name:l.reserveValueWithLabelType?c.label:c.type})),label:{show:!0,fontSize:12,color:X(l),position:"outside",formatter:(c)=>{return Z(c.value/(f||1))}},emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}],graphic:[{type:"text",left:"center",top:l.cycleCenterConfig?.content?.top??76,style:{text:l.cycleCenterConfig?.content?.value??Number(f.toFixed(2)).toString(),fill:l.theme==="dark"?"#fff":"#12161F",fontFamily:"roboto",fontSize:l.cycleCenterConfig?.content?.fontSize??28,fontWeight:"bold"}},{type:"text",left:"center",top:l.cycleCenterConfig?.title?.top??112,style:{text:l.cycleCenterConfig?.title?.value??"总计",fill:l.theme==="dark"?"#fff":"#394252 ",fontSize:l.cycleCenterConfig?.title?.fontSize??14}}]}};var n=(l)=>{let f=z(l);return{tooltip:x,legend:{bottom:0,type:"scroll"},xAxis:k(l),yAxis:{min:l.yStart?.[0]},series:f.map((c)=>{return{name:c,type:"line",smooth:!1,lineStyle:{width:2},showSymbol:!0,emphasis:{focus:"series"},label:m(l),data:S(l,c)}})}};var C=(l)=>{let f=z(l);return{tooltip:x,legend:{bottom:0,type:"scroll"},xAxis:{...k(l),axisPointer:{type:"shadow"}},yAxis:{min:l.yStart?.[0]},series:f.map((c)=>{return{name:c,type:"bar",barGap:"30%",barCategoryGap:"30%",barMaxWidth:8,label:m(l),data:S(l,c).map((o)=>({value:o,itemStyle:{borderRadius:o>0?[500,500,0,0]:[0,0,500,500]}}))}})}},P=(l)=>{let f=z(l);return{tooltip:x,legend:{bottom:0,type:"scroll"},xAxis:{...k(l),axisPointer:{type:"shadow"}},yAxis:{min:l.yStart?.[0]},series:f.map((c)=>{return{name:c,type:"bar",stack:"total",barGap:"30%",barCategoryGap:"30%",barMaxWidth:8,label:m(l),data:S(l,c)}})}};var a=(l)=>{let f=q(l.data)?.map((o)=>({value:o.value??0,name:l.reserveValueWithLabelType?o.label:o.type}))??[],c={type:"funnel",minSize:"20%",left:10,top:24,width:"76%",sort:"descending",data:f};return{tooltip:v,legend:{bottom:0,type:"scroll"},series:[{...c,label:{show:!0,position:"outer",formatter:"{c}"}},{...c,emphasis:{label:{fontSize:20}},label:{show:!0,position:"inner",color:"#fff",formatter:(o)=>{let e=o.dataIndex;if(e===0)return"100%";let b=f[e-1].value;return Z(o.value/b)}}}]}};var p=(l)=>{return{tooltip:x,legend:{bottom:0,type:"scroll"},xAxis:{},yAxis:{data:F(l),axisTick:{alignWithLabel:!0},axisPointer:{type:"shadow"},min:l.yStart?.[0],axisLabel:{rotate:l.xAxisLabelRotate,formatter:(f)=>J(l,f)}},series:z(l).map((f)=>{return{name:f,type:"bar",barGap:"30%",barCategoryGap:"30%",barMaxWidth:8,label:{...m(l),position:"right"},data:S(l,f).map((c)=>({value:c,itemStyle:{borderRadius:[0,500,500,0]}}))}})}},ll=(l)=>{let f=z(l),c=F(l);return{grid:{...l.showStackTotal&&{right:32}},tooltip:x,legend:{bottom:0,type:"scroll",data:f},xAxis:{},yAxis:{data:c,axisTick:{alignWithLabel:!0},axisPointer:{type:"shadow"},min:l.yStart?.[0],axisLabel:{rotate:l.xAxisLabelRotate,formatter:(o)=>J(l,o)}},series:[...f.map((o)=>{return{name:o,type:"bar",stack:"total",barGap:"30%",barCategoryGap:"30%",barMaxWidth:8,label:{...m(l),show:l.showLabel&&!l.showStackTotal,position:"right"},data:S(l,o)}}),{name:"总和",type:"bar",stack:"abc",barGap:"-100%",barMaxWidth:8,itemStyle:{normal:{color:"transparent"}},tooltip:{show:!1},label:{show:l.showStackTotal,normal:{show:!0,position:"right",color:"#000"},formatter:"{c}"},data:T(l.data??[],c)}]}};import{rgba as El}from"polished";var fl=(l)=>{let f=R(l.data?.map((c)=>l.reserveValueWithLabelType?c.label:c.type));return{tooltip:v,legend:{bottom:0,type:"scroll"},radar:{shape:"circle",radius:"60%",indicator:R(l.data?.map((c)=>l.reserveValueWithLabelType?c.type:c.label)).map((c)=>({name:c})),axisName:{color:"#5d677a"},splitArea:{areaStyle:{color:["transparent"]}},axisLine:{lineStyle:{color:"rgba(226, 229, 235, .3)"}},splitLine:{lineStyle:{color:"#e2e5eb",type:"dashed",dashOffset:1.5}}},series:[{type:"radar",data:f.map((c,o)=>({name:c,value:l.data?.filter((e)=>l.reserveValueWithLabelType?e.label:e.type===c).map((e)=>e.value),areaStyle:{color:El(Y[o],0.2)},label:{show:l.reserveValueWithLabelType,formatter:(e)=>{return e.value?.toString()}}})),emphasis:{lineStyle:{width:4}}}]}};var cl=(l)=>{let f=L(l);switch(f.chartType){case"mini-area":return h(f);case"area":return i(f);case"line":return n(f);case"column":return C(f);case"stack-column":return P(f);case"bar":return p(f);case"stack-bar":return ll(f);case"funnel":return a(f);case"dual-line-bar":return r(f);case"stack-dual-line-bar":return s(f);case"pie":return t(f);case"cycle":return w(f);case"radar":return fl(f);default:return{}}};import*as U from"echarts";var ol={color:["#3379ff","#00dcf0","#ffc94d","#00db75","#b8b3ff","#40b4ff","#ffa101","#90abe0","#6ee67a","#6b84ff","#fa6b69"],backgroundColor:"rgba(0,0,0,0)",textStyle:{},title:{textStyle:{color:"#272f3d"},subtextStyle:{color:"#394252"}},line:{itemStyle:{borderWidth:1},lineStyle:{width:2},symbolSize:4,symbol:"emptyCircle",smooth:!1},radar:{itemStyle:{borderWidth:1},lineStyle:{width:2},symbolSize:4,symbol:"emptyCircle",smooth:!1},bar:{itemStyle:{barBorderWidth:"0",barBorderColor:"#cccccc"}},pie:{itemStyle:{borderWidth:"0",borderColor:"#cccccc"}},scatter:{itemStyle:{borderWidth:"0",borderColor:"#cccccc"}},boxplot:{itemStyle:{borderWidth:"0",borderColor:"#cccccc"}},parallel:{itemStyle:{borderWidth:"0",borderColor:"#cccccc"}},sankey:{itemStyle:{borderWidth:"0",borderColor:"#cccccc"}},funnel:{itemStyle:{borderWidth:"0",borderColor:"#cccccc"}},gauge:{itemStyle:{borderWidth:"0",borderColor:"#cccccc"}},candlestick:{itemStyle:{color:"#f15451",color0:"#00c267",borderColor:"#f15451",borderColor0:"#00c267",borderWidth:1}},graph:{itemStyle:{borderWidth:"0",borderColor:"#cccccc"},lineStyle:{width:"1",color:"#dfe3eb"},symbolSize:4,symbol:"emptyCircle",smooth:!1,color:["#3379ff","#00dcf0","#ffc94d","#00db75","#b8b3ff","#40b4ff","#ffa101","#90abe0","#6ee67a","#6b84ff","#fa6b69"],label:{color:"#ffffff"}},map:{itemStyle:{areaColor:"#eee",borderColor:"#444",borderWidth:0.5},label:{color:"#000"},emphasis:{itemStyle:{areaColor:"rgba(255,215,0,0.8)",borderColor:"#444",borderWidth:1},label:{color:"rgb(100,0,0)"}}},geo:{itemStyle:{areaColor:"#eee",borderColor:"#444",borderWidth:0.5},label:{color:"#000"},emphasis:{itemStyle:{areaColor:"rgba(255,215,0,0.8)",borderColor:"#444",borderWidth:1},label:{color:"rgb(100,0,0)"}}},categoryAxis:{axisLine:{show:!0,lineStyle:{color:"#eef0f5"}},axisTick:{show:!0,lineStyle:{color:"#eef0f5"}},axisLabel:{show:!0,color:"#828b9e"},splitLine:{show:!1,lineStyle:{color:["#E0E6F1"]}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},valueAxis:{axisLine:{show:!1,lineStyle:{color:"#6E7079"}},axisTick:{show:!1,lineStyle:{color:"#6E7079"}},axisLabel:{show:!0,color:"#828b9e"},splitLine:{show:!0,lineStyle:{color:["#eef0f5"]}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},logAxis:{axisLine:{show:!1,lineStyle:{color:"#6E7079"}},axisTick:{show:!1,lineStyle:{color:"#6E7079"}},axisLabel:{show:!0,color:"#828b9e"},splitLine:{show:!0,lineStyle:{color:["#eef0f5"]}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},timeAxis:{axisLine:{show:!0,lineStyle:{color:"#eef0f5"}},axisTick:{show:!0,lineStyle:{color:"#eef0f5"}},axisLabel:{show:!0,color:"#828b9e"},splitLine:{show:!1,lineStyle:{color:["#E0E6F1"]}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},toolbox:{iconStyle:{borderColor:"#828c9e"},emphasis:{iconStyle:{borderColor:"#394252"}}},legend:{textStyle:{color:"#828b9e"}},tooltip:{axisPointer:{lineStyle:{color:"#ccd1db",width:"1"},crossStyle:{color:"#ccd1db",width:"1"}}},timeline:{lineStyle:{color:"#eef0f5",width:2},itemStyle:{color:"#eef0f5",borderWidth:"1"},controlStyle:{color:"#828c9e",borderColor:"#828c9e",borderWidth:1},checkpointStyle:{color:"#3379ff",borderColor:"#ffffff"},label:{color:"#b1b9c7"},emphasis:{itemStyle:{color:"#3379ff"},controlStyle:{color:"#828c9e",borderColor:"#828c9e",borderWidth:1},label:{color:"#b1b9c7"}}},visualMap:{color:["#062379","#2058d2","#3379ff","#a0cbff","#e8f4ff"]},dataZoom:{handleSize:"undefined%",textStyle:{}},markPoint:{label:{color:"#ffffff"},emphasis:{label:{color:"#ffffff"}}}};var el={color:["#5798ff","#00dcf0","#ffc94d","#00db75","#b8b3ff","#40b4ff","#ffa101","#90abe0","#6ee67a","#6b84ff","#fa6b69"],backgroundColor:"transparent",textStyle:{},title:{textStyle:{color:"#ffffff"},subtextStyle:{color:"#ffffff"}},line:{itemStyle:{borderWidth:"1"},lineStyle:{width:"2"},symbolSize:"6",symbol:"emptyCircle",smooth:!0},radar:{itemStyle:{borderWidth:"1"},lineStyle:{width:"2"},symbolSize:"6",symbol:"emptyCircle",smooth:!0},bar:{itemStyle:{barBorderWidth:"0",barBorderColor:"#cccccc"}},pie:{itemStyle:{borderWidth:"0",borderColor:"#cccccc"}},scatter:{itemStyle:{borderWidth:"0",borderColor:"#cccccc"}},boxplot:{itemStyle:{borderWidth:"0",borderColor:"#cccccc"}},parallel:{itemStyle:{borderWidth:"0",borderColor:"#cccccc"}},sankey:{itemStyle:{borderWidth:"0",borderColor:"#cccccc"}},funnel:{itemStyle:{borderWidth:"0",borderColor:"#cccccc"}},gauge:{itemStyle:{borderWidth:"0",borderColor:"#cccccc"}},candlestick:{itemStyle:{color:"#f15451",color0:"#00c267",borderColor:"#f15451",borderColor0:"#00c267",borderWidth:1}},graph:{itemStyle:{borderWidth:"0",borderColor:"#cccccc"},lineStyle:{width:"1",color:"#ffffff"},symbolSize:"6",symbol:"emptyCircle",smooth:!0,color:["#5798ff","#00dcf0","#ffc94d","#00db75","#b8b3ff","#40b4ff","#ffa101","#90abe0","#6ee67a","#6b84ff","#fa6b69"],label:{color:"#ffffff"}},map:{itemStyle:{areaColor:"#eee",borderColor:"#444",borderWidth:0.5},label:{color:"#000"},emphasis:{itemStyle:{areaColor:"rgba(255,215,0,0.8)",borderColor:"#444",borderWidth:1},label:{color:"rgb(100,0,0)"}}},geo:{itemStyle:{areaColor:"#eee",borderColor:"#444",borderWidth:0.5},label:{color:"#000"},emphasis:{itemStyle:{areaColor:"rgba(255,215,0,0.8)",borderColor:"#444",borderWidth:1},label:{color:"rgb(100,0,0)"}}},categoryAxis:{axisLine:{show:!0,lineStyle:{color:"rgba(255,255,255,0.12)"}},axisTick:{show:!0,lineStyle:{color:"rgba(255,255,255,0.12)"}},axisLabel:{show:!0,color:"rgba(255,255,255,0.5)"},splitLine:{show:!1,lineStyle:{color:["#E0E6F1"]}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},valueAxis:{axisLine:{show:!1,lineStyle:{color:"#6E7079"}},axisTick:{show:!1,lineStyle:{color:"#6E7079"}},axisLabel:{show:!0,color:"rgba(255,255,255,0.5)"},splitLine:{show:!0,lineStyle:{color:["rgba(255,255,255,0.12)"]}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},logAxis:{axisLine:{show:!1,lineStyle:{color:"#6E7079"}},axisTick:{show:!1,lineStyle:{color:"#6E7079"}},axisLabel:{show:!0,color:"rgba(255,255,255,0.5)"},splitLine:{show:!0,lineStyle:{color:["rgba(255,255,255,0.12)"]}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},timeAxis:{axisLine:{show:!0,lineStyle:{color:"rgba(255,255,255,0.12)"}},axisTick:{show:!0,lineStyle:{color:"rgba(255,255,255,0.12)"}},axisLabel:{show:!0,color:"rgba(255,255,255,0.5)"},splitLine:{show:!1,lineStyle:{color:["#E0E6F1"]}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},toolbox:{iconStyle:{borderColor:"#ffffff"},emphasis:{iconStyle:{borderColor:"#ffffff"}}},legend:{textStyle:{color:"#ffffff"}},tooltip:{axisPointer:{lineStyle:{color:"#ffffff",width:"1"},crossStyle:{color:"#ffffff",width:"1"}}},timeline:{lineStyle:{color:"#ffffff",width:2},itemStyle:{color:"#ffffff",borderWidth:"1"},controlStyle:{color:"#ffffff",borderColor:"#ffffff",borderWidth:1},checkpointStyle:{color:"#5798ff",borderColor:"#ffffff"},label:{color:"#ffffff"},emphasis:{itemStyle:{color:"#5798ff"},controlStyle:{color:"#ffffff",borderColor:"#ffffff",borderWidth:1},label:{color:"#ffffff"}}},visualMap:{color:["#062379","#2058d2","#3379ff","#a0cbff","#e8f4ff"]},dataZoom:{handleSize:"undefined%",textStyle:{}},markPoint:{label:{color:"#ffffff"},emphasis:{label:{color:"#ffffff"}}}};import B from"deepmerge";import{jsxDEV as Rl}from"react/jsx-dev-runtime";U.registerTheme("light",B(ol,G));U.registerTheme("dark",B(el,G));var vl={arrayMerge:(l,f)=>f},dl=(l)=>{let f=yl(null),[c,o]=bl(),[e,b]=bl(1);return g(()=>{let u=U.init(f.current,l.theme??"light");o(u);let E=K(u.resize,500),W=()=>E();return globalThis.addEventListener("resize",W),()=>{globalThis.removeEventListener("resize",W)}},[l.theme]),g(()=>{if(c&&e){let u=c.getHeight()-48,E={...l,...l.chartType==="cycle"&&!l.cycleCenterConfig&&{cycleCenterConfig:{title:{top:u/2+24},content:{top:u/2-8}}}},{extraOption:W={},extraSeriesOption:H}=E;c.clear();let Q=B(O(cl(E),H),W,vl);c.setOption(Q),E.onLoad?.(c);let y=setTimeout(()=>{c.resize()},500);return()=>{clearTimeout(y)}}},[c,l,e]),g(()=>{if(c)c.on("refresh",()=>{b((u)=>u+1)})},[c]),Rl($,{ref:f,className:l.className,style:l.style},void 0,!1,void 0,this)};import*as ml from"echarts";import"echarts-gl";import{useRef as Fl,useState as Hl,useEffect as Sl}from"react";import{jsxDEV as Ul}from"react/jsx-dev-runtime";var Yl=[];for(let l=0;l<50;l++)Yl.push({name:`测试${l+1}`,value:[Math.random()*150,Math.random()*50],symbolSize:8});var Zl=[];for(let l=0;l<10;l++)Zl.push([[Math.random()*150,Math.random()*50],[Math.random()*150,Math.random()*50]]);var ql=({className:l="",style:f={},extraOption:c={},lineStyles:o={},pointsStyles:e={},pointsData:b=[],linesData:u=[],globeOption:E={}})=>{let W=Fl(null),[H,Q]=Hl();return Sl(()=>{let y=ml.init(W.current);Q(y);let j=K(y.resize,500),d=()=>{j()};return globalThis.addEventListener("resize",d),()=>{globalThis.removeEventListener("resize",d)}},[]),Sl(()=>{if(H){let y=[];y.push({type:"lines3D",name:"lines3D",effect:{show:!0,trailWidth:2,trailLength:0.15,trailOpacity:1,trailColor:"rgb(30, 30, 60)"},lineStyle:{width:5,color:"rgb(50, 50, 150)",opacity:0.3},blendMode:"lighter",data:u,...o}),y.push({type:"scatter3D",coordinateSystem:"globe",zlevel:3,rippleEffect:{brushType:"stroke"},label:{fontSize:8,show:!0,position:"right",formatter:"{b}"},itemStyle:{normal:{color:"#f5f802"}},data:b,...e}),H.setOption({backgroundColor:"#000",baseColor:"#000",shading:"realistic",globe:{environment:"https://img.alicdn.com/imgextra/i2/O1CN017x8UE61p6wqej1Y0c_!!6000000005312-0-tps-2048-1024.jpg",heightTexture:"https://img.alicdn.com/imgextra/i2/O1CN01BB16kM1ILFttfdYZg_!!6000000000876-0-tps-4096-2048.jpg",baseTexture:"https://img.alicdn.com/imgextra/i4/O1CN01fs70Dq25ElSd8mU6C_!!6000000007495-0-tps-5400-2700.jpg",shading:"lambert",light:{ambient:{intensity:1},main:{intensity:0.1}},viewControl:{autoRotate:!0,distance:230},left:"20%",...E},series:y,...c});let j=setTimeout(()=>{H.resize()},500);return()=>{clearTimeout(j)}}},[H,c,E,o,u,b,e]),Ul($,{ref:W,className:l,style:f},void 0,!1,void 0,this)};var If=dl;export{Vf as echarts,If as default,I as WinChartType,dl as WinChart,ql as EarthChart};
4
+
5
+ //# debugId=2D75B8E4B170405A64756E2164756E21
@@ -0,0 +1,25 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts", "../../src/components/ChartWrapper.tsx", "../../src/components/WinChart.tsx", "../../src/types/index.ts", "../../src/utils/const.ts", "../../src/utils/tool.ts", "../../src/utils/getAreaSpec.ts", "../../src/utils/getDualSpec.ts", "../../src/utils/getPieSpec.ts", "../../src/utils/getLineSpec.ts", "../../src/utils/getColumnSpec.ts", "../../src/utils/getFunnelSpec.ts", "../../src/utils/getBarSpec.ts", "../../src/utils/getRadarSpec.ts", "../../src/utils/getChartOptions.ts", "../../src/components/EarthChart.tsx"],
4
+ "sourcesContent": [
5
+ "import * as echarts from 'echarts';\nimport { WinChart } from './components/WinChart';\nimport { WinChartType } from './types';\nimport type { IChartInfo, IWinChartProps } from './types';\nimport { EarthChart } from './components/EarthChart';\n\nexport { WinChart, WinChartType, echarts, EarthChart };\n\nexport type { IWinChartProps, IChartInfo };\n\nexport default WinChart;\n",
6
+ "import { styled } from 'styled-components';\n\nexport const ChartWrapper = styled.div`\n height: 100%;\n`;\n",
7
+ "import { ChartWrapper } from './ChartWrapper';\nimport { useRef, useEffect, useState } from 'react';\nimport { getEChartOptions } from '../utils/getChartOptions';\nimport * as echarts from 'echarts';\nimport { commonOpt } from '../utils/const';\nimport { debounce, mergeSeriesOption } from '../utils/tool';\nimport light from '../theme/win-light.json';\nimport dark from '../theme/win-dark.json';\nimport deepMerge from 'deepmerge';\nimport { IWinChartProps, WinChartType } from '../types';\n\necharts.registerTheme('light', deepMerge(light, commonOpt));\necharts.registerTheme('dark', deepMerge(dark, commonOpt));\n\nconst mergeOption: deepMerge.Options = {\n arrayMerge: (_destinationArray, sourceArray) => sourceArray,\n};\n\nexport const WinChart = (props: IWinChartProps) => {\n const boxRef = useRef<HTMLDivElement>(null);\n const [instance, setInstance] = useState<echarts.ECharts>();\n const [refreshTag, setRefreshTag] = useState(1);\n\n // 生成实例\n useEffect(() => {\n const chart = echarts.init(boxRef.current, props.theme ?? 'light');\n setInstance(chart);\n\n // 监听窗口变化\n const resize = debounce(chart.resize, 500);\n const handlerResize = () => resize();\n globalThis.addEventListener('resize', handlerResize);\n\n return () => {\n globalThis.removeEventListener('resize', handlerResize);\n };\n }, [props.theme]);\n\n // 设置配置\n useEffect(() => {\n if (instance && refreshTag) {\n const actualChartHeight = instance.getHeight() - 48;\n const newProps: IWinChartProps = {\n ...props,\n ...(props.chartType === WinChartType.CYCLE &&\n !props.cycleCenterConfig && {\n cycleCenterConfig: {\n title: {\n top: actualChartHeight / 2 + 24,\n },\n content: {\n top: actualChartHeight / 2 - 8,\n },\n },\n }),\n };\n\n const { extraOption = {}, extraSeriesOption } = newProps;\n\n instance.clear();\n\n // 设置配置\n const option = deepMerge(\n mergeSeriesOption(getEChartOptions(newProps), extraSeriesOption),\n extraOption,\n mergeOption,\n );\n instance.setOption(option);\n\n // 设置实例\n newProps.onLoad?.(instance);\n\n // 调整尺寸\n const timer = setTimeout(() => {\n instance.resize();\n }, 500);\n\n return () => {\n clearTimeout(timer);\n };\n }\n }, [instance, props, refreshTag]);\n\n // 监听自定义事件\n useEffect(() => {\n if (instance) {\n instance.on('refresh', () => {\n setRefreshTag((refreshTag) => refreshTag + 1);\n });\n }\n }, [instance]);\n\n return (\n <ChartWrapper\n ref={boxRef}\n className={props.className}\n style={props.style}\n />\n );\n};\n",
8
+ "/**\n * 标准图表数据\n */\nexport interface IChartInfo {\n label: string;\n value: number;\n type?: string;\n}\n\nexport interface IWinChartProps {\n theme?: 'light' | 'dark';\n sort?: 'asc' | 'desc';\n showLabel?: boolean;\n color?: string[];\n chartType?: WinChartType;\n xAxisLabelRotate?: number;\n xAxisLabelLength?: number;\n data?: IChartInfo[];\n extraData?: IChartInfo[];\n className?: string;\n style?: React.CSSProperties;\n onLoad?: (chart: echarts.ECharts) => void;\n\n /**\n * label 与 type 取值互换 (只作用饼图、环图、雷达图图表)\n */\n reserveValueWithLabelType?: boolean;\n\n /**\n * Y 轴起始值\n */\n yStart?: number[];\n\n /**\n * series 配置 (对原有 series 配置补充,name 为匹配字段,必填,取值为 IChartInfo 中的 type 字段)\n */\n extraSeriesOption?: echarts.SeriesOption[];\n\n /**\n * 自定义配置,优先级最高,会覆盖默认配置(采用deepmerge,只覆盖差异部分)\n */\n extraOption?: echarts.EChartsOption;\n\n /**\n * 环图中心部份配置\n */\n cycleCenterConfig?: {\n /**\n * 标题(默认为统计)\n */\n title?: ICenterConfig;\n\n /**\n * 内容(默认为合计值)\n */\n content?: ICenterConfig;\n };\n\n /**\n * 堆叠总计\n */\n showStackTotal?: boolean;\n}\n\nexport interface ICenterConfig {\n /**\n * 自定义统计显示内容\n */\n value?: string;\n\n /**\n * 距离头部高度\n */\n top?: number | string;\n\n /**\n * 字体大小\n */\n fontSize?: string | number;\n}\n\n/**\n * 图表类型\n */\nexport enum WinChartType {\n /**\n * MINI面积图\n */\n MINI_AREA = 'mini-area',\n\n /**\n * 面积图\n */\n AREA = 'area',\n\n /**\n * 双轴图\n */\n DUAL_LINE_BAR = 'dual-line-bar',\n\n /**\n * 堆叠双轴图\n */\n STACK_DUAL_LINE_BAR = 'stack-dual-line-bar',\n\n /**\n * 柱状图\n */\n COLUMN = 'column',\n\n /**\n * 堆叠柱状图\n */\n STACK_COLUMN = 'stack-column',\n\n /**\n * 折线图\n */\n LINE = 'line',\n\n /**\n * 条形图\n */\n BAR = 'bar',\n\n /**\n * 堆叠条形图\n */\n STACK_BAR = 'stack-bar',\n\n /**\n * 漏斗图\n */\n FUNNEL = 'funnel',\n\n /**\n * 饼图\n */\n PIE = 'pie',\n\n /**\n * 环形图\n */\n CYCLE = 'cycle',\n\n /**\n * 雷达图\n */\n RADAR = 'radar',\n}\n",
9
+ "import * as echarts from 'echarts';\n\n/**\n * 色值\n */\nexport const COLOR_LIST = [\n '#3D84FF',\n '#00DCF0',\n '#FCBC26',\n '#00DB75',\n '#BDB8FF',\n '#40B4FF',\n '#FFA101',\n '#90ABE0',\n '#6EE67A',\n '#6B84FF',\n '#FA6B69',\n];\n\n/**\n * 通用配置\n */\nexport const commonOpt: Partial<echarts.EChartsOption> = {\n grid: {\n top: 24,\n left: 0,\n right: 12,\n bottom: 32,\n containLabel: true,\n },\n color: COLOR_LIST,\n legend: {\n itemWidth: 10,\n itemHeight: 10,\n bottom: 0,\n type: 'scroll',\n icon: 'circle',\n },\n};\n\n/**\n * 通用 Tooltip 配置\n */\nexport const COMMON_TOOLTIP_OPT: echarts.TooltipComponentOption = {\n trigger: 'axis',\n axisPointer: {\n type: 'cross',\n crossStyle: {\n color: '#999',\n },\n label: {\n backgroundColor: '#999',\n },\n },\n};\n\nexport const ITEM_TOOLTIP_OPT: echarts.TooltipComponentOption = {\n trigger: 'item',\n};\n",
10
+ "import { IChartInfo, IWinChartProps } from '../types';\nimport { graphic } from 'echarts';\nimport { rgba } from 'polished';\n\n/**\n * 判断是否为一个非空数组\n * @param data 任意类型的数据\n * @returns 如果是非空数组则为真\n */\nexport function isNonEmptyArray<T>(data: unknown): data is T[] {\n return Array.isArray(data) && data.length > 0;\n}\n\n/**\n * 数据转百分比\n * @param value\n * @param num\n */\nexport const handleToPercent = (value: unknown, num = 2) =>\n typeof value === 'number' ? `${Number((value * 100).toFixed(num))}%` : '-%';\n\n/**\n * 数组去重\n * @param data\n * @returns\n */\nexport function arrDeduplication<T>(data?: T[]) {\n if (Array.isArray(data)) {\n return [...new Set(data)];\n }\n\n return [];\n}\n\n/**\n * 数组求和\n * @param list\n */\nexport const arraySum = (list?: number[]) => {\n if (Array.isArray(list) && list.length !== 0) {\n return list.reduce((a, b) => {\n const temp = Number(b);\n return a + (!Object.is(temp, NaN) ? temp : 0);\n }, 0);\n }\n return 0;\n};\n\n/**\n * 判断是否为一个有效数组(有值,并且长度大于 0)\n * @param data\n * @returns\n */\nexport const checkEntityArr = (data: unknown) =>\n Array.isArray(data) && data.length > 0;\n\n/**\n * 处理数据降序\n * @param data\n * @param order\n * @returns\n */\nexport const dataDescOrder = (\n data?: IChartInfo[],\n order: 'asc' | 'desc' = 'desc',\n) => {\n if (Array.isArray(data) && order === 'asc') {\n const _data = JSON.parse(JSON.stringify(data)) as IChartInfo[];\n return _data.sort((a, b) => a.value - b.value);\n }\n if (Array.isArray(data) && order === 'desc') {\n // 降序\n const _data = JSON.parse(JSON.stringify(data)) as IChartInfo[];\n return _data.sort((a, b) => b.value - a.value);\n }\n return data;\n};\n\n/**\n * 获取 X 轴刻度\n * @param winChartProps\n * @returns\n */\nexport const getMainAxisLabels = (winChartProps: IWinChartProps): string[] => {\n const data = [\n ...(winChartProps.data ?? []),\n ...(winChartProps.extraData ?? []),\n ];\n\n return arrDeduplication(data.map((item) => item.label));\n};\n\n/**\n * 获取 type 数组\n * @param winChartProps\n * @returns\n */\nexport const getDataTypes = (winChartProps: IWinChartProps): string[] => {\n return (arrDeduplication(\n winChartProps.data?.filter((item) => !!item.type).map((item) => item.type),\n ) ?? []) as string[];\n};\n\n/**\n * 获取 extra type 数组\n * @param winChartProps\n * @returns\n */\nexport const getExtraDataTypes = (winChartProps: IWinChartProps): string[] => {\n return (arrDeduplication(\n winChartProps.extraData\n ?.filter((item) => !!item.type)\n .map((item) => item.type),\n ) ?? []) as string[];\n};\n\n/**\n * 获取 series 数据\n * @param winChartProps\n * @param type\n * @param label\n * @returns\n */\nexport const getSeriesDataByType = (\n winChartProps: IWinChartProps,\n type: string,\n): number[] => {\n const data = [\n ...(winChartProps.data ?? []),\n ...(winChartProps.extraData ?? []),\n ];\n return getMainAxisLabels(winChartProps).map((label) => {\n return (\n data.find((item) => item.type === type && item.label === label)?.value ??\n 0\n );\n });\n};\n\n/**\n * 获取 series 标签\n * @returns\n */\nexport const getSeriesLabelConfig = (winChartProps: IWinChartProps) => {\n return winChartProps.showLabel\n ? {\n show: true,\n formatter: '{c}',\n position: 'top' as any,\n showSymbol: true,\n }\n : { show: false };\n};\n\n/**\n * 处理主轴标签\n * @param winChartProps\n * @param name\n * @returns\n */\nexport const handleMainAxisLabel = (\n winChartProps: IWinChartProps,\n name: string,\n): string => {\n const configLength = winChartProps.xAxisLabelLength;\n\n if (typeof configLength === 'number' && name.length > configLength) {\n return `${name.slice(0, configLength)}...`;\n }\n\n return name;\n};\n\n/**\n * 获取 X 轴配置\n * @param winChartProps\n * @returns\n */\nexport const getXAxisOpt = (\n winChartProps: IWinChartProps,\n): echarts.XAXisComponentOption => {\n return {\n boundaryGap: true,\n axisTick: {\n alignWithLabel: true,\n },\n data: getMainAxisLabels(winChartProps),\n axisLabel: {\n rotate: winChartProps.xAxisLabelRotate,\n formatter: (name) => handleMainAxisLabel(winChartProps, name),\n },\n };\n};\n\n/**\n * 获取渐变颜色\n * @param winChartProps\n * @param color\n * @returns\n */\nexport const getGradientColor = (\n winChartProps: IWinChartProps,\n color: string,\n): graphic.LinearGradient => {\n const gradientColor = new graphic.LinearGradient(0, 0, 0, 1, [\n { offset: 0, color: rgba(color, 0.5) },\n {\n offset: 1,\n color: winChartProps.theme === 'dark' ? rgba('gray', 0.1) : '#fff',\n },\n ]);\n\n return gradientColor;\n};\n\n/**\n * 根据 value 排序\n * @param arr\n * @param order\n * @returns\n */\nexport const sortArray = (arr: IChartInfo[], order: 'asc' | 'desc') => {\n if (order === 'asc') {\n // 升序\n arr.sort((a, b) => {\n return a.value - b.value;\n });\n } else if (order === 'desc') {\n // 降序\n arr.sort((a, b) => {\n return b.value - a.value;\n });\n }\n\n return arr;\n};\n\n/**\n * 根据 label 排序\n * @param arr\n * @param sortedLabels\n * @returns\n */\nexport const sortArrayByLabel = (arr: IChartInfo[], sortedLabels: string[]) => {\n arr.sort((a, b) => {\n const indexA = sortedLabels.indexOf(a.label);\n const indexB = sortedLabels.indexOf(b.label);\n return indexA - indexB;\n });\n\n return arr;\n};\n\n/**\n * 处理数据排序\n * @param winChartProps\n * @returns\n */\nexport const handleSort = (winChartProps: IWinChartProps) => {\n const { data, extraData, sort } = winChartProps;\n if (data && sort) {\n // 1. 整体排序\n const sortedData = sortArray([...data], sort);\n const sortedLabels = arrDeduplication(sortedData.map((item) => item.label));\n\n // 2. 根据标签二次排序\n const finalSortData = sortArrayByLabel(sortedData, sortedLabels);\n const finalSortedExtraData = sortArrayByLabel(\n [...(extraData ?? [])],\n sortedLabels,\n );\n\n return {\n ...winChartProps,\n data: finalSortData,\n extraData: finalSortedExtraData,\n };\n }\n\n return winChartProps;\n};\n\nexport function debounce(func: Function, delay: number): Function {\n let timer: any = null;\n\n return function (...args: any[]) {\n clearTimeout(timer);\n timer = setTimeout(() => {\n func.apply(globalThis, args);\n }, delay);\n };\n}\n\n/**\n * 合并 series 配置\n * @param option\n * @param seriesOption\n * @returns\n */\nexport const mergeSeriesOption = (\n option: Partial<echarts.EChartsOption>,\n seriesOption?: echarts.SeriesOption[],\n) => {\n if (isNonEmptyArray(option.series) && isNonEmptyArray(seriesOption)) {\n seriesOption.forEach((config) => {\n option.series = (option.series as any[]).map((item) => ({\n ...item,\n ...(item.name === config.name && config),\n }));\n });\n }\n\n return option;\n};\n\n/**\n * 获取 label 颜色\n * @param opt\n * @returns\n */\nexport const getLabelColor = (opt: Partial<IWinChartProps>) => {\n return opt.theme === 'dark'\n ? 'rgba(255, 255, 255, 0.7)'\n : 'rgba(0, 0, 0, 0.7)';\n};\n\n/**\n * 计算堆叠图汇总数据\n * @param data\n * @param labels 主轴标签列表,用于保证顺序一致\n * @returns\n */\nexport function aggregateStackData(\n data: IChartInfo[],\n labels?: string[],\n): number[] {\n // 使用 reduce 方法汇总数据\n const result = data.reduce<{ [label: string]: number }>((acc, item) => {\n const { label, value } = item;\n\n if (acc[label] === undefined) {\n acc[label] = 0;\n }\n\n // 将值累加,如果值存在\n if (value) {\n acc[label] += Number(value);\n }\n\n return acc;\n }, {});\n\n // 如果提供了 labels,按 labels 顺序提取\n if (labels && labels.length > 0) {\n return labels.map((label) => {\n const val = result[label] || 0;\n return parseFloat(val.toFixed(2));\n });\n }\n\n // 否则回退到 Object.values (不推荐,顺序不保证)\n return Object.values(result).map((totalValue) =>\n parseFloat(totalValue.toFixed(2)),\n );\n}\n",
11
+ "import { COLOR_LIST, COMMON_TOOLTIP_OPT } from './const';\nimport { IWinChartProps } from '../types';\nimport {\n getDataTypes,\n getGradientColor,\n getMainAxisLabels,\n getSeriesDataByType,\n getSeriesLabelConfig,\n getXAxisOpt,\n} from './tool';\nimport * as echarts from 'echarts';\n\n/**\n * Mini 面积图\n * @param winChartProps\n * @returns\n */\nexport const getMiniAreaOpt = (\n winChartProps: IWinChartProps,\n): echarts.EChartsOption => {\n const areaTypeList = getDataTypes(winChartProps);\n const color = winChartProps.color;\n\n return {\n color,\n grid: {\n top: 4,\n left: 0,\n right: 0,\n bottom: 0,\n containLabel: true,\n },\n tooltip: COMMON_TOOLTIP_OPT,\n legend: {\n show: false,\n },\n xAxis: {\n show: false,\n boundaryGap: false,\n data: getMainAxisLabels(winChartProps),\n },\n yAxis: {\n show: false,\n min: winChartProps.yStart?.at(0),\n },\n series: [\n ...areaTypeList.map((type, index) => {\n const areaColor = color?.[index] ?? COLOR_LIST[index];\n return {\n name: type,\n type: 'line' as any,\n smooth: true,\n lineStyle: {\n width: 2,\n },\n showSymbol: false,\n areaStyle: {\n opacity: 0.8,\n color: getGradientColor(winChartProps, areaColor),\n },\n emphasis: {\n focus: 'series' as any,\n },\n label: getSeriesLabelConfig(winChartProps),\n data: getSeriesDataByType(winChartProps, type),\n };\n }),\n ],\n };\n};\n\n/**\n * 面积图\n * @param winChartProps\n * @returns\n */\nexport const getAreaOpt = (\n winChartProps: IWinChartProps,\n): echarts.EChartsOption => {\n const areaTypeList = getDataTypes(winChartProps);\n\n return {\n tooltip: COMMON_TOOLTIP_OPT,\n legend: {\n bottom: 0,\n type: 'scroll',\n },\n xAxis: getXAxisOpt(winChartProps),\n yAxis: {\n min: winChartProps.yStart?.at(0),\n },\n series: [\n ...areaTypeList.map((type, index) => {\n const areaColor = COLOR_LIST[index];\n return {\n name: type,\n type: 'line' as any,\n smooth: true,\n lineStyle: {\n width: 2,\n },\n areaStyle: {\n opacity: 0.8,\n color: getGradientColor(winChartProps, areaColor),\n },\n emphasis: {\n focus: 'series' as any,\n },\n showSymbol: winChartProps.showLabel,\n label: getSeriesLabelConfig(winChartProps),\n data: getSeriesDataByType(winChartProps, type),\n };\n }),\n ],\n };\n};\n",
12
+ "import { IWinChartProps } from '../types';\nimport {\n getDataTypes,\n getExtraDataTypes,\n getSeriesDataByType,\n getSeriesLabelConfig,\n getXAxisOpt,\n} from './tool';\nimport * as echarts from 'echarts';\nimport { COMMON_TOOLTIP_OPT } from './const';\n\n/**\n * 双轴图(分组柱状 折线)\n * @param winChartProps\n * @returns\n */\nexport const getDualOpt = (\n winChartProps: IWinChartProps,\n): echarts.EChartsOption => {\n const barTypeList = getDataTypes(winChartProps);\n const lineTypeList = getExtraDataTypes(winChartProps);\n\n return {\n tooltip: COMMON_TOOLTIP_OPT,\n legend: {\n bottom: 0,\n type: 'scroll',\n },\n xAxis: {\n ...getXAxisOpt(winChartProps),\n axisPointer: {\n type: 'shadow',\n },\n },\n yAxis: [\n {\n alignTicks: true,\n min: winChartProps.yStart?.[0],\n },\n {\n alignTicks: true,\n min: winChartProps.yStart?.[1],\n },\n ],\n series: [\n ...barTypeList.map((type) => ({\n name: type,\n type: 'bar' as any,\n barGap: '30%',\n barCategoryGap: '30%',\n barMaxWidth: 8,\n label: getSeriesLabelConfig(winChartProps),\n data: getSeriesDataByType(winChartProps, type).map((item) => ({\n value: item,\n itemStyle: {\n borderRadius: item > 0 ? [500, 500, 0, 0] : [0, 0, 500, 500],\n },\n })),\n })),\n ...lineTypeList.map((type) => ({\n name: type,\n type: 'line' as any,\n smooth: true,\n yAxisIndex: 1,\n showSymbol: false,\n label: getSeriesLabelConfig(winChartProps),\n data: getSeriesDataByType(winChartProps, type),\n })),\n ],\n };\n};\n\n/**\n * 堆叠双轴图(分组柱状 折线)\n * @param winChartProps\n * @returns\n */\nexport const getStackDualOpt = (\n winChartProps: IWinChartProps,\n): echarts.EChartsOption => {\n const barTypeList = getDataTypes(winChartProps);\n const lineTypeList = getExtraDataTypes(winChartProps);\n\n return {\n tooltip: COMMON_TOOLTIP_OPT,\n legend: {\n bottom: 0,\n type: 'scroll',\n },\n xAxis: {\n ...getXAxisOpt(winChartProps),\n axisPointer: {\n type: 'shadow',\n },\n },\n yAxis: [\n {\n alignTicks: true,\n min: winChartProps.yStart?.[0],\n },\n {\n alignTicks: true,\n min: winChartProps.yStart?.[1],\n },\n ],\n series: [\n ...barTypeList.map((type) => ({\n name: type,\n type: 'bar' as any,\n stack: 'total',\n barGap: '30%',\n barCategoryGap: '30%',\n barMaxWidth: 8,\n label: getSeriesLabelConfig(winChartProps),\n data: getSeriesDataByType(winChartProps, type),\n })),\n ...lineTypeList.map((type) => ({\n name: type,\n type: 'line' as any,\n smooth: true,\n yAxisIndex: 1,\n showSymbol: false,\n label: getSeriesLabelConfig(winChartProps),\n data: getSeriesDataByType(winChartProps, type),\n })),\n ],\n };\n};\n",
13
+ "import {\n arraySum,\n dataDescOrder,\n getLabelColor,\n handleToPercent,\n} from './tool';\nimport { IWinChartProps } from '../types';\nimport { ITEM_TOOLTIP_OPT } from './const';\n\n/**\n * 饼图\n * @param winChartProps\n * @returns\n */\nexport const getPieOpt = (\n winChartProps: IWinChartProps,\n): echarts.EChartsOption => {\n const total = arraySum(winChartProps.data?.map((item) => item.value));\n\n return {\n tooltip: ITEM_TOOLTIP_OPT,\n legend: {\n bottom: 0,\n type: 'scroll',\n },\n series: [\n {\n top: -30,\n type: 'pie',\n radius: '50%',\n data: dataDescOrder(winChartProps.data)?.map((item) => ({\n value: item.value,\n name: winChartProps.reserveValueWithLabelType\n ? item.label\n : item.type,\n })),\n label: {\n show: true,\n fontSize: 12,\n color: getLabelColor(winChartProps),\n position: 'outside',\n formatter: (data) => {\n return handleToPercent((data.value as number) / (total || 1));\n },\n },\n emphasis: {\n itemStyle: {\n shadowBlur: 10,\n shadowOffsetX: 0,\n shadowColor: 'rgba(0, 0, 0, 0.5)',\n },\n },\n },\n ],\n };\n};\n\n/**\n * 环图\n * @param winChartProps\n * @returns\n */\nexport const getPieCycleOpt = (\n winChartProps: IWinChartProps,\n): echarts.EChartsOption => {\n const total = arraySum(winChartProps.data?.map((item) => item.value));\n\n return {\n tooltip: ITEM_TOOLTIP_OPT,\n legend: {\n bottom: 0,\n type: 'scroll',\n },\n series: [\n {\n top: -30,\n type: 'pie',\n radius: ['60%', '48%'],\n data: dataDescOrder(winChartProps.data, winChartProps.sort)?.map(\n (item) => ({\n value: item.value,\n name: winChartProps.reserveValueWithLabelType\n ? item.label\n : item.type,\n }),\n ),\n label: {\n show: true,\n fontSize: 12,\n color: getLabelColor(winChartProps),\n position: 'outside',\n formatter: (data) => {\n return handleToPercent((data.value as number) / (total || 1));\n },\n },\n emphasis: {\n itemStyle: {\n shadowBlur: 10,\n shadowOffsetX: 0,\n shadowColor: 'rgba(0, 0, 0, 0.5)',\n },\n },\n },\n ],\n graphic: [\n {\n type: 'text',\n left: 'center',\n top: winChartProps.cycleCenterConfig?.content?.top ?? 76,\n style: {\n text:\n winChartProps.cycleCenterConfig?.content?.value ??\n Number(total.toFixed(2)).toString(),\n fill: winChartProps.theme === 'dark' ? '#fff' : '#12161F',\n fontFamily: 'roboto',\n fontSize: winChartProps.cycleCenterConfig?.content?.fontSize ?? 28,\n fontWeight: 'bold',\n },\n },\n {\n type: 'text',\n left: 'center',\n top: winChartProps.cycleCenterConfig?.title?.top ?? 112,\n style: {\n text: winChartProps.cycleCenterConfig?.title?.value ?? '总计',\n fill: winChartProps.theme === 'dark' ? '#fff' : '#394252 ',\n fontSize: winChartProps.cycleCenterConfig?.title?.fontSize ?? 14,\n },\n },\n ],\n };\n};\n",
14
+ "import { IWinChartProps } from '../types';\nimport {\n getSeriesDataByType,\n getXAxisOpt,\n getDataTypes,\n getSeriesLabelConfig,\n} from './tool';\nimport * as echarts from 'echarts';\nimport { COMMON_TOOLTIP_OPT } from './const';\n\n/**\n * 折线图\n * @param winChartProps\n * @returns\n */\nexport const getLineOpt = (\n winChartProps: IWinChartProps,\n): echarts.EChartsOption => {\n const typeList = getDataTypes(winChartProps);\n\n return {\n tooltip: COMMON_TOOLTIP_OPT,\n legend: {\n bottom: 0,\n type: 'scroll',\n },\n xAxis: getXAxisOpt(winChartProps),\n yAxis: {\n min: winChartProps.yStart?.[0],\n },\n series: typeList.map((type) => {\n return {\n name: type,\n type: 'line',\n smooth: false,\n lineStyle: {\n width: 2,\n },\n showSymbol: true,\n emphasis: {\n focus: 'series',\n },\n label: getSeriesLabelConfig(winChartProps),\n data: getSeriesDataByType(winChartProps, type),\n };\n }),\n };\n};\n",
15
+ "import { IWinChartProps } from '../types';\nimport {\n getDataTypes,\n getSeriesDataByType,\n getSeriesLabelConfig,\n getXAxisOpt,\n} from './tool';\nimport * as echarts from 'echarts';\nimport { COMMON_TOOLTIP_OPT } from './const';\n\n/**\n * 柱状图\n * @param winChartProps\n * @returns\n */\nexport const getColumnOpt = (\n winChartProps: IWinChartProps,\n): echarts.EChartsOption => {\n const barTypeList = getDataTypes(winChartProps);\n\n return {\n tooltip: COMMON_TOOLTIP_OPT,\n legend: {\n bottom: 0,\n type: 'scroll',\n },\n xAxis: {\n ...getXAxisOpt(winChartProps),\n axisPointer: {\n type: 'shadow',\n },\n },\n yAxis: {\n min: winChartProps.yStart?.[0],\n },\n series: barTypeList.map((type) => {\n return {\n name: type,\n type: 'bar',\n barGap: '30%',\n barCategoryGap: '30%',\n barMaxWidth: 8,\n label: getSeriesLabelConfig(winChartProps),\n data: getSeriesDataByType(winChartProps, type).map((item) => ({\n value: item,\n itemStyle: {\n borderRadius: item > 0 ? [500, 500, 0, 0] : [0, 0, 500, 500],\n },\n })),\n };\n }),\n };\n};\n\n/**\n * 堆叠柱状图\n * @param winChartProps\n * @returns\n */\nexport const getColumnStackOpt = (\n winChartProps: IWinChartProps,\n): echarts.EChartsOption => {\n const barTypeList = getDataTypes(winChartProps);\n\n return {\n tooltip: COMMON_TOOLTIP_OPT,\n legend: {\n bottom: 0,\n type: 'scroll',\n },\n xAxis: {\n ...getXAxisOpt(winChartProps),\n axisPointer: {\n type: 'shadow',\n },\n },\n yAxis: {\n min: winChartProps.yStart?.[0],\n },\n series: barTypeList.map((name) => {\n return {\n name,\n type: 'bar',\n stack: 'total',\n barGap: '30%',\n barCategoryGap: '30%',\n barMaxWidth: 8,\n label: getSeriesLabelConfig(winChartProps),\n data: getSeriesDataByType(winChartProps, name),\n };\n }),\n };\n};\n",
16
+ "import { dataDescOrder, handleToPercent } from './tool';\nimport { IWinChartProps } from '../types';\nimport * as echarts from 'echarts';\nimport { ITEM_TOOLTIP_OPT } from './const';\n\n/**\n * 漏斗图\n * @param winChartProps\n * @returns\n */\nexport const getFunnelOpt = (\n winChartProps: IWinChartProps,\n): echarts.EChartsOption => {\n const data =\n dataDescOrder(winChartProps.data)?.map((item) => ({\n value: item.value ?? 0,\n name: winChartProps.reserveValueWithLabelType ? item.label : item.type,\n })) ?? [];\n\n const seriesConfig: echarts.FunnelSeriesOption = {\n type: 'funnel',\n minSize: '20%',\n left: 10,\n top: 24,\n width: '76%',\n sort: 'descending',\n data,\n };\n\n return {\n tooltip: ITEM_TOOLTIP_OPT,\n legend: {\n bottom: 0,\n type: 'scroll',\n },\n series: [\n {\n ...seriesConfig,\n label: {\n show: true,\n position: 'outer',\n formatter: '{c}',\n },\n },\n {\n ...seriesConfig,\n emphasis: {\n label: {\n fontSize: 20,\n },\n },\n label: {\n show: true,\n position: 'inner',\n color: '#fff',\n formatter: (params: any) => {\n const currentIndex = params.dataIndex;\n if (currentIndex === 0) {\n return '100%';\n }\n const prevValue = data[currentIndex - 1].value;\n\n return handleToPercent((params.value as number) / prevValue);\n },\n },\n },\n ],\n };\n};\n",
17
+ "import { IWinChartProps } from '../types';\nimport {\n aggregateStackData,\n getDataTypes,\n getSeriesDataByType,\n getMainAxisLabels,\n getSeriesLabelConfig,\n handleMainAxisLabel,\n} from './tool';\nimport * as echarts from 'echarts';\nimport { COMMON_TOOLTIP_OPT } from './const';\n\n/**\n * 条形图\n * @param winChartProps\n * @returns\n */\nexport const getBarOpt = (\n winChartProps: IWinChartProps,\n): echarts.EChartsOption => {\n return {\n tooltip: COMMON_TOOLTIP_OPT,\n legend: {\n bottom: 0,\n type: 'scroll',\n },\n xAxis: {},\n yAxis: {\n data: getMainAxisLabels(winChartProps),\n axisTick: {\n alignWithLabel: true,\n },\n axisPointer: {\n type: 'shadow',\n },\n min: winChartProps.yStart?.[0],\n axisLabel: {\n rotate: winChartProps.xAxisLabelRotate,\n formatter: (name: string) => handleMainAxisLabel(winChartProps, name),\n },\n },\n series: getDataTypes(winChartProps).map((type) => {\n return {\n name: type,\n type: 'bar',\n barGap: '30%',\n barCategoryGap: '30%',\n barMaxWidth: 8,\n label: {\n ...getSeriesLabelConfig(winChartProps),\n position: 'right',\n },\n data: getSeriesDataByType(winChartProps, type).map((item) => ({\n value: item,\n itemStyle: {\n borderRadius: [0, 500, 500, 0],\n },\n })),\n };\n }),\n };\n};\n\n/**\n * 条形图\n * @param winChartProps\n * @returns\n */\nexport const getStackBarOpt = (\n winChartProps: IWinChartProps,\n): echarts.EChartsOption => {\n const barTypeList = getDataTypes(winChartProps);\n const axisLabels = getMainAxisLabels(winChartProps);\n\n return {\n grid: {\n ...(winChartProps.showStackTotal && {\n right: 32,\n }),\n },\n tooltip: COMMON_TOOLTIP_OPT,\n legend: {\n bottom: 0,\n type: 'scroll',\n data: barTypeList,\n },\n xAxis: {},\n yAxis: {\n data: axisLabels,\n axisTick: {\n alignWithLabel: true,\n },\n axisPointer: {\n type: 'shadow',\n },\n min: winChartProps.yStart?.[0],\n axisLabel: {\n rotate: winChartProps.xAxisLabelRotate,\n formatter: (name: string) => handleMainAxisLabel(winChartProps, name),\n },\n },\n series: [\n ...barTypeList.map((type) => {\n return {\n name: type,\n type: 'bar' as any,\n stack: 'total',\n barGap: '30%',\n barCategoryGap: '30%',\n barMaxWidth: 8,\n label: {\n ...getSeriesLabelConfig(winChartProps),\n show: winChartProps.showLabel && !winChartProps.showStackTotal,\n position: 'right',\n },\n data: getSeriesDataByType(winChartProps, type),\n };\n }),\n {\n name: '总和',\n type: 'bar',\n stack: 'abc',\n barGap: '-100%',\n barMaxWidth: 8,\n itemStyle: {\n normal: {\n color: 'transparent',\n },\n } as any,\n tooltip: {\n show: false,\n },\n label: {\n show: winChartProps.showStackTotal,\n normal: {\n show: true,\n position: 'right',\n color: '#000',\n },\n formatter: '{c}',\n } as any,\n data: aggregateStackData(winChartProps.data ?? [], axisLabels),\n },\n ],\n };\n};\n",
18
+ "import { rgba } from 'polished';\nimport { COLOR_LIST, ITEM_TOOLTIP_OPT } from './const';\nimport { arrDeduplication } from './tool';\nimport { IWinChartProps } from '../types';\n\n/**\n * 雷达图\n * @param winChartProps\n * @returns\n */\nexport const getRadarOpt = (\n winChartProps: IWinChartProps,\n): echarts.EChartsOption => {\n const typeList = arrDeduplication<string>(\n winChartProps.data?.map((item) =>\n winChartProps.reserveValueWithLabelType ? item.label : item.type!,\n ),\n );\n\n return {\n tooltip: ITEM_TOOLTIP_OPT,\n legend: {\n bottom: 0,\n type: 'scroll',\n },\n radar: {\n shape: 'circle',\n radius: '60%',\n indicator: arrDeduplication(\n winChartProps.data?.map((item) =>\n winChartProps.reserveValueWithLabelType ? item.type : item.label,\n ),\n ).map((name) => ({ name })),\n axisName: {\n color: '#5d677a',\n },\n splitArea: {\n areaStyle: {\n color: ['transparent'],\n },\n },\n axisLine: {\n lineStyle: {\n color: 'rgba(226, 229, 235, .3)',\n },\n },\n splitLine: {\n lineStyle: {\n color: '#e2e5eb',\n type: 'dashed',\n dashOffset: 1.5,\n },\n },\n },\n series: [\n {\n type: 'radar' as any,\n data: typeList.map((name, index) => ({\n name,\n value: winChartProps.data\n ?.filter((item) =>\n winChartProps.reserveValueWithLabelType\n ? item.label\n : item.type! === name,\n )\n .map((item) => item.value),\n areaStyle: {\n color: rgba(COLOR_LIST[index], 0.2),\n },\n label: {\n show: winChartProps.reserveValueWithLabelType,\n formatter: (params: any) => {\n return params.value?.toString();\n },\n },\n })),\n emphasis: {\n lineStyle: {\n width: 4,\n },\n },\n },\n ],\n };\n};\n",
19
+ "import { IWinChartProps, WinChartType } from '../types';\nimport { getAreaOpt, getMiniAreaOpt } from './getAreaSpec';\nimport { getDualOpt, getStackDualOpt } from './getDualSpec';\nimport { getPieCycleOpt, getPieOpt } from './getPieSpec';\nimport { getLineOpt } from './getLineSpec';\nimport { getColumnOpt, getColumnStackOpt } from './getColumnSpec';\nimport { getFunnelOpt } from './getFunnelSpec';\nimport { getBarOpt, getStackBarOpt } from './getBarSpec';\nimport { handleSort } from './tool';\nimport { getRadarOpt } from './getRadarSpec';\n\n/**\n * 获取图表配置\n * @returns\n * @param originWinChartProps\n */\nexport const getEChartOptions = (\n originWinChartProps: IWinChartProps,\n): echarts.EChartsOption => {\n const winChartProps = handleSort(originWinChartProps);\n\n switch (winChartProps.chartType) {\n case WinChartType.MINI_AREA:\n return getMiniAreaOpt(winChartProps);\n\n case WinChartType.AREA:\n return getAreaOpt(winChartProps);\n\n case WinChartType.LINE:\n return getLineOpt(winChartProps);\n\n case WinChartType.COLUMN:\n return getColumnOpt(winChartProps);\n\n case WinChartType.STACK_COLUMN:\n return getColumnStackOpt(winChartProps);\n\n case WinChartType.BAR:\n return getBarOpt(winChartProps);\n\n case WinChartType.STACK_BAR:\n return getStackBarOpt(winChartProps);\n\n case WinChartType.FUNNEL:\n return getFunnelOpt(winChartProps);\n\n case WinChartType.DUAL_LINE_BAR:\n return getDualOpt(winChartProps);\n\n case WinChartType.STACK_DUAL_LINE_BAR:\n return getStackDualOpt(winChartProps);\n\n case WinChartType.PIE:\n return getPieOpt(winChartProps);\n\n case WinChartType.CYCLE:\n return getPieCycleOpt(winChartProps);\n\n case WinChartType.RADAR:\n return getRadarOpt(winChartProps);\n\n default:\n return {};\n }\n};\n",
20
+ "import * as echarts from 'echarts';\nimport 'echarts-gl';\nimport React, { useRef, useState, useEffect } from 'react';\nimport { ChartWrapper } from './ChartWrapper';\nimport { debounce } from '../utils/tool';\n\n// mock data\nconst mockPointsData = [];\nfor (let i = 0; i < 50; i++) {\n mockPointsData.push({\n name: `测试${i + 1}`,\n value: [Math.random() * 150, Math.random() * 50],\n symbolSize: 8,\n });\n}\n\nconst mockLinesData = [];\nfor (let i = 0; i < 10; i++) {\n mockLinesData.push([\n [Math.random() * 150, Math.random() * 50],\n [Math.random() * 150, Math.random() * 50],\n ]);\n}\n\ninterface IProps {\n className: string;\n style: React.CSSProperties;\n extraOption?: echarts.EChartsOption;\n lineStyles: any;\n pointsStyles: any;\n pointsData: any;\n linesData: any;\n globeOption: any;\n}\n\nconst EarthChart = ({\n className = '',\n style = {},\n extraOption = {},\n lineStyles = {},\n pointsStyles = {},\n pointsData = [],\n linesData = [],\n globeOption = {},\n}: Partial<IProps>) => {\n const boxRef = useRef(null);\n const [eChart, setEChart] = useState<echarts.ECharts>();\n\n // 生成实例\n useEffect(() => {\n const eChart = echarts.init(boxRef.current);\n setEChart(eChart);\n\n // 监听窗口变化\n const resize = debounce(eChart.resize, 500);\n const handlerResize = () => {\n resize();\n };\n globalThis.addEventListener('resize', handlerResize);\n\n return () => {\n globalThis.removeEventListener('resize', handlerResize);\n };\n }, []);\n\n useEffect(() => {\n if (eChart) {\n const series = [];\n\n // 航线图\n series.push({\n type: 'lines3D',\n name: `lines3D`,\n effect: {\n show: true,\n trailWidth: 2,\n trailLength: 0.15,\n trailOpacity: 1,\n trailColor: 'rgb(30, 30, 60)',\n },\n lineStyle: {\n width: 5,\n color: 'rgb(50, 50, 150)',\n // color: 'rgb(118, 233, 241)',\n opacity: 0.3,\n },\n blendMode: 'lighter',\n data: linesData,\n ...lineStyles,\n });\n\n series.push({\n type: 'scatter3D',\n coordinateSystem: 'globe',\n zlevel: 3,\n rippleEffect: {\n brushType: 'stroke',\n },\n label: {\n fontSize: 8,\n show: true,\n position: 'right',\n formatter: '{b}',\n },\n itemStyle: {\n normal: {\n color: '#f5f802',\n },\n },\n data: pointsData,\n ...pointsStyles,\n });\n\n // 散点图\n eChart.setOption({\n backgroundColor: '#000',\n baseColor: '#000',\n shading: 'realistic',\n globe: {\n environment:\n 'https://img.alicdn.com/imgextra/i2/O1CN017x8UE61p6wqej1Y0c_!!6000000005312-0-tps-2048-1024.jpg',\n heightTexture:\n 'https://img.alicdn.com/imgextra/i2/O1CN01BB16kM1ILFttfdYZg_!!6000000000876-0-tps-4096-2048.jpg',\n baseTexture:\n 'https://img.alicdn.com/imgextra/i4/O1CN01fs70Dq25ElSd8mU6C_!!6000000007495-0-tps-5400-2700.jpg',\n\n shading: 'lambert',\n light: {\n ambient: {\n intensity: 1,\n },\n main: {\n intensity: 0.1,\n },\n },\n viewControl: {\n autoRotate: true,\n distance: 230,\n // center: [120, 0, 0],\n },\n left: '20%',\n\n ...globeOption,\n },\n series: series,\n ...extraOption,\n });\n\n const timer = setTimeout(() => {\n eChart.resize();\n }, 500);\n\n return () => {\n clearTimeout(timer);\n };\n }\n }, [\n eChart,\n extraOption,\n globeOption,\n lineStyles,\n linesData,\n pointsData,\n pointsStyles,\n ]);\n\n return <ChartWrapper ref={boxRef} className={className} style={style} />;\n};\n\nexport { EarthChart };\n"
21
+ ],
22
+ "mappings": "AAAA,2BCAA,iBAAS,2BAEF,IAAM,EAAe,GAAO;AAAA;ECDnC,iBAAS,gBAAQ,cAAW,eCmFrB,IAAK,GAAL,CAAK,IAAL,CAI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AAC,EAAD,CAAc,IAAK,EAAQ,UAAW,EAAW,MAAO,GAAxD,qBAA+D,Gf5JxE,IAAe",
23
+ "debugId": "2D75B8E4B170405A64756E2164756E21",
24
+ "names": []
25
+ }
@@ -0,0 +1 @@
1
+ export declare const ChartWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -0,0 +1,15 @@
1
+ import * as echarts from 'echarts';
2
+ import 'echarts-gl';
3
+ import React from 'react';
4
+ interface IProps {
5
+ className: string;
6
+ style: React.CSSProperties;
7
+ extraOption?: echarts.EChartsOption;
8
+ lineStyles: any;
9
+ pointsStyles: any;
10
+ pointsData: any;
11
+ linesData: any;
12
+ globeOption: any;
13
+ }
14
+ declare const EarthChart: ({ className, style, extraOption, lineStyles, pointsStyles, pointsData, linesData, globeOption, }: Partial<IProps>) => import("react/jsx-runtime").JSX.Element;
15
+ export { EarthChart };
@@ -0,0 +1,8 @@
1
+ import * as echarts from 'echarts';
2
+ interface IProps {
3
+ className: string;
4
+ style: React.CSSProperties;
5
+ extraOption?: echarts.EChartsOption;
6
+ }
7
+ export declare const GanttChart: ({ className, style, extraOption, }: Partial<IProps>) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,2 @@
1
+ import { IWinChartProps } from '../types';
2
+ export declare const WinChart: (props: IWinChartProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import * as echarts from 'echarts';
2
+ import { WinChart } from './components/WinChart';
3
+ import { WinChartType } from './types';
4
+ import type { IChartInfo, IWinChartProps } from './types';
5
+ import { EarthChart } from './components/EarthChart';
6
+ export { WinChart, WinChartType, echarts, EarthChart };
7
+ export type { IWinChartProps, IChartInfo };
8
+ export default WinChart;
@@ -0,0 +1,126 @@
1
+ /**
2
+ * 标准图表数据
3
+ */
4
+ export interface IChartInfo {
5
+ label: string;
6
+ value: number;
7
+ type?: string;
8
+ }
9
+ export interface IWinChartProps {
10
+ theme?: 'light' | 'dark';
11
+ sort?: 'asc' | 'desc';
12
+ showLabel?: boolean;
13
+ color?: string[];
14
+ chartType?: WinChartType;
15
+ xAxisLabelRotate?: number;
16
+ xAxisLabelLength?: number;
17
+ data?: IChartInfo[];
18
+ extraData?: IChartInfo[];
19
+ className?: string;
20
+ style?: React.CSSProperties;
21
+ onLoad?: (chart: echarts.ECharts) => void;
22
+ /**
23
+ * label 与 type 取值互换 (只作用饼图、环图、雷达图图表)
24
+ */
25
+ reserveValueWithLabelType?: boolean;
26
+ /**
27
+ * Y 轴起始值
28
+ */
29
+ yStart?: number[];
30
+ /**
31
+ * series 配置 (对原有 series 配置补充,name 为匹配字段,必填,取值为 IChartInfo 中的 type 字段)
32
+ */
33
+ extraSeriesOption?: echarts.SeriesOption[];
34
+ /**
35
+ * 自定义配置,优先级最高,会覆盖默认配置(采用deepmerge,只覆盖差异部分)
36
+ */
37
+ extraOption?: echarts.EChartsOption;
38
+ /**
39
+ * 环图中心部份配置
40
+ */
41
+ cycleCenterConfig?: {
42
+ /**
43
+ * 标题(默认为统计)
44
+ */
45
+ title?: ICenterConfig;
46
+ /**
47
+ * 内容(默认为合计值)
48
+ */
49
+ content?: ICenterConfig;
50
+ };
51
+ /**
52
+ * 堆叠总计
53
+ */
54
+ showStackTotal?: boolean;
55
+ }
56
+ export interface ICenterConfig {
57
+ /**
58
+ * 自定义统计显示内容
59
+ */
60
+ value?: string;
61
+ /**
62
+ * 距离头部高度
63
+ */
64
+ top?: number | string;
65
+ /**
66
+ * 字体大小
67
+ */
68
+ fontSize?: string | number;
69
+ }
70
+ /**
71
+ * 图表类型
72
+ */
73
+ export declare enum WinChartType {
74
+ /**
75
+ * MINI面积图
76
+ */
77
+ MINI_AREA = "mini-area",
78
+ /**
79
+ * 面积图
80
+ */
81
+ AREA = "area",
82
+ /**
83
+ * 双轴图
84
+ */
85
+ DUAL_LINE_BAR = "dual-line-bar",
86
+ /**
87
+ * 堆叠双轴图
88
+ */
89
+ STACK_DUAL_LINE_BAR = "stack-dual-line-bar",
90
+ /**
91
+ * 柱状图
92
+ */
93
+ COLUMN = "column",
94
+ /**
95
+ * 堆叠柱状图
96
+ */
97
+ STACK_COLUMN = "stack-column",
98
+ /**
99
+ * 折线图
100
+ */
101
+ LINE = "line",
102
+ /**
103
+ * 条形图
104
+ */
105
+ BAR = "bar",
106
+ /**
107
+ * 堆叠条形图
108
+ */
109
+ STACK_BAR = "stack-bar",
110
+ /**
111
+ * 漏斗图
112
+ */
113
+ FUNNEL = "funnel",
114
+ /**
115
+ * 饼图
116
+ */
117
+ PIE = "pie",
118
+ /**
119
+ * 环形图
120
+ */
121
+ CYCLE = "cycle",
122
+ /**
123
+ * 雷达图
124
+ */
125
+ RADAR = "radar"
126
+ }
@@ -0,0 +1,14 @@
1
+ import * as echarts from 'echarts';
2
+ /**
3
+ * 色值
4
+ */
5
+ export declare const COLOR_LIST: string[];
6
+ /**
7
+ * 通用配置
8
+ */
9
+ export declare const commonOpt: Partial<echarts.EChartsOption>;
10
+ /**
11
+ * 通用 Tooltip 配置
12
+ */
13
+ export declare const COMMON_TOOLTIP_OPT: echarts.TooltipComponentOption;
14
+ export declare const ITEM_TOOLTIP_OPT: echarts.TooltipComponentOption;
@@ -0,0 +1,20 @@
1
+ export declare const data: {
2
+ label: string;
3
+ type: string;
4
+ value: number;
5
+ }[];
6
+ export declare const extraData: {
7
+ label: string;
8
+ type: string;
9
+ value: number;
10
+ }[];
11
+ export declare const airportData: {
12
+ parkingApron: {
13
+ dimensions: string[];
14
+ data: (string | boolean)[][];
15
+ };
16
+ flight: {
17
+ dimensions: string[];
18
+ data: (string | number | boolean)[][];
19
+ };
20
+ };
@@ -0,0 +1,7 @@
1
+ export declare const data: {
2
+ airportsFields: string[];
3
+ airlineFields: string[];
4
+ airports: (string | number)[][];
5
+ airlines: string[][];
6
+ routes: number[][];
7
+ };
@@ -0,0 +1,14 @@
1
+ import { IWinChartProps } from '../types';
2
+ import * as echarts from 'echarts';
3
+ /**
4
+ * Mini 面积图
5
+ * @param winChartProps
6
+ * @returns
7
+ */
8
+ export declare const getMiniAreaOpt: (winChartProps: IWinChartProps) => echarts.EChartsOption;
9
+ /**
10
+ * 面积图
11
+ * @param winChartProps
12
+ * @returns
13
+ */
14
+ export declare const getAreaOpt: (winChartProps: IWinChartProps) => echarts.EChartsOption;
@@ -0,0 +1,14 @@
1
+ import { IWinChartProps } from '../types';
2
+ import * as echarts from 'echarts';
3
+ /**
4
+ * 条形图
5
+ * @param winChartProps
6
+ * @returns
7
+ */
8
+ export declare const getBarOpt: (winChartProps: IWinChartProps) => echarts.EChartsOption;
9
+ /**
10
+ * 条形图
11
+ * @param winChartProps
12
+ * @returns
13
+ */
14
+ export declare const getStackBarOpt: (winChartProps: IWinChartProps) => echarts.EChartsOption;
@@ -0,0 +1,7 @@
1
+ import { IWinChartProps } from '../types';
2
+ /**
3
+ * 获取图表配置
4
+ * @returns
5
+ * @param originWinChartProps
6
+ */
7
+ export declare const getEChartOptions: (originWinChartProps: IWinChartProps) => echarts.EChartsOption;
@@ -0,0 +1,14 @@
1
+ import { IWinChartProps } from '../types';
2
+ import * as echarts from 'echarts';
3
+ /**
4
+ * 柱状图
5
+ * @param winChartProps
6
+ * @returns
7
+ */
8
+ export declare const getColumnOpt: (winChartProps: IWinChartProps) => echarts.EChartsOption;
9
+ /**
10
+ * 堆叠柱状图
11
+ * @param winChartProps
12
+ * @returns
13
+ */
14
+ export declare const getColumnStackOpt: (winChartProps: IWinChartProps) => echarts.EChartsOption;
@@ -0,0 +1,14 @@
1
+ import { IWinChartProps } from '../types';
2
+ import * as echarts from 'echarts';
3
+ /**
4
+ * 双轴图(分组柱状 折线)
5
+ * @param winChartProps
6
+ * @returns
7
+ */
8
+ export declare const getDualOpt: (winChartProps: IWinChartProps) => echarts.EChartsOption;
9
+ /**
10
+ * 堆叠双轴图(分组柱状 折线)
11
+ * @param winChartProps
12
+ * @returns
13
+ */
14
+ export declare const getStackDualOpt: (winChartProps: IWinChartProps) => echarts.EChartsOption;
@@ -0,0 +1,8 @@
1
+ import { IWinChartProps } from '../types';
2
+ import * as echarts from 'echarts';
3
+ /**
4
+ * 漏斗图
5
+ * @param winChartProps
6
+ * @returns
7
+ */
8
+ export declare const getFunnelOpt: (winChartProps: IWinChartProps) => echarts.EChartsOption;
@@ -0,0 +1,8 @@
1
+ import { IWinChartProps } from '../types';
2
+ import * as echarts from 'echarts';
3
+ /**
4
+ * 折线图
5
+ * @param winChartProps
6
+ * @returns
7
+ */
8
+ export declare const getLineOpt: (winChartProps: IWinChartProps) => echarts.EChartsOption;
@@ -0,0 +1,13 @@
1
+ import { IWinChartProps } from '../types';
2
+ /**
3
+ * 饼图
4
+ * @param winChartProps
5
+ * @returns
6
+ */
7
+ export declare const getPieOpt: (winChartProps: IWinChartProps) => echarts.EChartsOption;
8
+ /**
9
+ * 环图
10
+ * @param winChartProps
11
+ * @returns
12
+ */
13
+ export declare const getPieCycleOpt: (winChartProps: IWinChartProps) => echarts.EChartsOption;
@@ -0,0 +1,7 @@
1
+ import { IWinChartProps } from '../types';
2
+ /**
3
+ * 雷达图
4
+ * @param winChartProps
5
+ * @returns
6
+ */
7
+ export declare const getRadarOpt: (winChartProps: IWinChartProps) => echarts.EChartsOption;