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

2 lines
8.4 KiB
JavaScript
Executable File

!function(e){"use strict";var a={};e(document).ready(function(){return e("#area-chartist-chart").length&&a.area(),e("#bar-chartist-chart").length&&a.bar(),e("#bi-polar-area-chartist-chart").length&&a.biPolarArea(),e("#bi-polar-bar-chartist-chart").length&&a.biPolarBar(),e("#donut-bar-chartist-chart").length&&a.donut(),e("#donut-animation-bar-chartist-chart").length&&a.donutAnimation(),e("#gauge-bar-chartist-chart").length&&a.gauge(),e("#horizontal-bar-chartist-chart").length&&a.horizontalBar(),e("#line-chartist-chart").length&&a.line(),e("#pie-bar-chartist-chart").length&&a.pie(),e("#scatter-chartist-chart").length&&a.scatter(),e("#smil-animation-chartist-chart").length&&a.smilAnimation(),e("#smil-animation-index-chartist-chart").length&&a.smilAnimationIndex(),e("#stacked-bar-chartist-chart").length&&a.stackedBar(),e("#svg-animation-chartist-chart").length&&a.svgAnimation(),!1}),a={area:function(){return new Chartist.Line("#area-chartist-chart",{labels:[1,2,3,4,5,6,7,8],series:[[5,9,7,8,5,3,5,4]]},{low:0,showArea:!0,fullWidth:!0,axisY:{offset:10}}),!1},bar:function(){return new Chartist.Bar("#bar-chartist-chart",{labels:["Quarter 1","Quarter 2","Quarter 3","Quarter 4"],series:[[5,4,3,7],[3,2,9,5],[1,5,8,4],[2,3,4,6],[4,1,2,1]]},{stackBars:!0,axisX:{labelInterpolationFnc:function(e){return e.split(/\s+/).map(function(e){return e[0]}).join("")}},axisY:{offset:10}},[["screen and (min-width: 400px)",{reverseData:!0,horizontalBars:!0,axisX:{labelInterpolationFnc:Chartist.noop},axisY:{offset:20}}],["screen and (min-width: 800px)",{stackBars:!1,seriesBarDistance:10}],["screen and (min-width: 1000px)",{reverseData:!1,horizontalBars:!1,seriesBarDistance:15}]]),!1},biPolarArea:function(){return new Chartist.Line("#bi-polar-area-chartist-chart",{labels:[1,2,3,4,5,6,7,8],series:[[1,2,3,1,-2,0,1,0],[-2,-1,-2,-1,-2.5,-1,-2,-1],[0,0,0,1,2,2.5,2,1],[2.5,2,1,.5,1,.5,-1,-2.5]]},{high:3,low:-3,showArea:!0,showLine:!1,showPoint:!1,fullWidth:!0,axisY:{offset:20},axisX:{showLabel:!1,showGrid:!1}}),!1},biPolarBar:function(){var e={labels:["W1","W2","W3","W4","W5","W6","W7","W8","W9","W10"],series:[[1,2,4,8,6,-2,-1,-4,-6,-2]]},a={high:10,low:-10,axisX:{labelInterpolationFnc:function(e,a){return a%2===0?e:null}},fullWidth:!0,axisY:{offset:10}};return new Chartist.Bar("#bi-polar-bar-chartist-chart",e,a),!1},donut:function(){var e={series:[20,10,30,40]},a=function(e,a){return e+a};return new Chartist.Pie("#donut-bar-chartist-chart",e,{labelInterpolationFnc:function(t){return Math.round(t/e.series.reduce(a)*100)+"%"},donut:!0,donutWidth:80,startAngle:270}),!1},donutAnimation:function(){var e=new Chartist.Pie("#donut-animation-bar-chartist-chart",{series:[10,20,50,20,5,50,15],labels:[1,2,3,4,5,6,7]},{donut:!0,showLabel:!1});return e.on("draw",function(e){if("slice"===e.type){var a=e.element._node.getTotalLength();e.element.attr({"stroke-dasharray":a+"px "+a+"px"});var t={"stroke-dashoffset":{id:"anim"+e.index,dur:1e3,from:-a+"px",to:"0px",easing:Chartist.Svg.Easing.easeOutQuint,fill:"freeze"}};0!==e.index&&(t["stroke-dashoffset"].begin="anim"+(e.index-1)+".end"),e.element.attr({"stroke-dashoffset":-a+"px"}),e.element.animate(t,!1)}}),e.on("created",function(){window.__anim21278907124&&(clearTimeout(window.__anim21278907124),window.__anim21278907124=null),window.__anim21278907124=setTimeout(e.update.bind(e),1e4)}),!1},gauge:function(){return new Chartist.Pie("#gauge-bar-chartist-chart",{series:[20,10,30,40]},{donut:!0,donutWidth:60,startAngle:270,total:200,showLabel:!1}),!1},horizontalBar:function(){return new Chartist.Bar("#horizontal-bar-chartist-chart",{labels:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],series:[[5,4,3,7,5,10,3],[3,2,9,5,4,6,4]]},{seriesBarDistance:10,reverseData:!0,horizontalBars:!0,axisY:{offset:70}}),!1},line:function(){return new Chartist.Line("#line-chartist-chart",{labels:["1","2","3","4","5"],series:[[12,9,7,8,5],[2,1,3.5,7,3],[1,3,4,5,6]]},{fullWidth:!0,axisY:{offset:10},chartPadding:{right:30}}),!1},pie:function(){var e={series:[5,3,4]},a=function(e,a){return e+a};return new Chartist.Pie("#pie-bar-chartist-chart",e,{labelInterpolationFnc:function(t){return Math.round(t/e.series.reduce(a)*100)+"%"}}),!1},scatter:function(){var e=function(e){return Array.apply(null,new Array(e))},a=e(52).map(Math.random).reduce(function(e,a,t){return e.labels.push(t+1),e.series.forEach(function(e){e.push(100*Math.random())}),e},{labels:[],series:e(4).map(function(){return new Array})}),t={showLine:!1,axisX:{labelInterpolationFnc:function(e,a){return a%13===0?"W"+e:null}},fullWidth:!0,axisY:{offset:20}},r=[["screen and (min-width: 640px)",{axisX:{labelInterpolationFnc:function(e,a){return a%4===0?"W"+e:null}}}]];return new Chartist.Line("#scatter-chartist-chart",a,t,r),!1},smilAnimation:function(){var e=new Chartist.Line("#smil-animation-chartist-chart",{labels:["1","2","3","4","5","6","7","8","9","10","11","12"],series:[[12,9,7,8,5,4,6,2,3,3,4,6],[4,5,3,7,3,5,5,3,4,4,5,5],[5,3,4,5,6,3,3,4,5,6,3,4],[3,4,5,6,7,6,4,5,6,7,6,3]]},{low:0}),a=0,t=80,r=500;return e.on("created",function(){a=0}),e.on("draw",function(e){if(a++,"line"===e.type)e.element.animate({opacity:{begin:a*t+1e3,dur:r,from:0,to:1}});else if("label"===e.type&&"x"===e.axis)e.element.animate({y:{begin:a*t,dur:r,from:e.y+100,to:e.y,easing:"easeOutQuart"}});else if("label"===e.type&&"y"===e.axis)e.element.animate({x:{begin:a*t,dur:r,from:e.x-100,to:e.x,easing:"easeOutQuart"}});else if("point"===e.type)e.element.animate({x1:{begin:a*t,dur:r,from:e.x-10,to:e.x,easing:"easeOutQuart"},x2:{begin:a*t,dur:r,from:e.x-10,to:e.x,easing:"easeOutQuart"},opacity:{begin:a*t,dur:r,from:0,to:1,easing:"easeOutQuart"}});else if("grid"===e.type){var i={begin:a*t,dur:r,from:e[e.axis.units.pos+"1"]-30,to:e[e.axis.units.pos+"1"],easing:"easeOutQuart"},n={begin:a*t,dur:r,from:e[e.axis.units.pos+"2"]-100,to:e[e.axis.units.pos+"2"],easing:"easeOutQuart"},o={};o[e.axis.units.pos+"1"]=i,o[e.axis.units.pos+"2"]=n,o.opacity={begin:a*t,dur:r,from:0,to:1,easing:"easeOutQuart"},e.element.animate(o)}}),e.on("created",function(){window.__exampleAnimateTimeout&&(clearTimeout(window.__exampleAnimateTimeout),window.__exampleAnimateTimeout=null),window.__exampleAnimateTimeout=setTimeout(e.update.bind(e),12e3)}),!1},smilAnimationIndex:function(){var e=new Chartist.Line("#smil-animation-index-chartist-chart",{labels:["2008","2009","2010","2011","2012","2013","2014","2015","2016"],series:[[8,5,4,6,2,3,3,4,6],[7,3,5,5,3,4,4,5,5]]},{low:0,fullWidth:!0,chartPadding:{right:30}}),a=0,t=80,r=500;return e.on("created",function(){a=0}),e.on("draw",function(e){if(a++,"line"===e.type)e.element.animate({opacity:{begin:a*t+1e3,dur:r,from:0,to:1}});else if("label"===e.type&&"x"===e.axis)e.element.animate({y:{begin:a*t,dur:r,from:e.y+100,to:e.y,easing:"easeOutQuart"}});else if("label"===e.type&&"y"===e.axis)e.element.animate({x:{begin:a*t,dur:r,from:e.x-100,to:e.x,easing:"easeOutQuart"}});else if("point"===e.type)e.element.animate({x1:{begin:a*t,dur:r,from:e.x-10,to:e.x,easing:"easeOutQuart"},x2:{begin:a*t,dur:r,from:e.x-10,to:e.x,easing:"easeOutQuart"},opacity:{begin:a*t,dur:r,from:0,to:1,easing:"easeOutQuart"}});else if("grid"===e.type){var i={begin:a*t,dur:r,from:e[e.axis.units.pos+"1"]-30,to:e[e.axis.units.pos+"1"],easing:"easeOutQuart"},n={begin:a*t,dur:r,from:e[e.axis.units.pos+"2"]-100,to:e[e.axis.units.pos+"2"],easing:"easeOutQuart"},o={};o[e.axis.units.pos+"1"]=i,o[e.axis.units.pos+"2"]=n,o.opacity={begin:a*t,dur:r,from:0,to:1,easing:"easeOutQuart"},e.element.animate(o)}}),e.on("created",function(){window.__exampleAnimateTimeout&&(clearTimeout(window.__exampleAnimateTimeout),window.__exampleAnimateTimeout=null),window.__exampleAnimateTimeout=setTimeout(e.update.bind(e),12e3)}),!1},stackedBar:function(){return new Chartist.Bar("#stacked-bar-chartist-chart",{labels:["Q1","Q2","Q3","Q4"],series:[[8e5,12e5,14e5,13e5],[2e5,4e5,5e5,3e5],[1e5,2e5,4e5,6e5]]},{stackBars:!0,axisY:{labelInterpolationFnc:function(e){return e/1e3+"k"}}}).on("draw",function(e){"bar"===e.type&&e.element.attr({style:"stroke-width: 30px"})}),!1},svgAnimation:function(){var e=new Chartist.Line("#svg-animation-chartist-chart",{labels:["Mon","Tue","Wed","Thu","Fri","Sat"],series:[[1,5,2,5,4,3],[2,3,4,8,1,2],[5,4,3,2,1,.5]]},{low:0,showArea:!0,showPoint:!1,fullWidth:!0,axisY:{offset:10}});return e.on("draw",function(e){("line"===e.type||"area"===e.type)&&e.element.animate({d:{begin:2e3*e.index,dur:2e3,from:e.path.clone().scale(1,0).translate(0,e.chartRect.height()).stringify(),to:e.path.clone().stringify(),easing:Chartist.Svg.Easing.easeOutQuint}})}),!1}}}(jQuery);