Quite good looking graph derived from d3.js http://c3js.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
58 KiB

!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}var e={};e.generate=function(e){function f(a,b){if(!(a in e))throw Error(b)}function g(a,b){var c,d,f,g=e;for(c=0;c<a.length;c++){if("object"==typeof g&&!(a[c]in g))return b;if(d=c===a.length-1,f=g[a[c]],!d&&"object"!=typeof f||d&&"object"!=typeof b&&"object"==typeof f)return b;g=f}return g}function h(a){return"url("+document.URL.split("#")[0]+"#"+a+")"}function i(){Ph.attr("transform",Ah.main),Ph.select("."+Ie.axisX).attr("transform",Ah.x),Ph.select("."+Ie.axisY).attr("transform",Ah.y),Ph.select("."+Ie.axisY2).attr("transform",Ah.y2),Ph.select("."+Ie.chartArcs).attr("transform",Ah.arc)}function j(){Zf&&(Qh.attr("transform",Ah.context),Qh.select("."+Ie.axisX).attr("transform",Ah.subx))}function k(a){var b=a!==!1?250:0;ag&&Rh.transition().duration(b).attr("transform",Ah.legend)}function l(a){i(a),j(a),k(a)}function m(){_e=p(),af=q(),bf=O(),cf=N(),Ue={top:eg?u("y2"):Hh,right:s(),bottom:u(eg?"y":"x")+(eg?0:$f)+(Bh?0:bf),left:(eg?$f+Gh:0)+r()},Xe=_e-Ue.left-Ue.right,Ze=af-Ue.top-Ue.bottom,0>Xe&&(Xe=0),0>Ze&&(Ze=0),Ve={top:eg?Ue.top:af-$f-(Bh?0:bf),right:0/0,bottom:20+(Bh?0:bf),left:eg?Fh:Ue.left},Ye=eg?Ue.left-Fh-Gh:Xe,$e=eg?Ze:af-Ve.top-Ve.bottom,0>Ye&&(Ye=0),0>$e&&($e=0),We={top:Bh?0:af-bf,right:0/0,bottom:0,left:Bh?_e-cf:0},n(),Bh&&vd(De.data.targets)&&(We.left=Xe/2+ef)}function n(){ef=Ze/2,df=.95*ef,ff=ud(De.data.targets)?.6*df:0}function o(){var a=eg?Ie.axisX:Ie.axisY,b=Ce.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Ce.select(Je).node().getBoundingClientRect(),e=c.right-d.left-r();return e>0?e:0}function p(){return Ke?Ke:v()}function q(){var a=Le?Le:w();return a>0?a:320}function r(){return vd(De.data.targets)?0:Me?Me:eg||!pg||ug?1:t("y")}function s(){var a=1;return vd(De.data.targets)?0:Ne?Ne:Bh?cf+(yg&&!eg?t("y2"):a):yg?Dg||eg?a:t("y2"):a}function t(a){var b=db(a);return b.isInner?20+wb(a):40+wb(a)}function u(a){return"y"!==a||pg?"y2"!==a||yg?(db(a).isInner?30:40)+("y2"===a?-10:0):Hh:ag&&!Bh?10:1}function v(){return+Ce.select(Je).style("width").replace("px","")}function w(){return+Ce.select(Je).style("height").replace("px","")}function x(a){return a?-5:-(Ue.left-1)}function y(a){return a?-20:-1}function z(){return x(!eg)}function A(){return y(!eg)}function B(){return x(eg)}function C(){return y(eg)}function D(a){return a?Xe+2+4:Ue.left+20}function E(a){return a?80:Ze+2}function F(){return D(!eg)}function G(){return E(!eg)}function H(){return D(eg)}function I(){return E(eg)}function J(){var a=eg?Ze:Xe,b=mc(),c=Rb()*(rd(De.data.targets)?(b-(ph?.25:1))/b:.98);return b>1?a*c/(b-1):a}function K(a){Ch=a}function L(a){Dh=a}function M(a){Eh=a}function N(){return ag?Bh?Dh*(Ch+1):_e:0}function O(){return ag?Bh?af:Eh*(Ch+1):0}function P(){var a,b,c=!tf;lf=eg?1:0,mf=eg?Ze:Xe,nf=eg?0:Ze,of=eg?Xe:1,pf=lf,qf=mf,rf=eg?0:$e,sf=eg?Ye:1,tf=R(lf,mf,c?void 0:tf.domain(),function(){return zf.tickOffset()}),uf=S(nf,of),vf=S(nf,of),wf=R(lf,mf,Uh,function(a){return a%1?0:Cf.tickOffset()}),xf=S(rf,sf),yf=S(rf,sf),a=Y(),b=Z(),zf=V(tf,wh,a,b),Cf=V(wf,zh,a,b),Af=W(uf,xh,vg,xg),Bf=W(vf,yh,Eg,Gg),c||(Ih.scale(wf),Oe&&Mh.scale(tf)),Q()}function Q(){gf=zb(),hf=Ab(),jf=Ab(.98)}function R(a,b,e,f){var g=(oh?Ce.time.scale():Ce.scale.linear()).range([a,b]);if(g.orgDomain=function(){return g.domain()},d(e)&&g.domain(e),c(f)&&(f=function(){return 0}),ph){var h,i=g;g=function(a){return i(a)+f(a)};for(h in i)g[h]=i[h];g.orgDomain=function(){return i.domain()},g.domain=function(a){return arguments.length?(i.domain(a),g):(a=i.domain(),[a[0],a[1]+1])}}return g}function S(a,b){return Ce.scale.linear().range([a,b])}function T(a){return"y2"===X(a)?vf:uf}function U(a){return"y2"===X(a)?yf:xf}function V(a,b,c,d){var e=(ph?xb():Ce.svg.axis()).scale(a).orient(b);return e.tickFormat(c).ticks(d),ph?e.tickCentered(hg):e.tickOffset=function(){var a=eg?Ze:Xe;return a*Rb()/mc()/2},ph&&e.categories(gg),e}function W(a,b,c,d){return Ce.svg.axis().scale(a).orient(b).tickFormat(c).ticks(d).outerTickSize(0)}function X(a){re
11 years ago
}function me(a){var c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H=kd(),I=vd(De.data.targets);if(a=d(a)?a:{},t=d(a.withY)?a.withY:!0,u=d(a.withSubchart)?a.withSubchart:!0,v=d(a.withTransition)?a.withTransition:!0,w=d(a.withTransform)?a.withTransform:!1,x=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,y=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,z=d(a.withLegend)?a.withLegend:!1,E=v?Te:0,F=d(a.durationForExit)?a.durationForExit:E,G=d(a.durationForAxis)?a.durationForAxis:E,z&&ag&&ye(De.data.targets,a),y&&(tf.domain(Ce.extent(Vb(De.data.targets))),Uh=tf.domain(),Oe&&Mh.scale(tf).updateScaleExtent(),wf.domain(tf.domain()),Ih.scale(wf)),x&&(tf.domain(Ih.empty()?Uh:Ih.extent()),Oe&&Mh.scale(tf).updateScaleExtent()),uf.domain(Qb("y")),vf.domain(Qb("y2")),Ph.select("."+Ie.axisX).style("opacity",I?0:1).transition().duration(G).call(zf),Ph.select("."+Ie.axisY).style("opacity",I?0:1).transition().duration(G).call(Af),Ph.select("."+Ie.axisY2).style("opacity",I?0:1).transition().duration(G).call(Bf),A=_d(H),C=ae(H,!0),D=ae(H,!1),Ph.select("."+Ie.axisX+" ."+Ie.axisXLabel).attr("x",kb),Ph.select("."+Ie.axisY+" ."+Ie.axisYLabel).attr("x",lb).attr("dy",rb),Ph.select("."+Ie.axisY2+" ."+Ie.axisY2Label).attr("x",mb).attr("dy",sb),xf.domain(uf.domain()),yf.domain(vf.domain()),Sh.style("display","none"),Ph.select("line."+Ie.xgridFocus).style("visibility","hidden"),Hg){if("year"===Ig){e=[];for(var K=Vb(),L=K[0].getFullYear(),M=K[1].getFullYear(),N=L;M>=N;N++)e.push(new Date(N+"-01-01 00:00:00"))}else e=tf.ticks(10);c=Ph.select("."+Ie.xgrids).selectAll("."+Ie.xgrid).data(e),c.enter().append("line").attr("class",Ie.xgrid),c.attr("x1",eg?0:function(a){return tf(a)-zf.tickOffset()}).attr("x2",eg?Xe:function(a){return tf(a)-zf.tickOffset()}).attr("y1",eg?function(a){return tf(a)-zf.tickOffset()}:Ue.top).attr("y2",eg?function(a){return tf(a)-zf.tickOffset()}:Ze).style("opacity",function(){return+Ce.select(this).attr(eg?"y1":"x1")===(eg?Ze:0)?0:1}),c.exit().remove()}Ld(Jg)&&(f=Ph.select("."+Ie.xgridLines).selectAll("."+Ie.xgridLine).data(Jg),g=f.enter().append("g").attr("class",function(a){return Ie.xgridLine+(a.class?a.class:"")}),g.append("line").style("opacity",0),g.append("text").attr("text-anchor","end").attr("transform",eg?"":"rotate(-90)").attr("dx",eg?0:-Ue.top).attr("dy",-5).style("opacity",0),f.select("line").transition().duration(E).attr("x1",eg?0:Tc).attr("x2",eg?Xe:Tc).attr("y1",eg?Tc:Ue.top).attr("y2",eg?Tc:Ze).style("opacity",1),f.select("text").transition().duration(E).attr("x",eg?Xe:0).attr("y",Tc).text(function(a){return a.text}).style("opacity",1),f.exit().transition().duration(E).style("opacity",0).remove()),t&&Kg&&(h=Ph.select("."+Ie.ygrids).selectAll("."+Ie.ygrid).data(uf.ticks(Mg)),h.enter().append("line").attr("class",Ie.ygrid),h.attr("x1",eg?uf:0).attr("x2",eg?uf:Xe).attr("y1",eg?0:uf).attr("y2",eg?Ze:uf),h.exit().remove()),t&&Ld(Lg)&&(i=Ph.select("."+Ie.ygridLines).selectAll("."+Ie.ygridLine).data(Lg),j=i.enter().append("g").attr("class",function(a){return Ie.ygridLine+(a.class?a.class:"")}),j.append("line").style("opacity",0),j.append("text").attr("text-anchor","end").attr("transform",eg?"rotate(-90)":"").attr("dx",eg?0:-Ue.top).attr("dy",-5).style("opacity",0),i.select("line").transition().duration(E).attr("x1",eg?Uc:0).attr("x2",eg?Uc:Xe).attr("y1",eg?0:Uc).attr("y2",eg?Ze:Uc).style("opacity",1),i.select("text").transition().duration(E).attr("x",eg?0:Xe).attr("y",Uc).text(function(a){return a.text}).style("opacity",1),i.exit().transition().duration(E).style("opacity",0).remove()),l=Ph.selectAll("."+Ie.bars).selectAll("."+Ie.bar).data(Dd),l.enter().append("path").attr("d",A).style("stroke","none").style("opacity",0).style("fill",function(a){return uh(a.id)}).attr("class",Ec),l.style("opacity",Mc).transition().duration(E).attr("d",A).style("opacity",1),l.exit().transition().duration(F).style("opacity",0).remove(),n=Ph.selectAll("."+Ie.texts).selectAll("."+Ie.text).data(Fd),n.enter().append("text").attr("class",xc).attr("text-anchor",function(a){return eg?a.value<0?"end":"start":"middle"}).style("stro