6 lines
9.0 KiB
JavaScript
6 lines
9.0 KiB
JavaScript
/*!
|
|
* Codebase - v3.0.0
|
|
* @author pixelcave - https://pixelcave.com
|
|
* Copyright (c) 2018
|
|
*/
|
|
!function(t){var e={};function o(r){if(e[r])return e[r].exports;var l=e[r]={i:r,l:!1,exports:{}};return t[r].call(l.exports,l,l.exports,o),l.l=!0,l.exports}o.m=t,o.c=e,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var l in t)o.d(r,l,function(e){return t[e]}.bind(null,l));return r},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=4)}({4:function(t,e,o){t.exports=o(5)},5:function(t,e){function o(t,e){for(var o=0;o<e.length;o++){var r=e[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var r=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,r,l;return e=t,l=[{key:"initRandomEasyPieChart",value:function(){jQuery(".js-pie-randomize").on("click",function(t){jQuery(t.currentTarget).parents(".block").find(".pie-chart").each(function(t,e){jQuery(e).data("easyPieChart").update(Math.floor(100*Math.random()+1))})})}},{key:"initChartsSparkline",value:function(){var t=jQuery(".js-slc-line1"),e=jQuery(".js-slc-line2"),o=jQuery(".js-slc-line3"),r=jQuery(".js-slc-bar1"),l=jQuery(".js-slc-bar2"),a=jQuery(".js-slc-bar3"),i=jQuery(".js-slc-pie1"),n=jQuery(".js-slc-pie2"),s=jQuery(".js-slc-pie3"),f=jQuery(".js-slc-tristate1"),c=jQuery(".js-slc-tristate2"),u=jQuery(".js-slc-tristate3"),p={type:"line",width:"120px",height:"80px",tooltipOffsetX:-25,tooltipOffsetY:20,lineColor:"#ffca28",fillColor:"#ffca28",spotColor:"#555",minSpotColor:"#555",maxSpotColor:"#555",highlightSpotColor:"#555",highlightLineColor:"#555",spotRadius:2,tooltipPrefix:"",tooltipSuffix:" Tickets",tooltipFormat:"{{prefix}}{{y}}{{suffix}}"};t.length&&t.sparkline("html",p),p.lineColor="#9ccc65",p.fillColor="#9ccc65",p.tooltipPrefix="$ ",p.tooltipSuffix="",e.length&&e.sparkline("html",p),p.lineColor="#42a5f5",p.fillColor="#42a5f5",p.tooltipPrefix="",p.tooltipSuffix=" Sales",o.length&&o.sparkline("html",p);var h={type:"bar",barWidth:8,barSpacing:6,height:"80px",barColor:"#ffca28",tooltipPrefix:"",tooltipSuffix:" Tickets",tooltipFormat:"{{prefix}}{{value}}{{suffix}}"};r.length&&r.sparkline("html",h),h.barColor="#9ccc65",h.tooltipPrefix="$ ",h.tooltipSuffix="",l.length&&l.sparkline("html",h),h.barColor="#42a5f5",h.tooltipPrefix="",h.tooltipSuffix=" Sales",a.length&&a.sparkline("html",h);var d={type:"pie",width:"80px",height:"80px",sliceColors:["#ffca28","#9ccc65","#42a5f5","#ef5350"],highlightLighten:1.1,tooltipPrefix:"",tooltipSuffix:" Tickets",tooltipFormat:"{{prefix}}{{value}}{{suffix}}"};i.length&&i.sparkline("html",d),d.tooltipPrefix="$ ",d.tooltipSuffix="",n.length&&n.sparkline("html",d),d.tooltipPrefix="",d.tooltipSuffix=" Sales",s.length&&s.sparkline("html",d);var g={type:"tristate",barWidth:8,barSpacing:6,height:"110px",posBarColor:"#9ccc65",negBarColor:"#ef5350"};f.length&&f.sparkline("html",g),c.length&&c.sparkline("html",g),u.length&&u.sparkline("html",g)}},{key:"initChartsChartJS",value:function(){Chart.defaults.global.defaultFontColor="#555555",Chart.defaults.scale.gridLines.color="rgba(0,0,0,.04)",Chart.defaults.scale.gridLines.zeroLineColor="rgba(0,0,0,.1)",Chart.defaults.scale.ticks.beginAtZero=!0,Chart.defaults.global.elements.line.borderWidth=2,Chart.defaults.global.elements.point.radius=5,Chart.defaults.global.elements.point.hoverRadius=7,Chart.defaults.global.tooltips.cornerRadius=3,Chart.defaults.global.legend.labels.boxWidth=12;var t=jQuery(".js-chartjs-lines"),e=jQuery(".js-chartjs-bars"),o=jQuery(".js-chartjs-radar"),r=jQuery(".js-chartjs-polar"),l=jQuery(".js-chartjs-pie"),a=jQuery(".js-chartjs-donut"),i={labels:["MON","TUE","WED","THU","FRI","SAT","SUN"],datasets:[{label:"This Week",fill:!0,backgroundColor:"rgba(66,165,245,.75)",borderColor:"rgba(66,165,245,1)",pointBackgroundColor:"rgba(66,165,245,1)",pointBorderColor:"#fff",pointHoverBackgroundColor:"#fff",pointHoverBorderColor:"rgba(66,165,245,1)",data:[25,38,62,45,90,115,130]},{label:"Last Week",fill:!0,backgroundColor:"rgba(66,165,245,.25)",borderColor:"rgba(66,165,245,1)",pointBackgroundColor:"rgba(66,165,245,1)",pointBorderColor:"#fff",pointHoverBackgroundColor:"#fff",pointHoverBorderColor:"rgba(66,165,245,1)",data:[112,90,142,130,170,188,196]}]},n={labels:["Earnings","Sales","Tickets"],datasets:[{data:[50,25,25],backgroundColor:["rgba(156,204,101,1)","rgba(255,202,40,1)","rgba(239,83,80,1)"],hoverBackgroundColor:["rgba(156,204,101,.5)","rgba(255,202,40,.5)","rgba(239,83,80,.5)"]}]};t.length&&new Chart(t,{type:"line",data:i}),e.length&&new Chart(e,{type:"bar",data:i}),o.length&&new Chart(o,{type:"radar",data:i}),r.length&&new Chart(r,{type:"polarArea",data:n}),l.length&&new Chart(l,{type:"pie",data:n}),a.length&&new Chart(a,{type:"doughnut",data:n})}},{key:"initChartsFlot",value:function(){var t,e=jQuery(".js-flot-live"),o=jQuery(".js-flot-lines"),r=jQuery(".js-flot-stacked"),l=jQuery(".js-flot-pie"),a=jQuery(".js-flot-bars"),i=[[1,1500],[2,1700],[3,1400],[4,1900],[5,2500],[6,2300],[7,2700],[8,3200],[9,3500],[10,3260],[11,4100],[12,4600]],n=[[1,500],[2,600],[3,400],[4,750],[5,1150],[6,950],[7,1400],[8,1700],[9,1800],[10,1300],[11,1750],[12,2900]],s=[[1,"Jan"],[2,"Feb"],[3,"Mar"],[4,"Apr"],[5,"May"],[6,"Jun"],[7,"Jul"],[8,"Aug"],[9,"Sep"],[10,"Oct"],[11,"Nov"],[12,"Dec"]],f=[],c=0;function u(){for(f.length>0&&(f=f.slice(1));f.length<300;){var t=(f.length>0?f[f.length-1]:50)+10*Math.random()-5;t<0&&(t=0),t>100&&(t=100),f.push(t)}for(var e=[],o=0;o<f.length;++o)e.push([o,f[o]]);return jQuery(".js-flot-live-info").html(c.toFixed(0)+"%"),e}if(e.length&&(t=jQuery.plot(e,[{data:u()}],{series:{shadowSize:0},lines:{show:!0,lineWidth:1,fill:!0,fillColor:{colors:[{opacity:1},{opacity:.5}]}},colors:["#42a5f5"],grid:{borderWidth:0,color:"#cccccc"},yaxis:{show:!0,min:0,max:100},xaxis:{show:!1}}),function e(){t.setData([u()]),t.draw(),setTimeout(e,100)}()),o.length){jQuery.plot(o,[{label:"Earnings",data:i,lines:{show:!0,fill:!0,fillColor:{colors:[{opacity:.7},{opacity:.7}]}},points:{show:!0,radius:5}},{label:"Sales",data:n,lines:{show:!0,fill:!0,fillColor:{colors:[{opacity:.5},{opacity:.5}]}},points:{show:!0,radius:5}}],{colors:["#ffca28","#555555"],legend:{show:!0,position:"nw",backgroundOpacity:0},grid:{borderWidth:0,hoverable:!0,clickable:!0},yaxis:{tickColor:"#ffffff",ticks:3},xaxis:{ticks:s,tickColor:"#f5f5f5"}});var p=null,h=null;o.bind("plothover",function(t,e,o){if(o){if(p!==o.dataIndex){p=o.dataIndex,jQuery(".js-flot-tooltip").remove();o.datapoint[0];var r=o.datapoint[1];h=0===o.seriesIndex?"$ <strong>"+r+"</strong>":1===o.seriesIndex?"<strong>"+r+"</strong> sales":"<strong>"+r+"</strong> tickets",jQuery('<div class="js-flot-tooltip flot-tooltip">'+h+"</div>").css({top:o.pageY-45,left:o.pageX+5}).appendTo("body").show()}}else jQuery(".js-flot-tooltip").remove(),p=null})}r.length&&jQuery.plot(r,[{label:"Sales",data:n},{label:"Earnings",data:i}],{colors:["#555555","#26c6da"],series:{stack:!0,lines:{show:!0,fill:!0}},lines:{show:!0,lineWidth:0,fill:!0,fillColor:{colors:[{opacity:1},{opacity:1}]}},legend:{show:!0,position:"nw",sorted:!0,backgroundOpacity:0},grid:{borderWidth:0},yaxis:{tickColor:"#ffffff",ticks:3},xaxis:{ticks:s,tickColor:"#f5f5f5"}}),a.length&&jQuery.plot(a,[{label:"Sales Before Release",data:[[1,500],[4,600],[7,1e3],[10,600],[13,800],[16,1200],[19,1500],[22,1600],[25,2500],[28,2700],[31,3500],[34,4500]],bars:{show:!0,lineWidth:0,fillColor:{colors:[{opacity:.75},{opacity:.75}]}}},{label:"Sales After Release",data:[[2,900],[5,1200],[8,2e3],[11,1200],[14,1600],[17,2400],[20,3e3],[23,3200],[26,5e3],[29,5400],[32,7e3],[35,9e3]],bars:{show:!0,lineWidth:0,fillColor:{colors:[{opacity:.75},{opacity:.75}]}}}],{colors:["#ef5350","#9ccc65"],legend:{show:!0,position:"nw",backgroundOpacity:0},grid:{borderWidth:0},yaxis:{ticks:3,tickColor:"#f5f5f5"},xaxis:{ticks:[[2,"Jan"],[5,"Feb"],[8,"Mar"],[11,"Apr"],[14,"May"],[17,"Jun"],[20,"Jul"],[23,"Aug"],[26,"Sep"],[29,"Oct"],[32,"Nov"],[35,"Dec"]],tickColor:"#f5f5f5"}}),l.length&&jQuery.plot(l,[{label:"Sales",data:15},{label:"Tickets",data:12},{label:"Earnings",data:73}],{colors:["#26c6da","#ffca28","#9ccc65"],legend:{show:!1},series:{pie:{show:!0,radius:1,label:{show:!0,radius:2/3,formatter:function(t,e){return'<div class="flot-pie-label">'+t+"<br>"+Math.round(e.percent)+"%</div>"},background:{opacity:.75,color:"#000000"}}}}})}},{key:"init",value:function(){this.initRandomEasyPieChart(),this.initChartsSparkline(),this.initChartsChartJS(),this.initChartsFlot()}}],(r=null)&&o(e.prototype,r),l&&o(e,l),t}();jQuery(function(){r.init()})}}); |