New-OMIS/public/assets/js/pages/apexcharts-bar.init.js

1 line
8.8 KiB
JavaScript
Raw Normal View History

2024-04-04 07:23:00 +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 chart,chartBarColors=getChartColorsArray("bar_chart"),chartDatalabelsBarColors=(chartBarColors&&(options={chart:{height:350,type:"bar",toolbar:{show:!1}},plotOptions:{bar:{horizontal:!0}},dataLabels:{enabled:!1},series:[{data:[380,430,450,475,550,584,780,1100,1220,1365]}],colors:chartBarColors,grid:{borderColor:"#f1f1f1"},xaxis:{categories:["South Korea","Canada","United Kingdom","Netherlands","Italy","France","Japan","United States","China","Germany"]}},(chart=new ApexCharts(document.querySelector("#bar_chart"),options)).render()),getChartColorsArray("custom_datalabels_bar")),chartStackedBarColors=(chartDatalabelsBarColors&&(options={series:[{data:[400,430,448,470,540,580,690,1100,1200,1380]}],chart:{type:"bar",height:350,toolbar:{show:!1}},plotOptions:{bar:{barHeight:"100%",distributed:!0,horizontal:!0,dataLabels:{position:"bottom"}}},colors:chartDatalabelsBarColors,dataLabels:{enabled:!0,textAnchor:"start",style:{colors:["#fff"]},formatter:function(t,e){return e.w.globals.labels[e.dataPointIndex]+": "+t},offsetX:0,dropShadow:{enabled:!1}},stroke:{width:1,colors:["#fff"]},xaxis:{categories:["South Korea","Canada","United Kingdom","Netherlands","Italy","France","Japan","United States","China","India"]},yaxis:{labels:{show:!1}},title:{text:"Custom DataLabels",align:"center",floating:!0,style:{fontWeight:500}},subtitle:{text:"Category Names as DataLabels inside bars",align:"center"},tooltip:{theme:"dark",x:{show:!1},y:{title:{formatter:function(){return""}}}}},(chart=new ApexCharts(document.querySelector("#custom_datalabels_bar"),options)).render()),getChartColorsArray("stacked_bar")),chartStackedBar100Colors=(chartStackedBarColors&&(options={series:[{name:"Marine Sprite",data:[44,55,41,37,22,43,21]},{name:"Striking Calf",data:[53,32,33,52,13,43,32]},{name:"Tank Picture",data:[12,17,11,9,15,11,20]},{name:"Bucket Slope",data:[9,7,5,8,6,9,4]},{name:"Reborn Kid",data:[25,12,19,32,25,24,10]}],chart:{type:"bar",height:350,stacked:!0,toolbar:{show:!1}},plotOptions:{bar:{horizontal:!0}},stroke:{width:1,colors:["#fff"]},title:{text:"Fiction Books Sales",style:{fontWeight:500}},xaxis:{categories:[2008,2009,2010,2011,2012,2013,2014],labels:{formatter:function(t){return t+"K"}}},yaxis:{title:{text:void 0}},tooltip:{y:{formatter:function(t){return t+"K"}}},fill:{opacity:1},legend:{position:"top",horizontalAlign:"left",offsetX:40},colors:chartStackedBarColors},(chart=new ApexCharts(document.querySelector("#stacked_bar"),options)).render()),getChartColorsArray("stacked_bar_100")),chartNegativeBarColors=(chartStackedBar100Colors&&(options={series:[{name:"Marine Sprite",data:[44,55,41,37,22,43,21]},{name:"Striking Calf",data:[53,32,33,52,13,43,32]},{name:"Tank Picture",data:[12,17,11,9,15,11,20]},{name:"Bucket Slope",data:[9,7,5,8,6,9,4]},{name:"Reborn Kid",data:[25,12,19,32,25,24,10]}],chart:{type:"bar",height:350,stacked:!0,stackType:"100%",toolbar:{show:!1}},plotOptions:{bar:{horizontal:!0}},stroke:{width:1,colors:["#fff"]},title:{text:"100% Stacked Bar",style:{fontWeight:500}},xaxis:{categories:[2008,2009,2010,2011,2012,2013,2014]},tooltip:{y:{formatter:function(t){return t+"K"}}},fill:{opacity:1},legend:{position:"top",horizontalAlign:"left",offsetX:40},colors:chartStackedBar100Colors},(chart=new ApexCharts(document.querySelector("#stacked_bar_100"),options)).render()),getChartColorsArray("negative_bars")),chartBarMarkersColors=(chartNegativeBarColors&&(options={series:[{name:"Males",data:[.4,.65,.76,.88,1.5,2.1,2.9,3.8,3.9,4.2,4,4.3,4.1,4.2,4.5,3.9,3.5,3]},{name:"Females",data:[-.8,-1.05,-1.06,-1.18,-1.4,-2.2,-2.85,-3.7,-3.96,-4.22,-4.3,-4.4,-4.1,-4,-4.1,-3.4,-3.1,-2.8]}],chart:{type:"bar",height:360,stacked:!0,toolbar:{show:!1}},co