You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6 lines
5.7 KiB

6 years ago
/*!
* stack-admin-theme (https://pixinvent.com/bootstrap-admin-template/stack)
* Copyright 2018 PIXINVENT
* Licensed under the Themeforest Standard Licenses
*/
$(window).on("load",function(){Chart.defaults.derivedLine=Chart.defaults.line;var draw=Chart.controllers.line.prototype.draw,custom=Chart.controllers.line.extend({draw:function(){draw.apply(this,arguments);var ctx=this.chart.chart.ctx,_stroke=ctx.stroke;ctx.stroke=function(){ctx.save(),ctx.shadowColor="#ffb6c0",ctx.shadowBlur=30,ctx.shadowOffsetX=0,ctx.shadowOffsetY=20,_stroke.apply(this,arguments),ctx.restore()}}});Chart.controllers.derivedLine=custom;var ctx=document.querySelector("#thisYearRevenue").getContext("2d"),ctx2=(new Chart(ctx,{type:"derivedLine",data:{labels:["Mon","Tue","Wed","Thu","Fri","Sat","Sun","Mon"],datasets:[{data:[5e3,1e4,4e3,14500,8e3,18500,8e3,2e4],borderWidth:4,borderColor:"#FF4961",pointBackgroundColor:"#FFF",pointBorderColor:"#FF4961",pointHoverBackgroundColor:"#FFF",pointHoverBorderColor:"#FF4961",pointRadius:0,pointHoverRadius:6,fill:!1}]},options:{responsive:!0,tooltips:{displayColors:!1,callbacks:{label:function(e,d){},title:function(){}}},legend:{display:!1},scales:{xAxes:[{gridLines:{display:!1}}],yAxes:[{ticks:{padding:10,stepSize:5e3,max:2e4,min:0},gridLines:{display:!0,drawBorder:!1,lineWidth:1,zeroLineColor:"#e5e5e5"}}]}}}),document.querySelector("#lastYearRevenue").getContext("2d"));new Chart(ctx2,{type:"line",data:{labels:["Mon","Tue","Wed","Thu","Fri","Sat","Sun","Mon"],datasets:[{data:[7e3,15e3,6e3,10500,3e3,11500,4e3,1e4],borderWidth:4,borderDash:[8,4],borderColor:"#c3c3c3",pointBackgroundColor:"#FFF",pointBorderColor:"#c3c3c3",pointHoverBackgroundColor:"#FFF",pointHoverBorderColor:"#c3c3c3",pointRadius:0,pointHoverRadius:6,fill:!1}]},options:{responsive:!0,tooltips:{displayColors:!1,callbacks:{label:function(e,d){},title:function(){}}},legend:{display:!1},scales:{xAxes:[{gridLines:{display:!1}}],yAxes:[{ticks:{padding:10,stepSize:5e3,max:2e4,min:0},gridLines:{display:!0,drawBorder:!1,zeroLineColor:"#e5e5e5"}}]}}});Chart.defaults.hitRateDoughnut=Chart.defaults.doughnut;var draw=Chart.controllers.doughnut.prototype.draw,customDoughnut=Chart.controllers.doughnut.extend({draw:function(){draw.apply(this,arguments);var ctx=this.chart.chart.ctx,_fill=ctx.fill,width=this.chart.width,height=this.chart.height,fontSize=(height/114).toFixed(2);this.chart.ctx.font=fontSize+"em Verdana",this.chart.ctx.textBaseline="middle";var text="82%",textX=Math.round((width-this.chart.ctx.measureText(text).width)/2),textY=height/2;this.chart.ctx.fillText(text,textX,textY),ctx.fill=function(){ctx.save(),ctx.shadowColor="#bbbbbb",ctx.shadowBlur=30,ctx.shadowOffsetX=0,ctx.shadowOffsetY=12,_fill.apply(this,arguments),ctx.restore()}}});Chart.controllers.hitRateDoughnut=customDoughnut;var ctx=document.getElementById("hit-rate-doughnut");new Chart(ctx,{type:"hitRateDoughnut",data:{labels:["Remain","Completed"],datasets:[{label:"Favourite",backgroundColor:["#28D094","#FF4961"],data:[18,82]}]},options:{responsive:!0,title:{display:!1},legend:{display:!1},layout:{padding:{left:16,right:16,top:16,bottom:16}},cutoutPercentage:92,animation:{animateScale:!1,duration:2500}}});Chart.defaults.dealsDoughnut=Chart.defaults.doughnut;var draw=Chart.controllers.doughnut.prototype.draw,customDealDoughnut=Chart.controllers.doughnut.extend({draw:function(){draw.apply(this,arguments);var ctx=this.chart.chart.ctx,_fill=ctx.fill,width=this.chart.width,height=this.chart.height,fontSize=(height/114).toFixed(2);this.chart.ctx.font=fontSize+"em Verdana",this.chart.ctx.textBaseline="middle";var text="76%",textX=Math.round((width-this.chart.ctx.measureText(text).width)/2),textY=height/2;this.chart.ctx.fillText(text,textX,textY),ctx.fill=function(){ctx.save(),ctx.shadowColor="#FF4961",ctx.shadowBlur=30,ctx.shadowOffsetX=0,ctx.shadowOffsetY=12,_fill.apply(this,arguments),ctx.restore()}}});Chart.controllers.dealsDoughnut=customDealDoughnut;var ctx=document.getElementById("deals-doughnut"),ctx3=(new Chart(ctx,{type:"dealsDoughnut",data:{labels:["Remain","Completed"],datasets:[{label:"Favourite",borderWidth:0,backgroundColor:["#ff7b8c","#FFF"],data:[24,76]}]},options:{responsive:!0,title:{display:!1},legend:{display:!1},layout:{padding:{left