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
61 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={version:"0.1.26"},f={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",selectedCircle:"c3-selected-circle",selectedCircles:"c3-selected-circles",eventRect:"c3-event-rect",eventRects:"c3-event-rects",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",bar:"c3-bar",bars:"c3-bars",circle:"c3-circle",circles:"c3-circles",arc:"c3-arc",area:"c3-area",text:"c3-text",texts:"c3-texts",grid:"c3-grid",xgrid:"c3-xgrid",xgrids:"c3-xgrids",xgridLine:"c3-xgrid-line",xgridLines:"c3-xgrid-lines",xgridFocus:"c3-xgrid-focus",ygrid:"c3-ygrid",ygrids:"c3-ygrids",ygridLine:"c3-ygrid-line",ygridLines:"c3-ygrid-lines",axisX:"c3-axis-x",axisXLabel:"c3-axis-x-label",axisY:"c3-axis-y",axisYLabel:"c3-axis-y-label",axisY2:"c3-axis-y2",axisY2Label:"c3-axis-y2-label",legendItem:"c3-legend-item",legendItemEvent:"c3-legend-item-event",legendItemTile:"c3-legend-item-tile",dragarea:"c3-dragarea",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_"};e.generate=function(e){function g(a,b){if(!(a in e))throw Error(b)}function h(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&&null!==f)return b;g=f}return g}function i(a){return"url("+document.URL.split("#")[0]+"#"+a+")"}function j(){ji.attr("transform",Wh.main),ji.select("."+f.axisX).attr("transform",Wh.x),ji.select("."+f.axisY).attr("transform",Wh.y),ji.select("."+f.axisY2).attr("transform",Wh.y2),ji.select("."+f.chartArcs).attr("transform",Wh.arc)}function k(){lg&&(ki.attr("transform",Wh.context),ki.select("."+f.axisX).attr("transform",Wh.subx))}function l(a){var b=a!==!1?250:0;og&&li.transition().duration(b).attr("transform",Wh.legend)}function m(a){j(a),k(a),l(a)}function n(){mf=q(),nf=r(),of=P(),pf=O(),ef={top:sg?v("y2"):bi,right:t(),bottom:v(sg?"y":"x")+(sg?0:mg)+(Xh?0:of),left:(sg?mg+ai:0)+s()},hf=mf-ef.left-ef.right,kf=nf-ef.top-ef.bottom,0>hf&&(hf=0),0>kf&&(kf=0),ff={top:sg?ef.top:nf-mg-(Xh?0:of),right:0/0,bottom:20+(Xh?0:of),left:sg?_h:ef.left},jf=sg?ef.left-_h-ai:hf,lf=sg?kf:nf-ff.top-ff.bottom,0>jf&&(jf=0),0>lf&&(lf=0),gf={top:Xh?0:nf-of,right:0/0,bottom:0,left:Xh?mf-pf:0},o(),Xh&&Id(Te.data.targets)&&(gf.left=hf/2+rf)}function o(){rf=kf/2,qf=.95*rf,sf=Hd(Te.data.targets)?.6*qf:0}function p(){var a=sg?f.axisX:f.axisY,b=Se.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Se.select(Ve).node().getBoundingClientRect(),e=c.right-d.left-s();return e>0?e:0}function q(){return We?We:w()}function r(){var a=Xe?Xe:x();return a>0?a:320}function s(){return Id(Te.data.targets)?0:Ye?Ye:sg||!Fg||Kg?1:u("y")}function t(){var a=1;return Id(Te.data.targets)?0:Ze?Ze:Xh?pf+(Og&&!sg?u("y2"):a):Og?Tg||sg?a:u("y2"):a}function u(a){var b=fb(a);return b.isInner?20+yb(a):40+yb(a)}function v(a){return"y"!==a||Fg?"y2"!==a||Og?(fb(a).isInner?30:40)+("y2"===a?-10:0):bi:og&&!Xh?10:1}function w(){return+Se.select(Ve).style("width").replace("px","")}function x(){return+Se.select(Ve).style("height").replace("px","")}function y(a){return a?-5:-(ef.left-1)}function z(a){return a?-20:-1}function A(){return y(!sg)}function B(){return z(!sg)}function C(){return y(sg)}function D(){return z(sg)}function E(a){return a?hf+2+4:ef.left+20}function F(a){return a?80:kf+2}function G(){return E(!sg)}function H(){return F(!sg)}function I(){return E(sg)}function J(){return F(sg)}function K(){var a=sg?kf:hf,b=sc(),c=Ub()*(Ed(Te.data.targets)?(b-(Jh?.25:1))/b:.98);return b>1?a*c/(b-1):a}function L(a){Yh=a}function M(a){Zh=a}function N(a){$h=a}function O(){return og?Xh?Zh
})}}).on("mouseout",function(a,b){Id(Te.data.targets)||(ud(),sd(),je(b),me(),ji.selectAll("."+f.shape+"-"+b).each(function(a){gg(a)}))}).on("mousemove",function(a,b){var c;Mh||Id(Te.data.targets)||(c=yc(Te.data.targets).map(function(a){return ic(a.values[b])}),rd(c,Se.mouse(this)),td(c),ag&&(bg||ji.selectAll("."+f.shape+"-"+b).filter(function(a){return cg(a)}).each(function(){var a=Se.select(this).classed(f.EXPANDED,!0);"circle"===this.nodeName&&a.attr("r",fh),hi.select("."+f.eventRect+"-"+b).style("cursor",null)}).filter(function(){return"circle"===this.nodeName?Vd(this,gh):"path"===this.nodeName?Wd(this):void 0}).each(function(){var a=Se.select(this);a.classed(f.EXPANDED)||(a.classed(f.EXPANDED,!0),"circle"===this.nodeName&&a.attr("r",gh)),hi.select("."+f.eventRect+"-"+b).style("cursor","pointer")})))}).on("click",function(a,b){return Id(Te.data.targets)?void 0:Nh?void(Nh=!1):void ji.selectAll("."+f.shape+"-"+b).each(function(a){we(this,a,b)})}).call(Se.behavior.drag().origin(Object).on("drag",function(){xe(Se.mouse(this))}).on("dragstart",function(){ye(Se.mouse(this))}).on("dragend",function(){ze()})).call(gi).on("dblclick.zoom",null)}function ve(a){a.append("rect").attr("x",0).attr("y",0).attr("width",hf).attr("height",kf).attr("class",f.eventRect).on("mouseout",function(){Id(Te.data.targets)||(ud(),sd(),je())}).on("mousemove",function(){var a,b,c;Mh||Id(Te.data.targets)||(a=Se.mouse(this),b=ld(Te.data.targets,a),c=[ic(b)],rd(c,a),eh&&(je(),ie(b.index,b.id)),td(c),$d(b,a)<100?(hi.select("."+f.eventRect).style("cursor","pointer"),Oh||(fg(b),Oh=!0)):(hi.select("."+f.eventRect).style("cursor",null),gg(b),Oh=!1))}).on("click",function(){var a,b;Id(Te.data.targets)||(a=Se.mouse(this),b=ld(Te.data.targets,a),$d(b,a)<100&&ji.select("."+f.circles+"-"+Wc(b.id)).select("."+f.circle+"-"+b.index).each(function(){we(this,b,b.index)}))}).call(Se.behavior.drag().origin(Object).on("drag",function(){xe(Se.mouse(this))}).on("dragstart",function(){ye(Se.mouse(this))}).on("dragend",function(){ze()})).call(gi).on("dblclick.zoom",null)}function we(a,b,c){var d,e=Se.select(a),g=e.classed(f.SELECTED),h=!1;"circle"===a.nodeName?(h=Vd(a,1.5*gh),d=ce):"path"===a.nodeName&&(h=Wd(a),d=fe),(bg||h)&&(ag&&cg(b)&&(dg||ji.selectAll("."+f.shapes+(bg?Wc(b.id):"")).selectAll("."+f.shape).each(function(a,b){var c=Se.select(this);c.classed(f.SELECTED)&&d(!1,c.classed(f.SELECTED,!1),a,b)}),e.classed(f.SELECTED,!g),d(!g,e,b,c)),eg(b,a))}function xe(a){var b,c,d,e,g,h,i,j;Id(Te.data.targets)||ag&&(!$e||gi.altDomain)&&dg&&(b=Lh[0],c=Lh[1],d=a[0],e=a[1],g=Math.min(b,d),h=Math.max(b,d),i=bg?ef.top:Math.min(c,e),j=bg?kf:Math.max(c,e),ji.select("."+f.dragarea).attr("x",g).attr("y",i).attr("width",h-g).attr("height",j-i),ji.selectAll("."+f.shapes).selectAll("."+f.shape).filter(function(a){return cg(a)}).each(function(a,b){var c,d,e,k,l,m,n=Se.select(this),o=n.classed(f.SELECTED),p=n.classed(f.INCLUDED),q=!1;"circle"===this.nodeName?(c=1*n.attr("cx"),d=1*n.attr("cy"),l=ce,q=c>g&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=nd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=fe,q=!(c>h||g>c+e||d>j||i>d+k)),q^p&&(n.classed(f.INCLUDED,!p),n.classed(f.SELECTED,!o),l(!o,n,a,b))}))}function ye(a){Id(Te.data.targets)||ag&&(Lh=a,ji.select("."+f.chart).append("rect").attr("class",f.dragarea).style("opacity",.1),Mh=!0,jg())}function ze(){Id(Te.data.targets)||ag&&(ji.select("."+f.dragarea).transition().duration(100).style("opacity",0).remove(),ji.selectAll("."+f.shape).classed(f.INCLUDED,!1),Mh=!1,kg())}function Ae(a){var c,e,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,I,J,L,M=xd(),N=Id(Te.data.targets),O=yc(Te.data.targets);if(0!==O.length){if(a=d(a)?a:{},u=d(a.withY)?a.withY:!0,v=d(a.withSubchart)?a.withSubchart:!0,w=d(a.withTransition)?a.withTransition:!0,x=d(a.withTransform)?a.withTransform:!1,y=d(a.withUpdateXDomain)?a.withUpdateXDomain:!1,z=d(a.withUpdateOrgXDomain)?a.withUpdateOrgXDomain:!1,A=d(a.withLegend)?a.withLegend:!1,F=w?df:0,G=d(a.durationForExit)?a.durationForExit:F,H=d(a.durationForAxis)?a.durationForAxis:F,A&&og&&Oe(Te.data.targets,a),z&&(Ff.domain(Se.exte