From: Florian Forster Date: Wed, 20 Feb 2013 15:14:18 +0000 (+0100) Subject: Switch from Highcharts to Rickshaw, which is MIT / BSD licensed. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d1c8e07134a95b6d02a27f187f769a207c28d618;p=collection4.git Switch from Highcharts to Rickshaw, which is MIT / BSD licensed. --- diff --git a/README b/README index a88ebdc..640960c 100644 --- a/README +++ b/README @@ -109,12 +109,13 @@ License MIT license and the GPL. The file "share/jquery-1.4.4.min.js" includes a license header which points you to more detailed information. - c4 includes the JavaScript library "Highcharts" which is licensed under the - Creative Commons Attribution-NonCommercial 3.0 License (CC-by-nc 3.0). This - means that the library is free of charge for non-commercial use. The file - "share/highcharts.js" includes a license header which points you to more - detailed information. More information on Highcharts and licensing options is - available from . + c4 includes the JavaScript library "D3.js" which is licensed under the + 3-clause BSD license. More information on D3.js is available from + . + + c4 includes the JavaScript library "Rickshaw" which is licensed under the + MIT license. More information on Rickshaw is available from + . Author diff --git a/share/Makefile.am b/share/Makefile.am index ce08502..1686743 100644 --- a/share/Makefile.am +++ b/share/Makefile.am @@ -3,4 +3,6 @@ dist_sysconf_DATA = collection.conf dist_pkgdata_DATA = style.css \ collection.js \ jquery-1.4.4.min.js \ - highcharts.js + d3.min.js \ + rickshaw.min.css \ + rickshaw.min.js diff --git a/share/collection.js b/share/collection.js index e1764ac..e1a6a22 100644 --- a/share/collection.js +++ b/share/collection.js @@ -274,116 +274,102 @@ function def_draw (def, data_list, series_array) /* {{{ */ } } /* }}} function def_draw */ -function inst_get_chart_opts (inst, def) /* {{{ */ +/* + * Given one metric definition, returns the appropriate data from the data + * list. */ +function def_get_data (def, data_list) { - var chart_opts = new Object (); + var i; - chart_opts.chart = - { - renderTo: inst.container, - zoomType: 'x' - }; - chart_opts.xAxis = - { - type: 'datetime', - maxZoom: 300, // five minutes - title: { text: null }, - events: - { - setExtremes: function (event) - { - var begin = null; - var end = null; - - if ((event.min) && (event.max)) - { - begin = event.min / 1000.0; - end = event.max / 1000.0; - } - inst_fetch_data (inst, begin, end); - } - } - }; - chart_opts.yAxis = + for (i = 0; i < data_list.length; i++) { - labels: - { - formatter: function () { return (value_to_string (this.value)); } - }, - startOnTick: false, - endOnTick: false + if ((def.ds_name) && (def.ds_name != data_list[i].data_source)) + continue; + if (!ident_matches (def.select, data_list[i].file)) + continue; + + return (data_list[i]); + } + return; +} + +function def_to_rickshaw_one (def, data) +{ + var series = { + data: [] }; - chart_opts.legend = - { - labelFormatter: function () - { - var series = this; - var min = Number.MAX_VALUE; - var max = Number.NEGATIVE_INFINITY; - var num = 0; - var sum = 0; - var avg; - var i; + var i; - for (i = 0; i < this.data.length; i++) - { - var v; + if (def.legend) + series.name = def.legend; - v = this.data[i].y; - if (v == null) - continue; + if (def.color) + series.color = def.color; - if (min > v) - min = v; - if (max < v) - max = v; + for (i = 0; i < data.data.length; i++) + { + var x = data.first_value_time + (i * data.interval); + var y = data.data[i]; - sum += v; - num++; - } + series.data.push ({'x': x, 'y': y}); + } - if (num == 0) - { - min = null; - max = null; - avg = null; - } - else - { - avg = sum / num; - } + return (series); +} - return (this.name + " (" + value_to_string (min) + " min, " - + value_to_string (avg) + " avg, " - + value_to_string (max) + " max)"); - } +function def_to_rickshaw (graph_def, data_list) +{ + var graph_config = { + renderer: 'line', + series: [] }; - chart_opts.series = new Array (); + var graph; + var i; - if (def.title) - chart_opts.title = { text: def.title }; + for (i = 0; i < graph_def.defs.length; i++) + { + var def = graph_def.defs[i]; + var data = def_get_data (def, data_list); + var series; - if (def.vertical_label) - chart_opts.yAxis.title = { text: def.vertical_label }; + if (!data) + continue; - return (chart_opts); -} /* }}} function chart_opts_get */ + series = def_to_rickshaw_one (def, data); + if (series) + graph_config.series.push (series); -function inst_draw (inst, def, data_list) /* {{{ */ + //if (def.area) + // graph_config.renderer = 'area'; + } + + return (graph_config); +} + +function inst_draw_rickshaw (inst, def, data_list) { - var chart_opts; - var i; + var graph_config = def_to_rickshaw (def, data_list); - if (!inst || !def || !data_list) - return; + graph_config.element = document.getElementById (inst.container); - chart_opts = inst_get_chart_opts (inst, def); + inst.chart = new Rickshaw.Graph (graph_config); + inst.chart.render (); - for (i = def.defs.length - 1; i >= 0; i--) - def_draw (def.defs[i], data_list, chart_opts.series); + var x_axis = new Rickshaw.Graph.Axis.Time({ + graph: inst.chart + }); + x_axis.render (); + + var y_axis = new Rickshaw.Graph.Axis.Y({ + graph: inst.chart + }); + y_axis.render (); +} - inst.chart = new Highcharts.Chart (chart_opts); -} /* }}} function inst_draw */ +function inst_draw (inst, def, data_list) +{ + inst_draw_rickshaw (inst, def, data_list); +} function inst_redraw (inst, def, data_list) /* {{{ */ { diff --git a/share/d3.min.js b/share/d3.min.js new file mode 100644 index 0000000..9a9af75 --- /dev/null +++ b/share/d3.min.js @@ -0,0 +1,2 @@ +(function(){function e(a){var b=-1,c=a.length,d=[];while(++b=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function w(a,b){return{scale:Math.pow(10,(8-b)*3),symbol:a}}function B(a){return function(b){return b<=0?0:b>=1?1:a(b)}}function C(a){return function(b){return 1-a(1-b)}}function D(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function E(a){return a}function F(a){return function(b){return Math.pow(b,a)}}function G(a){return 1-Math.cos(a*Math.PI/2)}function H(a){return Math.pow(2,10*(a-1))}function I(a){return 1-Math.sqrt(1-a*a)}function J(a,b){var c;return arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a),function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function K(a){return a||(a=1.70158),function(b){return b*b*((a+1)*b-a)}}function L(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function M(){d3.event.stopPropagation(),d3.event.preventDefault()}function O(a){return a=="transform"?d3.interpolateTransform:d3.interpolate}function P(a,b){return b=b-(a=+a)?1/(b-a):0,function(c){return(c-a)*b}}function Q(a,b){return b=b-(a=+a)?1/(b-a):0,function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function R(a,b,c){return new S(a,b,c)}function S(a,b,c){this.r=a,this.g=b,this.b=c}function T(a){return a<16?"0"+Math.max(0,a).toString(16):Math.min(255,a).toString(16)}function U(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(W(h[0]),W(h[1]),W(h[2]))}}return(i=X[a])?b(i.r,i.g,i.b):(a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16)),b(d,e,f))}function V(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;return f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b360?a-=360:a<0&&(a+=360),a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}function g(a){return Math.round(f(a)*255)}var d,e;return a%=360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e,R(g(a+120),g(a),g(a-120))}function ba(a){return h(a,bd),a}function be(a){return function(){return bb(a,this)}}function bf(a){return function(){return bc(a,this)}}function bh(a,b){function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=m(e+" "+a),d?b.baseVal=e:this.className=e)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=m(e.replace(c," ")),d?b.baseVal=e:this.className=e}function h(){(b.apply(this,arguments)?f:g).call(this)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;return c.lastIndex=0,c.test(e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?h:b?f:g)}function bi(a){return{__data__:a}}function bj(a){return arguments.length||(a=d3.ascending),function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function bl(a){return h(a,bm),a}function bn(a,b,c){h(a,br);var d={},e=d3.dispatch("start","end"),f=bu;return a.id=b,a.time=c,a.tween=function(b,c){return arguments.length<2?d[b]:(c==null?delete d[b]:d[b]=c,a)},a.ease=function(b){return arguments.length?(f=typeof b=="function"?b:d3.ease.apply(d3,arguments),a):f},a.each=function(b,c){return arguments.length<2?bv.call(a,b):(e.on(b,c),a)},d3.timer(function(g){return a.each(function(h,i,j){function p(a){if(o.active>b)return r();o.active=b;for(var f in d)(f=d[f].call(l,h,i))&&k.push(f);return e.start.call(l,h,i),q(a)||d3.timer(q,0,c),1}function q(a){if(o.active!==b)return r();var c=(a-m)/n,d=f(c),g=k.length;while(g>0)k[--g].call(l,d);if(c>=1)return r(),bt=b,e.end.call(l,h,i),bt=0,1}function r(){return--o.count||delete l.__transition__,1}var k=[],l=this,m=a[j][i].delay,n=a[j][i].duration,o=l.__transition__||(l.__transition__={active:0,count:0});++o.count,m<=g?p(g):d3.timer(p,m,c)}),1},0,c),a}function bp(a,b,c){return c!=""&&bo}function bq(a,b){function d(a,d,e){var f=b.call(this,a,d);return f==null?e!=""&&bo:e!=f&&c(e,f)}function e(a,d,e){return e!=b&&c(e,b)}var c=O(a);return typeof b=="function"?d:b==null?bp:(b+="",e)}function bv(a){for(var b=0,c=this.length;b=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bA()-b;d>24?(isFinite(d)&&(clearTimeout(by),by=setTimeout(bz,d)),bx=0):(bx=1,bB(bz))}function bA(){var a=null,b=bw,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bw=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bC(a){var b=[a.a,a.b],c=[a.c,a.d],d=bE(b),e=bD(b,c),f=bE(bF(c,b,-e));this.translate=[a.e,a.f],this.rotate=Math.atan2(a.b,a.a)*bH,this.scale=[d,f||0],this.skew=f?e/f*bH:0}function bD(a,b){return a[0]*b[0]+a[1]*b[1]}function bE(a){var b=Math.sqrt(bD(a,a));return a[0]/=b,a[1]/=b,b}function bF(a,b,c){return a[0]+=c*b[0],a[1]+=c*b[1],a}function bI(){}function bJ(a){var b=a[0],c=a[a.length-1];return b0;j--)e.push(c(f)*j)}else{for(;fi;g--);e=e.slice(f,g)}return e},d.tickFormat=function(a,e){arguments.length<2&&(e=bV);if(arguments.length<1)return e;var f=a/d.ticks().length,g=b===bX?(h=-1e-15,Math.floor):(h=1e-15,Math.ceil),h;return function(a){return a/c(g(b(a)+h))1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cK(a){return a.length<3?cq(a):a[0]+cw(a,cJ(a))}function cL(a){var b,c=-1,d=a.length,e,f;while(++c1){var d=bJ(a.domain()),e,f=-1,g=b.length,h=(b[1]-b[0])/++c,i,j;while(++f0;)(j=+b[f]-i*h)>=d[0]&&e.push(j);for(--f,i=0;++ib?1:a>=b?0:NaN},d3.descending=function(a,b){return ba?1:b>=a?0:NaN},d3.mean=function(a,b){var c=a.length,d,e=0,f=-1,g=0;if(arguments.length===1)while(++f1&&(a=a.map(b)),a=a.filter(j),a.length?d3.quantile(a.sort(d3.ascending),.5):undefined},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++cf&&(e=f)}else{while(++cf&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++ce&&(e=f)}else{while(++ce&&(e=f)}return e},d3.extent=function(a,b){var c=-1,d=a.length,e,f,g;if(arguments.length===1){while(++cf&&(e=f),gf&&(e=f),g1);return a+b*c*Math.sqrt(-2*Math.log(e)/e)}}},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f>1;a[e]>1;b0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});return f&&e.sort(function(a,b){return f(a.key,b.key)}),e}var a={},b=[],c=[],d,e;return a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){return b.push(c),a},a.sortKeys=function(d){return c[b.length-1]=d,a},a.sortValues=function(b){return d=b,a},a.rollup=function(b){return e=b,a},a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++db)d.push(f);else while((f=a+c*++e)0&&(d=a.substring(c+1),a=a.substring(0,c)),this[a].on(d,b)},d3.format=function(a){var b=q.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=1,k="",l=!1;h&&(h=+h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=100,k="%",i="f";break;case"p":j=100,k="%",i="r";break;case"d":l=!0,h=0;break;case"s":j=-1,i="r"}return i=="r"&&!h&&(i="g"),i=r[i]||t,function(a){if(l&&a%1)return"";var b=a<0&&(a=-a)?"−":d;if(j<0){var m=d3.formatPrefix(a,h);a*=m.scale,k=m.symbol}else a*=j;a=i(a,h);if(e){var n=a.length+b.length;n=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,r={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){return d3.round(a,b=s(a,b)).toFixed(Math.max(0,Math.min(20,b)))}},v=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(w);d3.formatPrefix=function(a,b){var c=0;return a&&(a<0&&(a*=-1),b&&(a=d3.round(a,s(a,b))),c=1+Math.floor(1e-12+Math.log(a)/Math.LN10),c=Math.max(-24,Math.min(24,Math.floor((c<=0?c+1:c-1)/3)*3))),v[8+c/3]};var x=F(2),y=F(3),z={linear:function(){return E},poly:F,quad:function(){return x},cubic:function(){return y},sin:function(){return G},exp:function(){return H},circle:function(){return I},elastic:J,back:K,bounce:function(){return L}},A={"in":function(a){return a},out:C,"in-out":D,"out-in":function(a){return D(C(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return B(A[d](z[c].apply(null,Array.prototype.slice.call(arguments,1))))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){return b-=a,function(c){return a+b*c}},d3.interpolateRound=function(a,b){return b-=a,function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;N.lastIndex=0;for(d=0;c=N.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=N.lastIndex;f1){while(++e0&&(a=a.substring(0,e)),arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function h(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this;g[d]&&g.removeEventListener(a,g[d],c),b&&g.addEventListener(a,g[d]=h,c),h._=b})},bd.each=function(a){for(var b=-1,c=this.length;++b=cg?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,0 0,"+ -e+"A"+e+","+e+" 0 1,0 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=ch,b=ci,c=cj,d=ck;return e.innerRadius=function(b){return arguments.length?(a=d3.functor(b),e):a},e.outerRadius=function(a){return arguments.length?(b=d3.functor(a),e):b},e.startAngle=function(a){return arguments.length?(c=d3.functor(a),e):c},e.endAngle=function(a){return arguments.length?(d=d3.functor(a),e):d},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+cf;return[Math.cos(f)*e,Math.sin(f)*e]},e};var cf=-Math.PI/2,cg=2*Math.PI-1e-6;d3.svg.line=function(){return cl(Object)};var cp={linear:cq,"step-before":cr,"step-after":cs,basis:cy,"basis-open":cz,"basis-closed":cA,bundle:cB,cardinal:cv,"cardinal-open":ct,"cardinal-closed":cu,monotone:cK},cD=[0,2/3,1/3,0],cE=[0,1/3,2/3,0],cF=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=cl(cL);return a.radius=a.x,delete a.x,a.angle=a.y,delete a.y,a},cr.reverse=cs,cs.reverse=cr,d3.svg.area=function(){return cM(Object)},d3.svg.area.radial=function(){var a=cM(cL);return a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1,a},d3.svg.chord=function(){function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+cf,k=e.call(a,h,g)+cf;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function j(a,b,c,d){return"Q 0,0 "+d}var a=cP,b=cQ,c=cR,d=cj,e=ck;return f.radius=function(a){return arguments.length?(c=d3.functor(a),f):c},f.source=function(b){return arguments.length?(a=d3.functor(b),f):a},f.target=function(a){return arguments.length?(b=d3.functor(a),f):b},f.startAngle=function(a){return arguments.length?(d=d3.functor(a),f):d},f.endAngle=function(a){return arguments.length?(e=d3.functor(a),f):e},f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];return i=i.map(c),"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cP,b=cQ,c=cU;return d.source=function(b){return arguments.length?(a=d3.functor(b),d):a},d.target=function(a){return arguments.length?(b=d3.functor(a),d):b},d.projection=function(a){return arguments.length?(c=a,d):c},d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=cU,c=a.projection;return a.projection=function(a){return arguments.length?c(cV(b=a)):b},a},d3.svg.mouse=function(a){return cX(a,d3.event)};var cW=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(a,b){return arguments.length<2&&(b=d3.event.touches),b?d(b).map(function(b){var c=cX(a,b);return c.identifier=b.identifier,c}):[]},d3.svg.symbol=function(){function c(c,d){return(c$[a.call(this,c,d)]||c$.circle)(b.call(this,c,d))}var a=cZ,b=cY;return c.type=function(b){return arguments.length?(a=d3.functor(b),c):a},c.size=function(a){return arguments.length?(b=d3.functor(a),c):b},c};var c$={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*da)),c=b*da;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/c_),c=b*c_/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/c_),c=b*c_/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(c$);var c_=Math.sqrt(3),da=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function j(j){j.each(function(k,l,m){var n=d3.select(this),o=j.delay?function(a){var b=bt;try{return bt=j.id,a.transition().delay(j[m][l].delay).duration(j[m][l].duration).ease(j.ease())}finally{bt=b}}:Object,p=a.ticks.apply(a,g),q=h==null?a.tickFormat.apply(a,g):h,r=dd(a,p,i),s=n.selectAll(".minor").data(r,String),t=s.enter().insert("svg:line","g").attr("class","tick minor").style("opacity",1e-6),u=o(s.exit()).style("opacity",1e-6).remove(),v=o(s).style("opacity",1),w=n.selectAll("g").data(p,String),x=w.enter().insert("svg:g","path").style("opacity",1e-6),y=o(w.exit()).style("opacity",1e-6).remove(),z=o(w).style("opacity",1),A,B=bJ(a.range()),C=n.selectAll(".domain").data([0]),D=C.enter().append("svg:path").attr("class","domain"),E=o(C),F=this.__chart__||a;this.__chart__=a.copy(),x.append("svg:line").attr("class","tick"),x.append("svg:text"),z.select("text").text(q);switch(b){case"bottom":A=db,v.attr("x2",0).attr("y2",d),z.select("line").attr("x2",0).attr("y2",c),z.select("text").attr("x",0).attr("y",Math.max(c,0)+f).attr("dy",".71em").attr("text-anchor","middle"),E.attr("d","M"+B[0]+","+e+"V0H"+B[1]+"V"+e);break;case"top":A=db,v.attr("x2",0).attr("y2",-d),z.select("line").attr("x2",0).attr("y2",-c),z.select("text").attr("x",0).attr("y",-(Math.max(c,0)+f)).attr("dy","0em").attr("text-anchor","middle"),E.attr("d","M"+B[0]+","+ -e+"V0H"+B[1]+"V"+ -e);break;case"left":A=dc,v.attr("x2",-d).attr("y2",0),z.select("line").attr("x2",-c).attr("y2",0),z.select("text").attr("x",-(Math.max(c,0)+f)).attr("y",0).attr("dy",".32em").attr("text-anchor","end"),E.attr("d","M"+ -e+","+B[0]+"H0V"+B[1]+"H"+ -e);break;case"right":A=dc,v.attr("x2",d).attr("y2",0),z.select("line").attr("x2",c).attr("y2",0),z.select("text").attr("x",Math.max(c,0)+f).attr("y",0).attr("dy",".32em").attr("text-anchor","start"),E.attr("d","M"+e+","+B[0]+"H0V"+B[1]+"H"+e)}x.call(A,F),z.call(A,a),y.call(A,a),t.call(A,F),v.call(A,a),u.call(A,a)})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h,i=0;return j.scale=function(b){return arguments.length?(a=b,j):a},j.orient=function(a){return arguments.length?(b=a,j):b},j.ticks=function(){return arguments.length?(g=arguments,j):g},j.tickFormat=function(a){return arguments.length?(h=a,j):h},j.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;return c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c,j},j.tickPadding=function(a){return arguments.length?(f=+a,j):f},j.tickSubdivide=function(a){return arguments.length?(i=+a,j):i},j},d3.svg.brush=function(){function e(a){var g=b&&c?["n","e","s","w","nw","ne","se","sw"]:b?["e","w"]:c?["n","s"]:[];a.each(function(){var a=d3.select(this).on("mousedown.brush",f),h=a.selectAll(".background").data([,]),i=a.selectAll(".extent").data([,]),j=a.selectAll(".resize").data(g,String),k;h.enter().append("svg:rect").attr("class","background").style("visibility","hidden").style("pointer-events","all").style("cursor","crosshair"),i.enter().append("svg:rect").attr("class","extent").style("cursor","move"),j.enter().append("svg:rect").attr("class",function(a){return"resize "+a}).attr("width",6).attr("height",6).style("visibility","hidden").style("pointer-events",e.empty()?"none":"all").style("cursor",function(a){return dw[a]}),j.exit().remove(),b&&(k=bJ(b.range()),h.attr("x",k[0]).attr("width",k[1]-k[0]),dp(a,d)),c&&(k=bJ(c.range()),h.attr("y",k[0]).attr("height",k[1]-k[0]),dq(a,d))})}function f(){var a=d3.select(d3.event.target);de=e,dg=this,dj=d,dn=d3.svg.mouse(dg),(dk=a.classed("extent"))?(dn[0]=d[0][0]-dn[0],dn[1]=d[0][1]-dn[1]):a.classed("resize")?(dl=d3.event.target.__data__,dn[0]=d[+/w$/.test(dl)][0],dn[1]=d[+/^n/.test(dl)][1]):d3.event.altKey&&(dm=dn.slice()),dh=!/^(n|s)$/.test(dl)&&b,di=!/^(e|w)$/.test(dl)&&c,df=g(this,arguments),df("brushstart"),dt(),M()}function g(b,c){return function(d){var f=d3.event;try{d3.event={type:d,target:e},a[d].apply(b,c)}finally{d3.event=f}}}var a=d3.dispatch("brushstart","brush","brushend"),b,c,d=[[0,0],[0,0]];return e.x=function(a){return arguments.length?(b=a,e):b},e.y=function(a){return arguments.length?(c=a,e):c},e.extent=function(a){var f,g,h,i,j;return arguments.length?(b&&(f=a[0],g=a[1],c&&(f=f[0],g=g[0]),f=b(f),g=b(g),g3?g%3:0;return e+(g?b.substr(0,g)+d:"")+b.substr(g).replace(/(\d{3})(?=\d)/g,"$1"+d)+(f?c+$a(a-b).toFixed(f).slice(2):"")}function Fc(){}function Hd(a,c){function b(m,h){function x(l,p){this.pos=l;this.minor=p; -this.isNew=true;p||this.addLabel()}function w(l){if(l){this.options=l;this.id=l.id}return this}function O(){var l=[],p=[],r;Qa=v=null;S=[];t(za,function(o){r=false;t(["xAxis","yAxis"],function(da){if(o.isCartesian&&(da=="xAxis"&&ha||da=="yAxis"&&!ha)&&(o.options[da]==h.index||o.options[da]===Oa&&h.index===0)){o[da]=s;S.push(o);r=true}});if(!o.visible&&u.ignoreHiddenSeries)r=false;if(r){var V,W,F,A,ea;if(!ha){V=o.options.stacking;Gc=V=="percent";if(V){A=o.type+y(o.options.stack,"");ea="-"+A;o.stackKey= -A;W=l[A]||[];l[A]=W;F=p[ea]||[];p[ea]=F}if(Gc){Qa=0;v=99}}if(o.isCartesian){t(o.data,function(da){var B=da.x,sa=da.y,R=sa<0,X=R?F:W;R=R?ea:A;if(Qa===null)Qa=v=da[G];if(ha)if(B>v)v=B;else{if(Bv)v=da;else if(da=0){Qa=0;Id=true}else if(v<0){v=0;Jd=true}}}})}function fa(l,p){var r;Eb=p?1:Ra.pow(10,Mb(Ra.log(l)/Ra.LN10)); -r=l/Eb;if(!p){p=[1,2,2.5,5,10];if(h.allowDecimals===false)if(Eb==1)p=[1,2,5,10];else if(Eb<=0.1)p=[1/Eb]}for(var o=0;o0||!Jd))P+=l*Kd}Va=H==P?1:Nb&&!V&&W==r.options.tickPixelInterval?r.tickInterval:y(V,gb?1:(P-H)*W/C);if(!J&&!M(h.tickInterval))s.tickInterval=Va=fa(Va);Hc=h.minorTickInterval==="auto"&&Va?Va/5:h.minorTickInterval;if(J){la=[];V=Pa.global.useUTC;var F=1E3/nb,A=6E4/nb,ea=36E5/nb;W=864E5/ -nb;l=6048E5/nb;o=2592E6/nb;var da=31556952E3/nb,B=[["second",F,[1,2,5,10,15,30]],["minute",A,[1,2,5,10,15,30]],["hour",ea,[1,2,3,4,6,8,12]],["day",W,[1,2]],["week",l,[1,2]],["month",o,[1,2,3,4,6]],["year",da,null]],sa=B[6],R=sa[1],X=sa[2];for(r=0;r=F)X.setSeconds(R>=A?0:B*Mb(X.getSeconds()/B));if(R>=A)X[Cd](R>=ea?0:B*Mb(X[$c]()/ -B));if(R>=ea)X[Dd](R>=W?0:B*Mb(X[ad]()/B));if(R>=W)X[cd](R>=o?1:B*Mb(X[nc]()/B));if(R>=o){X[Ed](R>=da?0:B*Mb(X[Bc]()/B));p=X[Cc]()}if(R>=da){p-=p%B;X[Fd](p)}R==l&&X[cd](X[nc]()-X[bd]()+h.startOfWeek);r=1;p=X[Cc]();F=X.getTime()/nb;A=X[Bc]();for(ea=X[nc]();Fp&&la.shift();if(h.endOnTick)P=r;else PFb[G])Fb[G]=la.length}}function Ea(){var l,p;hb=H;cc=P;O();ia();ba=D;D=C/(P-H||1);if(!ha)for(l in aa)for(p in aa[l])aa[l][p].cum=aa[l][p].total;if(!s.isDirty)s.isDirty=H!=hb||P!=cc}function ta(l){l=(new w(l)).render();Ob.push(l);return l}function Ya(){var l=h.title,p=h.alternateGridColor, -r=h.lineWidth,o,V,W=m.hasRendered,F=W&&M(hb)&&!isNaN(hb);o=S.length&&M(H)&&M(P);C=L?Ba:qa;D=C/(P-H||1);ua=L?U:ob;if(o||Nb){if(Hc&&!gb)for(o=H+(la[0]-H)%Hc;o<=P;o+=Hc){Wb[o]||(Wb[o]=new x(o,true));F&&Wb[o].isNew&&Wb[o].render(null,true);Wb[o].isActive=true;Wb[o].render()}t(la,function(A,ea){if(!Nb||A>=H&&A<=P){F&&pb[A].isNew&&pb[A].render(ea,true);pb[A].isActive=true;pb[A].render(ea)}});p&&t(la,function(A,ea){if(ea%2===0&&A=1E3?Gd(l,0):l},Lc=L&&h.labels.staggerLines,Xb=h.reversed,Yb=gb&&h.tickmarkPlacement=="between"?0.5:0;x.prototype={addLabel:function(){var l=this.pos,p=h.labels,r=!(l==H&&!y(h.showFirstLabel,1)||l==P&&!y(h.showLastLabel,0)),o=this.label;l= -Zd.call({isFirst:l==la[0],isLast:l==la[la.length-1],dateTimeLabelFormat:Ic,value:gb&&gb[l]?gb[l]:l});if(o===Oa)this.label=M(l)&&r&&p.enabled?Y.text(l,0,0).attr({align:p.align,rotation:p.rotation}).css(p.style).add(cb):null;else o&&o.attr({text:l})},getLabelSize:function(){var l=this.label;return l?(this.labelBBox=l.getBBox())[L?"height":"width"]:0},render:function(l,p){var r=!this.minor,o=this.label,V=this.pos,W=h.labels,F=this.gridLine,A=r?h.gridLineWidth:h.minorGridLineWidth,ea=r?h.gridLineColor: -h.minorGridLineColor,da=r?h.gridLineDashStyle:h.minorGridLineDashStyle,B=this.mark,sa=r?h.tickLength:h.minorTickLength,R=r?h.tickWidth:h.minorTickWidth||0,X=r?h.tickColor:h.minorTickColor,oc=r?h.tickPosition:h.minorTickPosition;r=W.step;var qb=p&&Mc||La,Pb;Pb=L?ma(V+Yb,null,null,p)+ua:U+Q+(Ka?(p&&hd||Ta)-zb-U:0);qb=L?qb-ob+Q-(Ka?qa:0):qb-ma(V+Yb,null,null,p)-ua;if(A){V=ra(V+Yb,A,p);if(F===Oa){F={stroke:ea,"stroke-width":A};if(da)F.dashstyle=da;this.gridLine=F=A?Y.path(V).attr(F).add(Ab):null}F&&V&& -F.animate({d:V})}if(R){if(oc=="inside")sa=-sa;if(Ka)sa=-sa;A=Y.crispLine([Wa,Pb,qb,Aa,Pb+(L?0:-sa),qb+(L?sa:0)],R);if(B)B.animate({d:A});else this.mark=Y.path(A).attr({stroke:X,"stroke-width":R}).add(cb)}if(o){Pb=Pb+W.x-(Yb&&L?Yb*D*(Xb?-1:1):0);qb=qb+W.y-(Yb&&!L?Yb*D*(Xb?1:-1):0);if(Lc)qb+=l%Lc*16;if(r)o[l%r?"hide":"show"]();o[this.isNew?"attr":"animate"]({x:Pb,y:qb})}this.isNew=false},destroy:function(){for(var l in this)this[l]&&this[l].destroy&&this[l].destroy()}};w.prototype={render:function(){var l= -this,p=l.options,r=p.label,o=l.label,V=p.width,W=p.to,F,A=p.from,ea=p.dashStyle,da=l.svgElem,B=[],sa,R,X=p.color;R=p.zIndex;var oc=p.events;if(V){B=ra(p.value,V);p={stroke:X,"stroke-width":V};if(ea)p.dashstyle=ea}else if(M(A)&&M(W)){A=Ca(A,H);W=ab(W,P);F=ra(W);if((B=ra(A))&&F)B.push(F[4],F[5],F[1],F[2]);else B=null;p={fill:X}}else return;if(M(R))p.zIndex=R;if(da)if(B)da.animate({d:B},null,da.onGetPath);else{da.hide();da.onGetPath=function(){da.show()}}else if(B&&B.length){l.svgElem=da=Y.path(B).attr(p).add(); -if(oc){ea=function(qb){da.on(qb,function(Pb){oc[qb].apply(l,[Pb])})};for(sa in oc)ea(sa)}}if(r&&M(r.text)&&B&&B.length&&Ba>0&&qa>0){r=va({align:L&&F&&"center",x:L?!F&&4:10,verticalAlign:!L&&F&&"middle",y:L?F?16:10:F?6:-4,rotation:L&&!F&&90},r);if(!o)l.label=o=Y.text(r.text,0,0).attr({align:r.textAlign||r.align,rotation:r.rotation,zIndex:R}).css(r.style).add();F=[B[1],B[4],B[6]||B[1]];B=[B[2],B[5],B[7]||B[2]];sa=ab.apply(Ra,F);R=ab.apply(Ra,B);o.align(r,false,{x:sa,y:R,width:Ca.apply(Ra,F)-sa,height:Ca.apply(Ra, -B)-R});o.show()}else o&&o.hide();return l},destroy:function(){for(var l in this){this[l]&&this[l].destroy&&this[l].destroy();delete this[l]}yc(Ob,this)}};ma=function(l,p,r,o){var V=1,W=0,F=o?ba:D;o=o?hb:H;F||(F=D);if(r){V*=-1;W=C}if(Xb){V*=-1;W-=V*C}if(p){if(Xb)l=C-l;l=l/F+o}else l=V*(l-o)*F+W;return l};ra=function(l,p,r){var o,V,W;l=ma(l,null,null,r);var F=r&&Mc||La,A=r&&hd||Ta,ea;r=V=T(l+ua);o=W=T(F-l-ua);if(isNaN(l))ea=true;else if(L){o=Z;W=F-ob;if(rU+Ba)ea=true}else{r=U;V=A-zb;if(o -Z+qa)ea=true}return ea?null:Y.crispLine([Wa,r,o,Aa,V,W],p||0)};if(Ga&&ha&&Xb===Oa)Xb=true;oa(s,{addPlotBand:ta,addPlotLine:ta,adjustTickAmount:function(){if(Fb&&!J&&!gb&&!Nb){var l=ec,p=la.length;ec=Fb[G];if(pl)l=H;else if(P',C?Kc("%A, %b %e, %Y",D):D,"
"]:[];t(G,function(ra){ua=ra.series;ma.push('',ra.name||ua.name,": ",!ba?"x = "+(ra.name||ra.x)+", ":"","",!ba?"y = ":"",ra.y,"
")});return ma.join("")}function x(G,C){E=ha? -G:(2*E+G)/3;aa=ha?C:(aa+C)/2;s.translate(E,aa);id=$a(G-E)>1||$a(C-aa)>1?function(){x(G,C)}:null}function w(){if(!ha){var G=q.hoverPoints;s.hide();t(ia,function(C){C.hide()});G&&t(G,function(C){C.setState()});q.hoverPoints=null;ha=true}}var O,fa=m.borderWidth,I=m.crosshairs,ia=[],Ea=m.style,ta=m.shared,Ya=pa(Ea.padding),Ha=fa+Ya,ha=true,Ka,L,E=0,aa=0;Ea.padding=0;var s=Y.g("tooltip").attr({zIndex:8}).add(),J=Y.rect(Ha,Ha,0,0,m.borderRadius,fa).attr({fill:m.backgroundColor,"stroke-width":fa}).add(s).shadow(m.shadow), -Q=Y.text("",Ya+Ha,pa(Ea.fontSize)+Ya+Ha).attr({zIndex:1}).css(Ea).add(s);s.hide();return{shared:ta,refresh:function(G){var C,D,ba,ua=0,ma={},ra=[];ba=G.tooltipPos;C=m.formatter||h;ma=q.hoverPoints;var cb=function(Fa){return{series:Fa.series,point:Fa,x:Fa.category,y:Fa.y,percentage:Fa.percentage,total:Fa.total||Fa.stackTotal}};if(ta){ma&&t(ma,function(Fa){Fa.setState()});q.hoverPoints=G;t(G,function(Fa){Fa.setState(xb);ua+=Fa.plotY;ra.push(cb(Fa))});D=G[0].plotX;ua=T(ua)/G.length;ma={x:G[0].category}; -ma.points=ra;G=G[0]}else ma=cb(G);ma=C.call(ma);O=G.series;D=ta?D:G.plotX;ua=ta?ua:G.plotY;C=T(ba?ba[0]:Ga?Ba-ua:D);D=T(ba?ba[1]:Ga?qa-D:ua);ba=!G.series.isCartesian||hc(C,D);if(ma===false||!ba)w();else{if(ha){s.show();ha=false}Q.attr({text:ma});ba=Q.getBBox();Ka=ba.width;L=ba.height;J.attr({width:Ka+2*Ya,height:L+2*Ya,stroke:m.borderColor||G.color||O.color||"#606060"});C=C-Ka+U-25;D=D-L+Z+10;if(C<7){C=7;D-=30}if(D<5)D=5;else if(D+L>La)D=La-L-5;x(T(C-Ha),T(D-Ha))}if(I){I=mc(I);D=I.length;for(var Ab;D--;)if(I[D]&& -(Ab=G.series[D?"yAxis":"xAxis"])){C=Ab.getPlotLinePath(G[D?"y":"x"],1);if(ia[D])ia[D].attr({d:C,visibility:Bb});else{ba={"stroke-width":I[D].width||1,stroke:I[D].color||"#C0C0C0",zIndex:2};if(I[D].dashStyle)ba.dashstyle=I[D].dashStyle;ia[D]=Y.path(C).attr(ba).add()}}}},hide:w}}function f(m,h){function x(E){var aa;E=E||rb.event;if(!E.target)E.target=E.srcElement;aa=E.touches?E.touches.item(0):E;if(E.type!="mousemove"||rb.opera){for(var s=xa,J={left:s.offsetLeft,top:s.offsetTop};s=s.offsetParent;){J.left+= -s.offsetLeft;J.top+=s.offsetTop;if(s!=Da.body&&s!=Da.documentElement){J.left-=s.scrollLeft;J.top-=s.scrollTop}}pc=J}if(Zc){E.chartX=E.x;E.chartY=E.y}else if(aa.layerX===Oa){E.chartX=aa.pageX-pc.left;E.chartY=aa.pageY-pc.top}else{E.chartX=E.layerX;E.chartY=E.layerY}return E}function w(E){var aa={xAxis:[],yAxis:[]};t(Xa,function(s){var J=s.translate,Q=s.isXAxis;aa[Q?"xAxis":"yAxis"].push({axis:s,value:J((Ga?!Q:Q)?E.chartX-U:qa-E.chartY+Z,true)})});return aa}function O(){var E=m.hoverSeries,aa=m.hoverPoint; -aa&&aa.onMouseOut();E&&E.onMouseOut();qc&&qc.hide();jd=null}function fa(){if(ta){var E={xAxis:[],yAxis:[]},aa=ta.getBBox(),s=aa.x-U,J=aa.y-Z;if(Ea){t(Xa,function(Q){var G=Q.translate,C=Q.isXAxis,D=Ga?!C:C,ba=G(D?s:qa-J-aa.height,true);G=G(D?s+aa.width:qa-J,true);E[C?"xAxis":"yAxis"].push({axis:Q,min:ab(ba,G),max:Ca(ba,G)})});Ia(m,"selection",E,kd)}ta=ta.destroy()}m.mouseIsDown=ld=Ea=false;Cb(Da,Gb?"touchend":"mouseup",fa)}var I,ia,Ea,ta,Ya=u.zoomType,Ha=/x/.test(Ya),ha=/y/.test(Ya),Ka=Ha&&!Ga||ha&& -Ga,L=ha&&!Ga||Ha&&Ga;Nc=function(){if(Oc){Oc.translate(U,Z);Ga&&Oc.attr({width:m.plotWidth,height:m.plotHeight}).invert()}else m.trackerGroup=Oc=Y.g("tracker").attr({zIndex:9}).add()};Nc();if(h.enabled)m.tooltip=qc=e(h);(function(){var E=true;xa.onmousedown=function(s){s=x(s);m.mouseIsDown=ld=true;I=s.chartX;ia=s.chartY;Ma(Da,Gb?"touchend":"mouseup",fa)};var aa=function(s){if(!(s&&s.touches&&s.touches.length>1)){s=x(s);if(!Gb)s.returnValue=false;var J=s.chartX,Q=s.chartY,G=!hc(J-U,Q-Z);if(Gb&&s.type== -"touchstart")if(ya(s.target,"isTracker"))m.runTrackerClick||s.preventDefault();else!$d&&!G&&s.preventDefault();if(G){E||O();if(JU+Ba)J=U+Ba;if(QZ+qa)Q=Z+qa}if(ld&&s.type!="touchstart"){if(Ea=Math.sqrt(Math.pow(I-J,2)+Math.pow(ia-Q,2))>10){if(ic&&(Ha||ha)&&hc(I-U,ia-Z))ta||(ta=Y.rect(U,Z,Ka?1:Ba,L?1:qa,0).attr({fill:"rgba(69,114,167,0.25)",zIndex:7}).add());if(ta&&Ka){J=J-I;ta.attr({width:$a(J),x:(J>0?0:J)+I})}if(ta&&L){Q=Q-ia;ta.attr({height:$a(Q),y:(Q>0?0:Q)+ia})}}}else if(!G){var C; -Q=m.hoverPoint;J=m.hoverSeries;var D,ba,ua=Ta,ma=Ga?s.chartY:s.chartX-U;if(qc&&h.shared){C=[];D=za.length;for(ba=0;baua&&C.splice(D,1);if(C.length&&C[0].plotX!=jd){qc.refresh(C);jd=C[0].plotX}}if(J&&J.tracker)(s=J.tooltipPoints[ma])&&s!=Q&&s.onMouseOver()}return(E=G)||!ic}};xa.onmousemove=aa;Ma(xa,"mouseleave",O);xa.ontouchstart=function(s){if(Ha|| -ha)xa.onmousedown(s);aa(s)};xa.ontouchmove=aa;xa.ontouchend=function(){Ea&&O()};xa.onclick=function(s){var J=m.hoverPoint;s=x(s);s.cancelBubble=true;if(!Ea)if(J&&ya(s.target,"isTracker")){var Q=J.plotX,G=J.plotY;oa(J,{pageX:pc.left+U+(Ga?Ba-G:Q),pageY:pc.top+Z+(Ga?qa-Q:G)});Ia(J.series,"click",oa(s,{point:J}));J.firePointEvent("click",s)}else{oa(s,w(s));hc(s.chartX-U,s.chartY-Z)&&Ia(m,"click",s)}Ea=false}})();Nd=setInterval(function(){id&&id()},32);oa(this,{zoomX:Ha,zoomY:ha,resetTracker:O})}function g(m){var h= -m.type||u.type||u.defaultSeriesType,x=sb[h],w=q.hasRendered;if(w)if(Ga&&h=="column")x=sb.bar;else if(!Ga&&h=="bar")x=sb.column;h=new x;h.init(q,m);if(!w&&h.inverted)Ga=true;if(h.isCartesian)ic=h.isCartesian;za.push(h);return h}function i(){u.alignTicks!==false&&t(Xa,function(m){m.adjustTickAmount()});Fb=null}function j(m){var h=q.isDirtyLegend,x,w=q.isDirtyBox,O=za.length,fa=O,I=q.clipRect;for(Kb(m,q);fa--;){m=za[fa];if(m.isDirty&&m.options.stacking){x=true;break}}if(x)for(fa=O;fa--;){m=za[fa];if(m.options.stacking)m.isDirty= -true}t(za,function(ia){if(ia.isDirty){ia.cleanData();ia.getSegments();if(ia.options.legendType=="point")h=true}});if(h&&md.renderLegend){md.renderLegend();q.isDirtyLegend=false}if(ic){if(!Pc){Fb=null;t(Xa,function(ia){ia.setScale()})}i();rc();t(Xa,function(ia){if(ia.isDirty||w){ia.redraw();w=true}})}if(w){nd();Nc();if(I){Qc(I);I.animate({width:q.plotSizeX,height:q.plotSizeY})}}t(za,function(ia){ia.isDirty&&ia.visible&&ia.redraw()});gc&&gc.resetTracker&&gc.resetTracker();Ia(q,"redraw")}function k(){var m= -a.xAxis||{},h=a.yAxis||{},x;m=mc(m);t(m,function(w,O){w.index=O;w.isX=true});h=mc(h);t(h,function(w,O){w.index=O});Xa=m.concat(h);q.xAxis=[];q.yAxis=[];Xa=jc(Xa,function(w){x=new b(q,w);q[x.isXAxis?"xAxis":"yAxis"].push(x);return x});i()}function n(m,h){kc=va(a.title,m);sc=va(a.subtitle,h);t([["title",m,kc],["subtitle",h,sc]],function(x){var w=x[0],O=q[w],fa=x[1];x=x[2];if(O&&fa){O.destroy();O=null}if(x&&x.text&&!O)q[w]=Y.text(x.text,0,0).attr({align:x.align,"class":"highcharts-"+w,zIndex:1}).css(x.style).add().align(x, -false,tc)})}function z(){ib=u.renderTo;Od=Zb+od++;if(Ib(ib))ib=Da.getElementById(ib);ib.innerHTML="";if(!ib.offsetWidth){Rb=ib.cloneNode(0);Ua(Rb,{position:lc,top:"-9999px",display:""});Da.body.appendChild(Rb)}Rc=(Rb||ib).offsetWidth;uc=(Rb||ib).offsetHeight;q.chartWidth=Ta=u.width||Rc||600;q.chartHeight=La=u.height||(uc>19?uc:400);q.container=xa=fb(Lb,{className:"highcharts-container"+(u.className?" "+u.className:""),id:Od},oa({position:Pd,overflow:tb,width:Ta+bb,height:La+bb,textAlign:"left"},u.style), -Rb||ib);q.renderer=Y=u.renderer=="SVG"?new Sc(xa,Ta,La):new Qd(xa,Ta,La);var m;if(/Gecko/.test(vc)){m=function(){Ua(xa,{left:0,top:0});var h=xa.getBoundingClientRect();Ua(xa,{left:-h.left%1+bb,top:-h.top%1+bb})};m();Ma(rb,"resize",m);Ma(q,"destroy",function(){Cb(rb,"resize",m)})}}function K(){function m(){var x=u.width||ib.offsetWidth,w=u.height||ib.offsetHeight;if(x&&w){if(x!=Rc||w!=uc){clearTimeout(h);h=setTimeout(function(){pd(x,w,false)},100)}Rc=x;uc=w}}var h;Ma(window,"resize",m);Ma(q,"destroy", -function(){Cb(window,"resize",m)})}function ja(){var m=a.labels,h=a.credits,x;n();md=q.legend=new ae(q);rc();t(Xa,function(w){w.setTickPositions(true)});i();rc();nd();ic&&t(Xa,function(w){w.render()});if(!q.seriesGroup)q.seriesGroup=Y.g("series-group").attr({zIndex:3}).add();t(za,function(w){w.translate();w.setTooltipPoints();w.render()});m.items&&t(m.items,function(){var w=oa(m.style,this.style),O=pa(w.left)+U,fa=pa(w.top)+Z+12;delete w.left;delete w.top;Y.text(this.html,O,fa).attr({zIndex:2}).css(w).add()}); -if(!q.toolbar)q.toolbar=d(q);if(h.enabled&&!q.credits){x=h.href;Y.text(h.text,0,0).on("click",function(){if(x)location.href=x}).attr({align:h.position.align,zIndex:8}).css(h.style).add().align(h.position)}Nc();q.hasRendered=true;if(Rb){ib.appendChild(xa);Dc(Rb)}}function $(){var m=za.length,h=xa.parentNode;Ia(q,"destroy");Cb(rb,"unload",$);Cb(q);for(t(Xa,function(x){Cb(x)});m--;)za[m].destroy();xa.innerHTML="";Cb(xa);h&&h.removeChild(xa);xa=null;Y.alignedObjects=null;clearInterval(Nd);for(m in q)delete q[m]} -function ga(){if(!Tc&&Da.readyState!="complete")Da.attachEvent("onreadystatechange",function(){Da.detachEvent("onreadystatechange",ga);ga()});else{z();qd();rd();t(a.series||[],function(m){g(m)});q.inverted=Ga=y(Ga,a.chart.inverted);k();q.render=ja;q.tracker=gc=new f(q,a.tooltip);ja();Ia(q,"load");c&&c.apply(q,[q]);t(q.callbacks,function(m){m.apply(q,[q])})}}Jc=va(Jc,Pa.xAxis);fd=va(fd,Pa.yAxis);Pa.xAxis=Pa.yAxis=null;a=va(Pa,a);var u=a.chart,N=u.margin;N=Jb(N)?N:[N,N,N,N];var ka=y(u.marginTop,N[0]), -Na=y(u.marginRight,N[1]),ca=y(u.marginBottom,N[2]),na=y(u.marginLeft,N[3]),Za=u.spacingTop,jb=u.spacingRight,sd=u.spacingBottom,Uc=u.spacingLeft,tc,kc,sc,Z,zb,ob,U,Qb,ib,Rb,xa,Od,Rc,uc,Ta,La,hd,Mc,td,ud,vd,wd,q=this,$d=(N=u.events)&&!!N.click,xd,hc,qc,ld,$b,Rd,yd,qa,Ba,gc,Oc,Nc,md,Sb,Tb,pc,ic=u.showAxes,Pc=0,Xa=[],Fb,za=[],Ga,Y,id,Nd,jd,nd,rc,qd,rd,pd,kd,Sd,ae=function(m){function h(v,S){var wa=v.legendItem,Sa=v.legendLine,P=v.legendSymbol,H=L.color,hb=S?I.itemStyle.color:H;H=S?v.color:H;wa&&wa.css({fill:hb}); -Sa&&Sa.attr({stroke:H});P&&P.attr({stroke:H,fill:H})}function x(v,S,wa){var Sa=v.legendItem,P=v.legendLine,H=v.legendSymbol;v=v.checkbox;Sa&&Sa.attr({x:S,y:wa});P&&P.translate(S,wa-4);H&&H.attr({x:S+H.xOff,y:wa+H.yOff});if(v){v.x=S;v.y=wa}}function w(){t(Ya,function(v){var S=v.checkbox;S&&Ua(S,{left:ra.attr("translateX")+v.legendItemWidth+S.x-40+bb,top:ra.attr("translateY")+S.y-11+bb})})}function O(v){var S,wa,Sa,P,H,hb=v.legendItem;P=v.series||v;if(!hb){H=/^(bar|pie|area|column)$/.test(P.type);v.legendItem= -hb=Y.text(I.labelFormatter.call(v),0,0).css(v.visible?ha:L).on("mouseover",function(){v.setState(xb);hb.css(Ka)}).on("mouseout",function(){hb.css(v.visible?ha:L);v.setState()}).on("click",function(){var Vb=function(){v.setVisible()};v.firePointEvent?v.firePointEvent("legendItemClick",null,Vb):Ia(v,"legendItemClick",null,Vb)}).attr({zIndex:2}).add(ra);if(!H&&v.options&&v.options.lineWidth){var cc=v.options;P={"stroke-width":cc.lineWidth,zIndex:2};if(cc.dashStyle)P.dashstyle=cc.dashStyle;v.legendLine= -Y.path([Wa,-Ea-ta,0,Aa,-ta,0]).attr(P).add(ra)}if(H)S=Y.rect(wa=-Ea-ta,Sa=-11,Ea,12,2).attr({"stroke-width":0,zIndex:3}).add(ra);else if(v.options&&v.options.marker&&v.options.marker.enabled)S=Y.symbol(v.symbol,wa=-Ea/2-ta,Sa=-4,v.options.marker.radius).attr(v.pointAttr[db]).attr({zIndex:3}).add(ra);if(S){S.xOff=wa;S.yOff=Sa}v.legendSymbol=S;h(v,v.visible);if(v.options&&v.options.showCheckbox){v.checkbox=fb("input",{type:"checkbox",checked:v.selected,defaultChecked:v.selected},I.itemCheckboxStyle, -xa);Ma(v.checkbox,"click",function(Vb){Ia(v,"checkboxClick",{checked:Vb.target.checked},function(){v.select()})})}}x(v,Q,G);S=hb.getBBox();C=G;D=S.height;v.legendItemWidth=S=I.itemWidth||Ea+ta+S.width+aa;if(ia){Q+=S;cb=Ab||Ca(Q-J,cb);if(Q-J+S>(Ab||Ta-2*E-J)){Q=J;G+=D}}else{G+=D;cb=Ab||Ca(S,cb)}Ya.push(v)}function fa(){Q=J;G=s;C=cb=0;Ya=[];ra||(ra=Y.g("legend").attr({zIndex:7}).add());Qa&&Fa.reverse();t(Fa,function(Sa){if(Sa.options.showInLegend)t(Sa.options.legendType=="point"?Sa.data:[Sa],O)});Qa&& -Fa.reverse();Sb=Ab||cb;Tb=C-s+D;if(ua||ma){Sb+=2*E;Tb+=2*E;if(ba)Sb>0&&Tb>0&&ba.animate({width:Sb,height:Tb});else ba=Y.rect(0,0,Sb,Tb,I.borderRadius,ua||0).attr({stroke:I.borderColor,"stroke-width":ua||0,fill:ma||mb}).add(ra).shadow(I.shadow);ba[Ya.length?"show":"hide"]()}for(var v=["left","right","top","bottom"],S,wa=4;wa--;){S=v[wa];if(Ha[S]&&Ha[S]!="auto"){I[wa<2?"align":"verticalAlign"]=S;I[wa<2?"x":"y"]=pa(Ha[S])*(wa%2?-1:1)}}ra.align(oa(I,{width:Sb,height:Tb}),true,tc);Pc||w()}var I=m.options.legend; -if(I.enabled){var ia=I.layout=="horizontal",Ea=I.symbolWidth,ta=I.symbolPadding,Ya,Ha=I.style,ha=I.itemStyle,Ka=I.itemHoverStyle,L=I.itemHiddenStyle,E=pa(Ha.padding),aa=20,s=18,J=4+E+Ea+ta,Q,G,C,D=0,ba,ua=I.borderWidth,ma=I.backgroundColor,ra,cb,Ab=I.width,Fa=m.series,Qa=I.reversed;fa();Ma(m,"endResize",w);return{colorizeItem:h,destroyItem:function(v){var S=v.checkbox;t(["legendItem","legendLine","legendSymbol"],function(wa){v[wa]&&v[wa].destroy()});S&&Dc(v.checkbox)},renderLegend:fa}}};hc=function(m, -h){return m>=0&&m<=Ba&&h>=0&&h<=qa};Sd=function(){Ia(q,"selection",{resetSelection:true},kd);q.toolbar.remove("zoom")};kd=function(m){var h=Pa.lang,x=q.pointCount<100;q.toolbar.add("zoom",h.resetZoom,h.resetZoomTitle,Sd);!m||m.resetSelection?t(Xa,function(w){w.setExtremes(null,null,false,x)}):t(m.xAxis.concat(m.yAxis),function(w){var O=w.axis;if(q.tracker[O.isXAxis?"zoomX":"zoomY"])O.setExtremes(w.min,w.max,false,x)});j()};rc=function(){var m=a.legend,h=y(m.margin,10),x=m.x,w=m.y,O=m.align,fa=m.verticalAlign, -I;qd();if((q.title||q.subtitle)&&!M(ka))if(I=Ca(q.title&&!kc.floating&&!kc.verticalAlign&&kc.y||0,q.subtitle&&!sc.floating&&!sc.verticalAlign&&sc.y||0))Z=Ca(Z,I+y(kc.margin,15)+Za);if(m.enabled&&!m.floating)if(O=="right")M(Na)||(zb=Ca(zb,Sb-x+h+jb));else if(O=="left")M(na)||(U=Ca(U,Sb+x+h+Uc));else if(fa=="top")M(ka)||(Z=Ca(Z,Tb+w+h+Za));else if(fa=="bottom")M(ca)||(ob=Ca(ob,Tb-w+h+sd));ic&&t(Xa,function(ia){ia.getOffset()});M(na)||(U+=Qb[3]);M(ka)||(Z+=Qb[0]);M(ca)||(ob+=Qb[2]);M(Na)||(zb+=Qb[1]); -rd()};pd=function(m,h,x){var w=q.title,O=q.subtitle;Pc+=1;Kb(x,q);Mc=La;hd=Ta;Ta=T(m);La=T(h);Ua(xa,{width:Ta+bb,height:La+bb});Y.setSize(Ta,La);Ba=Ta-U-zb;qa=La-Z-ob;Fb=null;t(Xa,function(fa){fa.isDirty=true;fa.setScale()});t(za,function(fa){fa.isDirty=true});q.isDirtyLegend=true;q.isDirtyBox=true;rc();w&&w.align(null,null,tc);O&&O.align(null,null,tc);j();Mc=null;Ia(q,"resize");setTimeout(function(){Ia(q,"endResize",null,function(){Pc-=1})},zc&&zc.duration||500)};rd=function(){q.plotLeft=U=T(U); -q.plotTop=Z=T(Z);q.plotWidth=Ba=T(Ta-U-zb);q.plotHeight=qa=T(La-Z-ob);q.plotSizeX=Ga?qa:Ba;q.plotSizeY=Ga?Ba:qa;tc={x:Uc,y:Za,width:Ta-Uc-jb,height:La-Za-sd}};qd=function(){Z=y(ka,Za);zb=y(Na,jb);ob=y(ca,sd);U=y(na,Uc);Qb=[0,0,0,0]};nd=function(){var m=u.borderWidth||0,h=u.backgroundColor,x=u.plotBackgroundColor,w=u.plotBackgroundImage,O,fa={x:U,y:Z,width:Ba,height:qa};O=2*m+(u.shadow?8:0);if(m||h)if(td)td.animate({width:Ta-O,height:La-O});else td=Y.rect(O/2,O/2,Ta-O,La-O,u.borderRadius,m).attr({stroke:u.borderColor, -"stroke-width":m,fill:h||mb}).add().shadow(u.shadow);if(x)if(ud)ud.animate(fa);else ud=Y.rect(U,Z,Ba,qa,0).attr({fill:x}).add().shadow(u.plotShadow);if(w)if(vd)vd.animate(fa);else vd=Y.image(w,U,Z,Ba,qa).add();if(u.plotBorderWidth)if(wd)wd.animate(fa);else wd=Y.rect(U,Z,Ba,qa,0,u.plotBorderWidth).attr({stroke:u.plotBorderColor,"stroke-width":u.plotBorderWidth,zIndex:4}).add();q.isDirtyBox=false};Vc=Hb=0;Ma(rb,"unload",$);u.reflow!==false&&Ma(q,"load",K);if(N)for(xd in N)Ma(q,xd,N[xd]);q.options=a; -q.series=za;q.addSeries=function(m,h,x){var w;if(m){Kb(x,q);h=y(h,true);Ia(q,"addSeries",{options:m},function(){w=g(m);w.isDirty=true;q.isDirtyLegend=true;h&&q.redraw()})}return w};q.animation=y(u.animation,true);q.destroy=$;q.get=function(m){var h,x,w;for(h=0;h-1,f=e?7:3,g;c=c.split(" ");b=[].concat(b);var i,j,k=function(n){for(g=n.length;g--;)n[g]==Wa&&n.splice(g+1,0,n[g+1],n[g+ -2],n[g+1],n[g+2])};if(e){k(c);k(b)}if(a.isArea){i=c.splice(c.length-6,6);j=b.splice(b.length-6,6)}if(d){b=[].concat(b).splice(0,f).concat(b);a.shift=false}for(a=b.length;c.length255)c[e]=255}}return this},setOpacity:function(d){c[3]=d;return this}}};Kc=function(a,c,b){function d(K){return K.toString().replace(/^([0-9])$/,"0$1")}if(!M(c)||isNaN(c))return"Invalid date";a=y(a,"%Y-%m-%d %H:%M:%S");c=new Date(c* -nb);var e=c[ad](),f=c[bd](),g=c[nc](),i=c[Bc](),j=c[Cc](),k=Pa.lang,n=k.weekdays;k=k.months;c={a:n[f].substr(0,3),A:n[f],d:d(g),e:g,b:k[i].substr(0,3),B:k[i],m:d(i+1),y:j.toString().substr(2,2),Y:j,H:d(e),I:d(e%12||12),l:e%12||12,M:d(c[$c]()),p:e<12?"AM":"PM",P:e<12?"am":"pm",S:d(c.getSeconds())};for(var z in c)a=a.replace("%"+z,c[z]);return b?a.substr(0,1).toUpperCase()+a.substr(1):a};Fc.prototype={init:function(a,c){this.element=Da.createElementNS("http://www.w3.org/2000/svg",c);this.renderer=a}, -animate:function(a,c,b){if(c=y(c,zc,true)){c=va(c);if(b)c.complete=b;Wc(this,a,c)}else{this.attr(a);b&&b()}},attr:function(a,c){var b,d,e,f,g=this.element,i=g.nodeName,j=this.renderer,k,n=this.shadows,z,K=this;if(Ib(a)&&M(c)){b=a;a={};a[b]=c}if(Ib(a)){b=a;if(i=="circle")b={x:"cx",y:"cy"}[b]||b;else if(b=="strokeWidth")b="stroke-width";K=ya(g,b)||this[b]||0;if(b!="d"&&b!="visibility")K=parseFloat(K)}else for(b in a){k=false;d=a[b];if(b=="d"){if(d&&d.join)d=d.join(" ");if(/(NaN| {2}|^$)/.test(d))d= -"M 0 0";this.d=d}else if(b=="x"&&i=="text"){for(e=0;ef||!M(f)&&M(b))){c.insertBefore(e,a);return this}}c.appendChild(e);return this},destroy:function(){var a=this.element||{},c=this.shadows,b=a.parentNode,d;a.onclick=a.onmouseout=a.onmouseover=a.onmousemove=null;Qc(this);b&&b.removeChild(a);c&&t(c,function(e){(b=e.parentNode)&&b.removeChild(e)});yc(this.renderer.alignedObjects, -this);for(d in this)delete this[d];return null},empty:function(){for(var a=this.element,c=a.childNodes,b=c.length;b--;)a.removeChild(c[b])},shadow:function(a){var c=[],b,d=this.element,e=this.parentInverted?"(-1,-1)":"(1,1)";if(a){for(a=1;a<=3;a++){b=d.cloneNode(0);ya(b,{isShadow:"true",stroke:"rgb(0, 0, 0)","stroke-opacity":0.05*a,"stroke-width":7-2*a,transform:"translate"+e,fill:mb});d.parentNode.insertBefore(b,d);c.push(b)}this.shadows=c}return this}};var Sc=function(){this.init.apply(this,arguments)}; -Sc.prototype={init:function(a,c,b){var d=location,e;this.Element=Fc;e=this.createElement("svg").attr({xmlns:"http://www.w3.org/2000/svg",version:"1.1"});a.appendChild(e.element);this.box=e.element;this.boxWrapper=e;this.alignedObjects=[];this.url=Zc?"":d.href.replace(/#.*?$/,"");this.defs=this.createElement("defs").add();this.setSize(c,b,false)},createElement:function(a){var c=new this.Element;c.init(this,a);return c},buildText:function(a,c){for(var b=c.toString().replace(/<(b|strong)>/g,'').replace(/<(i|em)>/g, -'').replace(//g,"").split(/]?>/g),d=a.childNodes,e=/style="([^"]+)"/,f=/href="([^"]+)"/,g=ya(a,"x"),i,j=d.length;j--;)a.removeChild(d[j]);t(b,function(k,n){var z,K=0,ja;k=k.replace(//g,"|||");z=k.split("|||");t(z,function($){if($!==""||z.length==1){var ga={},u=Da.createElementNS("http://www.w3.org/2000/svg","tspan");e.test($)&&ya(u,"style",$.match(e)[1].replace(/(;| |^)color([ :])/, -"$1fill$2"));if(f.test($)){ya(u,"onclick",'location.href="'+$.match(f)[1]+'"');Ua(u,{cursor:"pointer"})}$=$.replace(/<(.|\n)*?>/g,"");u.appendChild(Da.createTextNode($||" "));if(K)ga.dx=3;else ga.x=g;if(!K){if(n){ja=pa(window.getComputedStyle(i,null).getPropertyValue("line-height"));if(isNaN(ja))ja=i.offsetHeight||18;ya(u,"dy",ja)}i=u}ya(u,ga);a.appendChild(u);K++}})})},crispLine:function(a,c){if(a[1]==a[4])a[1]=a[4]=T(a[1])+c%2/2;if(a[2]==a[5])a[2]=a[5]=T(a[2])+c%2/2;return a},path:function(a){return this.createElement("path").attr({d:a, -fill:mb})},circle:function(a,c,b){a=Jb(a)?a:{x:a,y:c,r:b};return this.createElement("circle").attr(a)},arc:function(a,c,b,d,e,f){if(Jb(a)){c=a.y;b=a.r;d=a.innerR;e=a.start;f=a.end;a=a.x}return this.symbol("arc",a||0,c||0,b||0,{innerR:d||0,start:e||0,end:f||0})},rect:function(a,c,b,d,e,f){if(arguments.length>1){var g=(f||0)%2/2;a=T(a||0)+g;c=T(c||0)+g;b=T((b||0)-2*g);d=T((d||0)-2*g)}g=Jb(a)?a:{x:a,y:c,width:Ca(b,0),height:Ca(d,0)};return this.createElement("rect").attr(oa(g,{rx:e||g.r,ry:e||g.r,fill:mb}))}, -setSize:function(a,c,b){var d=this.alignedObjects,e=d.length;this.width=a;this.height=c;for(this.boxWrapper[y(b,true)?"animate":"attr"]({width:a,height:c});e--;)d[e].align()},g:function(a){return this.createElement("g").attr(M(a)&&{"class":Zb+a})},image:function(a,c,b,d,e){var f={preserveAspectRatio:mb};arguments.length>1&&oa(f,{x:c,y:b,width:d,height:e});f=this.createElement("image").attr(f);f.element.setAttributeNS("http://www.w3.org/1999/xlink","href",a);return f},symbol:function(a,c,b,d,e){var f, -g=this.symbols[a];g=g&&g(c,b,d,e);var i=/^url\((.*?)\)$/;if(g){f=this.path(g);oa(f,{symbolName:a,x:c,y:b,r:d});e&&oa(f,e)}else if(i.test(a)){a=a.match(i)[1];f=this.image(a).attr({x:c,y:b});fb("img",{onload:function(){var j=ce[this.src]||[this.width,this.height];f.attr({width:j[0],height:j[1]}).translate(-T(j[0]/2),-T(j[1]/2))},src:a})}else f=this.circle(c,b,d);return f},symbols:{square:function(a,c,b){b=0.707*b;return[Wa,a-b,c-b,Aa,a+b,c-b,a+b,c+b,a-b,c+b,"Z"]},triangle:function(a,c,b){return[Wa, -a,c-1.33*b,Aa,a+b,c+0.67*b,a-b,c+0.67*b,"Z"]},"triangle-down":function(a,c,b){return[Wa,a,c+1.33*b,Aa,a-b,c-0.67*b,a+b,c-0.67*b,"Z"]},diamond:function(a,c,b){return[Wa,a,c-b,Aa,a+b,c,a,c+b,a-b,c,"Z"]},arc:function(a,c,b,d){var e=d.start,f=d.end-1.0E-6,g=d.innerR,i=ub(e),j=yb(e),k=ub(f);f=yb(f);d=d.end-e');if(c){b=c==Lb||c=="span"||c=="img"?b.join(""):a.prepVML(b);this.element=fb(b)}this.renderer=a},add:function(a){var c=this.renderer,b=this.element,d=c.box;d=a?a.element||a:d;a&&a.inverted&&c.invertChild(b,d);wc&&d.gVis==tb&&Ua(b,{visibility:tb});d.appendChild(b);this.added=true;this.alignOnAdd&&this.updateTransform();return this},attr:function(a,c){var b,d,e,f=this.element||{},g=f.style,i=f.nodeName,j=this.renderer,k=this.symbolName,n,z,K=this.shadows,ja=this;if(Ib(a)&&M(c)){b=a; -a={};a[b]=c}if(Ib(a)){b=a;ja=b=="strokeWidth"||b=="stroke-width"?this.strokeweight:this[b]}else for(b in a){d=a[b];n=false;if(k&&/^(x|y|r|start|end|width|height|innerR)/.test(b)){if(!z){this.symbolAttr(a);z=true}n=true}else if(b=="d"){d=d||[];this.d=d.join(" ");e=d.length;for(n=[];e--;)n[e]=bc(d[e])?T(d[e]*10)-5:d[e]=="Z"?"x":d[e];d=n.join(" ")||"x";f.path=d;if(K)for(e=K.length;e--;)K[e].path=d;n=true}else if(b=="zIndex"||b=="visibility"){if(wc&&b=="visibility"&&i=="DIV"){f.gVis=d;n=f.childNodes; -for(e=n.length;e--;)Ua(n[e],{visibility:d});if(d==Bb)d=null}if(d)g[b]=d;n=true}else if(/^(width|height)$/.test(b)){if(this.updateClipping){this[b]=d;this.updateClipping()}else g[b]=d;n=true}else if(/^(x|y)$/.test(b)){this[b]=d;if(f.tagName=="SPAN")this.updateTransform();else g[{x:"left",y:"top"}[b]]=d}else if(b=="class")f.className=d;else if(b=="stroke"){d=j.color(d,f,b);b="strokecolor"}else if(b=="stroke-width"||b=="strokeWidth"){f.stroked=d?true:false;b="strokeweight";this[b]=d;if(bc(d))d+=bb}else if(b== -"dashstyle"){(f.getElementsByTagName("stroke")[0]||fb(j.prepVML([""]),null,null,f))[b]=d||"solid";this.dashstyle=d;n=true}else if(b=="fill")if(i=="SPAN")g.color=d;else{f.filled=d!=mb?true:false;d=j.color(d,f,b);b="fillcolor"}else if(b=="translateX"||b=="translateY"||b=="rotation"||b=="align"){if(b=="align")b="textAlign";this[b]=d;this.updateTransform();n=true}else if(b=="text"){f.innerHTML=d;n=true}if(K&&b=="visibility")for(e=K.length;e--;)K[e].style[b]=d;if(!n)if(wc)f[b]=d;else ya(f,b,d)}return ja}, -clip:function(a){var c=a.members,b=c.length;c.push(this);this.destroyClip=function(){c.splice(b,1)};return this.css(a.getCSS(this.inverted))},css:function(a){Ua(this.element,a);return this},destroy:function(){this.destroyClip&&this.destroyClip();Fc.prototype.destroy.apply(this)},empty:function(){for(var a=this.element.childNodes,c=a.length,b;c--;){b=a[c];b.parentNode.removeChild(b)}},getBBox:function(){var a=this.element;if(a.nodeName=="text")a.style.position=lc;return{x:a.offsetLeft,y:a.offsetTop, -width:a.offsetWidth,height:a.offsetHeight}},on:function(a,c){this.element["on"+a]=function(){var b=rb.event;b.target=b.srcElement;c(b)};return this},updateTransform:function(){if(this.added){var a=this,c=a.element,b=a.translateX||0,d=a.translateY||0,e=a.x||0,f=a.y||0,g=a.rotation||0,i=g*Td,j=ub(i);i=yb(i);var k=a.textAlign||"left",n={right:1,center:2}[k],z=k&&k!="left";if(b||d)a.css({marginLeft:b,marginTop:d});a.inverted&&t(c.childNodes,function(K){a.renderer.invertChild(K,c)});if(c.tagName=="SPAN"){Ua(c, -{filter:g?["progid:DXImageTransform.Microsoft.Matrix(M11=",j,", M12=",-i,", M21=",i,", M22=",j,", sizingMethod='auto expand')"].join(""):mb});b=c.offsetWidth;d=c.offsetHeight;g=T(pa(c.style.fontSize||12)*1.2);e+=b*ab(j,0)+ab(i,0)*g;f+=d*ab(i,0)-Ca(j,0)*g;if(z){e-=b/n*j;f-=d/n*i}Ua(c,{textAlign:k,left:e,top:f})}}else this.alignOnAdd=true},shadow:function(a){var c=[],b=this.element,d=this.renderer,e,f=b.style,g,i=b.path;if(""+b.path==="")i="x";if(a){for(a=1;a<=3;a++){g=[''];e=fb(d.prepVML(g),null,{left:pa(f.left)+1,top:pa(f.top)+1});g=[''];fb(d.prepVML(g),null,null,e);b.parentNode.insertBefore(e,b);c.push(e)}this.shadows=c}return this}});Ja=function(){this.init.apply(this,arguments)};Ja.prototype=va(Sc.prototype,{isIE8:vc.indexOf("MSIE 8.0")>-1,init:function(a,c,b){var d;this.Element=fe;this.alignedObjects=[];d=this.createElement(Lb); -a.appendChild(d.element);this.box=d.element;this.boxWrapper=d;this.setSize(c,b,false);if(!Da.namespaces.hcv){Da.namespaces.add("hcv","urn:schemas-microsoft-com:vml");Da.createStyleSheet().cssText="hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke{ behavior:url(#default#VML); display: inline-block; } "}},clipRect:function(a,c,b,d){var e=this.createElement();return oa(e,{members:[],left:a,top:c,width:b,height:d,getCSS:function(f){var g=this.top,i=this.left,j=i+this.width,k=g+this.height;g={clip:"rect("+ -T(f?i:g)+"px,"+T(f?k:j)+"px,"+T(f?j:k)+"px,"+T(f?g:i)+"px)"};!f&&wc&&oa(g,{width:j+bb,height:k+bb});return g},updateClipping:function(){t(e.members,function(f){f.css(e.getCSS(f.inverted))})}})},color:function(a,c,b){var d,e=/^rgba/;if(a&&a.linearGradient){var f,g,i=a.linearGradient,j,k,n,z;t(a.stops,function(K,ja){if(e.test(K[1])){d=ac(K[1]);f=d.get("rgb");g=d.get("a")}else{f=K[1];g=1}if(ja){n=f;z=g}else{j=f;k=g}});a=90-Ra.atan((i[3]-i[1])/(i[2]-i[0]))*180/Ub;b=["<",b,' colors="0% ',j,",100% ",n, -'" angle="',a,'" opacity="',z,'" o:opacity2="',k,'" type="gradient" focus="100%" />'];fb(this.prepVML(b),null,null,c)}else if(e.test(a)&&c.tagName!="IMG"){d=ac(a);b=["<",b,' opacity="',d.get("a"),'"/>'];fb(this.prepVML(b),null,null,c);return d.get("rgb")}else return a},prepVML:function(a){var c=this.isIE8;a=a.join("");if(c){a=a.replace("/>",' xmlns="urn:schemas-microsoft-com:vml" />');a=a.indexOf('style="')==-1?a.replace("/>",' style="display:inline-block;behavior:url(#default#VML);" />'):a.replace('style="', -'style="display:inline-block;behavior:url(#default#VML);')}else a=a.replace("<","1&&f.css({left:c,top:b,width:d,height:e});return f},rect:function(a,c,b,d,e,f){if(arguments.length>1){var g=(f||0)%2/2;a=T(a||0)+g;c=T(c||0)+g;b=T((b||0)-2*g);d=T((d||0)-2*g)}if(Jb(a)){c=a.y;b=a.width;d=a.height;e=a.r;a=a.x}return this.symbol("rect",a||0,c||0,e||0,{width:b||0,height:d||0})},invertChild:function(a,c){var b=c.style;Ua(a,{flip:"x",left:pa(b.width)-10,top:pa(b.height)-10,rotation:-90})},symbols:{arc:function(a, -c,b,d){var e=d.start,f=d.end,g=ub(e),i=yb(e),j=ub(f),k=yb(f);d=d.innerR;if(f-e===0)return["x"];else if(f-e==2*Ub)j=-0.07/b;return["wa",a-b,c-b,a+b,c+b,a+b*g,c+b*i,a+b*j,c+b*k,"at",a-d,c-d,a+d,c+d,a+d*j,c+d*k,a+d*g,c+d*i,"x","e"]},circle:function(a,c,b){return["wa",a-b,c-b,a+b,c+b,a+b,c,a+b,c,"e"]},rect:function(a,c,b,d){var e=d.width;d=d.height;var f=a+e,g=c+d;b=ab(b,e,d);return[Wa,a+b,c,Aa,f-b,c,"wa",f-2*b,c,f,c+2*b,f-b,c,f,c+b,Aa,f,g-b,"wa",f-2*b,g-2*b,f,g,f,g-b,f-b,g,Aa,a+b,g,"wa",a,g-2*b,a+2* -b,g,a+b,g,a,g-b,Aa,a,c+b,"wa",a,c,a+2*b,c+2*b,a,c+b,a+b,c,"x","e"]}}})}var Qd=Tc?Sc:Ja;Hd.prototype.callbacks=[];var xc=function(){};xc.prototype={init:function(a,c){var b;this.series=a;this.applyOptions(c);this.pointAttr={};if(a.options.colorByPoint){b=a.chart.options.colors;if(!this.options)this.options={};this.color=this.options.color=this.color||b[Hb++];if(Hb>=b.length)Hb=0}a.chart.pointCount++;return this},applyOptions:function(a){var c=this.series;this.config=a;if(bc(a)||a===null)this.y=a;else if(Jb(a)&& -!bc(a.length)){oa(this,a);this.options=a}else if(Ib(a[0])){this.name=a[0];this.y=a[1]}else if(bc(a[0])){this.x=a[0];this.y=a[1]}if(this.x===Oa)this.x=c.autoIncrement()},destroy:function(){var a=this,c=a.series,b;c.chart.pointCount--;a==c.chart.hoverPoint&&a.onMouseOut();c.chart.hoverPoints=null;Cb(a);t(["graphic","tracker","group","dataLabel","connector"],function(d){a[d]&&a[d].destroy()});a.legendItem&&a.series.chart.legend.destroyItem(a);for(b in a)a[b]=null},select:function(a,c){var b=this,d=b.series.chart; -b.selected=a=y(a,!b.selected);b.firePointEvent(a?"select":"unselect");b.setState(a&&"select");c||t(d.getSelectedPoints(),function(e){if(e.selected&&e!=b){e.selected=false;e.setState(db);e.firePointEvent("unselect")}})},onMouseOver:function(){var a=this.series.chart,c=a.tooltip,b=a.hoverPoint;b&&b!=this&&b.onMouseOut();this.firePointEvent("mouseOver");c&&!c.shared&&c.refresh(this);this.setState(xb);a.hoverPoint=this},onMouseOut:function(){this.firePointEvent("mouseOut");this.setState();this.series.chart.hoverPoint= -null},update:function(a,c,b){var d=this,e=d.series,f=e.chart;Kb(b,f);c=y(c,true);d.firePointEvent("update",{options:a},function(){d.applyOptions(a);e.isDirty=true;c&&f.redraw()})},remove:function(a,c){var b=this,d=b.series,e=d.chart,f=d.data;Kb(c,e);a=y(a,true);b.firePointEvent("remove",null,function(){yc(f,b);b.destroy();d.isDirty=true;a&&e.redraw()})},firePointEvent:function(a,c,b){var d=this,e=this.series.options;if(e.point.events[a]||d.options&&d.options.events&&d.options.events[a])this.importEvents(); -if(a=="click"&&e.allowPointSelect)b=function(f){d.select(null,f.ctrlKey||f.metaKey||f.shiftKey)};Ia(this,a,c,b)},importEvents:function(){if(!this.hasImportedEvents){var a=va(this.series.options.point,this.options).events,c;this.events=a;for(c in a)Ma(this,c,a[c]);this.hasImportedEvents=true}},setState:function(a){var c=this.series,b=c.options.states,d=vb[c.type].marker&&c.options.marker,e=d&&!d.enabled,f=(d=d&&d.states[a])&&d.enabled===false,g=c.stateMarkerGraphic,i=c.chart,j=this.pointAttr;a||(a= -db);if(!(a==this.state||this.selected&&a!="select"||b[a]&&b[a].enabled===false||a&&(f||e&&!d.enabled))){if(this.graphic)this.graphic.attr(j[a]);else{if(a){if(!g)c.stateMarkerGraphic=g=i.renderer.circle(0,0,j[a].r).attr(j[a]).add(c.group);g.translate(this.plotX,this.plotY)}if(g)g[a?"show":"hide"]()}this.state=a}}};var lb=function(){};lb.prototype={isCartesian:true,type:"line",pointClass:xc,pointAttrToOptions:{stroke:"lineColor","stroke-width":"lineWidth",fill:"fillColor",r:"radius"},init:function(a, -c){var b,d;d=a.series.length;this.chart=a;c=this.setOptions(c);oa(this,{index:d,options:c,name:c.name||"Series "+(d+1),state:db,pointAttr:{},visible:c.visible!==false,selected:c.selected===true});d=c.events;for(b in d)Ma(this,b,d[b]);if(d&&d.click||c.point&&c.point.events&&c.point.events.click||c.allowPointSelect)a.runTrackerClick=true;this.getColor();this.getSymbol();this.setData(c.data,false)},autoIncrement:function(){var a=this.options,c=this.xIncrement;c=y(c,a.pointStart,0);this.pointInterval= -y(this.pointInterval,a.pointInterval,1);this.xIncrement=c+this.pointInterval;return c},cleanData:function(){var a=this.chart,c=this.data,b,d,e=a.smallestInterval,f,g;c.sort(function(i,j){return i.x-j.x});for(g=c.length-1;g>=0;g--)c[g-1]&&c[g-1].x==c[g].x&&c.splice(g-1,1);for(g=c.length-1;g>=0;g--)if(c[g-1]){f=c[g].x-c[g-1].x;if(d===Oa||fa+1&&c.push(b.slice(a+ -1,e));a=e}else e==b.length-1&&c.push(b.slice(a+1,e+1))});this.segments=c},setOptions:function(a){var c=this.chart.options.plotOptions;return va(c[this.type],c.series,a)},getColor:function(){var a=this.chart.options.colors;this.color=this.options.color||a[Hb++]||"#0000ff";if(Hb>=a.length)Hb=0},getSymbol:function(){var a=this.chart.options.symbols;this.symbol=this.options.marker.symbol||a[Vc++];if(Vc>=a.length)Vc=0},addPoint:function(a,c,b,d){var e=this.data,f=this.graph,g=this.area,i=this.chart;a= -(new this.pointClass).init(this,a);Kb(d,i);if(f&&b)f.shift=b;if(g){g.shift=b;g.isArea=true}c=y(c,true);e.push(a);b&&e[0].remove(false);this.isDirty=true;c&&i.redraw()},setData:function(a,c){var b=this,d=b.data,e=b.initialColor,f=b.chart,g=d&&d.length||0;b.xIncrement=null;if(M(e))Hb=e;for(a=jc(mc(a||[]),function(i){return(new b.pointClass).init(b,i)});g--;)d[g].destroy();b.data=a;b.cleanData();b.getSegments();b.isDirty=true;f.isDirtyBox=true;y(c,true)&&f.redraw(false)},remove:function(a,c){var b=this, -d=b.chart;a=y(a,true);if(!b.isRemoving){b.isRemoving=true;Ia(b,"remove",null,function(){b.destroy();d.isDirtyLegend=d.isDirtyBox=true;a&&d.redraw(c)})}b.isRemoving=false},translate:function(){for(var a=this.chart,c=this.options.stacking,b=this.xAxis.categories,d=this.yAxis,e=this.data,f=e.length;f--;){var g=e[f],i=g.x,j=g.y,k;k=d.stacks[(j<0?"-":"")+this.stackKey];g.plotX=this.xAxis.translate(i);if(c&&this.visible&&k[i]){k=k[i];i=k.total;k.cum=k=k.cum-j;j=k+j;if(c=="percent"){k=i?k*100/i:0;j=i?j* -100/i:0}g.percentage=i?g.y*100/i:0;g.stackTotal=i;g.yBottom=d.translate(k,0,1)}if(j!==null)g.plotY=d.translate(j,0,1);g.clientX=a.inverted?a.plotHeight-g.plotX:g.plotX;g.category=b&&b[g.x]!==Oa?b[g.x]:g.x}},setTooltipPoints:function(a){var c=this.chart,b=c.inverted,d=[],e=T((b?c.plotTop:c.plotLeft)+c.plotSizeX),f,g,i=[];if(a)this.tooltipPoints=null;t(this.segments,function(j){d=d.concat(j)});if(this.xAxis&&this.xAxis.reversed)d=d.reverse();t(d,function(j,k){f=d[k-1]?d[k-1].high+1:0;for(g=j.high=d[k+ -1]?Mb((j.plotX+(d[k+1]?d[k+1].plotX:e))/2):e;f<=g;)i[b?e-f++:f++]=j});this.tooltipPoints=i},onMouseOver:function(){var a=this.chart,c=a.hoverSeries;if(!(!Gb&&a.mouseIsDown)){c&&c!=this&&c.onMouseOut();this.options.events.mouseOver&&Ia(this,"mouseOver");this.tracker&&this.tracker.toFront();this.setState(xb);a.hoverSeries=this}},onMouseOut:function(){var a=this.options,c=this.chart,b=c.tooltip,d=c.hoverPoint;d&&d.onMouseOut();this&&a.events.mouseOut&&Ia(this,"mouseOut");b&&!a.stickyTracking&&b.hide(); -this.setState();c.hoverSeries=null},animate:function(a){var c=this,b=c.chart,d=c.clipRect,e=c.options.animation;if(e&&!Jb(e))e={};if(a){if(!d.isAnimating){d.attr("width",0);d.isAnimating=true}}else{d.animate({width:b.plotSizeX},e&&oa(e,{complete:function(){d.isAnimating=false;if(d!=b.clipRect){c.group.clip(c.clipRect=b.clipRect);d.destroy()}}}));this.animate=null}},drawPoints:function(){var a,c=this.data,b=this.chart,d,e,f,g,i,j;if(this.options.marker.enabled)for(f=c.length;f--;){g=c[f];d=g.plotX; -e=g.plotY;j=g.graphic;if(e!==Oa&&!isNaN(e)){a=g.pointAttr[g.selected?"select":db];i=a.r;if(j)j.animate({x:d,y:e,r:i});else g.graphic=b.renderer.symbol(y(g.marker&&g.marker.symbol,this.symbol),d,e,i).attr(a).add(this.group)}}},convertAttribs:function(a,c,b,d){var e=this.pointAttrToOptions,f,g,i={};a=a||{};c=c||{};b=b||{};d=d||{};for(f in e){g=e[f];i[f]=y(a[g],c[f],b[f],d[f])}return i},getAttribs:function(){var a=this,c=vb[a.type].marker?a.options.marker:a.options,b=c.states,d=b[xb],e,f={},g=a.color, -i=a.data,j=[],k,n=a.pointAttrToOptions;if(a.options.marker){f={stroke:g,fill:g};d.radius=d.radius||c.radius+2;d.lineWidth=d.lineWidth||c.lineWidth+1}else{f={fill:g};d.color=d.color||ac(d.color||g).brighten(d.brightness).get()}j[db]=a.convertAttribs(c,f);t([xb,"select"],function(K){j[K]=a.convertAttribs(b[K],j[db])});a.pointAttr=j;for(f=i.length;f--;){g=i[f];if((c=g.options&&g.options.marker||g.options)&&c.enabled===false)c.radius=0;e=false;if(g.options)for(var z in n)if(M(c[n[z]]))e=true;if(e){k= -[];b=c.states||{};e=b[xb]=b[xb]||{};if(!a.options.marker)e.color=ac(e.color||g.options.color).brighten(e.brightness||d.brightness).get();k[db]=a.convertAttribs(c,j[db]);k[xb]=a.convertAttribs(b[xb],j[xb],k[db]);k.select=a.convertAttribs(b.select,j.select,k[db])}else k=j;g.pointAttr=k}},destroy:function(){var a=this,c=a.chart,b=/\/5[0-9\.]+ Safari\//.test(vc),d,e;Cb(a);a.legendItem&&a.chart.legend.destroyItem(a);t(a.data,function(f){f.destroy()});t(["area","graph","dataLabelsGroup","group","tracker"], -function(f){if(a[f]){d=b&&f=="group"?"hide":"destroy";a[f][d]()}});if(c.hoverSeries==a)c.hoverSeries=null;yc(c.series,a);for(e in a)delete a[e]},drawDataLabels:function(){if(this.options.dataLabels.enabled){var a=this,c,b,d=a.data,e=a.options.dataLabels,f,g=a.dataLabelsGroup,i=a.chart,j=i.inverted,k=a.type,n;if(!g)g=a.dataLabelsGroup=i.renderer.g(Zb+"data-labels").attr({visibility:a.visible?Bb:tb,zIndex:5}).translate(i.plotLeft,i.plotTop).add();n=e.color;if(n=="auto")n=null;e.style.color=y(n,a.color); -t(d,function(z){var K=y(z.barX,z.plotX,-999),ja=y(z.plotY,-999),$=z.dataLabel,ga=e.align;f=e.formatter.call({x:z.x,y:z.y,series:a,point:z,percentage:z.percentage,total:z.total||z.stackTotal});c=(j?i.plotWidth-ja:K)+e.x;b=(j?i.plotHeight-K:ja)+e.y;if(k=="column")c+={center:z.barW/2,right:z.barW}[ga]||0;if($)$.animate({x:c,y:b});else if(f)z.dataLabel=i.renderer.text(f,c,b).attr({align:ga,rotation:e.rotation,zIndex:1}).css(e.style).add(g)})}},drawGraph:function(){var a=this,c=a.options,b=a.graph,d=[], -e,f=a.area,g=a.group,i=c.lineColor||a.color,j=c.lineWidth,k=c.dashStyle,n,z=a.chart.renderer,K=a.yAxis.getThreshold(c.threshold||0),ja=/^area/.test(a.type),$=[],ga=[];t(a.segments,function(u){n=[];t(u,function(ca,na){if(a.getPointSpline)n.push.apply(n,a.getPointSpline(u,ca,na));else{n.push(na?Aa:Wa);na&&c.step&&n.push(ca.plotX,u[na-1].plotY);n.push(ca.plotX,ca.plotY)}});if(u.length>1)d=d.concat(n);else $.push(u[0]);if(ja){var N=[],ka,Na=n.length;for(ka=0;ka=0;ka--)N.push(u[ka].plotX,u[ka].yBottom);else N.push(Aa,u[u.length-1].plotX,K,Aa,u[0].plotX,K);ga=ga.concat(N)}});a.graphPath=d;a.singlePoints=$;if(ja){e=y(c.fillColor,ac(a.color).setOpacity(c.fillOpacity||0.75).get());if(f)f.animate({d:ga});else a.area=a.chart.renderer.path(ga).attr({fill:e}).add(g)}if(b)b.animate({d:d});else if(j){b={stroke:i,"stroke-width":j};if(k)b.dashstyle=k;a.graph=z.path(d).attr(b).add(g).shadow(c.shadow)}}, -render:function(){var a=this.chart,c,b,d=this.options,e=d.animation&&this.animate;b=a.renderer;if(!this.clipRect){this.clipRect=!a.hasRendered&&a.clipRect?a.clipRect:b.clipRect(0,0,a.plotSizeX,a.plotSizeY);if(!a.clipRect)a.clipRect=this.clipRect}if(!this.group){c=this.group=b.g("series");if(a.inverted){b=function(){c.attr({width:a.plotWidth,height:a.plotHeight}).invert()};b();Ma(a,"resize",b)}c.clip(this.clipRect).attr({visibility:this.visible?Bb:tb,zIndex:d.zIndex}).translate(a.plotLeft,a.plotTop).add(a.seriesGroup)}this.drawDataLabels(); -e&&this.animate(true);this.getAttribs();this.drawGraph&&this.drawGraph();this.drawPoints();this.options.enableMouseTracking!==false&&this.drawTracker();e&&this.animate();this.isDirty=false},redraw:function(){var a=this.chart,c=this.group;if(c){a.inverted&&c.attr({width:a.plotWidth,height:a.plotHeight});c.animate({translateX:a.plotLeft,translateY:a.plotTop})}this.translate();this.setTooltipPoints(true);this.render()},setState:function(a){var c=this.options,b=this.graph,d=c.states;c=c.lineWidth;a=a|| -db;if(this.state!=a){this.state=a;if(!(d[a]&&d[a].enabled===false)){if(a)c=d[a].lineWidth||c+1;if(b&&!b.dashstyle)b.attr({"stroke-width":c},a?0:500)}}},setVisible:function(a,c){var b=this.chart,d=this.legendItem,e=this.group,f=this.tracker,g=this.dataLabelsGroup,i,j=this.data,k=b.options.chart.ignoreHiddenSeries;i=this.visible;i=(this.visible=a=a===Oa?!i:a)?"show":"hide";e&&e[i]();if(f)f[i]();else for(e=j.length;e--;){f=j[e];f.tracker&&f.tracker[i]()}g&&g[i]();d&&b.legend.colorizeItem(this,a);this.isDirty= -true;this.options.stacking&&t(b.series,function(n){if(n.options.stacking&&n.visible)n.isDirty=true});if(k)b.isDirtyBox=true;c!==false&&b.redraw();Ia(this,i)},show:function(){this.setVisible(true)},hide:function(){this.setVisible(false)},select:function(a){this.selected=a=a===Oa?!this.selected:a;if(this.checkbox)this.checkbox.checked=a;Ia(this,a?"select":"unselect")},drawTracker:function(){var a=this,c=a.options,b=[].concat(a.graphPath),d=b.length,e=a.chart,f=e.options.tooltip.snap,g=a.tracker,i=c.cursor; -i=i&&{cursor:i};var j=a.singlePoints,k;if(d)for(k=d+1;k--;){b[k]==Wa&&b.splice(k+1,0,b[k+1]-f,b[k+2],Aa);if(k&&b[k]==Wa||k==d)b.splice(k,0,Aa,b[k-2]+f,b[k-1])}for(k=0;ka&&j>e){j=Ca(a,e);n=2*e-j}else if(jg&&n>e){n=Ca(g,e);j=2*e-n}else if(nu?Na-u:ga-(ka<=ga?u:0)}jb=na-3}oa(N,{barX:ca,barY:na,barW:ja,barH:Za});N.shapeType="rect";N.shapeArgs={x:ca,y:na,width:ja,height:Za,r:j.borderRadius};N.trackerArgs=M(jb)&&va(N.shapeArgs,{height:Ca(6,Za+3),y:jb})})},getSymbol:function(){},drawGraph:function(){},drawPoints:function(){var a= -this,c=a.options,b=a.chart.renderer,d,e;t(a.data,function(f){var g=f.plotY;if(g!==Oa&&!isNaN(g)){d=f.graphic;e=f.shapeArgs;if(d){Qc(d);d.animate(e)}else f.graphic=b[f.shapeType](e).attr(f.pointAttr[f.selected?"select":db]).add(a.group).shadow(c.shadow)}})},drawTracker:function(){var a=this,c=a.chart,b=c.renderer,d,e,f=+new Date,g=a.options.cursor,i=g&&{cursor:g},j;t(a.data,function(k){e=k.tracker;d=k.trackerArgs||k.shapeArgs;if(k.y!==null)if(e)e.attr(d);else k.tracker=b[k.shapeType](d).attr({isTracker:f, -fill:Ud,visibility:a.visible?Bb:tb,zIndex:1}).on(Gb?"touchstart":"mouseover",function(n){j=n.relatedTarget||n.fromElement;c.hoverSeries!=a&&ya(j,"isTracker")!=f&&a.onMouseOver();k.onMouseOver()}).on("mouseout",function(n){if(!a.options.stickyTracking){j=n.relatedTarget||n.toElement;ya(j,"isTracker")!=f&&a.onMouseOut()}}).css(i).add(c.trackerGroup)})},animate:function(a){var c=this,b=c.data;if(!a){t(b,function(d){var e=d.graphic;if(e){e.attr({height:0,y:c.yAxis.translate(0,0,1)});e.animate({height:d.barH, -y:d.barY},c.options.animation)}});c.animate=null}},remove:function(){var a=this,c=a.chart;c.hasRendered&&t(c.series,function(b){if(b.type==a.type)b.isDirty=true});lb.prototype.remove.apply(a,arguments)}});sb.column=Yc;Ja=wb(Yc,{type:"bar",init:function(a){a.inverted=this.inverted=true;Yc.prototype.init.apply(this,arguments)}});sb.bar=Ja;Ja=wb(lb,{type:"scatter",translate:function(){var a=this;lb.prototype.translate.apply(a);t(a.data,function(c){c.shapeType="circle";c.shapeArgs={x:c.plotX,y:c.plotY, -r:a.chart.options.tooltip.snap}})},drawTracker:function(){var a=this,c=a.options.cursor,b=c&&{cursor:c},d;t(a.data,function(e){(d=e.graphic)&&d.attr({isTracker:true}).on("mouseover",function(){a.onMouseOver();e.onMouseOver()}).on("mouseout",function(){a.options.stickyTracking||a.onMouseOut()}).css(b)})},cleanData:function(){}});sb.scatter=Ja;Ja=wb(xc,{init:function(){xc.prototype.init.apply(this,arguments);var a=this,c;oa(a,{visible:a.visible!==false,name:y(a.name,"Slice")});c=function(){a.slice()}; -Ma(a,"select",c);Ma(a,"unselect",c);return a},setVisible:function(a){var c=this.series.chart,b=this.tracker,d=this.dataLabel,e=this.connector,f;f=(this.visible=a=a===Oa?!this.visible:a)?"show":"hide";this.group[f]();b&&b[f]();d&&d[f]();e&&e[f]();this.legendItem&&c.legend.colorizeItem(this,a)},slice:function(a,c,b){var d=this.series.chart,e=this.slicedTranslation;Kb(b,d);y(c,true);a=this.sliced=M(a)?a:!this.sliced;this.group.animate({translateX:a?e[0]:d.plotLeft,translateY:a?e[1]:d.plotTop})}});Ja= -wb(lb,{type:"pie",isCartesian:false,pointClass:Ja,pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color"},getColor:function(){this.initialColor=Hb},animate:function(){var a=this;t(a.data,function(c){var b=c.graphic;c=c.shapeArgs;var d=-Ub/2;if(b){b.attr({r:0,start:d,end:d});b.animate({r:c.r,start:c.start,end:c.end},a.options.animation)}});a.animate=null},translate:function(){var a=0,c=-0.25,b=this.options,d=b.slicedOffset,e=d+b.borderWidth,f=b.center,g=this.chart,i=g.plotWidth, -j=g.plotHeight,k,n,z,K=this.data,ja=2*Ub,$,ga=ab(i,j),u,N,ka,Na=b.dataLabels.distance;f.push(b.size,b.innerSize||0);f=jc(f,function(ca,na){return(u=/%$/.test(ca))?[i,j,ga,ga][na]*pa(ca)/100:ca});this.getX=function(ca,na){z=Ra.asin((ca-f[1])/(f[2]/2+Na));return f[0]+(na?-1:1)*ub(z)*(f[2]/2+Na)};this.center=f;t(K,function(ca){a+=ca.y});t(K,function(ca){$=a?ca.y/a:0;k=c*ja;c+=$;n=c*ja;ca.shapeType="arc";ca.shapeArgs={x:f[0],y:f[1],r:f[2]/2,innerR:f[3]/2,start:k,end:n};z=(n+k)/2;ca.slicedTranslation= -jc([ub(z)*d+g.plotLeft,yb(z)*d+g.plotTop],T);N=ub(z)*f[2]/2;ka=yb(z)*f[2]/2;ca.tooltipPos=[f[0]+N*0.7,f[1]+ka*0.7];ca.labelPos=[f[0]+N+ub(z)*Na,f[1]+ka+yb(z)*Na,f[0]+N+ub(z)*e,f[1]+ka+yb(z)*e,f[0]+N,f[1]+ka,Na<0?"center":z0,k,n,z=this.center[1],K=[[],[],[],[]],ja,$,ga,u,N,ka,Na,ca=4,na;lb.prototype.drawDataLabels.apply(this);t(a,function(Za){var jb=Za.labelPos[7];K[jb<0?0:jbjb.y};ca--;){a=0;c=[].concat(K[ca]);c.sort(Na);for(na=c.length;na--;)c[na].rank=na;for(u=0;u<2;u++){n=(ka=ca%3)?9999:-9999;N=ka?-1:1;for(na=0;nan-k){$=n+N*k;ja=this.getX($,ca>1);if(!ka&&$+k>z||ka&&$-kthis.window.xMax)isInRange=false;return isInRange}return true};this.onUpdate=function(callback){this.updateCallbacks.push(callback)};this.registerRenderer=function(renderer){this._renderers=this._renderers||{};this._renderers[renderer.name]=renderer};this.configure=function(args){if(args.width||args.height){this.setSize(args)}Rickshaw.keys(this.defaults).forEach(function(k){this[k]=k in args?args[k]:k in this?this[k]:this.defaults[k]},this);this.setRenderer(args.renderer||this.renderer.name,args)};this.setRenderer=function(name,args){if(!this._renderers[name]){throw"couldn't find renderer "+name}this.renderer=this._renderers[name];if(typeof args=="object"){this.renderer.configure(args)}};this.setSize=function(args){args=args||{};if(typeof window!==undefined){var style=window.getComputedStyle(this.element,null);var elementWidth=parseInt(style.getPropertyValue("width"));var elementHeight=parseInt(style.getPropertyValue("height"))}this.width=args.width||elementWidth||400;this.height=args.height||elementHeight||250;this.vis&&this.vis.attr("width",this.width).attr("height",this.height)};this.initialize(args)};Rickshaw.namespace("Rickshaw.Fixtures.Color");Rickshaw.Fixtures.Color=function(){this.schemes={};this.schemes.spectrum14=["#ecb796","#dc8f70","#b2a470","#92875a","#716c49","#d2ed82","#bbe468","#a1d05d","#e7cbe6","#d8aad6","#a888c2","#9dc2d3","#649eb9","#387aa3"].reverse();this.schemes.spectrum2000=["#57306f","#514c76","#646583","#738394","#6b9c7d","#84b665","#a7ca50","#bfe746","#e2f528","#fff726","#ecdd00","#d4b11d","#de8800","#de4800","#c91515","#9a0000","#7b0429","#580839","#31082b"];this.schemes.spectrum2001=["#2f243f","#3c2c55","#4a3768","#565270","#6b6b7c","#72957f","#86ad6e","#a1bc5e","#b8d954","#d3e04e","#ccad2a","#cc8412","#c1521d","#ad3821","#8a1010","#681717","#531e1e","#3d1818","#320a1b"];this.schemes.classic9=["#423d4f","#4a6860","#848f39","#a2b73c","#ddcb53","#c5a32f","#7d5836","#963b20","#7c2626","#491d37","#2f254a"].reverse();this.schemes.httpStatus={503:"#ea5029",502:"#d23f14",500:"#bf3613",410:"#efacea",409:"#e291dc",403:"#f457e8",408:"#e121d2",401:"#b92dae",405:"#f47ceb",404:"#a82a9f",400:"#b263c6",301:"#6fa024",302:"#87c32b",307:"#a0d84c",304:"#28b55c",200:"#1a4f74",206:"#27839f",201:"#52adc9",202:"#7c979f",203:"#a5b8bd",204:"#c1cdd1"};this.schemes.colorwheel=["#b5b6a9","#858772","#785f43","#96557e","#4682b4","#65b9ac","#73c03a","#cb513a"].reverse();this.schemes.cool=["#5e9d2f","#73c03a","#4682b4","#7bc3b8","#a9884e","#c1b266","#a47493","#c09fb5"];this.schemes.munin=["#00cc00","#0066b3","#ff8000","#ffcc00","#330099","#990099","#ccff00","#ff0000","#808080","#008f00","#00487d","#b35a00","#b38f00","#6b006b","#8fb300","#b30000","#bebebe","#80ff80","#80c9ff","#ffc080","#ffe680","#aa80ff","#ee00cc","#ff8080","#666600","#ffbfff","#00ffcc","#cc6699","#999900"]};Rickshaw.namespace("Rickshaw.Fixtures.RandomData");Rickshaw.Fixtures.RandomData=function(timeInterval){var addData;timeInterval=timeInterval||1;var lastRandomValue=200;var timeBase=Math.floor((new Date).getTime()/1e3);this.addData=function(data){var randomValue=Math.random()*100+15+lastRandomValue;var index=data[0].length;var counter=1;data.forEach(function(series){var randomVariance=Math.random()*20;var v=randomValue/25+counter++ +(Math.cos(index*counter*11/960)+2)*15+(Math.cos(index/7)+2)*7+(Math.cos(index/17)+2)*1;series.push({x:index*timeInterval+timeBase,y:v+randomVariance})});lastRandomValue=randomValue*.85}};Rickshaw.namespace("Rickshaw.Fixtures.Time");Rickshaw.Fixtures.Time=function(){var tzOffset=(new Date).getTimezoneOffset()*60;var self=this;this.months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];this.units=[{name:"decade",seconds:86400*365.25*10,formatter:function(d){return parseInt(d.getUTCFullYear()/10)*10}},{name:"year",seconds:86400*365.25,formatter:function(d){return d.getUTCFullYear()}},{name:"month",seconds:86400*30.5,formatter:function(d){return self.months[d.getUTCMonth()]}},{name:"week",seconds:86400*7,formatter:function(d){return self.formatDate(d)}},{name:"day",seconds:86400,formatter:function(d){return d.getUTCDate()}},{name:"6 hour",seconds:3600*6,formatter:function(d){return self.formatTime(d)}},{name:"hour",seconds:3600,formatter:function(d){return self.formatTime(d)}},{name:"15 minute",seconds:60*15,formatter:function(d){return self.formatTime(d)}},{name:"minute",seconds:60,formatter:function(d){return d.getUTCMinutes()}},{name:"15 second",seconds:15,formatter:function(d){return d.getUTCSeconds()+"s"}},{name:"second",seconds:1,formatter:function(d){return d.getUTCSeconds()+"s"}}];this.unit=function(unitName){return this.units.filter(function(unit){return unitName==unit.name}).shift()};this.formatDate=function(d){return d.toUTCString().match(/, (\w+ \w+ \w+)/)[1]};this.formatTime=function(d){return d.toUTCString().match(/(\d+:\d+):/)[1]};this.ceil=function(time,unit){if(unit.name=="month"){var nearFuture=new Date((time+unit.seconds-1)*1e3);var rounded=new Date(0);rounded.setUTCFullYear(nearFuture.getUTCFullYear());rounded.setUTCMonth(nearFuture.getUTCMonth());rounded.setUTCDate(1);rounded.setUTCHours(0);rounded.setUTCMinutes(0);rounded.setUTCSeconds(0);rounded.setUTCMilliseconds(0);return rounded.getTime()/1e3}if(unit.name=="year"){var nearFuture=new Date((time+unit.seconds-1)*1e3);var rounded=new Date(0);rounded.setUTCFullYear(nearFuture.getUTCFullYear());rounded.setUTCMonth(0);rounded.setUTCDate(1);rounded.setUTCHours(0);rounded.setUTCMinutes(0);rounded.setUTCSeconds(0);rounded.setUTCMilliseconds(0);return rounded.getTime()/1e3}return Math.ceil(time/unit.seconds)*unit.seconds}};Rickshaw.namespace("Rickshaw.Fixtures.Number");Rickshaw.Fixtures.Number.formatKMBT=function(y){abs_y=Math.abs(y);if(abs_y>=1e12){return y/1e12+"T"}else if(abs_y>=1e9){return y/1e9+"B"}else if(abs_y>=1e6){return y/1e6+"M"}else if(abs_y>=1e3){return y/1e3+"K"}else if(abs_y<1&&y>0){return y.toFixed(2)}else if(abs_y==0){return""}else{return y}};Rickshaw.Fixtures.Number.formatBase1024KMGTP=function(y){abs_y=Math.abs(y);if(abs_y>=0x4000000000000){return y/0x4000000000000+"P"}else if(abs_y>=1099511627776){return y/1099511627776+"T"}else if(abs_y>=1073741824){return y/1073741824+"G"}else if(abs_y>=1048576){return y/1048576+"M"}else if(abs_y>=1024){return y/1024+"K"}else if(abs_y<1&&y>0){return y.toFixed(2)}else if(abs_y==0){return""}else{return y}};Rickshaw.namespace("Rickshaw.Color.Palette");Rickshaw.Color.Palette=function(args){var color=new Rickshaw.Fixtures.Color;args=args||{};this.schemes={};this.scheme=color.schemes[args.scheme]||args.scheme||color.schemes.colorwheel;this.runningIndex=0;this.generatorIndex=0;if(args.interpolatedStopCount){var schemeCount=this.scheme.length-1;var i,j,scheme=[];for(i=0;iself.graph.x.range()[1]){if(annotation.element){annotation.line.classList.add("offscreen");annotation.element.style.display="none"}annotation.boxes.forEach(function(box){if(box.rangeElement)box.rangeElement.classList.add("offscreen")});return}if(!annotation.element){var element=annotation.element=document.createElement("div");element.classList.add("annotation");this.elements.timeline.appendChild(element);element.addEventListener("click",function(e){element.classList.toggle("active");annotation.line.classList.toggle("active");annotation.boxes.forEach(function(box){if(box.rangeElement)box.rangeElement.classList.toggle("active")})},false)}annotation.element.style.left=left+"px";annotation.element.style.display="block";annotation.boxes.forEach(function(box){var element=box.element;if(!element){element=box.element=document.createElement("div");element.classList.add("content");element.innerHTML=box.content;annotation.element.appendChild(element);annotation.line=document.createElement("div");annotation.line.classList.add("annotation_line");self.graph.element.appendChild(annotation.line);if(box.end){box.rangeElement=document.createElement("div");box.rangeElement.classList.add("annotation_range");self.graph.element.appendChild(box.rangeElement)}}if(box.end){var annotationRangeStart=left;var annotationRangeEnd=Math.min(self.graph.x(box.end),self.graph.x.range()[1]);if(annotationRangeStart>annotationRangeEnd){annotationRangeEnd=left;annotationRangeStart=Math.max(self.graph.x(box.end),self.graph.x.range()[0])}var annotationRangeWidth=annotationRangeEnd-annotationRangeStart;box.rangeElement.style.left=annotationRangeStart+"px";box.rangeElement.style.width=annotationRangeWidth+"px";box.rangeElement.classList.remove("offscreen")}annotation.line.classList.remove("offscreen");annotation.line.style.left=left+"px"})},this)};this.graph.onUpdate(function(){self.update()})};Rickshaw.namespace("Rickshaw.Graph.Axis.Time");Rickshaw.Graph.Axis.Time=function(args){var self=this;this.graph=args.graph;this.elements=[];this.ticksTreatment=args.ticksTreatment||"plain";this.fixedTimeUnit=args.timeUnit;var time=new Rickshaw.Fixtures.Time;this.appropriateTimeUnit=function(){var unit;var units=time.units;var domain=this.graph.x.domain();var rangeSeconds=domain[1]-domain[0];units.forEach(function(u){if(Math.floor(rangeSeconds/u.seconds)>=2){unit=unit||u}});return unit||time.units[time.units.length-1]};this.tickOffsets=function(){var domain=this.graph.x.domain();var unit=this.fixedTimeUnit||this.appropriateTimeUnit();var count=Math.ceil((domain[1]-domain[0])/unit.seconds);var runningTick=domain[0];var offsets=[];for(var i=0;iself.graph.x.range()[1])return;var element=document.createElement("div");element.style.left=self.graph.x(o.value)+"px";element.classList.add("x_tick");element.classList.add(self.ticksTreatment);var title=document.createElement("div");title.classList.add("title");title.innerHTML=o.unit.formatter(new Date(o.value*1e3));element.appendChild(title);self.graph.element.appendChild(element);self.elements.push(element)})};this.graph.onUpdate(function(){self.render()})};Rickshaw.namespace("Rickshaw.Graph.Axis.X");Rickshaw.Graph.Axis.X=function(args){var self=this;var berthRate=.1;this.initialize=function(args){this.graph=args.graph;this.orientation=args.orientation||"top";var pixelsPerTick=args.pixelsPerTick||75;this.ticks=args.ticks||Math.floor(this.graph.width/pixelsPerTick);this.tickSize=args.tickSize||4;this.ticksTreatment=args.ticksTreatment||"plain";if(args.element){this.element=args.element;this._discoverSize(args.element,args);this.vis=d3.select(args.element).append("svg:svg").attr("height",this.height).attr("width",this.width).attr("class","rickshaw_graph x_axis_d3");this.element=this.vis[0][0];this.element.style.position="relative";this.setSize({width:args.width,height:args.height})}else{this.vis=this.graph.vis}this.graph.onUpdate(function(){self.render()})};this.setSize=function(args){args=args||{};if(!this.element)return;this._discoverSize(this.element.parentNode,args);this.vis.attr("height",this.height).attr("width",this.width*(1+berthRate));var berth=Math.floor(this.width*berthRate/2);this.element.style.left=-1*berth+"px"};this.render=function(){if(this.graph.width!==this._renderWidth)this.setSize({auto:true});var axis=d3.svg.axis().scale(this.graph.x).orient(this.orientation);axis.tickFormat(args.tickFormat||function(x){return x});var berth=Math.floor(this.width*berthRate/2)||0;if(this.orientation=="top"){var yOffset=this.height||this.graph.height;var transform="translate("+berth+","+yOffset+")"}else{var transform="translate("+berth+", 0)"}if(this.element){this.vis.selectAll("*").remove()}this.vis.append("svg:g").attr("class",["x_ticks_d3",this.ticksTreatment].join(" ")).attr("transform",transform).call(axis.ticks(this.ticks).tickSubdivide(0).tickSize(this.tickSize));var gridSize=(this.orientation=="bottom"?1:-1)*this.graph.height;this.graph.vis.append("svg:g").attr("class","x_grid_d3").call(axis.ticks(this.ticks).tickSubdivide(0).tickSize(gridSize));this._renderHeight=this.graph.height};this._discoverSize=function(element,args){if(typeof window!=="undefined"){var style=window.getComputedStyle(element,null);var elementHeight=parseInt(style.getPropertyValue("height"));if(!args.auto){var elementWidth=parseInt(style.getPropertyValue("width"))}}this.width=(args.width||elementWidth||this.graph.width)*(1+berthRate);this.height=args.height||elementHeight||40};this.initialize(args)};Rickshaw.namespace("Rickshaw.Graph.Axis.Y");Rickshaw.Graph.Axis.Y=function(args){var self=this;var berthRate=.1;this.initialize=function(args){this.graph=args.graph;this.orientation=args.orientation||"right";var pixelsPerTick=args.pixelsPerTick||75;this.ticks=args.ticks||Math.floor(this.graph.height/pixelsPerTick);this.tickSize=args.tickSize||4;this.ticksTreatment=args.ticksTreatment||"plain";if(args.element){this.element=args.element;this.vis=d3.select(args.element).append("svg:svg").attr("class","rickshaw_graph y_axis");this.element=this.vis[0][0];this.element.style.position="relative";this.setSize({width:args.width,height:args.height})}else{this.vis=this.graph.vis}this.graph.onUpdate(function(){self.render()})};this.setSize=function(args){args=args||{};if(!this.element)return;if(typeof window!=="undefined"){var style=window.getComputedStyle(this.element.parentNode,null);var elementWidth=parseInt(style.getPropertyValue("width"));if(!args.auto){var elementHeight=parseInt(style.getPropertyValue("height"))}}this.width=args.width||elementWidth||this.graph.width*berthRate;this.height=args.height||elementHeight||this.graph.height;this.vis.attr("width",this.width).attr("height",this.height*(1+berthRate));var berth=this.height*berthRate;this.element.style.top=-1*berth+"px"};this.render=function(){if(this.graph.height!==this._renderHeight)this.setSize({auto:true});var axis=d3.svg.axis().scale(this.graph.y).orient(this.orientation);axis.tickFormat(args.tickFormat||function(y){return y});if(this.orientation=="left"){var berth=this.height*berthRate;var transform="translate("+this.width+", "+berth+")"}if(this.element){this.vis.selectAll("*").remove()}this.vis.append("svg:g").attr("class",["y_ticks",this.ticksTreatment].join(" ")).attr("transform",transform).call(axis.ticks(this.ticks).tickSubdivide(0).tickSize(this.tickSize));var gridSize=(this.orientation=="right"?1:-1)*this.graph.width;this.graph.vis.append("svg:g").attr("class","y_grid").call(axis.ticks(this.ticks).tickSubdivide(0).tickSize(gridSize));this._renderHeight=this.graph.height};this.initialize(args)};Rickshaw.namespace("Rickshaw.Graph.Behavior.Series.Highlight");Rickshaw.Graph.Behavior.Series.Highlight=function(args){this.graph=args.graph;this.legend=args.legend;var self=this;var colorSafe={};var activeLine=null;this.addHighlightEvents=function(l){l.element.addEventListener("mouseover",function(e){if(activeLine)return;else activeLine=l;self.legend.lines.forEach(function(line,index){if(l===line){if(index>0&&self.graph.renderer.unstack){var seriesIndex=self.graph.series.length-index-1;line.originalIndex=seriesIndex;var series=self.graph.series.splice(seriesIndex,1)[0];self.graph.series.push(series)}return}colorSafe[line.series.name]=colorSafe[line.series.name]||line.series.color;line.series.color=d3.interpolateRgb(line.series.color,d3.rgb("#d8d8d8"))(.8).toString()});self.graph.update()},false);l.element.addEventListener("mouseout",function(e){if(!activeLine)return;else activeLine=null;self.legend.lines.forEach(function(line){if(l===line&&line.hasOwnProperty("originalIndex")){var series=self.graph.series.pop();self.graph.series.splice(line.originalIndex,0,series);delete line["originalIndex"]}if(colorSafe[line.series.name]){line.series.color=colorSafe[line.series.name]}});self.graph.update()},false)};if(this.legend){this.legend.lines.forEach(function(l){self.addHighlightEvents(l)})}};Rickshaw.namespace("Rickshaw.Graph.Behavior.Series.Order");Rickshaw.Graph.Behavior.Series.Order=function(args){this.graph=args.graph;this.legend=args.legend;var self=this;$(function(){$(self.legend.list).sortable({containment:"parent",tolerance:"pointer",update:function(event,ui){var series=[];$(self.legend.list).find("li").each(function(index,item){if(!item.series)return;series.push(item.series)});for(var i=self.graph.series.length-1;i>=0;i--){self.graph.series[i]=series.shift()}self.graph.update()}});$(self.legend.list).disableSelection()});this.graph.onUpdate(function(){var h=window.getComputedStyle(self.legend.element).height;self.legend.element.style.height=h})};Rickshaw.namespace("Rickshaw.Graph.Behavior.Series.Toggle");Rickshaw.Graph.Behavior.Series.Toggle=function(args){this.graph=args.graph;this.legend=args.legend;var self=this;this.addAnchor=function(line){var anchor=document.createElement("a");anchor.innerHTML="✔";anchor.classList.add("action");line.element.insertBefore(anchor,line.element.firstChild);anchor.onclick=function(e){if(line.series.disabled){line.series.enable();line.element.classList.remove("disabled")}else{line.series.disable();line.element.classList.add("disabled")}};var label=line.element.getElementsByTagName("span")[0];label.onclick=function(e){var disableAllOtherLines=line.series.disabled;if(!disableAllOtherLines){for(var i=0;idomainX){dataIndex=i;break}if(data[i+1].x<=domainX){i++}else{i--}}var value=data[dataIndex];var distance=Math.sqrt(Math.pow(Math.abs(graph.x(value.x)-eventX),2)+Math.pow(Math.abs(graph.y(value.y+value.y0)-eventY),2));var xFormatter=series.xFormatter||this.xFormatter;var yFormatter=series.yFormatter||this.yFormatter;var point={formattedXValue:xFormatter(value.x),formattedYValue:yFormatter(value.y),series:series,value:value,distance:distance,order:j,name:series.name};if(!nearestPoint||distanceyMax)yMax=y});if(series[0].xxMax)xMax=series[series.length-1].x});xMin-=(xMax-xMin)*this.padding.left;xMax+=(xMax-xMin)*this.padding.right;yMin=this.graph.min==="auto"?yMin:this.graph.min||0;yMax=this.graph.max||yMax;if(this.graph.min==="auto"||yMin<0){yMin-=(yMax-yMin)*this.padding.bottom}if(this.graph.max===undefined){yMax+=(yMax-yMin)*this.padding.top}return{x:[xMin,xMax],y:[yMin,yMax]}},render:function(){var graph=this.graph;graph.vis.selectAll("*").remove();var nodes=graph.vis.selectAll("path").data(this.graph.stackedData).enter().append("svg:path").attr("d",this.seriesPathFactory());var i=0;graph.series.forEach(function(series){if(series.disabled)return;series.path=nodes[0][i++];this._styleSeries(series)},this)},_styleSeries:function(series){var fill=this.fill?series.color:"none";var stroke=this.stroke?series.color:"none";series.path.setAttribute("fill",fill);series.path.setAttribute("stroke",stroke);series.path.setAttribute("stroke-width",this.strokeWidth);series.path.setAttribute("class",series.className)},configure:function(args){args=args||{};Rickshaw.keys(this.defaults()).forEach(function(key){if(!args.hasOwnProperty(key)){this[key]=this[key]||this.graph[key]||this.defaults()[key];return}if(typeof this.defaults()[key]=="object"){Rickshaw.keys(this.defaults()[key]).forEach(function(k){this[key][k]=args[key][k]!==undefined?args[key][k]:this[key][k]!==undefined?this[key][k]:this.defaults()[key][k]},this)}else{this[key]=args[key]!==undefined?args[key]:this[key]!==undefined?this[key]:this.graph[key]!==undefined?this.graph[key]:this.defaults()[key]}},this)},setStrokeWidth:function(strokeWidth){if(strokeWidth!==undefined){this.strokeWidth=strokeWidth}},setTension:function(tension){if(tension!==undefined){this.tension=tension}}});Rickshaw.namespace("Rickshaw.Graph.Renderer.Line");Rickshaw.Graph.Renderer.Line=Rickshaw.Class.create(Rickshaw.Graph.Renderer,{name:"line",defaults:function($super){return Rickshaw.extend($super(),{unstack:true,fill:false,stroke:true})},seriesPathFactory:function(){var graph=this.graph;var factory=d3.svg.line().x(function(d){return graph.x(d.x)}).y(function(d){return graph.y(d.y)}).interpolate(this.graph.interpolation).tension(this.tension);factory.defined&&factory.defined(function(d){return d.y!==null});return factory}});Rickshaw.namespace("Rickshaw.Graph.Renderer.Stack");Rickshaw.Graph.Renderer.Stack=Rickshaw.Class.create(Rickshaw.Graph.Renderer,{name:"stack",defaults:function($super){return Rickshaw.extend($super(),{fill:true,stroke:false,unstack:false})},seriesPathFactory:function(){var graph=this.graph;var factory=d3.svg.area().x(function(d){return graph.x(d.x)}).y0(function(d){return graph.y(d.y0)}).y1(function(d){return graph.y(d.y+d.y0)}).interpolate(this.graph.interpolation).tension(this.tension);factory.defined&&factory.defined(function(d){return d.y!==null});return factory}});Rickshaw.namespace("Rickshaw.Graph.Renderer.Bar");Rickshaw.Graph.Renderer.Bar=Rickshaw.Class.create(Rickshaw.Graph.Renderer,{name:"bar",defaults:function($super){var defaults=Rickshaw.extend($super(),{gapSize:.05,unstack:false});delete defaults.tension;return defaults},initialize:function($super,args){args=args||{};this.gapSize=args.gapSize||this.gapSize;$super(args)},domain:function($super){var domain=$super();var frequentInterval=this._frequentInterval();domain.x[1]+=parseInt(frequentInterval.magnitude);return domain},barWidth:function(){var stackedData=this.graph.stackedData||this.graph.stackData();var data=stackedData.slice(-1).shift();var frequentInterval=this._frequentInterval();var barWidth=this.graph.x(data[0].x+frequentInterval.magnitude*(1-this.gapSize));return barWidth},render:function(){var graph=this.graph;graph.vis.selectAll("*").remove();var barWidth=this.barWidth();var barXOffset=0;var activeSeriesCount=graph.series.filter(function(s){return!s.disabled}).length;var seriesBarWidth=this.unstack?barWidth/activeSeriesCount:barWidth;var transform=function(d){var matrix=[1,0,0,d.y<0?-1:1,0,d.y<0?graph.y.magnitude(Math.abs(d.y))*2:0];return"matrix("+matrix.join(",")+")"};graph.series.forEach(function(series){if(series.disabled)return;var nodes=graph.vis.selectAll("path").data(series.stack.filter(function(d){return d.y!==null})).enter().append("svg:rect").attr("x",function(d){return graph.x(d.x)+barXOffset}).attr("y",function(d){return graph.y(d.y0+Math.abs(d.y))*(d.y<0?-1:1)}).attr("width",seriesBarWidth).attr("height",function(d){return graph.y.magnitude(Math.abs(d.y))}).attr("transform",transform);Array.prototype.forEach.call(nodes[0],function(n){n.setAttribute("fill",series.color)});if(this.unstack)barXOffset+=seriesBarWidth},this)},_frequentInterval:function(){var stackedData=this.graph.stackedData||this.graph.stackData();var data=stackedData.slice(-1).shift();var intervalCounts={};for(var i=0;i0){this[0].data.forEach(function(plot){item.data.push({x:plot.x,y:0})})}else if(item.data.length==0){item.data.push({x:this.timeBase-(this.timeInterval||0),y:0})}this.push(item);if(this.legend){this.legend.addLine(this.itemByName(item.name))}},addData:function(data){var index=this.getIndex();Rickshaw.keys(data).forEach(function(name){if(!this.itemByName(name)){this.addItem({name:name})}},this);this.forEach(function(item){item.data.push({x:(index*this.timeInterval||1)+this.timeBase,y:data[item.name]||0})},this)},getIndex:function(){return this[0]&&this[0].data&&this[0].data.length?this[0].data.length:0},itemByName:function(name){for(var i=0;i0;i--){this.currentSize+=1;this.currentIndex+=1;this.forEach(function(item){item.data.unshift({x:((i-1)*this.timeInterval||1)+this.timeBase,y:0,i:i})},this)}}},addData:function($super,data){$super(data);this.currentSize+=1;this.currentIndex+=1;if(this.maxDataPoints!==undefined){while(this.currentSize>this.maxDataPoints){this.dropData()}}},dropData:function(){this.forEach(function(item){item.data.splice(0,1)});this.currentSize-=1},getIndex:function(){return this.currentIndex}}); \ No newline at end of file diff --git a/src/utils_cgi.c b/src/utils_cgi.c index f4d3e52..f7ff84d 100644 --- a/src/utils_cgi.c +++ b/src/utils_cgi.c @@ -688,9 +688,12 @@ int html_print_page (const char *title, /* {{{ */ " \n" " %s\n" " \n" + " \n" " \n" - " \n" + " \n" " \n"