master_template/public/assets/js/pages/echarts.init.js

1 line
20 KiB
JavaScript
Raw Normal View History

2024-06-10 12:21:58 +00:00
function getChartColorsArray(t){if(null!==document.getElementById(t))return t=document.getElementById(t).getAttribute("data-colors"),(t=JSON.parse(t)).map(function(t){var e=t.replace(" ","");return-1===e.indexOf(",")?getComputedStyle(document.documentElement).getPropertyValue(e)||e:2==(t=t.split(",")).length?"rgba("+getComputedStyle(document.documentElement).getPropertyValue(t[0])+","+t[1]+")":e})}var posList,labelOption,data,chartDom,myChart,option,chartLineColors=getChartColorsArray("chart-line"),chartLineStackedColors=(chartLineColors&&(chartDom=document.getElementById("chart-line"),myChart=echarts.init(chartDom),option={grid:{left:"0%",right:"0%",bottom:"0%",top:"4%",containLabel:!0},xAxis:{type:"category",data:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],axisLine:{lineStyle:{color:"#858d98"}}},yAxis:{type:"value",axisLine:{lineStyle:{color:"#858d98"}},splitLine:{lineStyle:{color:"rgba(133, 141, 152, 0.1)"}}},series:[{data:[150,230,224,218,135,147,260],type:"line"}],textStyle:{fontFamily:"Poppins, sans-serif"},color:chartLineColors})&&"object"==typeof option&&option&&myChart.setOption(option),getChartColorsArray("chart-line-stacked")),chartAreaColors=(chartLineStackedColors&&(chartDom=document.getElementById("chart-line-stacked"),myChart=echarts.init(chartDom),option={tooltip:{trigger:"axis"},legend:{data:["Email","Union Ads","Video Ads","Direct","Search Engine"],textStyle:{color:"#858d98"}},grid:{left:"0%",right:"0%",bottom:"0%",containLabel:!0},toolbox:{feature:{saveAsImage:{}}},textStyle:{fontFamily:"Poppins, sans-serif"},xAxis:{type:"category",boundaryGap:!1,data:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],axisLine:{lineStyle:{color:"#858d98"}}},yAxis:{type:"value",axisLine:{lineStyle:{color:"#858d98"}},splitLine:{lineStyle:{color:"rgba(133, 141, 152, 0.1)"}}},series:[{name:"Email",type:"line",stack:"Total",data:[120,132,101,134,90,230,210]},{name:"Union Ads",type:"line",stack:"Total",data:[220,182,191,234,290,330,310]},{name:"Video Ads",type:"line",stack:"Total",data:[150,232,201,154,190,330,410]},{name:"Direct",type:"line",stack:"Total",data:[320,332,301,334,390,330,320]},{name:"Search Engine",type:"line",stack:"Total",data:[820,932,901,934,1290,1330,1320]}],color:chartLineStackedColors})&&myChart.setOption(option),getChartColorsArray("chart-area")),chartAreaStackedColors=(chartAreaColors&&(chartDom=document.getElementById("chart-area"),myChart=echarts.init(chartDom),option={grid:{left:"0%",right:"0%",bottom:"0%",top:"4%",containLabel:!0},xAxis:{type:"category",boundaryGap:!1,data:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],axisLine:{lineStyle:{color:"#858d98"}}},yAxis:{type:"value",axisLine:{lineStyle:{color:"#858d98"}},splitLine:{lineStyle:{color:"rgba(133, 141, 152, 0.1)"}}},series:[{data:[820,932,901,934,1290,1330,1320],type:"line",areaStyle:{}}],textStyle:{fontFamily:"Poppins, sans-serif"},color:chartAreaColors[0],backgroundColor:chartAreaColors[1]})&&myChart.setOption(option),getChartColorsArray("chart-area-stacked")),chartStepLineColors=(chartAreaStackedColors&&(chartDom=document.getElementById("chart-area-stacked"),myChart=echarts.init(chartDom),option={tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}},legend:{data:["Email","Union Ads","Video Ads","Direct","Search Engine"],textStyle:{color:"#858d98"}},toolbox:{feature:{saveAsImage:{}}},grid:{left:"0%",right:"0%",bottom:"0%",containLabel:!0},xAxis:[{type:"category",boundaryGap:!1,data:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],axisLine:{lineStyle:{color:"#858d98"}}}],yAxis:{type:"value",axisLine:{lineStyle:{color:"#858d98"}},splitLine:{lineStyle:{color:"rgba(133, 141, 152, 0.1)"}}},textStyle:{fontFamily:"Poppins, sans-serif"},color:chartAreaStackedColors,series:[{name:"Email",type:"line",stack:"Total",areaStyle:{},emphasis:{focus:"series"},data:[120,132,101,134,90,230,210]},{name:"Union Ads",type:"line",stack:"Total",areaStyle:{},emphasis:{focus:"series"},data:[220,182,191,234,290,330,310]},{name:"Video Ads",type:"line",stack:"Total",areaStyle:{},emphasis:{focus:"series"},data:[150,232,201,154,190,330,410]},{name:"Dir