raspberry-pi-absensi/assets/scripts/chart.flot.init.min.js

2 lines
4.1 KiB
JavaScript
Executable File

!function(e){"use strict";function t(e,t){return"<div style='font-size:8pt; text-align:center; padding:2px; color:white;'>"+e+"<br/>"+Math.round(t.percent)+"%</div>"}var a={};e(document).ready(function(){return e("#real-time-flot-chart").length&&a.module.realtime.init(),e("#categories-flot-chart").length&&a.module.categories.init(),e("#pile-flot-chart").length&&a.module.pile.init(),e("#donut-flot-chart").length&&a.module.donut.init(),e("#lines-flot-chart").length&&a.module.lines.init(),!1}),e(window).resize(function(){return e("#real-time-flot-chart").length&&a.module.realtime.init(),e("#categories-flot-chart").length&&a.module.categories.init(),e("#pile-flot-chart").length&&a.module.pile.init(),e("#donut-flot-chart").length&&a.module.donut.init(),e("#lines-flot-chart").length&&a.module.lines.init(),!1}),a.module={categories:{container:"#categories-flot-chart",data:[["January",10],["February",8],["March",4],["April",13],["May",17],["June",9]],init:function(){return e.plot(a.module.categories.container,[a.module.categories.data],{colors:["#f9c851"],series:{bars:{show:!0,barWidth:.6,align:"center"}},xaxis:{mode:"categories",tickLength:0}}),!1}},donut:{container:"#donut-flot-chart",data:[{label:"Series 1",data:50},{label:"Series 2",data:60},{label:"Series 3",data:90},{label:"Series 4",data:70},{label:"Series 5",data:80}],init:function(){return e.plot(a.module.donut.container,a.module.donut.data,{tooltip:!0,tooltipOpts:{content:"%s, %p.0%"},series:{pie:{show:!0,innerRadius:.5}},grid:{hoverable:!0},colors:["#03a9f4","#01ba9a","#dcdcdc","#6c85bd","#f8ca4e"],legend:{show:!0,labelFormatter:function(e){return'<div style="font-size:14px;">&nbsp;'+e+"</div>"},labelBoxBorderColor:null,margin:20,width:20,padding:1}}),!1}},lines:{container:"#lines-flot-chart",data:[[[0,14],[1,20],[2,23],[3,20],[4,24],[5,18],[6,27],[7,24],[8,16],[9,26],[10,25]],[[0,4],[1,10],[2,2],[3,17],[4,25],[5,17],[6,22],[7,22],[8,18],[9,11],[10,20]]],init:function(){return e.plot(a.module.lines.container,a.module.lines.data,{colors:["#6e8cd7","#03a9f4"],series:{lines:{show:!0,fill:!0,lineWidth:1,fillColor:{colors:[{opacity:.5},{opacity:.5}]}},points:{show:!0},shadowSize:0},legend:{position:"nw"},grid:{hoverable:!0,clickable:!0,borderColor:"#efefef",borderWidth:1,labelMargin:10,backgroundColor:"#fff"},yaxis:{min:0,max:40,color:"rgba(0,0,0,0.1)"},xaxis:{color:"rgba(0,0,0,0.1)"},tooltip:!0,tooltipOpts:{content:"%s: Value of %x is %y",shifts:{x:-60,y:25},defaultTheme:!1}}),!1}},pile:{container:"#pile-flot-chart",data:[{label:"Series 1",data:30},{label:"Series 2",data:30},{label:"Series 3",data:90},{label:"Series 4",data:70}],init:function(){return e.plot(a.module.pile.container,a.module.pile.data,{series:{pie:{show:!0,radius:1,label:{show:!0,radius:.75,formatter:t,background:{opacity:.5}}}},grid:{hoverable:!0},legend:{show:!1},colors:["#03a9f4","#01ba9a","#dcdcdc","#6c85bd"]}),!1}},realtime:{container:e("#real-time-flot-chart"),maximum:0,data:[],series:[],plot:{},init:function(){return a.module.realtime.maximum=a.module.realtime.container.outerWidth()/2||300,a.module.realtime.series=[{data:a.func.getRandomData(),lines:{fill:!0,lineWidth:1,fillColor:{colors:[{opacity:.45},{opacity:.45}]}},points:{show:!1},shadowSize:0}],a.module.realtime.plot=e.plot(a.module.realtime.container,a.module.realtime.series,{colors:["#03a9f4"],grid:{show:!0,aboveData:!1,color:"#dcdcdc",labelMargin:15,axisMargin:0,borderWidth:0,borderColor:null,minBorderMargin:5,clickable:!0,hoverable:!0,autoHighlight:!1,mouseActiveRadius:20},yaxis:{min:0,max:150,color:"rgba(0,0,0,0.1)"},xaxis:{show:!1},legend:{show:!0}}),setInterval(function(){a.module.realtime.series[0].data=a.func.getRandomData(),a.module.realtime.plot.setData(a.module.realtime.series),a.module.realtime.plot.draw()},40),!1}}},a.func={getRandomData:function(){for(a.module.realtime.data.length&&(a.module.realtime.data=a.module.realtime.data.slice(1));a.module.realtime.data.length<a.module.realtime.maximum;){var e=a.module.realtime.data.length?a.module.realtime.data[a.module.realtime.data.length-1]:50,t=e+10*Math.random()-5;a.module.realtime.data.push(0>t?0:t>100?100:t)}for(var i=[],l=0;l<a.module.realtime.data.length;++l)i.push([l,a.module.realtime.data[l]]);return i}}}(jQuery);