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
81 KiB

(function(e){"use strict";function r(e){return e||e===0}function i(e){return typeof e==="undefined"}function s(e){return typeof e!=="undefined"}function o(e,t){function d(e,t){e.attr("transform",function(e){return"translate("+Math.ceil(t(e)+l)+", 0)"})}function v(e,t){e.attr("transform",function(e){return"translate(0,"+Math.ceil(t(e))+")"})}function m(e){var t=e[0],n=e[e.length-1];return t<n?[t,n]:[n,t]}function g(e){var t,n,r=[];if(e.ticks&&f!=undefined){return e.ticks.apply(e,f)}n=e.domain();for(t=Math.ceil(n[0]);t<n[1];t++){r.push(t)}if(r.length>0&&r[0]>0){r.unshift(r[0]-(r[1]-r[0]))}return r}function y(){var e=n.copy(),r;if(t){r=n.domain();e.domain([r[0],r[1]-1])}return e}function b(e){var n=t&&e<h.length?h[e]:e;return a?a(n):n}function w(a){a.each(function(){function P(e){var t=n(e)+l;return C[0]<t&&t<C[1]?i:0}var a=e.select(this);var f=this.__chart__||n,c=this.__chart__=y();var h=u?u:g(c),w=a.selectAll(".tick").data(h,c),E=w.enter().insert("g",".domain").attr("class","tick").style("opacity",1e-6),S=e.transition(w.exit()).style("opacity",1e-6).remove(),x=e.transition(w).style("opacity",1),T,N;var C=n.rangeExtent?n.rangeExtent():m(n.range()),k=a.selectAll(".domain").data([0]),L=(k.enter().append("path").attr("class","domain"),e.transition(k));E.append("line");E.append("text");var A=E.select("line"),O=x.select("line"),M=w.select("text").text(b),_=E.select("text"),D=x.select("text");if(t){l=Math.ceil((c(1)-c(0))/2);N=p?0:l}else{l=N=0}switch(r){case"bottom":{T=d;A.attr("y2",i);_.attr("y",Math.max(i,0)+o);O.attr("x1",N).attr("x2",N).attr("y2",P);D.attr("x",0).attr("y",Math.max(i,0)+o);M.attr("dy",".71em").style("text-anchor","middle");L.attr("d","M"+C[0]+","+s+"V0H"+C[1]+"V"+s);break};case"top":{T=d;A.attr("y2",-i);_.attr("y",-(Math.max(i,0)+o));O.attr("x2",0).attr("y2",-i);D.attr("x",0).attr("y",-(Math.max(i,0)+o));M.attr("dy","0em").style("text-anchor","middle");L.attr("d","M"+C[0]+","+ -s+"V0H"+C[1]+"V"+ -s);break};case"left":{T=v;A.attr("x2",-i);_.attr("x",-(Math.max(i,0)+o));O.attr("x2",-i).attr("y2",0);D.attr("x",-(Math.max(i,0)+o)).attr("y",l);M.attr("dy",".32em").style("text-anchor","end");L.attr("d","M"+ -s+","+C[0]+"H0V"+C[1]+"H"+ -s);break};case"right":{T=v;A.attr("x2",i);_.attr("x",Math.max(i,0)+o);O.attr("x2",i).attr("y2",0);D.attr("x",Math.max(i,0)+o).attr("y",0);M.attr("dy",".32em").style("text-anchor","start");L.attr("d","M"+s+","+C[0]+"H0V"+C[1]+"H"+s);break}}if(c.rangeBand){var H=c,B=H.rangeBand()/2;f=c=function(e){return H(e)+B}}else if(f.rangeBand){f=c}else{S.call(T,c)}E.call(T,f);x.call(T,c)})}var n=e.scale.linear(),r="bottom",i=6,s=6,o=3,u=null,a,f;var l=0,c=true;var h=[],p;w.scale=function(e){if(!arguments.length){return n}n=e;return w};w.orient=function(e){if(!arguments.length){return r}r=e in{top:1,right:1,bottom:1,left:1}?e+"":"bottom";return w};w.tickFormat=function(e){if(!arguments.length){return a}a=e;return w};w.tickCentered=function(e){if(!arguments.length){return p}p=e;return w};w.tickOffset=function(){return l};w.ticks=function(){if(!arguments.length){return f}f=arguments;return w};w.tickCulling=function(e){if(!arguments.length){return c}c=e;return w};w.tickValues=function(e){if(!arguments.length){return u}u=e;return w};w.categories=function(e){if(!arguments.length){return h}h=e;return w};return w}var t={version:"0.1.42"};var n={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",gaugeArc:"c3-gauge-arc",gaugeArcs:"c3-gauge-arcs",gaugeArcsTitle:"c3-gauge-arcs-title",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",li