1 line
8.2 KiB
JavaScript
Vendored
1 line
8.2 KiB
JavaScript
Vendored
!function(NioApp){"use strict";let earningsChart={labels:["M","T","W","T","F","S","S"],legend:!1,yAxis:!1,ticksColor:"#9CA3AF",ticksFontSize:11,ticksFontWeight:100,gridColorX:NioApp.Colors.white,gridColorY:NioApp.Colors.white,gridBorderColorX:NioApp.Colors.white,gridBorderColorY:NioApp.Colors.white,barThickness:6,datasets:[{borderRadius:10,borderWidth:1,color:NioApp.Colors.info,background:NioApp.Colors.info,hoverBackgroundColor:NioApp.Colors.info,label:"Earnings",data:[700,780,570,870,670,910,770]}]},totalClientsChart={labels:["Jan","Feb","Mar","Apr","May","Jun"],legend:!1,lineTension:.4,yAxis:!1,xAxis:!1,maxTicksLimit:4,datasets:[{label:"Total Clients",color:NioApp.Colors.success,backgroundGradient:NioApp.Colors.success,borderWidth:4,pointBorderColor:"transparent",pointBackgroundColor:"transparent",pointHoverBackgroundColor:NioApp.Colors.success,borderCapStyle:"round",data:[38,40,23,80,70,110]}]},projectsOverviewChart={labels:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],legend:!1,stacked:!1,ticksColor:"#9CA3AF",ticksFontSize:11,ticksFontWeight:100,ticksValue:"k",gridBorderDash:[8,4],gridColorX:NioApp.Colors.white,gridColorY:NioApp.Colors.gray100,gridBorderColorX:NioApp.Colors.white,gridBorderColorY:NioApp.Colors.white,datasets:[{color:NioApp.Colors.primary,background:NioApp.Colors.primary,border:1,label:"Total Income",data:[120,160,95,105,98,99,167,140,155,267,237,250],order:1},{color:NioApp.Colors.warning,background:NioApp.Colors.warning,border:2,label:"Total Profit",data:[110,80,125,55,95,75,90,110,80,125,55,95],type:"line",order:0}]},avgEarningsChart={labels:["01 Jan","02 Jan","03 Jan","04 Jan","05 Jan","06 Jan","07 Jan","08 Jan","09 Jan","10 Jan","11 Jan","12 Jan","13 Jan","14 Jan","15 Jan"],legend:!1,lineTension:.4,ticksValue:"k",ticksColor:"#9CA3AF",ticksFontSize:11,ticksFontWeight:100,gridBorderDash:[8,4],xAxis:!1,gridColorX:NioApp.Colors.gray100,gridColorY:NioApp.Colors.gray100,gridBorderColorX:NioApp.Colors.gray100,gridBorderColorY:NioApp.Colors.white,datasets:[{label:"Avg Earnings",color:NioApp.Colors.success,backgroundGradient:NioApp.Colors.success,pointBackgroundColor:"transparent",borderWidth:2,pointBorderColor:"transparent",pointHoverBackgroundColor:NioApp.Colors.success,data:[55,105,100,115,150,145,190,150,200,190,230,200,256,234,300]}]};NioApp.Chart={tooltip:{rtl:NioApp.State.isRTL,textDirection:NioApp.State.isRTL?"rtl":"ltr",padding:12,boxWidth:10,boxHeight:10,boxPadding:6,backgroundColor:NioApp.Colors.gray100,titleColor:NioApp.Colors.gray900,bodyColor:NioApp.Colors.bodyColor},legend:{rtl:NioApp.State.isRTL,position:"top",labels:{boxWidth:12,boxHeight:12,fontColor:NioApp.Colors.bodyColor,padding:10}},bar:function(selector,data){let elm=document.querySelectorAll(selector);elm.forEach(item=>{let chartId=item.id,setData=void 0===data?eval(chartId):data,chartLegend=void 0!==setData.legend&&setData.legend,chartStacked=void 0!==setData.stacked&&setData.stacked,chartxAxis=void 0===setData.xAxis||setData.xAxis,chartyAxis=void 0===setData.yAxis||setData.yAxis,chartTicksColor=setData.ticksColor,chartTicksFontSize=setData.ticksFontSize,chartTicksFontWeight=setData.ticksFontWeight,chartMaxTicksLimit=setData.maxTicksLimit,chartTicksValue=void 0!==setData.ticksValue&&setData.ticksValue,chartGridColorX=setData.gridColorX,chartGridColorY=setData.gridColorY,chartGridBorderColorX=setData.gridBorderColorX,chartGridBorderColorY=setData.gridBorderColorY,chartGridBorderDash=setData.gridBorderDash,chartBarPercentage=void 0===setData.barPercentage?.1:setData.barPercentage,chartCategoryPercentage=void 0===setData.categoryPercentage?.1:setData.categoryPercentage,chartBarThickness=void 0===setData.barThickness?10:setData.barThickness,chartData=[];for(let t=0;t<setData.datasets.length;t++)chartData.push({label:setData.datasets[t].label,backgroundColor:void 0===setData.datasets[t].background?"transparent":setData.datasets[t].background,borderWidth:void 0===setData.datasets[t].border?1:setData.datasets[t].border,borderColor:setData.datasets[t].color,data:setData.datasets[t].data,borderRadius:void 0===setData.datasets[t].borderRadius?0:setData.datasets[t].borderRadius,borderSkipped:!1,hoverBackgroundColor:setData.datasets[t].hoverBackgroundColor,type:setData.datasets[t].type,order:setData.datasets[t].order});let canvas=document.getElementById(chartId).getContext("2d"),chart=new Chart(canvas,{type:"bar",data:{labels:setData.labels,datasets:chartData},options:{categoryPercentage:chartCategoryPercentage,barPercentage:chartBarPercentage,barThickness:chartBarThickness,plugins:{legend:{display:chartLegend,...NioApp.Chart.legend},tooltip:{enabled:!0,...NioApp.Chart.tooltip}},responsive:!0,maintainAspectRatio:!1,maintainAspectRatio:!1,scales:{x:{stacked:chartStacked,display:chartxAxis,grid:{color:chartGridColorX,borderColor:chartGridBorderColorX,borderDash:chartGridBorderDash},ticks:{color:chartTicksColor,beginAtZero:!0,maxTicksLimit:chartMaxTicksLimit,font:{size:chartTicksFontSize,weight:chartTicksFontWeight}}},y:{stacked:chartStacked,display:chartyAxis,grid:{color:chartGridColorY,borderColor:chartGridBorderColorY,borderDash:chartGridBorderDash},ticks:{callback:function(t,a,r){return t+chartTicksValue},color:chartTicksColor,beginAtZero:!0,maxTicksLimit:chartMaxTicksLimit,font:{size:chartTicksFontSize,weight:chartTicksFontWeight}}}}}})})},line:function(selector,data){let elm=document.querySelectorAll(selector);elm.forEach(item=>{let chartId=item.id,setData=void 0===data?eval(chartId):data,chartLegend=void 0!==setData.legend&&setData.legend,chartxAxis=void 0===setData.xAxis||setData.xAxis,chartyAxis=void 0===setData.yAxis||setData.yAxis,chartTicksColor=setData.ticksColor,chartTicksFontSize=setData.ticksFontSize,chartTicksFontWeight=setData.ticksFontWeight,chartMaxTicksLimit=setData.maxTicksLimit,chartTicksValue=void 0!==setData.ticksValue&&setData.ticksValue,chartGridColorX=setData.gridColorX,chartGridColorY=setData.gridColorY,chartGridBorderColorX=setData.gridBorderColorX,chartGridBorderColorY=setData.gridBorderColorY,chartGridBorderDash=setData.gridBorderDash,canvas=document.getElementById(chartId).getContext("2d"),chartData=[];for(let t=0;t<setData.datasets.length;t++){let a=void 0===setData.datasets[t].background?"transparent":setData.datasets[t].background;chartData.push({label:setData.datasets[t].label,tension:setData.lineTension,backgroundColor:setData.datasets[t].backgroundGradient?getGradient(setData.datasets[t].backgroundGradient):a,borderWidth:setData.datasets[t].borderWidth,borderColor:setData.datasets[t].color,pointBorderColor:setData.datasets[t].pointBorderColor,pointBackgroundColor:setData.datasets[t].pointBackgroundColor,pointHoverBackgroundColor:setData.datasets[t].pointHoverBackgroundColor,pointHoverBorderColor:setData.datasets[t].pointHoverBackgroundColor,pointBorderWidth:setData.datasets[t].pointBorderWidth,pointHoverRadius:setData.datasets[t].pointHoverRadius,pointHoverBorderWidth:setData.datasets[t].pointBorderWidth,pointRadius:setData.datasets[t].pointRadius,pointHitRadius:setData.datasets[t].pointHitRadius,fill:!0,data:setData.datasets[t].data,borderDash:setData.datasets[t].borderDash,borderCapStyle:setData.datasets[t].borderCapStyle})}function getGradient(t){let a=canvas.createLinearGradient(0,0,0,canvas.canvas.clientHeight);return a.addColorStop(0,""+NioApp.hexRGB(t,0)),a.addColorStop(.5,""+NioApp.hexRGB(t,.25)),a.addColorStop(1,""+NioApp.hexRGB(t,.1)),a}let chart=new Chart(canvas,{type:"line",data:{labels:setData.labels,datasets:chartData},options:{plugins:{legend:{display:chartLegend,...NioApp.Chart.legend},tooltip:{enabled:!0,...NioApp.Chart.tooltip}},interaction:{mode:"nearest"},responsive:!0,maintainAspectRatio:!1,scales:{y:{display:chartyAxis,grid:{color:chartGridColorY,borderColor:chartGridBorderColorY,borderDash:chartGridBorderDash},ticks:{callback:function(t,a,r){return t+chartTicksValue},color:chartTicksColor,beginAtZero:!0,maxTicksLimit:chartMaxTicksLimit,font:{size:chartTicksFontSize,weight:chartTicksFontWeight}}},x:{display:chartxAxis,grid:{color:chartGridColorX,borderColor:chartGridBorderColorX,borderDash:chartGridBorderDash},ticks:{color:chartTicksColor,beginAtZero:!0,maxTicksLimit:chartMaxTicksLimit,font:{size:chartTicksFontSize,weight:chartTicksFontWeight}}}}}})})}},NioApp.Chart.init=function(){NioApp.Chart.bar('[data-nk-chart="bar"]'),NioApp.Chart.line('[data-nk-chart="line"]')},NioApp.winLoad(NioApp.Chart.init)}(NioApp); |