school-administrarion/assets/scripts/chart.morris.init.min.js

2 lines
4.0 KiB
JavaScript
Raw Normal View History

2024-05-07 19:49:43 +00:00
!function(e){"use strict";var a,r={};e(document).ready(function(){return e("#area-morris-chart").length&&r.area.init(),e("#bar-morris-chart").length&&r.bar.init(),e("#donut-morris-chart").length&&r.donut.init(),e("#lines-morris-chart").length&&r.lines.init(),e("#realtime-morris-chart").length&&r.realtime.init(),e("#stack-morris-chart").length&&r.stack.init(),e("#realtime-morris-chart").length&&setInterval(function(){r.realtime.update()},500),!1}),e(window).on("resize",function(){return e("#area-morris-chart").length&&r.area.update(),e("#bar-morris-chart").length&&r.bar.update(),e("#donut-morris-chart").length&&r.donut.update(),e("#lines-morris-chart").length&&r.lines.update(),e("#stack-morris-chart").length&&r.stack.update(),!1}),r={area:{graph:null,data:[{x:"2010",y:10,z:10},{x:"2011",y:9,z:8},{x:"2012",y:9,z:11},{x:"2013",y:13,z:10},{x:"2014",y:15,z:13},{x:"2015",y:12,z:14},{x:"2016",y:13,z:18}],init:function(){return r.area.graph=Morris.Area({element:"area-morris-chart",behaveLikeLine:!0,data:r.area.data,xkey:"x",ykeys:["y","z"],labels:["Sales","Salary"],pointSize:0,pointStrokeColors:["#fcb03b","#ea65a2"],behaveLikeLine:!0,gridLineColor:"#eee",lineWidth:0,smooth:!0,hideHover:"auto",lineColors:["#fcb03b","#ea65a2"],resize:!0,gridTextColor:"#2f2c2c"}),!1},update:function(){return r.area.graph.setData(r.area.data),!1}},bar:{graph:null,data:[{x:"2010",y:10,z:17,a:9},{x:"2011",y:5,z:14,a:13},{x:"2012",y:5,z:13,a:12},{x:"2013",y:6,z:12,a:5},{x:"2014",y:17,z:8,a:8},{x:"2015",y:10,z:14,a:18},{x:"2016",y:8,z:17,a:14}],init:function(){return Morris.Bar({element:"bar-morris-chart",behaveLikeLine:!0,data:r.bar.data,barColors:["#fcb03b","#ea65a2","#566FC9"],xkey:"x",ykeys:["y","z","a"],labels:["Series A","Series B","Series C"]}),!1},update:function(){return r.bar.graph.setData(r.bar.data),!1}},donut:{graph:null,data:[{value:40,label:"Series A"},{value:20,label:"Series B"},{value:30,label:"Series C"}],init:function(){return Morris.Donut({element:"donut-morris-chart",data:r.donut.data,colors:["#fcb03b","#ea65a2","#566FC9"],resize:!0,labelColor:"#2f2c2c",formatter:function(e){return e+"%"}}),!1},update:function(){return r.donut.graph.setData(r.donut.data),!1}},lines:{graph:null,data:[{x:"2010",y:10,z:17},{x:"2011",y:5,z:14},{x:"2012",y:5,z:13},{x:"2013",y:6,z:12},{x:"2014",y:17,z:8},{x:"2015",y:10,z:14},{x:"2016",y:8,z:17}],init:function(){return Morris.Line({element:"lines-morris-chart",behaveLikeLine:!0,data:r.lines.data,xkey:"x",ykeys:["y","z"],labels:["Upload","Download"],lineColors:["#fcb03b","#ea65a2"],pointSize:1,pointStrokeColors:["#fcb03b"],behaveLikeLine:!0,gridLineColor:"#eee",gridTextColor:"#2f2c2c",lineWidth:2,smooth:!0,hideHover:"auto",resize:!0}),!1},update:function(){return r.lines.graph.setData(r.lines.data),!1}},realtime:{data:[{x:"0",y:10},{x:"1",y:5},{x:"2",y:5},{x:"3",y:6},{x:"4",y:17},{x:"5",y:10},{x:"6",y:12},{x:"7",y:15},{x:"8",y:9},{x:"9",y:6},{x:"10",y:15},{x:"11",y:14},{x:"12",y:5},{x:"13",y:12},{x:"14",y:16},{x:"15",y:5},{x:"16",y:10},{x:"17",y:8},{x:"18",y:8},{x:"19",y:8},{x:"20",y:6}],init:function(){return a=Morris.Line({element:"realtime-morris-chart",data:r.realtime.data,xkey:"x",ykeys:["y"],axes:"y",labels:["Visitors Online"],parseTime:!1,pointSize:1,pointStrokeColors:["#fcb03b"],behaveLikeLine:!0,gridLineColor:"#eee",gridTextColor:"#2f2c2c",lineWidth:2,smooth:!0,hideHover:"auto",lineColors:["#fcb03b"],resize:!0}),!1},update:function(){var e,t=Math.floor(20*Math.random()+1);for(e=0;e<r.realtime.data.length-1;e++)r.realtime.data[e].y=r.realtime.data[e+1].y;return r.realtime.data[r.realtime.data.length-1].y=t,a.setData(r.realtime.data),!1}},stack:{graph:null,data:[{x:"2010",y:10,z:17},{x:"2011",y:5,z:14},{x:"2012",y:5,z:13},{x:"2013",y:6,z:12},{x:"2014",y:17,z:8},{x:"2015",y:10,z:14},{x:"2016",y:8,z:17}],init:function(){return Morris.Bar({element:"stack-morris-chart",behaveLikeLine:!0,data:r.stack.data,xkey:"x",ykeys:["y","z"],labels:["Series A","Series B"],stacked:!0,barColors:["#ea65a2","#566FC9"]}),!1},update:function(){return r.stack.graph.setData(r.stack.data),!1}}}}(jQuery);