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.

3 lines
77 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}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b<c[1];b++)d.push(b);return d.length>0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){return j?j(a):a}function i(i){i.each(function(){function i(a){var b=m(a)+s;return B[0]<b&&b<B[1]?o:0}var j,k,t=a.select(this),u=this.__chart__||m,v=this.__chart__=g(),w=r?r:f(v),x=t.selectAll(".tick").data(w,v),y=x.enter().insert("g",".domain").attr("class","tick").style("opacity",1e-6),z=a.transition(x.exit()).style("opacity",1e-6).remove(),A=a.transition(x).style("opacity",1),B=m.rangeExtent?m.rangeExtent():e(m.range()),C=t.selectAll(".domain").data([0]),D=(C.enter().append("path").attr("class","domain"),a.transition(C));y.append("line"),y.append("text");var E=y.select("line"),F=A.select("line"),G=x.select("text").text(h),H=y.select("text"),I=A.select("text");switch(b?(s=Math.ceil((v(1)-v(0))/2),k=l?0:s):s=k=0,n){case"bottom":j=c,E.attr("y2",o),H.attr("y",Math.max(o,0)+q),F.attr("x1",k).attr("x2",k).attr("y2",i),I.attr("x",0).attr("y",Math.max(o,0)+q),G.attr("dy",".71em").style("text-anchor","middle"),D.attr("d","M"+B[0]+","+p+"V0H"+B[1]+"V"+p);break;case"top":j=c,E.attr("y2",-o),H.attr("y",-(Math.max(o,0)+q)),F.attr("x2",0).attr("y2",-o),I.attr("x",0).attr("y",-(Math.max(o,0)+q)),G.attr("dy","0em").style("text-anchor","middle"),D.attr("d","M"+B[0]+","+-p+"V0H"+B[1]+"V"+-p);break;case"left":j=d,E.attr("x2",-o),H.attr("x",-(Math.max(o,0)+q)),F.attr("x2",-o).attr("y2",0),I.attr("x",-(Math.max(o,0)+q)).attr("y",s),G.attr("dy",".32em").style("text-anchor","end"),D.attr("d","M"+-p+","+B[0]+"H0V"+B[1]+"H"+-p);break;case"right":j=d,E.attr("x2",o),H.attr("x",Math.max(o,0)+q),F.attr("x2",o).attr("y2",0),I.attr("x",Math.max(o,0)+q).attr("y",0),G.attr("dy",".32em").style("text-anchor","start"),D.attr("d","M"+p+","+B[0]+"H0V"+B[1]+"H"+p)}if(v.rangeBand){var J=v,K=J.rangeBand()/2;u=v=function(a){return J(a)+K}}else u.rangeBand?u=v:z.call(j,v);y.call(j,u),A.call(j,v)})}var j,k,l,m=a.scale.linear(),n="bottom",o=6,p=6,q=3,r=null,s=0,t=!0;return i.scale=function(a){return arguments.length?(m=a,i):m},i.orient=function(a){return arguments.length?(n=a in{top:1,right:1,bottom:1,left:1}?a+"":"bottom",i):n},i.tickFormat=function(a){return arguments.length?(j=a,i):j},i.tickCentered=function(a){return arguments.length?(l=a,i):l},i.tickOffset=function(){return s},i.ticks=function(){return arguments.length?(k=arguments,i):k},i.tickCulling=function(a){return arguments.length?(t=a,i):t},i.tickValues=function(a){return arguments.length?(r=a,i):r},i}var f={version:"0.1.42"},g={target:"c3-target",chart:"c3-chart",chartLine:"c3-chart-line",chartLines:"c3-chart-lines",chartBar:"c3-chart-bar",chartBars:"c3-chart-bars",chartText:"c3-chart-text",chartTexts:"c3-chart-texts",chartArc:"c3-chart-arc",chartArcs:"c3-chart-arcs",chartArcsTitle:"c3-chart-arcs-title",chartArcsBackground:"c3-chart-arcs-background",chartArcsGaugeUnit:"c3-chart-arcs-gauge-unit",chartArcsGaugeMax:"c3-chart-arcs-gauge-max",chartArcsGaugeMin:"c3-chart-arcs-gauge-min",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",eventRectsSingle:"c3-event-rects-single",eventRectsMultiple:"c3-event-rects-multiple",zoomRect:"c3-zoom-rect",brush:"c3-brush",focused:"c3-focused",region:"c3-region",regions:"c3-regions",tooltip:"c3-tooltip",tooltipName:"c3-tooltip-name",shape:"c3-shape",shapes:"c3-shapes",line:"c3-line",lines:"c3-lines",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",arcs:"c3-arcs",area:"c3-area",areas:"c3-areas",text
11 years ago
}).attr("cx",Qh?je:ie).attr("cy",Qh?ie:je).attr("stroke",function(){return Fj(b)}).attr("r",1.4*jf(b)).transition().duration(100).attr("r",jf)}function $e(a,b,c){Dh(b,a.node()),bk.select("."+g.selectedCircles+xd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function _e(a,b,c,d){a?Ze(b,c,d):$e(b,c,d)}function af(a,b){Ch(b,a.node()),a.transition().duration(100).style("fill",function(){return dg.rgb(Fj(b)).brighter(.75)})}function bf(a,b){Dh(b,a.node()),a.transition().duration(100).style("fill",function(){return Fj(b)})}function cf(a,b,c,d){a?af(b,c,d):bf(b,c,d)}function df(a,b,c,d){cf(a,b,c.data,d)}function ef(a){return"circle"===a.nodeName?_e:dg.select(a).classed(g.bar)?cf:df}function ff(a){return a.filter(function(a){return b(a.value)})}function gf(a){return Fi&&!ue(a)?"function"==typeof Gi?Gi(a):Gi:0}function hf(a){return Ii?Ji?Ji:1.75*gf(a):gf(a)}function jf(a){return Ki?Ki:4*gf(a)}function kf(a,c){return(c?bk.selectAll("."+g.circles+xd(c)):bk).selectAll("."+g.circle+(b(a)?"-"+a:""))}function lf(a,b){kf(a,b).classed(g.EXPANDED,!0).attr("r",hf)}function mf(a){kf(a).filter(function(){return dg.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",gf)}function nf(a){return bk.selectAll("."+g.bar+(b(a)?"-"+a:""))}function of(a){nf(a).classed(g.EXPANDED,!0)}function pf(a){nf(a).classed(g.EXPANDED,!1)}function qf(a,b){var c=dg.svg.area(),d=wf(a,b),e=b?ab:_,f=function(a,b){return kh.length>0?d(a,b)[0][1]:e(a.id)(0)},g=function(a,b){return kh.length>0?d(a,b)[1][1]:e(a.id)(a.value)};return c=Qh?c.x0(f).x1(g).y(Od):c.x(Od).y0(f).y1(g),function(a){var b,d,e=ff(a.values);return we(a)?c.interpolate(Ye(a))(e):(b=Wg(e[0].x),d=_(a.id)(e[0].value),Qh?"M "+d+" "+b:"M "+b+" "+d)}}function rf(a,b){var c=dg.svg.line(),d=yf(a,b),e=b?ab:_,f=b?Rd:Od,g=function(a,b){return kh.length>0?d(a,b)[0][1]:e(a.id)(a.value)};return c=Qh?c.x(g).y(f):c.x(f).y(g),Li||(c=c.defined(function(a){return null!=a.value})),function(a){var d=Li?ff(a.values):a.values,f=b?f:Zg,g=e(a.id),h=0,i=0;return te(a)?qh[a.id]?zf(d,f,g,qh[a.id]):c.interpolate(Ye(a))(d):(d[0]&&(h=f(d[0].x),i=g(d[0].value)),Qh?"M "+i+" "+h:"M "+h+" "+i)}}function sf(a,b){var c=xf(a,b);return function(a,b){var d=c(a,b),e=Qh?1:0,f=Qh?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function tf(a,b){var c=xf(a,!1),d=b?uf:vf;return function(a,b){return d(c(a,b),a,this)}}function uf(a,b){var c;return Qh?(c=xe(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function vf(a,b,c){var d=c.getBoundingClientRect();return Qh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:xe(b)?-3:-6)}function wf(a,b){var c=a.__max__+1,d=fe(0,c,a,!!b),e=ge(!!b),f=he(we,a,!!b),g=b?ab:_;return function(a,b){var c=g(a.id)(0),h=f(a,b)||c,i=d(a),j=e(a);return Qh&&(0<a.value&&c>j||a.value<0&&j>c)&&(j=c),[[i,h],[i,j-(c-h)]]}}function xf(a,b){var c=a.__max__+1,d=ke(ah,c),e=fe(d,c,a,!!b),f=ge(!!b),g=he(xe,a,!!b),h=b?ab:_;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return Qh&&(0<a.value&&c>k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function yf(a,b){var c=a.__max__+1,d=fe(0,c,a,!!b),e=ge(!!b),f=he(te,a,!!b),g=b?ab:_;return function(a,b){var c=g(a.id)(0),h=f(a,b)||c,i=d(a),j=e(a);return Qh&&(0<a.value&&c>j||a.value<0&&j>c)&&(j=c),[[i,j-(c-h)]]}}function zf(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g<f.length;g++)u[g]={},u[g].start=c(f[g].start)?a[0].x:wj?Le(f[g].start):f[g].start,u[g].end=c(f[g].end)?a[a.length-1].x:wj?Le(f[g].end):f[g].end;for(q=Qh?function(a){return e(a.value)}:function(a){return b(a.x)},r=Qh?function(a){return b(a.x)}:function(a){return e(a.value)},i=wj?function(a,c,d,f){var g=a.x.getTime(),h=c.x-a.x,i=new Date(g+h*d),j=new Date(g+h*(d+f));return"M"+b(i)+" "+e(k(d))+" "+b(j)+" "+e(k(d+f))}:function(a,c,d,f){return"M"+b(j(d),!0)+" "+e(k(d))+" "+b(j(d+f),!0)+" "+e(k(d+f))},g=0;g<a.length;g++){if(c(u)||!Oe(a[g].x,u))t+=" "+q(a[g])+" "+r(a[g]);else for(j=Y(a[g-1].x,a[g].x,wj),k=Y(a[g-1].value,a
}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=dk.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",Fj).attr("x",f).attr("y",j),dk.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Pc(a)}).transition().style("opacity",function(a){var b=dg.select(this);return Pc(a)?!G||b.classed(g.legendItemFocused)?Uf(b):Vf(b):Vj}),S(w),T(x),R(F),p(),W(),Nf(),o(q,c)}function _f(a){return Oc(eg.data.targets,a.id)}function ag(a){return"data"in a&&Oc(eg.data.targets,a.data.id)}function bg(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function cg(a,b,c){var d=!se(eg.data.targets);Dj=!1,le(a,b),Pf(c||{withTransitionForAxis:d})}var dg=a.d3?a.d3:"undefined"!=typeof require?require("d3"):void 0,eg={data:{},axis:{},legend:{}},fg={},gg=i(["bindto"],"#chart"),hg=i(["size","width"]),ig=i(["size","height"]),jg=i(["padding","left"]),kg=i(["padding","right"]),lg=i(["padding","top"]),mg=i(["padding","bottom"]),ng=i(["zoom","enabled"],!1),og=i(["zoom","extent"]),pg=i(["zoom","privileged"],!1),qg=i(["interaction","enabled"],!0),rg=i(["onenter"],function(){}),sg=i(["onleave"],function(){}),tg=i(["onresize"],function(){}),ug=i(["onresized"],function(){}),vg=i(["transition","duration"],350);h("data","data is required in config");var wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg,Lg,Mg,Ng,Og,Pg,Qg,Rg,Sg,Tg,Ug,Vg,Wg,Xg,Yg,Zg,$g,_g,ah,bh,ch,dh,eh=i(["data","x"]),fh=i(["data","xs"],{}),gh=i(["data","x_format"]),hh=i(["data","id_converter"],function(a){return a}),ih=i(["data","names"],{}),jh=i(["data","classes"],{}),kh=i(["data","groups"],[]),lh=i(["data","axes"],{}),mh=i(["data","type"]),nh=i(["data","types"],{}),oh=i(["data","labels"],{}),ph=i(["data","order"]),qh=i(["data","regions"],{}),rh=i(["data","color"]),sh=i(["data","colors"],{}),th=i(["data","hide"],!1),uh=i(["data","filter"]),vh=i(["data","selection","enabled"],!1),wh=i(["data","selection","grouped"],!1),xh=i(["data","selection","isselectable"],function(){return!0}),yh=i(["data","selection","multiple"],!0),zh=i(["data","onclick"],function(){}),Ah=i(["data","onenter"],function(){}),Bh=i(["data","onleave"],function(){}),Ch=i(["data","onselected"],function(){}),Dh=i(["data","onunselected"],function(){}),Eh=i(["data","ondragstart"],function(){}),Fh=i(["data","ondragend"],function(){}),Gh=i(["subchart","show"],!1),Hh=i(["subchart","size","height"],60),Ih=i(["color","pattern"],[]),Jh=i(["color","threshold"],{}),Kh=i(["legend","show"],!0),Lh=i(["legend","position"],"bottom"),Mh=i(["legend","item","onclick"]),Nh=i(["legend","item","onmouseover"]),Oh=i(["legend","item","onmouseout"]),Ph=i(["legend","equally"],!1),Qh=i(["axis","rotated"],!1),Rh=i(["axis","x","show"],!0),Sh=i(["axis","x","type"],"indexed"),Th=i(["axis","x","localtime"],!0),Uh=i(["axis","x","categories"],[]),Vh=i(["axis","x","tick","centered"],!1),Wh=i(["axis","x","tick","format"]),Xh=i(["axis","x","tick","culling"],{}),Yh=i(["axis","x","tick","culling","max"],10),Zh=i(["axis","x","tick","count"]),$h=i(["axis","x","tick","fit"],!0),_h=i(["axis","x","tick","values"],null),ai=i(["axis","x","tick","rotate"]),bi=i(["axis","x","max"],null),ci=i(["axis","x","min"],null),di=i(["axis","x","padding"],{}),ei=i(["axis","x","height"]),fi=i(["axis","x","default"]),gi=i(["axis","x","label"],{}),hi=i(["axis","y","show"],!0),ii=i(["axis","y","max"]),ji=i(["axis","y","min"]),ki=i(["axis","y","center"]),li=i(["axis","y","label"],{}),mi=i(["axis","y","inner"],!1),ni=i(["axis","y","tick","format"]),oi=i(["axis","y","padding"]),pi=i(["axis","y","ticks"],10),qi=i(["axis","y2","show"],!1),ri=i(["axis","y2","max"]),si=i(["axis","y2","min"]),ti=i(["axis","y2","center"]),ui=i(["axis","y2","label"],{}),vi=i(["axis","y2","inner"],!1),wi=i(["axis","y2","tick","format"]),xi=i(["axis","y2","padding"]),yi=i(["axis","y2","ticks"],10),zi=i(["grid","x","show"],!1),Ai=i(["grid","x","type"],"tick"),Bi=i(["grid","x","lines"],[]),Ci=i(["grid","y","show"],!1),Di=i(["grid","y","lines"],[]),Ei=i(["gr