Comparing version 0.5.7 to 1.0.0
@@ -1,5 +0,5 @@ | ||
/*! d3fc 28-08-2015 */ | ||
/*! d3fc 02-09-2015 */ | ||
!function(){"use strict";var a="0.5.7",b=null;b=(1,eval)("this"),b.fc={annotation:{},chart:{},data:{feed:{},random:{}},indicator:{algorithm:{calculator:{}},renderer:{}},scale:{discontinuity:{}},series:{stacked:{}},svg:{},tool:{},util:{},version:a}}(),function(a,b){"use strict";b.annotation.band=function(){var c,d,e,f,g=a.time.scale(),h=a.scale.linear(),i=function(){return b.util.scale.range(g)[0]},j=function(){return b.util.scale.range(g)[1]},k=function(){return b.util.scale.range(h)[0]},l=function(){return b.util.scale.range(h)[1]},m=b.util.fn.noop,n=b.util.dataJoin().selector("g.annotation").element("g").attr("class","annotation"),o=function(c){c.each(function(c,d){var e=a.select(this),f=n(e,c);f.enter().append("path").classed("band",!0);var g=b.svg.bar().align("right").x(i).y(k).height(function(){return l.apply(this,arguments)-k.apply(this,arguments)}).width(function(){return j.apply(this,arguments)-i.apply(this,arguments)});f.select("path").attr("d",function(a,b){return g.call(this,[a],b)}),m(f,c,d)})};return o.xScale=function(a){return arguments.length?(g=a,o):g},o.yScale=function(a){return arguments.length?(h=a,o):h},o.decorate=function(a){return arguments.length?(m=a,o):m},o.x0=function(b){return arguments.length?(c=a.functor(b),i=function(){return g(c.apply(this,arguments))},o):c},o.x1=function(b){return arguments.length?(d=a.functor(b),j=function(){return g(d.apply(this,arguments))},o):d},o.y0=function(b){return arguments.length?(e=a.functor(b),k=function(){return h(e.apply(this,arguments))},o):e},o.y1=function(b){return arguments.length?(f=a.functor(b),l=function(){return h(f.apply(this,arguments))},o):f},o}}(d3,fc),function(a,b){"use strict";b.annotation.gridline=function(){var c=a.time.scale(),d=a.scale.linear(),e=10,f=10,g=b.util.fn.noop,h=b.util.fn.noop,i=b.util.dataJoin().selector("line.x").element("line").attr("class","x gridline"),j=b.util.dataJoin().selector("line.y").element("line").attr("class","y gridline"),k=function(a){a.each(function(a,b){var k=c.ticks(e),l=i(this,k);l.attr({x1:c,x2:c,y1:d.range()[0],y2:d.range()[1]}),g(l,k,b);var m=d.ticks(f),n=j(this,m);n.attr({x1:c.range()[0],x2:c.range()[1],y1:d,y2:d}),h(n,m,b)})};return k.xScale=function(a){return arguments.length?(c=a,k):c},k.yScale=function(a){return arguments.length?(d=a,k):d},k.xTicks=function(a){return arguments.length?(e=a,k):e},k.yTicks=function(a){return arguments.length?(f=a,k):f},k.yDecorate=function(a){return arguments.length?(h=a,k):h},k.xDecorate=function(a){return arguments.length?(g=a,k):g},k}}(d3,fc),function(a,b){"use strict";b.annotation.line=function(){var c=a.time.scale(),d=a.scale.linear(),e=b.util.fn.identity,f=b.util.fn.index,g=e,h=b.util.fn.noop,i="horizontal",j=b.util.dataJoin().selector("g.annotation").element("g").attr("class","annotation"),k=function(f){f.each(function(f,k){var l,m,n,o,p,q,r={x:-5,y:-5};switch(i){case"horizontal":n=function(a,b){return"translate("+a+", "+b+")"},o="x2",m=c,l=d,p="left-handle",q="right-handle";break;case"vertical":n=function(a,b){return"translate("+b+", "+a+")"},o="y2",m=d,l=c,r.transform="rotate(-90)",p="bottom-handle",q="top-handle";break;default:throw new Error("Invalid orientation")}var s=b.util.scale.range(m),t=function(a){var b=l(e(a));return n(s[0],b)},u=s[1]-s[0],v=a.select(this),w=j(v,f),x=w.enter().attr("transform",t);x.append("line").attr(o,u),x.append("g").classed(p,!0),x.append("g").classed(q,!0).attr("transform",n(u,0)).append("text").attr(r),w.attr("transform",t),w.select("line").attr(o,u),w.select("g."+q).attr("transform",n(u,0)),w.select("text").text(g),h(w,f,k)})};return k.xScale=function(a){return arguments.length?(c=a,k):c},k.yScale=function(a){return arguments.length?(d=a,k):d},k.value=function(b){return arguments.length?(e=a.functor(b),k):e},k.keyValue=function(b){return arguments.length?(f=a.functor(b),k):f},k.label=function(b){return arguments.length?(g=a.functor(b),k):g},k.decorate=function(a){return arguments.length?(h=a,k):h},k.orient=function(a){return arguments.length?(i=a,k):i},k}}(d3,fc),function(a,b){"use strict";b.chart.legend=function(){var c=b.util.fn.noop,d=b.util.fn.noop,e=[["datum",function(a){return a.datum}]],f=b.util.dataJoin().selector("table.legend").element("table").attr("class","legend"),g=b.util.dataJoin().selector("tr.row").element("tr").attr("class","row"),h=function(b){b.each(function(b,h){var i=a.select(this),j=e.map(function(c,d){return{datum:b,header:a.functor(c[0]),value:a.functor(c[1])}}),k=f(i,[j]),l=g(k),m=l.enter();m.append("th"),m.append("td"),l.select("th").html(function(a,b){return a.header.call(this,a.datum,b)}),l.select("td").html(function(a,b){return a.value.call(this,a.datum,b)}),c(k,b,h),d(l,b,h)})};return h.items=function(a){return arguments.length?(e=a,h):e},h.rowDecorate=function(a){return arguments.length?(d=a,h):d},h.tableDecorate=function(a){return arguments.length?(c=a,h):c},h}}(d3,fc),function(a,b){"use strict";b.chart.linearTimeSeries=function(){var c=20,d=0,e=b.series.line(),f=b.scale.dateTime(),g=a.scale.linear(),h=b.svg.axis().scale(f).orient("bottom"),i=b.svg.axis().scale(g).orient("left"),j=function(b){b.each(function(b){var j=a.select(this),k={position:"absolute",top:0,right:d,bottom:c,left:0},l=j.selectAll("rect.background").data([b]);l.enter().append("rect").attr("class","background").layout(k);var m=j.selectAll("svg.plot-area").data([b]);m.enter().append("svg").attr({"class":"plot-area"}).layout(k);var n=j.selectAll("g.x-axis").data([b]);n.enter().append("g").attr("class","axis x-axis").layout({position:"absolute",left:0,bottom:0,right:d,height:c});var o=j.selectAll("g.y-axis").data([b]);o.enter().append("g").attr("class","axis y-axis").layout({position:"absolute",top:0,right:0,bottom:c,width:d}),j.layout(),f.range([0,n.layout("width")]),g.range([o.layout("height"),0]),n.call(h),o.call(i),e.xScale(f).yScale(g),m.call(e)})};return b.util.rebind(j,f,{xDiscontinuityProvider:"discontinuityProvider",xDomain:"domain",xNice:"nice"}),b.util.rebind(j,g,{yDomain:"domain",yNice:"nice"}),b.util.rebind(j,h,{xTicks:"ticks",xTickValues:"tickValues",xTickSize:"tickSize",xInnerTickSize:"innerTickSize",xOuterTickSize:"outerTickSize",xTickPadding:"tickPadding",xTickFormat:"tickFormat",xOrient:"orient",xDecorate:"decorate"}),b.util.rebind(j,i,{yTicks:"ticks",yTickValues:"tickValues",yTickSize:"tickSize",yInnerTickSize:"innerTickSize",yOuterTickSize:"outerTickSize",yTickPadding:"tickPadding",yTickFormat:"tickFormat",yOrient:"orient",yDecorate:"decorate"}),j.xScale=function(){return f},j.yScale=function(){return g},j.plotArea=function(a){return arguments.length?(e=a,j):e},j.xAxisHeight=function(a){return arguments.length?(c=a,j):c},j.yAxisWidth=function(a){return arguments.length?(d=a,j):d},j}}(d3,fc),function(a,b){"use strict";b.chart.sparkline=function(){function c(b){function c(a){return b.filter(function(b){return e(b)===a})[0]}var d=j.xValue(),e=j.yValue(),f=a.max(b,e),g=a.min(b,e);return[{x:d(b[0]),y:e(b[0])},{x:d(c(f)),y:f},{x:d(c(g)),y:g},{x:d(b[b.length-1]),y:e(b[b.length-1])}]}var d=b.scale.dateTime(),e=a.scale.linear(),f=2,g=b.series.line(),h=b.series.point().xValue(function(a){return a.x}).yValue(function(a){return a.y}).decorate(function(a){a.attr("class",function(a,b){switch(b){case 0:return"open";case 1:return"high";case 2:return"low";case 3:return"close"}})}),i=b.series.multi().series([g,h]).mapping(function(a){switch(a){case h:return c(this);default:return this}}),j=function(c){h.radius(f),c.each(function(c){var g=a.select(this),h=b.util.innerDimensions(this),j=f;d.range([j,h.width-j]),e.range([h.height-j,j]),i.xScale(d).yScale(e),g.call(i)})};return b.util.rebind(j,d,{xDiscontinuityProvider:"discontinuityProvider",xDomain:"domain"}),b.util.rebind(j,e,{yDomain:"domain"}),b.util.rebind(j,g,"xValue","yValue"),j.xScale=function(){return d},j.yScale=function(){return e},j.radius=function(a){return arguments.length?(f=a,j):f},j}}(d3,fc),function(a){"use strict";a.data.feed.coinbase=function(){var a="BTC-USD",b=null,c=null,d=null,e=function(e){var f=[];null!=b&&f.push("start="+b.toISOString()),null!=c&&f.push("end="+c.toISOString()),null!=d&&f.push("granularity="+d);var g="https://api.exchange.coinbase.com/products/"+a+"/candles?"+f.join("&");d3.json(g,function(a,b){return a?void e(a):(b=b.map(function(a){return{date:new Date(1e3*a[0]),open:a[3],high:a[2],low:a[1],close:a[4],volume:a[5]}}),void e(a,b))})};return e.product=function(b){return arguments.length?(a=b,e):a},e.start=function(a){return arguments.length?(b=a,e):b},e.end=function(a){return arguments.length?(c=a,e):c},e.granularity=function(a){return arguments.length?(d=a,e):d},e}}(fc),function(a){"use strict";a.data.random.financial=function(){var b=.1,c=.1,d=100,e=1e5,f=new Date,g=50,h=.3,i=function(a){return!(0===a.getDay()||6===a.getDay())},j=function(a,b,c){for(var d,e=[],h=0,i=0;e.length<a;)d=b.slice(i,i+g),e.push({date:new Date(f.getTime()),open:d[0],high:Math.max.apply({},d),low:Math.min.apply({},d),close:d[g-1],volume:c[h]}),i+=g,h+=1,f.setUTCDate(f.getUTCDate()+1);return e},k=function(k){var l=new Date(f.getTime());l.setUTCDate(f.getUTCDate()+k);var m=315569e5,n=(l.getTime()-f.getTime())/m,o=a.data.random.walk(n,k*g,b,c,d),p=a.data.random.walk(n,k,0,c,e);return p=p.map(function(a){var b=Math.min(0,Math.max(h,1)),c=1+b*(1-2*Math.random());return Math.floor(a*c)}),d=o[o.length-1],e=p[p.length-1],j(k,o,p).filter(function(a){return!i||i(a.date)})};return k.mu=function(a){return arguments.length?(b=a,k):b},k.sigma=function(a){return arguments.length?(c=a,k):c},k.startPrice=function(a){return arguments.length?(d=a,k):d},k.startVolume=function(a){return arguments.length?(e=a,k):e},k.startDate=function(a){return arguments.length?(f=a,k):f},k.stepsPerDay=function(a){return arguments.length?(g=a,k):g},k.volumeNoiseFactor=function(a){return arguments.length?(h=a,k):h},k.filter=function(a){return arguments.length?(i=a,k):i},k}}(fc),function(a,b){"use strict";b.data.random.walk=function(b,c,d,e,f){var g,h,i=a.random.normal(),j=b/c,k=new Array(c+1);for(h=1;h<k.length;h+=1)g=i(),g*=Math.sqrt(j),g*=e,g+=(d-e*e/2)*j,k[h]=Math.exp(g);for(k[0]=f,h=1;h<k.length;h+=1)k[h]=k[h-1]*k[h];return k}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.bollingerBands=function(){var c=b.indicator.algorithm.calculator.bollingerBands().value(function(a){return a.close}),d=b.indicator.algorithm.merge().algorithm(c).merge(function(a,b){a.bollingerBands=b}),e=function(a){return d(a)};return e.root=function(a){return a.bollingerBands},a.rebind(e,d,"merge"),a.rebind(e,c,"windowSize","value","multiplier"),e}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.calculator.bollingerBands=function(){var c=2,d=b.indicator.algorithm.calculator.slidingWindow().undefinedValue({upper:void 0,average:void 0,lower:void 0}).accumulator(function(b){var d=a.mean(b),e=a.deviation(b);return{upper:d+c*e,average:d,lower:d-c*e}}),e=function(a){return d(a)};return e.multiplier=function(a){return arguments.length?(c=a,e):c},a.rebind(e,d,"windowSize","value"),e}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.calculator.exponentialMovingAverage=function(){var a=9,c=b.util.fn.identity,d=function(b){var d,e=2/(a+1),f=0;return b.map(function(b,g){if(a-1>g)return void(f+=c(b,g));if(g===a-1){f+=c(b,g);var h=f/a;return d=h,h}var i=c(b,g)*e+(1-e)*d;return d=i,i})};return d.windowSize=function(b){return arguments.length?(a=b,d):a},d.value=function(a){return arguments.length?(c=a,d):c},d}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.calculator.macd=function(){var c=b.util.fn.identity,d=b.indicator.algorithm.calculator.exponentialMovingAverage().windowSize(12),e=b.indicator.algorithm.calculator.exponentialMovingAverage().windowSize(29),f=b.indicator.algorithm.calculator.exponentialMovingAverage().windowSize(9),g=b.indicator.algorithm.calculator.undefinedInputAdapter().algorithm(f),h=function(b){d.value(c),e.value(c);var f=a.zip(d(b),e(b)).map(function(a){return void 0!==a[0]&&void 0!==a[1]?a[0]-a[1]:void 0}),h=g(f),i=a.zip(f,h).map(function(a){return{macd:a[0],signal:a[1],divergence:void 0!==a[0]&&void 0!==a[1]?a[0]-a[1]:void 0}});return i};return h.value=function(a){return arguments.length?(c=a,h):c},b.util.rebind(h,d,{fastPeriod:"windowSize"}),b.util.rebind(h,e,{slowPeriod:"windowSize"}),b.util.rebind(h,f,{signalPeriod:"windowSize"}),h}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.calculator.percentageChange=function(){var c=a.functor(0),d=b.util.fn.identity,e=function(a){if(0===a.length)return[];var b=d(a[c(a)]);return a.map(function(a,c){return(d(a,c)-b)/b})};return e.baseIndex=function(b){return arguments.length?(c=a.functor(b),e):c},e.value=function(a){return arguments.length?(d=a,e):d},e}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.calculator.relativeStrengthIndex=function(){var c=function(a,b){return a.open},d=function(a,b){return a.close},e=function(a){for(var b=1/a.length,c=a[0],d=1,e=a.length;e>d;d++)c=b*a[d]+(1-b)*c;return c},f=b.indicator.algorithm.calculator.slidingWindow().windowSize(14).accumulator(function(a){for(var b=[],f=[],g=0,h=a.length;h>g;g++){var i=a[g],j=c(i),k=d(i);b.push(j>k?j-k:0),f.push(k>j?k-j:0)}var l=e(b);if(0===l)return 100;var m=e(f)/l;return 100-100/(1+m)}),g=function(a){return f(a)};return g.openValue=function(a){return arguments.length?(c=a,g):c},g.closeValue=function(a){return arguments.length?(d=a,g):d},a.rebind(g,f,"windowSize"),g}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.calculator.slidingWindow=function(){var c=a.functor(void 0),d=a.functor(10),e=b.util.fn.noop,f=b.util.fn.identity,g=function(a){var b=d.apply(this,arguments),g=a.slice(0,b).map(f);return a.map(function(a,d){return b-1>d?c(a,d):(d>=b&&(g.shift(),g.push(f(a,d))),e(g))})};return g.undefinedValue=function(b){return arguments.length?(c=a.functor(b),g):c},g.windowSize=function(b){return arguments.length?(d=a.functor(b),g):d},g.accumulator=function(a){return arguments.length?(e=a,g):e},g.value=function(a){return arguments.length?(f=a,g):f},g}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.calculator.undefinedInputAdapter=function(){function c(a){return Array.apply(null,new Array(a)).map(e)}var d=b.indicator.algorithm.calculator.slidingWindow().accumulator(a.mean),e=a.functor(void 0),f=function(a){return void 0===a},g=function(a){for(var b=0;f(a[b])&&b<a.length;)b++;var e=a.slice(b);return c(b).concat(d(e))};return g.algorithm=function(a){return arguments.length?(d=a,g):d},g.undefinedValue=function(b){return arguments.length?(e=a.functor(b),g):e},g.defined=function(a){return arguments.length?(f=a,g):f},g}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.exponentialMovingAverage=function(){var c=b.indicator.algorithm.calculator.slidingWindow().accumulator(a.mean).value(function(a){return a.close}),d=b.indicator.algorithm.merge().algorithm(c).merge(function(a,b){a.exponentialMovingAverage=b}),e=function(a){return d(a)};return a.rebind(e,d,"merge"),a.rebind(e,c,"windowSize","value"),e}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.macd=function(){var c=b.indicator.algorithm.calculator.macd().value(function(a){return a.close}),d=b.indicator.algorithm.merge().algorithm(c).merge(function(a,b){a.macd=b}),e=function(a){return d(a)};return a.rebind(e,d,"merge"),a.rebind(e,c,"fastPeriod","slowPeriod","signalPeriod","value"),e}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.merge=function(){var c=b.util.fn.noop,d=b.indicator.algorithm.calculator.slidingWindow(),e=function(b){return a.zip(b,d(b)).forEach(function(a){c(a[0],a[1])})};return e.algorithm=function(a){return arguments.length?(d=a,e):d},e.merge=function(a){return arguments.length?(c=a,e):c},e}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.movingAverage=function(){var c=b.indicator.algorithm.calculator.slidingWindow().accumulator(a.mean).value(function(a){return a.close}),d=b.indicator.algorithm.merge().algorithm(c).merge(function(a,b){a.movingAverage=b}),e=function(a){return d(a)};return a.rebind(e,d,"merge"),a.rebind(e,c,"windowSize","undefinedValue","value"),e}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.relativeStrengthIndex=function(){var c=b.indicator.algorithm.calculator.relativeStrengthIndex(),d=b.indicator.algorithm.merge().algorithm(c).merge(function(a,b){a.rsi=b}),e=function(a){return d(a)};return a.rebind(e,d,"merge"),a.rebind(e,c,"windowSize","openValue","closeValue"),e}}(d3,fc),function(a,b){"use strict";b.indicator.renderer.bollingerBands=function(){var c=a.time.scale(),d=a.scale.linear(),e=function(a,b){return a.close},f=function(a,b){return a.date},g=function(a){return a.bollingerBands},h=b.series.area().y0Value(function(a,b){return g(a).upper}).y1Value(function(a,b){return g(a).lower}),i=b.series.line().yValue(function(a,b){return g(a).upper}),j=b.series.line().yValue(function(a,b){return g(a).average}),k=b.series.line().yValue(function(a,b){return g(a).lower}),l=function(a){var e=b.series.multi().xScale(c).yScale(d).series([h,i,k,j]).decorate(function(a){a.enter().attr("class",function(a,b){return"multi "+["area","upper","lower","average"][b]})});h.xValue(f),i.xValue(f),j.xValue(f),k.xValue(f),a.call(e)};return l.xScale=function(a){return arguments.length?(c=a,l):c},l.yScale=function(a){return arguments.length?(d=a,l):d},l.xValue=function(a){return arguments.length?(f=a,l):f},l.yValue=function(a){return arguments.length?(e=a,l):e},l.root=function(a){return arguments.length?(g=a,l):g},l}}(d3,fc),function(a,b){"use strict";b.indicator.renderer.macd=function(){var c=a.time.scale(),d=a.scale.linear(),e=function(a){return a.date},f=function(a){return a.macd},g=b.series.line(),h=b.series.line(),i=b.series.bar(),j=b.series.multi(),k=function(a){g.xValue(e).yValue(function(a,b){return f(a).macd}),h.xValue(e).yValue(function(a,b){return f(a).signal}),i.xValue(e).yValue(function(a,b){return f(a).divergence}),j.xScale(c).yScale(d).series([i,g,h]).decorate(function(a){a.enter().attr("class",function(a,b){return"multi "+["divergence","macd","signal"][b]})}),a.call(j)};return k.xScale=function(a){return arguments.length?(c=a,k):c},k.xValue=function(a){return arguments.length?(e=a,k):e},k.yScale=function(a){return arguments.length?(d=a,k):d},k.root=function(a){return arguments.length?(f=a,k):f},k}}(d3,fc),function(a,b){"use strict";b.indicator.renderer.relativeStrengthIndex=function(){var c=a.time.scale(),d=a.scale.linear(),e=70,f=30,g=b.annotation.line(),h=b.series.line().yValue(function(a,b){return a.rsi}),i=function(b){g.xScale(c).yScale(d),h.xScale(c).yScale(d),b.each(function(b){var c=a.select(this),d=c.selectAll("g.annotations").data([[e,50,f]]);d.enter().append("g").attr("class","annotations"),d.call(g);var i=c.selectAll("g.indicator").data([b]);i.enter().append("g").attr("class","indicator"),i.call(h)})};return i.xScale=function(a){return arguments.length?(c=a,i):c},i.yScale=function(a){return arguments.length?(d=a,i):d},i.upperValue=function(a){return arguments.length?(e=a,i):e},i.lowerValue=function(a){return arguments.length?(f=a,i):f},a.rebind(i,h,"yValue","xValue"),i}}(d3,fc),function(a,b,c){"use strict";a.selection.prototype.layout=function(a,c){var d=b.layout(),e=arguments.length;if(2===e)"string"!=typeof a?(d.width(a).height(c),this.call(d)):this.attr("layout-css",a+":"+c);else if(1===e){if("string"==typeof a)return Number(this.attr("layout-"+a));var f=a,g=Object.keys(f).map(function(a){return a+":"+f[a]}).join(";");this.attr("layout-css",g)}else 0===e&&this.call(d);return this},b.layout=function(){function a(a){if(!a)return{};var b=a.split(";"),c={};return b.forEach(function(a){var b=a.split(":");if(2===b.length){var d=b[0].trim(),e=b[1].trim();c[d]=isNaN(e)?e:Number(e)}}),c}function d(b){function c(){for(var a=[],c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];1===e.nodeType&&e.getAttribute("layout-css")&&a.push(d(e))}return a}return{style:a(b.getAttribute("layout-css")),children:c(b),element:b,layout:{width:void 0,height:void 0,top:0,left:0}}}function e(a){a.element.setAttribute("layout-width",a.layout.width),a.element.setAttribute("layout-height",a.layout.height),a.element.nodeName.match(/(?:svg|rect)/i)?(a.element.setAttribute("width",a.layout.width),a.element.setAttribute("height",a.layout.height),a.element.setAttribute("x",a.layout.left),a.element.setAttribute("y",a.layout.top)):a.element.setAttribute("transform","translate("+a.layout.left+", "+a.layout.top+")"),a.children.forEach(e)}var f=-1,g=-1,h=function(a){a.each(function(a){var h=b.util.innerDimensions(this),i=d(this);i.style.width=-1!==f?f:h.width,i.style.height=-1!==g?g:h.height,c.computeLayout(i),e(i)})};return h.width=function(a){return arguments.length?(f=a,h):f},h.height=function(a){return arguments.length?(g=a,h):g},h}}(d3,fc,computeLayout),function(a,b){"use strict";function c(d,e){function f(a){var b=d.domain(),c=d.range(),f=e.distance(b[0],b[1]),g=e.distance(b[0],a),h=g/f,i=h*(c[1]-c[0])+c[0];return i}return arguments.length||(d=a.time.scale(),e=b.scale.discontinuity.identity()),f.invert=function(a){var b=d.domain(),c=d.range(),f=(a-c[0])/(c[1]-c[0]),g=e.distance(b[0],b[1]),h=f*g;return e.offset(b[0],h)},f.domain=function(a){if(!arguments.length)return d.domain();var b=e.clampUp(a[0]),c=e.clampDown(a[1]);return d.domain([b,c]),f},f.nice=function(){d.nice();var a=d.domain(),b=e.clampUp(a[0]),c=e.clampDown(a[1]);return d.domain([b,c]),f},f.ticks=function(){var a=d.ticks.apply(this,arguments);return b.scale.dateTime.tickTransformer(a,e,f.domain())},f.copy=function(){return c(d.copy(),e.copy())},f.discontinuityProvider=function(a){return arguments.length?(e=a,f):e},a.rebind(f,d,"range","rangeRound","interpolate","clamp","tickFormat")}b.scale.dateTime=function(){return c()},b.scale.dateTime.tickTransformer=function(a,b,c){var d=a.map(function(d,e){if(e<a.length-1)return b.clampUp(d);var f=b.clampUp(d);return f<c[1]?f:b.clampDown(d)}),e=d.reduce(function(a,b){return 0===a.filter(function(a){return a.getTime()===b.getTime()}).length&&a.push(b),a},[]);return e}}(d3,fc),function(a,b){"use strict";b.scale.discontinuity.identity=function(){var a={};return a.distance=function(a,b){return b.getTime()-a.getTime()},a.offset=function(a,b){return new Date(a.getTime()+b)},a.clampUp=b.util.fn.identity,a.clampDown=b.util.fn.identity,a.copy=function(){return a},a}}(d3,fc),function(a,b){"use strict";b.scale.discontinuity.skipWeekends=function(){function b(a){return 0===a.getDay()||6===a.getDay()}var c=864e5,d=5*c,e=7*c,f={};return f.clampDown=function(c){if(b(c)){var d=0===c.getDay()?2:1,e=a.time.day.ceil(c);return a.time.day.offset(e,-d)}return c},f.clampUp=function(c){if(b(c)){var d=0===c.getDay()?1:2,e=a.time.day.floor(c);return a.time.day.offset(e,d)}return c},f.distance=function(b,c){b=f.clampUp(b),c=f.clampDown(c);var g=a.time.saturday.ceil(b);if(g>c)return c.getTime()-b.getTime();var h=g.getTime()-b.getTime(),i=a.time.saturday.ceil(c),j=i.getTime()-c.getTime(),k=(i.getTime()-g.getTime())/e;return k*d+h-j},f.offset=function(c,e){var g=b(c)?f.clampUp(c):c,h=e,i=a.time.saturday.ceil(g);if(h-=i.getTime()-g.getTime(),0>h)return new Date(g.getTime()+e);g=a.time.day.offset(i,2);var j=Math.floor(h/d);return g=a.time.day.offset(g,7*j),h-=j*d,g=new Date(g.getTime()+h)},f.copy=function(){return f},f}}(d3,fc),function(a,b){"use strict";b.series.area=function(){var c=b.util.fn.noop,d=a.time.scale(),e=a.scale.linear(),f=a.functor(0),g=function(a,b){return a.close},h=function(a,b){return a.date},i=function(a,b){return d(h(a,b))},j=function(a,b){return e(f(a,b))},k=function(a,b){return e(g(a,b))},l=a.svg.area().defined(function(a,b){return!isNaN(j(a,b))&&!isNaN(k(a,b))}).x(i).y0(j).y1(k),m=b.util.dataJoin().selector("path.area").element("path").attr("class","area"),n=function(a){a.each(function(a,b){var d=m(this,[a]);d.attr("d",l),c(d,a,b)})};return n.decorate=function(a){return arguments.length?(c=a,n):c},n.xScale=function(a){return arguments.length?(d=a,n):d},n.yScale=function(a){return arguments.length?(e=a,n):e},n.xValue=function(a){return arguments.length?(h=a,n):h},n.y0Value=function(b){return arguments.length?(f=a.functor(b),n):f},n.yValue=n.y1Value=function(a){return arguments.length?(g=a,n):g},a.rebind(n,m,"key"),a.rebind(n,l,"interpolate","tension"),n}}(d3,fc),function(a,b){"use strict";b.series.axis=function(){var c=b.svg.axis(),d=a.functor(0),e=b.util.fn.noop,f=a.time.scale(),g=a.scale.linear(),h=b.util.dataJoin().selector("g.axis-adapter").element("g").attr({"class":"axis axis-adapter"}),i=function(a){a.each(function(a,b){var j=h(this,[a]);switch(i.orient()){case"top":case"bottom":j.attr("transform","translate(0,"+g(d(a))+")"),c.scale(f);break;case"left":case"right":j.attr("transform","translate("+f(d(a))+",0)"),c.scale(g);break;default:throw new Error("Invalid orientation")}j.call(c),e(j,a,b)})};return i.baseline=function(b){return arguments.length?(d=a.functor(b),i):d},i.decorate=function(a){return arguments.length?(e=a,i):e},i.xScale=function(a){return arguments.length?(f=a,i):f},i.yScale=function(a){return arguments.length?(g=a,i):g},a.rebind(i,c,"orient","ticks","tickValues","tickSize","innerTickSize","outerTickSize","tickPadding","tickFormat")}}(d3,fc),function(a,b){"use strict";b.series.bar=function(){var c=b.util.fn.noop,d=a.time.scale(),e=a.scale.linear(),f=function(a,b){return a.close},g=function(a,b){return a.date},h=a.functor(0),i=b.util.fractionalBarWidth(.75),j=b.util.dataJoin().selector("g.bar").element("g").attr("class","bar"),k=function(a,b){return d(g(a,b))},l=function(d){d.each(function(d,l){var m=d.filter(function(a,b){return void 0!==h(a,b)&&void 0!==f(a,b)&&void 0!==g(a,b)}),n=j(this,m),o=i(m.map(k)),p=b.svg.bar().x(0).y(0).width(o).height(0),q=function(a,b){return k(a,b)},r=function(a,b){return e(f(a,b))},s=function(a,b){return e(h(a,b))};n.enter().attr("transform",function(a,b){return"translate("+q(a,b)+", "+s(a,b)+")"}).append("path").attr("d",function(a){return p([a])}),n.each(function(b,c){p.height(s(b,c)-r(b,c));var d=a.select(this);a.transition(d).attr("transform","translate("+q(b,c)+", "+r(b,c)+")").select("path").attr("d",p([b]))}),c(n,m,l)})};return l.decorate=function(a){return arguments.length?(c=a,l):c},l.xScale=function(a){return arguments.length?(d=a,l):d},l.yScale=function(a){return arguments.length?(e=a,l):e},l.xValue=function(a){return arguments.length?(g=a,l):g},l.y0Value=function(b){return arguments.length?(h=a.functor(b),l):h},l.yValue=l.y1Value=function(a){return arguments.length?(f=a,l):f},l.barWidth=function(b){return arguments.length?(i=a.functor(b),l):i},a.rebind(l,j,"key"),l}}(d3,fc),function(a,b){"use strict";b.series.candlestick=function(){var c=b.util.fn.noop,d=a.time.scale(),e=a.scale.linear(),f=function(a,b){return a.date},g=function(a,b){return a.open},h=function(a,b){return a.high},i=function(a,b){return a.low},j=function(a,b){return a.close},k=b.util.fractionalBarWidth(.75),l=b.util.dataJoin().selector("g.candlestick").element("g").attr("class","candlestick"),m=function(a,b){return d(f(a,b))},n=function(d){d.each(function(d,f){var n=l(this,d);n.enter().append("path");var o=b.svg.candlestick().width(k(d.map(m)));n.each(function(b,c){var d=j(b,c),f=g(b,c),k=m(b,c),l=e(f),n=e(h(b,c)),p=e(i(b,c)),q=e(d),r=a.select(this).classed({up:d>f,down:f>d}).attr("transform","translate("+k+", "+n+")");o.x(a.functor(0)).open(function(){return l-n}).high(function(){return n-n}).low(function(){return p-n}).close(function(){return q-n}),r.select("path").attr("d",o([b]))}),c(n,d,f)})};return n.decorate=function(a){return arguments.length?(c=a,n):c},n.xScale=function(a){return arguments.length?(d=a,n):d},n.yScale=function(a){return arguments.length?(e=a,n):e},n.xValue=function(a){return arguments.length?(f=a,n):f},n.yOpenValue=function(a){return arguments.length?(g=a,n):g},n.yHighValue=function(a){return arguments.length?(h=a,n):h},n.yLowValue=function(a){return arguments.length?(i=a,n):i},n.yValue=n.yCloseValue=function(a){return arguments.length?(j=a,n):j},n.barWidth=function(b){return arguments.length?(k=a.functor(b),n):k},a.rebind(n,l,"key"),n}}(d3,fc),function(a,b){"use strict";b.series.cycle=function(){var c=b.util.fn.noop,d=a.scale.linear(),e=a.scale.linear(),f=function(a,b){return a.date.getDay()},g=a.scale.linear(),h=b.series.line(),i=b.util.fractionalBarWidth(.75),j=b.util.dataJoin().selector("g.cycle").element("g").attr("class","cycle"),k=function(b){b.each(function(b,k){var l=a.nest().key(f).map(b),m=Object.keys(l),n=i(m.map(d)),o=n/2,p=j(this,m);p.each(function(b,c){var f=a.select(this);f.attr("transform","translate("+d(b)+", 0)"),(g.rangeBands||g.range)([-o,o]),h.xScale(g).yScale(e),a.select(this).datum(l[b]).call(h)}),c(p,m,k)})};return k.decorate=function(a){return arguments.length?(c=a,k):c},k.xScale=function(a){return arguments.length?(d=a,k):d},k.yScale=function(a){return arguments.length?(e=a,k):e},k.xValue=function(a){return arguments.length?(f=a,k):f},k.subScale=function(a){return arguments.length?(g=a,k):g},k.subSeries=function(a){return arguments.length?(h=a,k):h},k.barWidth=function(b){return arguments.length?(i=a.functor(b),k):i},a.rebind(k,j,"key"),k}}(d3,fc),function(a,b){"use strict";b.series.line=function(){var c=b.util.fn.noop,d=a.time.scale(),e=a.scale.linear(),f=function(a,b){return a.close},g=function(a,b){return a.date},h=function(a,b){return d(g(a,b))},i=function(a,b){return e(f(a,b))},j=a.svg.line().defined(function(a,b){return!isNaN(i(a,b))}).x(h).y(i),k=b.util.dataJoin().selector("path.line").element("path").attr("class","line"),l=function(a){a.each(function(a,b){var d=k(this,[a]);d.attr("d",j),c(d,a,b)})};return l.decorate=function(a){return arguments.length?(c=a,l):c},l.xScale=function(a){return arguments.length?(d=a,l):d},l.yScale=function(a){return arguments.length?(e=a,l):e},l.xValue=function(a){return arguments.length?(g=a,l):g},l.yValue=function(a){return arguments.length?(f=a,l):f},a.rebind(l,k,"key"),a.rebind(l,j,"interpolate","tension"),l}}(d3,fc),function(a,b){"use strict";b.series.multi=function(){var c=a.time.scale(),d=a.scale.linear(),e=[],f=b.util.fn.context,g=b.util.fn.index,h=b.util.fn.noop,i=b.util.dataJoin().selector("g.multi").children(!0).attr("class","multi").element("g").key(function(a,b){var c=this.__series__||a;return g.call(this,c,b)}),j=function(b){b.each(function(b){var g=i(this,e);g.each(function(e,g){this.__series__=e,(e.xScale||e.x).call(e,c),(e.yScale||e.y).call(e,d),a.select(this).datum(f.call(b,e,g)).call(e)}),h(g)})};return j.xScale=function(a){return arguments.length?(c=a,j):c},j.yScale=function(a){return arguments.length?(d=a,j):d},j.series=function(a){return arguments.length?(e=a,j):e},j.mapping=function(a){return arguments.length?(f=a,j):f},j.key=function(a){return arguments.length?(g=a,j):g},j.decorate=function(a){return arguments.length?(h=a,j):h},j}}(d3,fc),function(a,b){"use strict";b.series.ohlc=function(c){var d=b.util.fn.noop,e=a.time.scale(),f=a.scale.linear(),g=function(a,b){return a.date},h=function(a,b){return a.open},i=function(a,b){return a.high},j=function(a,b){return a.low},k=function(a,b){return a.close},l=b.util.fractionalBarWidth(.75),m=function(a,b){return e(g(a,b))},n=b.util.dataJoin().selector("g.ohlc").element("g").attr("class","ohlc"),o=function(c){c.each(function(c,e){var g=n(this,c);g.enter().append("path");var o=b.svg.ohlc().width(l(c.map(m)));g.each(function(b,c){var d=k(b,c),e=h(b,c),g=m(b,c),l=f(e),n=f(i(b,c)),p=f(j(b,c)),q=f(d),r=a.select(this).classed({up:d>e,down:e>d}).attr("transform","translate("+g+", "+n+")");o.x(a.functor(0)).open(function(){return l-n}).high(function(){return n-n}).low(function(){return p-n}).close(function(){return q-n}),r.select("path").attr("d",o([b]))}),d(g,c,e)})};return o.decorate=function(a){return arguments.length?(d=a,o):d},o.xScale=function(a){return arguments.length?(e=a,o):e},o.yScale=function(a){return arguments.length?(f=a,o):f},o.xValue=function(a){return arguments.length?(g=a,o):g},o.yOpenValue=function(a){return arguments.length?(h=a,o):h},o.yHighValue=function(a){return arguments.length?(i=a,o):i},o.yLowValue=function(a){return arguments.length?(j=a, | ||
o):j},o.yValue=o.yCloseValue=function(a){return arguments.length?(k=a,o):k},o.barWidth=function(b){return arguments.length?(l=a.functor(b),o):l},a.rebind(o,n,"key"),o}}(d3,fc),function(a,b){"use strict";b.series.point=function(){var c=b.util.fn.noop,d=a.time.scale(),e=a.scale.linear(),f=function(a,b){return a.close},g=function(a,b){return a.date},h=a.functor(5),i=b.util.dataJoin().selector("g.point").element("g").attr("class","point"),j=function(a,b){var c=d(g(a,b)),h=e(f(a,b));return"translate("+c+", "+h+")"},k=function(a){a.each(function(a,b){var d=i(this,a);d.enter().attr("transform",j).append("circle"),d.attr("transform",j),d.select("circle").attr("r",h),c(d,a,b)})};return k.decorate=function(a){return arguments.length?(c=a,k):c},k.xScale=function(a){return arguments.length?(d=a,k):d},k.yScale=function(a){return arguments.length?(e=a,k):e},k.xValue=function(a){return arguments.length?(g=a,k):g},k.yValue=function(a){return arguments.length?(f=a,k):f},k.radius=function(a){return arguments.length?(h=a,k):h},a.rebind(k,i,"key"),k}}(d3,fc),function(a,b){"use strict";b.series.stacked.area=function(){var a=b.series.area().yValue(function(a){return a.y0+a.y}).y0Value(function(a){return a.y0}),c=b.series.stacked.stack().series(a),d=function(a){a.call(c)};return b.util.rebind(d,a,{decorate:"decorate",xScale:"xScale",yScale:"yScale",xValue:"xValue",y0Value:"y0Value",y1Value:"y1Value",yValue:"yValue"})}}(d3,fc),function(a,b){"use strict";b.series.stacked.bar=function(){var a=b.series.bar().yValue(function(a){return a.y0+a.y}).y0Value(function(a){return a.y0}),c=b.series.stacked.stack().series(a),d=function(a){a.call(c)};return b.util.rebind(d,a,{decorate:"decorate",xScale:"xScale",yScale:"yScale",xValue:"xValue",y0Value:"y0Value",y1Value:"y1Value",yValue:"yValue",barWidth:"barWidth"})}}(d3,fc),function(a,b){"use strict";b.series.stacked.line=function(){var a=b.series.line().yValue(function(a){return a.y0+a.y}),c=b.series.stacked.stack().series(a),d=function(a){a.call(c)};return b.util.rebind(d,a,{decorate:"decorate",xScale:"xScale",yScale:"yScale",xValue:"xValue",yValue:"yValue"})}}(d3,fc),function(a,b){"use strict";b.series.stacked.stack=function(){var c=b.util.fn.noop,d=function(d){d.each(function(d){var e=a.select(this),f=b.util.dataJoin().selector("g.stacked").element("g").attr("class","stacked");f(e,d).call(c)})};return d.series=function(a){return arguments.length?(c=a,d):c},d}}(d3,fc),function(a,b){"use strict";b.svg.axis=function(){function c(a,b){return function(c){return b(a(c),0)}}function d(a,b){return f()?"translate("+b+", "+a+")":"translate("+a+", "+b+")"}function e(a){return f()?a.map(function(a){return[a[1],a[0]]}):a}function f(){return"left"===j||"right"===j}function g(a,b){return h[a]?h[a].apply(h,k):b}var h=a.scale.identity(),i=b.util.fn.noop,j="bottom",k=[10],l=null,m=null,n=6,o=6,p=3,q=a.svg.line(),r=b.util.dataJoin().selector("g.tick").element("g").key(b.util.fn.identity).attr("class","tick"),s=b.util.dataJoin().selector("path.domain").element("path").attr("class","domain"),t=function(f){f.each(function(f,k){var t=this.__chart__||h;this.__chart__=h.copy();var u=null==l?g("ticks",h.domain()):l,v=null==m?g("tickFormat",b.util.fn.identity):m,w="bottom"===j||"right"===j?1:-1,x=a.select(this),y=b.util.scale.range(h),z=e([[y[0],w*n],[y[0],0],[y[1],0],[y[1],w*n]]),A=s(x,[f]);A.attr("d",q(z)),r.attr({transform:c(b.util.scale.isOrdinal(h)?h:t,d)});var B=r(x,u);B.enter().append("path");var C=w*(o+p);B.enter().append("text").attr("transform",d(0,C)),B.attr("class","tick orient-"+j),B.attr("transform",c(h,d)),B.selectAll("path").attr("d",function(a){return q(e([[0,0],[0,w*o]]))}),B.selectAll("text").attr("transform",d(0,C)).text(v),b.util.scale.isOrdinal(h)||B.exit().attr("transform",c(h,d)),i(B,f,k)})};return t.scale=function(a){return arguments.length?(h=a,t):h},t.ticks=function(a){return arguments.length?(k=arguments,t):k},t.tickValues=function(a){return arguments.length?(l=a,t):l},t.tickFormat=function(a){return arguments.length?(m=a,t):m},t.tickSize=function(a){var b=arguments.length;return b?(o=Number(a),n=Number(arguments[b-1]),t):o},t.innerTickSize=function(a){return arguments.length?(o=Number(a),t):o},t.outerTickSize=function(a){return arguments.length?(n=Number(a),t):n},t.tickPadding=function(a){return arguments.length?(p=a,t):p},t.orient=function(a){return arguments.length?(j=a,t):j},t.decorate=function(a){return arguments.length?(i=a,t):i},t}}(d3,fc),function(a,b){"use strict";b.svg.bar=function(){var b=function(a,b){return a.x},c=function(a,b){return a.y},d="center",e=function(a,b){return a.height},f=a.functor(3),g=function(a,g){return a.map(function(a,h){var i,j=b.call(this,a,g||h),k=c.call(this,a,g||h),l=e.call(this,a,g||h),m=f.call(this,a,g||h);switch(d){case"left":i=m;break;case"right":i=0;break;case"center":i=m/2;break;default:throw new Error("Invalid alignment")}var n="M"+(j-i)+","+k+"h"+m+"v"+l+"h"+-m+"z";return n},this).join("")};return g.x=function(c){return arguments.length?(b=a.functor(c),g):b},g.y=function(b){return arguments.length?(c=a.functor(b),g):c},g.width=function(b){return arguments.length?(f=a.functor(b),g):f},g.align=function(a){return arguments.length?(d=a,g):d},g.height=function(b){return arguments.length?(e=a.functor(b),g):e},g}}(d3,fc),function(a,b){"use strict";b.svg.candlestick=function(){var b=function(a,b){return a.date},c=function(a,b){return a.open},d=function(a,b){return a.high},e=function(a,b){return a.low},f=function(a,b){return a.close},g=a.functor(3),h=function(a){return a.map(function(a,h){var i=b(a,h),j=c(a,h),k=d(a,h),l=e(a,h),m=f(a,h),n=g(a,h),o="M"+(i-n/2)+","+j+"h"+n+"V"+m+"h"+-n+"V"+j+"z",p="M"+i+","+Math.min(m,j)+"V"+k,q="M"+i+","+Math.max(m,j)+"V"+l;return o+p+q}).join("")};return h.x=function(a){return arguments.length?(b=a,h):b},h.open=function(a){return arguments.length?(c=a,h):c},h.high=function(a){return arguments.length?(d=a,h):d},h.low=function(a){return arguments.length?(e=a,h):e},h.close=function(a){return arguments.length?(f=a,h):f},h.width=function(b){return arguments.length?(g=a.functor(b),h):g},h}}(d3,fc),function(a,b){"use strict";b.svg.ohlc=function(){var b=function(a,b){return a.date},c=function(a,b){return a.open},d=function(a,b){return a.high},e=function(a,b){return a.low},f=function(a,b){return a.close},g=a.functor(3),h=function(a){return a.map(function(a,h){var i=b(a,h),j=c(a,h),k=d(a,h),l=e(a,h),m=f(a,h),n=g(a,h)/2,o="M"+i+","+l,p="V"+k,q="M"+i+","+j+"h"+-n,r="M"+i+","+m+"h"+n;return o+p+q+r}).join("")};return h.x=function(a){return arguments.length?(b=a,h):b},h.open=function(a){return arguments.length?(c=a,h):c},h.high=function(a){return arguments.length?(d=a,h):d},h.low=function(a){return arguments.length?(e=a,h):e},h.close=function(a){return arguments.length?(f=a,h):f},h.width=function(b){return arguments.length?(g=a.functor(b),h):g},h}}(d3,fc),function(a,b){"use strict";b.tool.crosshair=function(){function c(c){return a.scale.identity().range(b.util.scale.range(c))}function d(){var b=a.mouse(this),c=a.select(this),d=j.apply(this,b),e=c.datum();e.push(d),c.call(q),g.trackingstart.apply(this,arguments)}function e(){var b=a.mouse(this),c=a.select(this),d=j.apply(this,b),e=c.datum();e[e.length-1]=d,c.call(q),g.trackingmove.apply(this,arguments)}function f(){var b=a.select(this),c=b.datum();c.pop(),b.call(q),g.trackingend.apply(this,arguments)}var g=a.dispatch("trackingstart","trackingmove","trackingend"),h=a.time.scale(),i=a.scale.linear(),j=function(a,c){return b.util.noSnap(h,i)(a,c)},k=b.util.fn.noop,l=function(a){return a.xInDomainUnits?h(a.x):a.x},m=function(a){return a.yInDomainUnits?i(a.y):a.y},n=b.util.dataJoin().children(!0).selector("g.crosshair").element("g").attr("class","crosshair"),o=b.annotation.line().value(m).label(function(a){return a.y}),p=b.annotation.line().orient("vertical").value(l).label(function(a){return a.x}),q=function(g){g.each(function(g,j){var q=a.select(this).style("pointer-events","all").on("mouseenter.crosshair",d).on("mousemove.crosshair",e).on("mouseleave.crosshair",f),r=q.selectAll("rect").data([g]);r.enter().append("rect").style("visibility","hidden"),q.select("rect").attr("x",b.util.scale.range(h)[0]).attr("y",b.util.scale.range(i)[1]).attr("width",b.util.scale.range(h)[1]).attr("height",b.util.scale.range(i)[0]);var s=n(q,g),t=function(a){return"translate("+l(a)+", "+m(a)+")"};s.enter().style("pointer-events","none").append("g").classed("trackball",!0).attr("transform",t).append("circle").attr("r",5),s.select("g.trackball").attr("transform",t);var u=b.series.multi().series([o,p]).xScale(c(h)).yScale(c(i)).mapping(function(){return[this]});s.call(u),k(s,g,j)})};return q.xScale=function(a){return arguments.length?(h=a,q):h},q.yScale=function(a){return arguments.length?(i=a,q):i},q.snap=function(a){return arguments.length?(j=a,q):j},q.decorate=function(a){return arguments.length?(k=a,q):k},a.rebind(q,g,"on"),b.util.rebind(q,o,{yLabel:"label"}),b.util.rebind(q,p,{xLabel:"label"}),q}}(d3,fc),function(a,b){"use strict";b.tool.fibonacciFan=function(){function c(){var b=a.select(this),c=b.datum()[0];if("DONE"!==c.state){var d=a.mouse(this),e=k.apply(this,d);if("SELECT_SOURCE"===c.state)c.source=c.target=e;else{if("SELECT_TARGET"!==c.state)throw new Error("Unknown state "+c.state);c.target=e}}}function d(){var b=a.select(this).on("click.fan",g).on("mousemove.fan",e).on("mouseleave.fan",f),d=b.datum();null==d[0]&&d.push({state:"SELECT_SOURCE"}),c.call(this),b.call(p)}function e(){var b=a.select(this);c.call(this),b.call(p)}function f(){var b=a.select(this),c=b.datum();null!=c[0]&&"SELECT_SOURCE"===c[0].state&&c.pop(),b.on("click.fan",null).on("mousemove.fan",null).on("mouseleave.fan",null)}function g(){var b=a.select(this),d=b.datum()[0];switch(d.state){case"SELECT_SOURCE":c.call(this),h.fansource.apply(this,arguments),d.state="SELECT_TARGET";break;case"SELECT_TARGET":c.call(this),h.fantarget.apply(this,arguments),d.state="DONE";break;case"DONE":h.fanclear.apply(this,arguments),d.state="SELECT_SOURCE",c.call(this);break;default:throw new Error("Unknown state "+d.state)}b.call(p)}var h=a.dispatch("fansource","fantarget","fanclear"),i=a.time.scale(),j=a.scale.linear(),k=function(a,c){return b.util.noSnap(i,j)(a,c)},l=b.util.fn.noop,m=function(a){return a.xInDomainUnits?i(a.x):a.x},n=function(a){return a.yInDomainUnits?j(a.y):a.y},o=b.util.dataJoin().selector("g.fan").element("g").attr("class","fan"),p=function(b){b.each(function(b,c){var e=a.select(this).style("pointer-events","all").on("mouseenter.fan",d),f=e.selectAll("rect").data([b]);f.enter().append("rect").style("visibility","hidden"),e.select("rect").attr("x",i.range()[0]).attr("y",j.range()[1]).attr("width",i.range()[1]).attr("height",j.range()[0]);var g=o(e,b);g.each(function(a){if(a.x=i.range()[1],a.ay=a.by=a.cy=n(a.target),m(a.source)!==m(a.target)){if("DONE"===a.state&&m(a.source)>m(a.target)){var b=a.source;a.source=a.target,a.target=b}var c=(n(a.target)-n(a.source))/(m(a.target)-m(a.source)),d=a.x-m(a.source),e=c*d;a.ay=.618*e+n(a.source),a.by=.5*e+n(a.source),a.cy=.382*e+n(a.source)}});var h=g.enter();h.append("line").attr("class","trend"),h.append("line").attr("class","a"),h.append("line").attr("class","b"),h.append("line").attr("class","c"),h.append("polygon").attr("class","area"),g.select("line.trend").attr("x1",function(a){return m(a.source)}).attr("y1",function(a){return n(a.source)}).attr("x2",function(a){return m(a.target)}).attr("y2",function(a){return n(a.target)}),g.select("line.a").attr("x1",function(a){return m(a.source)}).attr("y1",function(a){return n(a.source)}).attr("x2",function(a){return a.x}).attr("y2",function(a){return a.ay}).style("visibility",function(a){return"DONE"!==a.state?"hidden":"visible"}),g.select("line.b").attr("x1",function(a){return m(a.source)}).attr("y1",function(a){return n(a.source)}).attr("x2",function(a){return a.x}).attr("y2",function(a){return a.by}).style("visibility",function(a){return"DONE"!==a.state?"hidden":"visible"}),g.select("line.c").attr("x1",function(a){return m(a.source)}).attr("y1",function(a){return n(a.source)}).attr("x2",function(a){return a.x}).attr("y2",function(a){return a.cy}).style("visibility",function(a){return"DONE"!==a.state?"hidden":"visible"}),g.select("polygon.area").attr("points",function(a){return m(a.source)+","+n(a.source)+" "+a.x+","+a.ay+" "+a.x+","+a.cy}).style("visibility",function(a){return"DONE"!==a.state?"hidden":"visible"}),l(g,b,c)})};return p.xScale=function(a){return arguments.length?(i=a,p):i},p.yScale=function(a){return arguments.length?(j=a,p):j},p.snap=function(a){return arguments.length?(k=a,p):k},p.decorate=function(a){return arguments.length?(l=a,p):l},a.rebind(p,h,"on"),p}}(d3,fc),function(a,b){"use strict";b.tool.measure=function(){function c(){var b=a.select(this),c=b.datum()[0];if("DONE"!==c.state){var d=a.mouse(this),e=k.apply(this,d);if("SELECT_SOURCE"===c.state)c.source=c.target=e;else{if("SELECT_TARGET"!==c.state)throw new Error("Unknown state "+c.state);c.target=e}}}function d(){var b=a.select(this).on("click.measure",g).on("mousemove.measure",e).on("mouseleave.measure",f),d=b.datum();null==d[0]&&d.push({state:"SELECT_SOURCE"}),c.call(this),b.call(s)}function e(){var b=a.select(this);c.call(this),b.call(s)}function f(){var b=a.select(this),c=b.datum();null!=c[0]&&"SELECT_SOURCE"===c[0].state&&c.pop(),b.on("click.measure",null).on("mousemove.measure",null).on("mouseleave.measure",null)}function g(){var b=a.select(this),d=b.datum()[0];switch(d.state){case"SELECT_SOURCE":c.call(this),h.measuresource.apply(this,arguments),d.state="SELECT_TARGET";break;case"SELECT_TARGET":c.call(this),h.measuretarget.apply(this,arguments),d.state="DONE";break;case"DONE":h.measureclear.apply(this,arguments),d.state="SELECT_SOURCE",c.call(this);break;default:throw new Error("Unknown state "+d.state)}b.call(s)}var h=a.dispatch("measuresource","measuretarget","measureclear"),i=a.time.scale(),j=a.scale.linear(),k=function(a,c){return b.util.noSnap(i,j)(a,c)},l=b.util.fn.noop,m=a.functor(""),n=a.functor(""),o=a.functor(2),p=function(a){return a.xInDomainUnits?i(a.x):a.x},q=function(a){return a.yInDomainUnits?j(a.y):a.y},r=b.util.dataJoin().selector("g.measure").element("g").attr("class","measure"),s=function(b){b.each(function(b,c){var e=a.select(this).style("pointer-events","all").on("mouseenter.measure",d),f=e.selectAll("rect").data([b]);f.enter().append("rect").style("visibility","hidden"),e.select("rect").attr("x",i.range()[0]).attr("y",j.range()[1]).attr("width",i.range()[1]).attr("height",j.range()[0]);var g=r(e,b),h=g.enter();h.append("line").attr("class","tangent"),h.append("line").attr("class","horizontal"),h.append("line").attr("class","vertical"),h.append("text").attr("class","horizontal"),h.append("text").attr("class","vertical"),g.select("line.tangent").attr("x1",function(a){return p(a.source)}).attr("y1",function(a){return q(a.source)}).attr("x2",function(a){return p(a.target)}).attr("y2",function(a){return q(a.target)}),g.select("line.horizontal").attr("x1",function(a){return p(a.source)}).attr("y1",function(a){return q(a.source)}).attr("x2",function(a){return p(a.target)}).attr("y2",function(a){return q(a.source)}).style("visibility",function(a){return"DONE"!==a.state?"hidden":"visible"}),g.select("line.vertical").attr("x1",function(a){return p(a.target)}).attr("y1",function(a){return q(a.target)}).attr("x2",function(a){return p(a.target)}).attr("y2",function(a){return q(a.source)}).style("visibility",function(a){return"DONE"!==a.state?"hidden":"visible"});var k=o.apply(this,arguments);g.select("text.horizontal").attr("x",function(a){return p(a.source)+(p(a.target)-p(a.source))/2}).attr("y",function(a){return q(a.source)-k}).style("visibility",function(a){return"DONE"!==a.state?"hidden":"visible"}).text(m),g.select("text.vertical").attr("x",function(a){return p(a.target)+k}).attr("y",function(a){return q(a.source)+(q(a.target)-q(a.source))/2}).style("visibility",function(a){return"DONE"!==a.state?"hidden":"visible"}).text(n),l(g,b,c)})};return s.xScale=function(a){return arguments.length?(i=a,s):i},s.yScale=function(a){return arguments.length?(j=a,s):j},s.snap=function(a){return arguments.length?(k=a,s):k},s.decorate=function(a){return arguments.length?(l=a,s):l},s.xLabel=function(b){return arguments.length?(m=a.functor(b),s):m},s.yLabel=function(b){return arguments.length?(n=a.functor(b),s):n},s.padding=function(b){return arguments.length?(o=a.functor(b),s):o},a.rebind(s,h,"on"),s}}(d3,fc),function(a,b){"use strict";var c=1e-6;b.util.dataJoin=function(){var d="g",e=!1,f="g",g={},h=b.util.fn.index,i=function(i,j){var k=j||b.util.fn.identity;i.selectAll&&i.node||(i=a.select(i));var l=i.selectAll(d);e&&(l=l.filter(function(){return this.parentNode===i.node()}));var m=l.data(k,h),n=m.enter().append(f).attr(g).style("opacity",c),o=a.transition(m.exit()).style("opacity",c).remove();return m=a.transition(m).style("opacity",1),m.enter=a.functor(n),m.exit=a.functor(o),m};return i.selector=function(a){return arguments.length?(d=a,i):d},i.children=function(a){return arguments.length?(e=a,i):e},i.element=function(a){return arguments.length?(f=a,i):f},i.attr=function(a){if(!arguments.length)return g;if(1===arguments.length)g=arguments[0];else if(2===arguments.length){var b=arguments[0],c=arguments[1];g[b]=c}return i},i.key=function(a){return arguments.length?(h=a,i):h},i}}(d3,fc),function(a,b){"use strict";b.util.extent=function(b,c){return Array.isArray(b[0])||(b=[b]),Array.isArray(c)||(c=[c]),"function"!=typeof c[0]&&(c=c.map(function(a){return function(b){return b[a]}})),[a.min(b,function(b){return a.min(b,function(b){return a.min(c.map(function(a){return a(b)}))})}),a.max(b,function(b){return a.max(b,function(b){return a.max(c.map(function(a){return a(b)}))})})]}}(d3,fc),function(a,b){"use strict";b.util.fn={context:function(){return this},identity:function(a){return a},index:function(a,b){return b},noop:function(a){}}}(d3,fc),function(a,b){"use strict";b.util.fractionalBarWidth=function(b){return function(c){if(c.length<=1)return 10;c.sort();var d=a.pairs(c).map(function(a){return Math.abs(a[0]-a[1])}),e=a.min(d);return b*e}}}(d3,fc),function(a,b){"use strict";b.util.innerDimensions=function(a){var b=getComputedStyle(a);return{width:parseFloat(b.width)-parseFloat(b.paddingLeft)-parseFloat(b.paddingRight),height:parseFloat(b.height)-parseFloat(b.paddingTop)-parseFloat(b.paddingBottom)}}}(d3,fc),function(a,b){"use strict";b.util.rebind=function(b,c,d){return"object"!=typeof d?a.rebind.apply(a,arguments):(Object.keys(d).forEach(function(a){var e=c[d[a]];if("function"!=typeof e)throw new Error("The method "+d[a]+" does not exist on the source object");b[a]=function(){var a=e.apply(c,arguments);return a===c?b:a}}),b)}}(d3,fc),function(a,b){"use strict";b.util.scale={range:function(a){return b.util.scale.isOrdinal(a)?a.rangeExtent():a.range()},isOrdinal:function(a){return a.rangeExtent}}}(d3,fc),function(a,b){"use strict";b.util.noSnap=function(a,b){return function(c,d){var e={xInDomainUnits:!1,x:c,yInDomainUnits:!1,y:d};return a.invert&&(e.xInDomainUnits=!0,e.x=a.invert(c)),b.invert&&(e.yInDomainUnits=!0,e.y=b.invert(d)),e}},b.util.pointSnap=function(a,b,c,d,e,f){return f=f||function(a,b,c,d){var e=a-c,f=b-d;return Math.sqrt(e*e+f*f)},function(g,h){var i=e.map(function(e){var i=f(g,h,a(c(e)),b(d(e)));return[i,e]}).reduce(function(a,b){return a[0]>b[0]?b:a},[Number.MAX_VALUE,null])[1];return{datum:i,x:i?c(i):g,xInDomainUnits:Boolean(i),y:i?d(i):h,yInDomainUnits:Boolean(i)}}},b.util.seriesPointSnapXOnly=function(a,c){function d(a,b,c,d){var e=a-c;return Math.abs(e)}return b.util.seriesPointSnap(a,c,d)},b.util.seriesPointSnapYOnly=function(a,c){function d(a,b,c,d){var e=b-d;return Math.abs(e)}return b.util.seriesPointSnap(a,c,d)},b.util.seriesPointSnap=function(a,c,d){return function(e,f){var g=a.xScale(),h=a.yScale(),i=a.xValue(),j=(a.yValue||a.yCloseValue).call(a);return b.util.pointSnap(g,h,i,j,c,d)(e,f)}}}(d3,fc); | ||
!function(){"use strict";var a="1.0.0",b=null;b=(1,eval)("this"),b.fc={annotation:{},chart:{},data:{feed:{},random:{}},indicator:{algorithm:{calculator:{}},renderer:{}},scale:{discontinuity:{}},series:{stacked:{}},svg:{},tool:{},util:{},version:a}}(),function(a,b){"use strict";b.annotation.band=function(){var c,d,e,f,g=a.time.scale(),h=a.scale.linear(),i=function(){return b.util.scale.range(g)[0]},j=function(){return b.util.scale.range(g)[1]},k=function(){return b.util.scale.range(h)[0]},l=function(){return b.util.scale.range(h)[1]},m=b.util.fn.noop,n=b.util.dataJoin().selector("g.annotation").element("g").attr("class","annotation"),o=function(c){c.each(function(c,d){var e=a.select(this),f=n(e,c);f.enter().append("path").classed("band",!0);var g=b.svg.bar().align("right").x(i).y(k).height(function(){return l.apply(this,arguments)-k.apply(this,arguments)}).width(function(){return j.apply(this,arguments)-i.apply(this,arguments)});f.select("path").attr("d",function(a,b){return g.call(this,[a],b)}),m(f,c,d)})};return o.xScale=function(a){return arguments.length?(g=a,o):g},o.yScale=function(a){return arguments.length?(h=a,o):h},o.decorate=function(a){return arguments.length?(m=a,o):m},o.x0=function(b){return arguments.length?(c=a.functor(b),i=function(){return g(c.apply(this,arguments))},o):c},o.x1=function(b){return arguments.length?(d=a.functor(b),j=function(){return g(d.apply(this,arguments))},o):d},o.y0=function(b){return arguments.length?(e=a.functor(b),k=function(){return h(e.apply(this,arguments))},o):e},o.y1=function(b){return arguments.length?(f=a.functor(b),l=function(){return h(f.apply(this,arguments))},o):f},o}}(d3,fc),function(a,b){"use strict";b.annotation.gridline=function(){var c=a.time.scale(),d=a.scale.linear(),e=10,f=10,g=b.util.fn.noop,h=b.util.fn.noop,i=b.util.dataJoin().selector("line.x").element("line").attr("class","x gridline"),j=b.util.dataJoin().selector("line.y").element("line").attr("class","y gridline"),k=function(a){a.each(function(a,b){var k=c.ticks(e),l=i(this,k);l.attr({x1:c,x2:c,y1:d.range()[0],y2:d.range()[1]}),g(l,k,b);var m=d.ticks(f),n=j(this,m);n.attr({x1:c.range()[0],x2:c.range()[1],y1:d,y2:d}),h(n,m,b)})};return k.xScale=function(a){return arguments.length?(c=a,k):c},k.yScale=function(a){return arguments.length?(d=a,k):d},k.xTicks=function(a){return arguments.length?(e=a,k):e},k.yTicks=function(a){return arguments.length?(f=a,k):f},k.yDecorate=function(a){return arguments.length?(h=a,k):h},k.xDecorate=function(a){return arguments.length?(g=a,k):g},k}}(d3,fc),function(a,b){"use strict";b.annotation.line=function(){var c=a.time.scale(),d=a.scale.linear(),e=b.util.fn.identity,f=b.util.fn.index,g=e,h=b.util.fn.noop,i="horizontal",j=b.util.dataJoin().selector("g.annotation").element("g").attr("class","annotation"),k=function(f){f.each(function(f,k){var l,m,n,o,p,q,r={x:-5,y:-5};switch(i){case"horizontal":n=function(a,b){return"translate("+a+", "+b+")"},o="x2",m=c,l=d,p="left-handle",q="right-handle";break;case"vertical":n=function(a,b){return"translate("+b+", "+a+")"},o="y2",m=d,l=c,r.transform="rotate(-90)",p="bottom-handle",q="top-handle";break;default:throw new Error("Invalid orientation")}var s=b.util.scale.range(m),t=function(a){var b=l(e(a));return n(s[0],b)},u=s[1]-s[0],v=a.select(this),w=j(v,f),x=w.enter().attr("transform",t);x.append("line").attr(o,u),x.append("g").classed(p,!0),x.append("g").classed(q,!0).attr("transform",n(u,0)).append("text").attr(r),w.attr("transform",t),w.select("line").attr(o,u),w.select("g."+q).attr("transform",n(u,0)),w.select("text").text(g),h(w,f,k)})};return k.xScale=function(a){return arguments.length?(c=a,k):c},k.yScale=function(a){return arguments.length?(d=a,k):d},k.value=function(b){return arguments.length?(e=a.functor(b),k):e},k.keyValue=function(b){return arguments.length?(f=a.functor(b),k):f},k.label=function(b){return arguments.length?(g=a.functor(b),k):g},k.decorate=function(a){return arguments.length?(h=a,k):h},k.orient=function(a){return arguments.length?(i=a,k):i},k}}(d3,fc),function(a,b){"use strict";b.chart.legend=function(){var c=b.util.fn.noop,d=b.util.fn.noop,e=[["datum",function(a){return a.datum}]],f=b.util.dataJoin().selector("table.legend").element("table").attr("class","legend"),g=b.util.dataJoin().selector("tr.row").element("tr").attr("class","row"),h=function(b){b.each(function(b,h){var i=a.select(this),j=e.map(function(c,d){return{datum:b,header:a.functor(c[0]),value:a.functor(c[1])}}),k=f(i,[j]),l=g(k),m=l.enter();m.append("th"),m.append("td"),l.select("th").html(function(a,b){return a.header.call(this,a.datum,b)}),l.select("td").html(function(a,b){return a.value.call(this,a.datum,b)}),c(k,b,h),d(l,b,h)})};return h.items=function(a){return arguments.length?(e=a,h):e},h.rowDecorate=function(a){return arguments.length?(d=a,h):d},h.tableDecorate=function(a){return arguments.length?(c=a,h):c},h}}(d3,fc),function(a,b){"use strict";b.chart.linearTimeSeries=function(){var c=20,d=0,e=b.series.line(),f=b.scale.dateTime(),g=a.scale.linear(),h=b.svg.axis().scale(f).orient("bottom"),i=b.svg.axis().scale(g).orient("left"),j=function(b){b.each(function(b){var j=a.select(this),k={position:"absolute",top:0,right:d,bottom:c,left:0},l=j.selectAll("rect.background").data([b]);l.enter().append("rect").attr("class","background").layout(k);var m=j.selectAll("svg.plot-area").data([b]);m.enter().append("svg").attr({"class":"plot-area"}).layout(k);var n=j.selectAll("g.x-axis").data([b]);n.enter().append("g").attr("class","axis x-axis").layout({position:"absolute",left:0,bottom:0,right:d,height:c});var o=j.selectAll("g.y-axis").data([b]);o.enter().append("g").attr("class","axis y-axis").layout({position:"absolute",top:0,right:0,bottom:c,width:d}),j.layout(),f.range([0,n.layout("width")]),g.range([o.layout("height"),0]),n.call(h),o.call(i),e.xScale(f).yScale(g),m.call(e)})};return b.util.rebind(j,f,{xDiscontinuityProvider:"discontinuityProvider",xDomain:"domain",xNice:"nice"}),b.util.rebind(j,g,{yDomain:"domain",yNice:"nice"}),b.util.rebind(j,h,{xTicks:"ticks",xTickValues:"tickValues",xTickSize:"tickSize",xInnerTickSize:"innerTickSize",xOuterTickSize:"outerTickSize",xTickPadding:"tickPadding",xTickFormat:"tickFormat",xOrient:"orient",xDecorate:"decorate"}),b.util.rebind(j,i,{yTicks:"ticks",yTickValues:"tickValues",yTickSize:"tickSize",yInnerTickSize:"innerTickSize",yOuterTickSize:"outerTickSize",yTickPadding:"tickPadding",yTickFormat:"tickFormat",yOrient:"orient",yDecorate:"decorate"}),j.xScale=function(){return f},j.yScale=function(){return g},j.plotArea=function(a){return arguments.length?(e=a,j):e},j.xAxisHeight=function(a){return arguments.length?(c=a,j):c},j.yAxisWidth=function(a){return arguments.length?(d=a,j):d},j}}(d3,fc),function(a,b){"use strict";b.chart.sparkline=function(){function c(b){function c(a){return b.filter(function(b){return e(b)===a})[0]}var d=j.xValue(),e=j.yValue(),f=a.max(b,e),g=a.min(b,e);return[{x:d(b[0]),y:e(b[0])},{x:d(c(f)),y:f},{x:d(c(g)),y:g},{x:d(b[b.length-1]),y:e(b[b.length-1])}]}var d=b.scale.dateTime(),e=a.scale.linear(),f=2,g=b.series.line(),h=b.series.point().xValue(function(a){return a.x}).yValue(function(a){return a.y}).decorate(function(a){a.attr("class",function(a,b){switch(b){case 0:return"open";case 1:return"high";case 2:return"low";case 3:return"close"}})}),i=b.series.multi().series([g,h]).mapping(function(a){switch(a){case h:return c(this);default:return this}}),j=function(c){h.radius(f),c.each(function(c){var g=a.select(this),h=b.util.innerDimensions(this),j=f;d.range([j,h.width-j]),e.range([h.height-j,j]),i.xScale(d).yScale(e),g.call(i)})};return b.util.rebind(j,d,{xDiscontinuityProvider:"discontinuityProvider",xDomain:"domain"}),b.util.rebind(j,e,{yDomain:"domain"}),b.util.rebind(j,g,"xValue","yValue"),j.xScale=function(){return d},j.yScale=function(){return e},j.radius=function(a){return arguments.length?(f=a,j):f},j}}(d3,fc),function(a){"use strict";a.data.feed.coinbase=function(){var a="BTC-USD",b=null,c=null,d=null,e=function(e){var f=[];null!=b&&f.push("start="+b.toISOString()),null!=c&&f.push("end="+c.toISOString()),null!=d&&f.push("granularity="+d);var g="https://api.exchange.coinbase.com/products/"+a+"/candles?"+f.join("&");d3.json(g,function(a,b){return a?void e(a):(b=b.map(function(a){return{date:new Date(1e3*a[0]),open:a[3],high:a[2],low:a[1],close:a[4],volume:a[5]}}),void e(a,b))})};return e.product=function(b){return arguments.length?(a=b,e):a},e.start=function(a){return arguments.length?(b=a,e):b},e.end=function(a){return arguments.length?(c=a,e):c},e.granularity=function(a){return arguments.length?(d=a,e):d},e}}(fc),function(a){"use strict";a.data.random.financial=function(){var b=.1,c=.1,d=100,e=1e5,f=new Date,g=50,h=.3,i=function(a){return!(0===a.getDay()||6===a.getDay())},j=function(a,b,c){for(var d,e=[],h=0,i=0;e.length<a;)d=b.slice(i,i+g),e.push({date:new Date(f.getTime()),open:d[0],high:Math.max.apply({},d),low:Math.min.apply({},d),close:d[g-1],volume:c[h]}),i+=g,h+=1,f.setUTCDate(f.getUTCDate()+1);return e},k=function(k){var l=new Date(f.getTime());l.setUTCDate(f.getUTCDate()+k);var m=315569e5,n=(l.getTime()-f.getTime())/m,o=a.data.random.walk(n,k*g,b,c,d),p=a.data.random.walk(n,k,0,c,e);return p=p.map(function(a){var b=Math.min(0,Math.max(h,1)),c=1+b*(1-2*Math.random());return Math.floor(a*c)}),d=o[o.length-1],e=p[p.length-1],j(k,o,p).filter(function(a){return!i||i(a.date)})};return k.mu=function(a){return arguments.length?(b=a,k):b},k.sigma=function(a){return arguments.length?(c=a,k):c},k.startPrice=function(a){return arguments.length?(d=a,k):d},k.startVolume=function(a){return arguments.length?(e=a,k):e},k.startDate=function(a){return arguments.length?(f=a,k):f},k.stepsPerDay=function(a){return arguments.length?(g=a,k):g},k.volumeNoiseFactor=function(a){return arguments.length?(h=a,k):h},k.filter=function(a){return arguments.length?(i=a,k):i},k}}(fc),function(a,b){"use strict";b.data.random.walk=function(b,c,d,e,f){var g,h,i=a.random.normal(),j=b/c,k=new Array(c+1);for(h=1;h<k.length;h+=1)g=i(),g*=Math.sqrt(j),g*=e,g+=(d-e*e/2)*j,k[h]=Math.exp(g);for(k[0]=f,h=1;h<k.length;h+=1)k[h]=k[h-1]*k[h];return k}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.bollingerBands=function(){var c=b.indicator.algorithm.calculator.bollingerBands().value(function(a){return a.close}),d=b.indicator.algorithm.merge().algorithm(c).merge(function(a,b){a.bollingerBands=b}),e=function(a){return d(a)};return e.root=function(a){return a.bollingerBands},a.rebind(e,d,"merge"),a.rebind(e,c,"windowSize","value","multiplier"),e}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.calculator.bollingerBands=function(){var c=2,d=b.indicator.algorithm.calculator.slidingWindow().undefinedValue({upper:void 0,average:void 0,lower:void 0}).accumulator(function(b){var d=a.mean(b),e=a.deviation(b);return{upper:d+c*e,average:d,lower:d-c*e}}),e=function(a){return d(a)};return e.multiplier=function(a){return arguments.length?(c=a,e):c},a.rebind(e,d,"windowSize","value"),e}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.calculator.exponentialMovingAverage=function(){var a=9,c=b.util.fn.identity,d=function(b){var d,e=2/(a+1),f=0;return b.map(function(b,g){if(a-1>g)return void(f+=c(b,g));if(g===a-1){f+=c(b,g);var h=f/a;return d=h,h}var i=c(b,g)*e+(1-e)*d;return d=i,i})};return d.windowSize=function(b){return arguments.length?(a=b,d):a},d.value=function(a){return arguments.length?(c=a,d):c},d}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.calculator.macd=function(){var c=b.util.fn.identity,d=b.indicator.algorithm.calculator.exponentialMovingAverage().windowSize(12),e=b.indicator.algorithm.calculator.exponentialMovingAverage().windowSize(29),f=b.indicator.algorithm.calculator.exponentialMovingAverage().windowSize(9),g=b.indicator.algorithm.calculator.undefinedInputAdapter().algorithm(f),h=function(b){d.value(c),e.value(c);var f=a.zip(d(b),e(b)).map(function(a){return void 0!==a[0]&&void 0!==a[1]?a[0]-a[1]:void 0}),h=g(f),i=a.zip(f,h).map(function(a){return{macd:a[0],signal:a[1],divergence:void 0!==a[0]&&void 0!==a[1]?a[0]-a[1]:void 0}});return i};return h.value=function(a){return arguments.length?(c=a,h):c},b.util.rebind(h,d,{fastPeriod:"windowSize"}),b.util.rebind(h,e,{slowPeriod:"windowSize"}),b.util.rebind(h,f,{signalPeriod:"windowSize"}),h}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.calculator.percentageChange=function(){var c=a.functor(0),d=b.util.fn.identity,e=function(a){if(0===a.length)return[];var b=d(a[c(a)]);return a.map(function(a,c){return(d(a,c)-b)/b})};return e.baseIndex=function(b){return arguments.length?(c=a.functor(b),e):c},e.value=function(a){return arguments.length?(d=a,e):d},e}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.calculator.relativeStrengthIndex=function(){var c=function(a,b){return a.open},d=function(a,b){return a.close},e=function(a){for(var b=1/a.length,c=a[0],d=1,e=a.length;e>d;d++)c=b*a[d]+(1-b)*c;return c},f=b.indicator.algorithm.calculator.slidingWindow().windowSize(14).accumulator(function(a){for(var b=[],f=[],g=0,h=a.length;h>g;g++){var i=a[g],j=c(i),k=d(i);b.push(j>k?j-k:0),f.push(k>j?k-j:0)}var l=e(b);if(0===l)return 100;var m=e(f)/l;return 100-100/(1+m)}),g=function(a){return f(a)};return g.openValue=function(a){return arguments.length?(c=a,g):c},g.closeValue=function(a){return arguments.length?(d=a,g):d},a.rebind(g,f,"windowSize"),g}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.calculator.slidingWindow=function(){var c=a.functor(void 0),d=a.functor(10),e=b.util.fn.noop,f=b.util.fn.identity,g=function(a){var b=d.apply(this,arguments),g=a.slice(0,b).map(f);return a.map(function(a,d){return b-1>d?c(a,d):(d>=b&&(g.shift(),g.push(f(a,d))),e(g))})};return g.undefinedValue=function(b){return arguments.length?(c=a.functor(b),g):c},g.windowSize=function(b){return arguments.length?(d=a.functor(b),g):d},g.accumulator=function(a){return arguments.length?(e=a,g):e},g.value=function(a){return arguments.length?(f=a,g):f},g}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.calculator.undefinedInputAdapter=function(){function c(a){return Array.apply(null,new Array(a)).map(e)}var d=b.indicator.algorithm.calculator.slidingWindow().accumulator(a.mean),e=a.functor(void 0),f=function(a){return void 0===a},g=function(a){for(var b=0;f(a[b])&&b<a.length;)b++;var e=a.slice(b);return c(b).concat(d(e))};return g.algorithm=function(a){return arguments.length?(d=a,g):d},g.undefinedValue=function(b){return arguments.length?(e=a.functor(b),g):e},g.defined=function(a){return arguments.length?(f=a,g):f},g}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.exponentialMovingAverage=function(){var c=b.indicator.algorithm.calculator.slidingWindow().accumulator(a.mean).value(function(a){return a.close}),d=b.indicator.algorithm.merge().algorithm(c).merge(function(a,b){a.exponentialMovingAverage=b}),e=function(a){return d(a)};return a.rebind(e,d,"merge"),a.rebind(e,c,"windowSize","value"),e}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.macd=function(){var c=b.indicator.algorithm.calculator.macd().value(function(a){return a.close}),d=b.indicator.algorithm.merge().algorithm(c).merge(function(a,b){a.macd=b}),e=function(a){return d(a)};return a.rebind(e,d,"merge"),a.rebind(e,c,"fastPeriod","slowPeriod","signalPeriod","value"),e}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.merge=function(){var c=b.util.fn.noop,d=b.indicator.algorithm.calculator.slidingWindow(),e=function(b){return a.zip(b,d(b)).forEach(function(a){c(a[0],a[1])})};return e.algorithm=function(a){return arguments.length?(d=a,e):d},e.merge=function(a){return arguments.length?(c=a,e):c},e}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.movingAverage=function(){var c=b.indicator.algorithm.calculator.slidingWindow().accumulator(a.mean).value(function(a){return a.close}),d=b.indicator.algorithm.merge().algorithm(c).merge(function(a,b){a.movingAverage=b}),e=function(a){return d(a)};return a.rebind(e,d,"merge"),a.rebind(e,c,"windowSize","undefinedValue","value"),e}}(d3,fc),function(a,b){"use strict";b.indicator.algorithm.relativeStrengthIndex=function(){var c=b.indicator.algorithm.calculator.relativeStrengthIndex(),d=b.indicator.algorithm.merge().algorithm(c).merge(function(a,b){a.rsi=b}),e=function(a){return d(a)};return a.rebind(e,d,"merge"),a.rebind(e,c,"windowSize","openValue","closeValue"),e}}(d3,fc),function(a,b){"use strict";b.indicator.renderer.bollingerBands=function(){var c=a.time.scale(),d=a.scale.linear(),e=function(a,b){return a.close},f=function(a,b){return a.date},g=function(a){return a.bollingerBands},h=b.series.area().y0Value(function(a,b){return g(a).upper}).y1Value(function(a,b){return g(a).lower}),i=b.series.line().yValue(function(a,b){return g(a).upper}),j=b.series.line().yValue(function(a,b){return g(a).average}),k=b.series.line().yValue(function(a,b){return g(a).lower}),l=function(a){var e=b.series.multi().xScale(c).yScale(d).series([h,i,k,j]).decorate(function(a){a.enter().attr("class",function(a,b){return"multi "+["area","upper","lower","average"][b]})});h.xValue(f),i.xValue(f),j.xValue(f),k.xValue(f),a.call(e)};return l.xScale=function(a){return arguments.length?(c=a,l):c},l.yScale=function(a){return arguments.length?(d=a,l):d},l.xValue=function(a){return arguments.length?(f=a,l):f},l.yValue=function(a){return arguments.length?(e=a,l):e},l.root=function(a){return arguments.length?(g=a,l):g},l}}(d3,fc),function(a,b){"use strict";b.indicator.renderer.macd=function(){var c=a.time.scale(),d=a.scale.linear(),e=function(a){return a.date},f=function(a){return a.macd},g=b.series.line(),h=b.series.line(),i=b.series.bar(),j=b.series.multi(),k=function(a){g.xValue(e).yValue(function(a,b){return f(a).macd}),h.xValue(e).yValue(function(a,b){return f(a).signal}),i.xValue(e).yValue(function(a,b){return f(a).divergence}),j.xScale(c).yScale(d).series([i,g,h]).decorate(function(a){a.enter().attr("class",function(a,b){return"multi "+["divergence","macd","signal"][b]})}),a.call(j)};return k.xScale=function(a){return arguments.length?(c=a,k):c},k.xValue=function(a){return arguments.length?(e=a,k):e},k.yScale=function(a){return arguments.length?(d=a,k):d},k.root=function(a){return arguments.length?(f=a,k):f},k}}(d3,fc),function(a,b){"use strict";b.indicator.renderer.relativeStrengthIndex=function(){var c=a.time.scale(),d=a.scale.linear(),e=70,f=30,g=b.annotation.line(),h=b.series.line().yValue(function(a,b){return a.rsi}),i=function(b){g.xScale(c).yScale(d),h.xScale(c).yScale(d),b.each(function(b){var c=a.select(this),d=c.selectAll("g.annotations").data([[e,50,f]]);d.enter().append("g").attr("class","annotations"),d.call(g);var i=c.selectAll("g.indicator").data([b]);i.enter().append("g").attr("class","indicator"),i.call(h)})};return i.xScale=function(a){return arguments.length?(c=a,i):c},i.yScale=function(a){return arguments.length?(d=a,i):d},i.upperValue=function(a){return arguments.length?(e=a,i):e},i.lowerValue=function(a){return arguments.length?(f=a,i):f},a.rebind(i,h,"yValue","xValue"),i}}(d3,fc),function(a,b,c){"use strict";a.selection.prototype.layout=function(a,c){var d=b.layout(),e=arguments.length;if(2===e)"string"!=typeof a?(d.width(a).height(c),this.call(d)):this.attr("layout-css",a+":"+c);else if(1===e){if("string"==typeof a)return Number(this.attr("layout-"+a));var f=a,g=Object.keys(f).map(function(a){return a+":"+f[a]}).join(";");this.attr("layout-css",g)}else 0===e&&this.call(d);return this},b.layout=function(){function a(a){if(!a)return{};var b=a.split(";"),c={};return b.forEach(function(a){var b=a.split(":");if(2===b.length){var d=b[0].trim(),e=b[1].trim();c[d]=isNaN(e)?e:Number(e)}}),c}function d(b){function c(){for(var a=[],c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];1===e.nodeType&&e.getAttribute("layout-css")&&a.push(d(e))}return a}return{style:a(b.getAttribute("layout-css")),children:c(b),element:b}}function e(a){a.element.setAttribute("layout-width",a.layout.width),a.element.setAttribute("layout-height",a.layout.height),a.element.nodeName.match(/(?:svg|rect)/i)?(a.element.setAttribute("width",a.layout.width),a.element.setAttribute("height",a.layout.height),a.element.setAttribute("x",a.layout.left),a.element.setAttribute("y",a.layout.top)):a.element.setAttribute("transform","translate("+a.layout.left+", "+a.layout.top+")"),a.children.forEach(e)}var f=-1,g=-1,h=function(a){a.each(function(a){var h=b.util.innerDimensions(this),i=d(this);i.style.width=-1!==f?f:h.width,i.style.height=-1!==g?g:h.height,c(i),e(i)})};return h.width=function(a){return arguments.length?(f=a,h):f},h.height=function(a){return arguments.length?(g=a,h):g},h}}(d3,fc,computeLayout),function(a,b){"use strict";function c(d,e){function f(a){var b=d.domain(),c=d.range(),f=e.distance(b[0],b[1]),g=e.distance(b[0],a),h=g/f,i=h*(c[1]-c[0])+c[0];return i}return arguments.length||(d=a.time.scale(),e=b.scale.discontinuity.identity()),f.invert=function(a){var b=d.domain(),c=d.range(),f=(a-c[0])/(c[1]-c[0]),g=e.distance(b[0],b[1]),h=f*g;return e.offset(b[0],h)},f.domain=function(a){if(!arguments.length)return d.domain();var b=e.clampUp(a[0]),c=e.clampDown(a[1]);return d.domain([b,c]),f},f.nice=function(){d.nice();var a=d.domain(),b=e.clampUp(a[0]),c=e.clampDown(a[1]);return d.domain([b,c]),f},f.ticks=function(){var a=d.ticks.apply(this,arguments);return b.scale.dateTime.tickTransformer(a,e,f.domain())},f.copy=function(){return c(d.copy(),e.copy())},f.discontinuityProvider=function(a){return arguments.length?(e=a,f):e},a.rebind(f,d,"range","rangeRound","interpolate","clamp","tickFormat")}b.scale.dateTime=function(){return c()},b.scale.dateTime.tickTransformer=function(a,b,c){var d=a.map(function(d,e){if(e<a.length-1)return b.clampUp(d);var f=b.clampUp(d);return f<c[1]?f:b.clampDown(d)}),e=d.reduce(function(a,b){return 0===a.filter(function(a){return a.getTime()===b.getTime()}).length&&a.push(b),a},[]);return e}}(d3,fc),function(a,b){"use strict";b.scale.discontinuity.identity=function(){var a={};return a.distance=function(a,b){return b.getTime()-a.getTime()},a.offset=function(a,b){return new Date(a.getTime()+b)},a.clampUp=b.util.fn.identity,a.clampDown=b.util.fn.identity,a.copy=function(){return a},a}}(d3,fc),function(a,b){"use strict";b.scale.discontinuity.skipWeekends=function(){function b(a){return 0===a.getDay()||6===a.getDay()}var c=864e5,d=5*c,e=7*c,f={};return f.clampDown=function(c){if(b(c)){var d=0===c.getDay()?2:1,e=a.time.day.ceil(c);return a.time.day.offset(e,-d)}return c},f.clampUp=function(c){if(b(c)){var d=0===c.getDay()?1:2,e=a.time.day.floor(c);return a.time.day.offset(e,d)}return c},f.distance=function(b,c){b=f.clampUp(b),c=f.clampDown(c);var g=a.time.saturday.ceil(b);if(g>c)return c.getTime()-b.getTime();var h=g.getTime()-b.getTime(),i=a.time.saturday.ceil(c),j=i.getTime()-c.getTime(),k=(i.getTime()-g.getTime())/e;return k*d+h-j},f.offset=function(c,e){var g=b(c)?f.clampUp(c):c,h=e,i=a.time.saturday.ceil(g);if(h-=i.getTime()-g.getTime(),0>h)return new Date(g.getTime()+e);g=a.time.day.offset(i,2);var j=Math.floor(h/d);return g=a.time.day.offset(g,7*j),h-=j*d,g=new Date(g.getTime()+h)},f.copy=function(){return f},f}}(d3,fc),function(a,b){"use strict";b.series.area=function(){var c=b.util.fn.noop,d=a.time.scale(),e=a.scale.linear(),f=a.functor(0),g=function(a,b){return a.close},h=function(a,b){return a.date},i=function(a,b){return d(h(a,b))},j=function(a,b){return e(f(a,b))},k=function(a,b){return e(g(a,b))},l=a.svg.area().defined(function(a,b){return!isNaN(j(a,b))&&!isNaN(k(a,b))}).x(i).y0(j).y1(k),m=b.util.dataJoin().selector("path.area").element("path").attr("class","area"),n=function(a){a.each(function(a,b){var d=m(this,[a]);d.attr("d",l),c(d,a,b)})};return n.decorate=function(a){return arguments.length?(c=a,n):c},n.xScale=function(a){return arguments.length?(d=a,n):d},n.yScale=function(a){return arguments.length?(e=a,n):e},n.xValue=function(a){return arguments.length?(h=a,n):h},n.y0Value=function(b){return arguments.length?(f=a.functor(b),n):f},n.yValue=n.y1Value=function(a){return arguments.length?(g=a,n):g},a.rebind(n,m,"key"),a.rebind(n,l,"interpolate","tension"),n}}(d3,fc),function(a,b){"use strict";b.series.axis=function(){var c=b.svg.axis(),d=a.functor(0),e=b.util.fn.noop,f=a.time.scale(),g=a.scale.linear(),h=b.util.dataJoin().selector("g.axis-adapter").element("g").attr({"class":"axis axis-adapter"}),i=function(a){a.each(function(a,b){var j=h(this,[a]);switch(i.orient()){case"top":case"bottom":j.attr("transform","translate(0,"+g(d(a))+")"),c.scale(f);break;case"left":case"right":j.attr("transform","translate("+f(d(a))+",0)"),c.scale(g);break;default:throw new Error("Invalid orientation")}j.call(c),e(j,a,b)})};return i.baseline=function(b){return arguments.length?(d=a.functor(b),i):d},i.decorate=function(a){return arguments.length?(e=a,i):e},i.xScale=function(a){return arguments.length?(f=a,i):f},i.yScale=function(a){return arguments.length?(g=a,i):g},a.rebind(i,c,"orient","ticks","tickValues","tickSize","innerTickSize","outerTickSize","tickPadding","tickFormat")}}(d3,fc),function(a,b){"use strict";b.series.bar=function(){var c=b.util.fn.noop,d=a.time.scale(),e=a.scale.linear(),f=function(a,b){return a.close},g=function(a,b){return a.date},h=a.functor(0),i=b.util.fractionalBarWidth(.75),j=b.util.dataJoin().selector("g.bar").element("g").attr("class","bar"),k=function(a,b){return d(g(a,b))},l=function(d){d.each(function(d,l){var m=d.filter(function(a,b){return void 0!==h(a,b)&&void 0!==f(a,b)&&void 0!==g(a,b)}),n=j(this,m),o=i(m.map(k)),p=b.svg.bar().x(0).y(0).width(o).height(0),q=function(a,b){return k(a,b)},r=function(a,b){return e(f(a,b))},s=function(a,b){return e(h(a,b))};n.enter().attr("transform",function(a,b){return"translate("+q(a,b)+", "+s(a,b)+")"}).append("path").attr("d",function(a){return p([a])}),n.each(function(b,c){p.height(s(b,c)-r(b,c));var d=a.select(this);a.transition(d).attr("transform","translate("+q(b,c)+", "+r(b,c)+")").select("path").attr("d",p([b]))}),c(n,m,l)})};return l.decorate=function(a){return arguments.length?(c=a,l):c},l.xScale=function(a){return arguments.length?(d=a,l):d},l.yScale=function(a){return arguments.length?(e=a,l):e},l.xValue=function(a){return arguments.length?(g=a,l):g},l.y0Value=function(b){return arguments.length?(h=a.functor(b),l):h},l.yValue=l.y1Value=function(a){return arguments.length?(f=a,l):f},l.barWidth=function(b){return arguments.length?(i=a.functor(b),l):i},a.rebind(l,j,"key"),l}}(d3,fc),function(a,b){"use strict";b.series.candlestick=function(){var c=b.util.fn.noop,d=a.time.scale(),e=a.scale.linear(),f=function(a,b){return a.date},g=function(a,b){return a.open},h=function(a,b){return a.high},i=function(a,b){return a.low},j=function(a,b){return a.close},k=b.util.fractionalBarWidth(.75),l=b.util.dataJoin().selector("g.candlestick").element("g").attr("class","candlestick"),m=function(a,b){return d(f(a,b))},n=function(d){d.each(function(d,f){var n=l(this,d);n.enter().append("path");var o=b.svg.candlestick().width(k(d.map(m)));n.each(function(b,c){var d=j(b,c),f=g(b,c),k=m(b,c),l=e(f),n=e(h(b,c)),p=e(i(b,c)),q=e(d),r=a.select(this).classed({up:d>f,down:f>d}).attr("transform","translate("+k+", "+n+")");o.x(a.functor(0)).open(function(){return l-n}).high(function(){return n-n}).low(function(){return p-n}).close(function(){return q-n}),r.select("path").attr("d",o([b]))}),c(n,d,f)})};return n.decorate=function(a){return arguments.length?(c=a,n):c},n.xScale=function(a){return arguments.length?(d=a,n):d},n.yScale=function(a){return arguments.length?(e=a,n):e},n.xValue=function(a){return arguments.length?(f=a,n):f},n.yOpenValue=function(a){return arguments.length?(g=a,n):g},n.yHighValue=function(a){return arguments.length?(h=a,n):h},n.yLowValue=function(a){return arguments.length?(i=a,n):i},n.yValue=n.yCloseValue=function(a){return arguments.length?(j=a,n):j},n.barWidth=function(b){return arguments.length?(k=a.functor(b),n):k},a.rebind(n,l,"key"),n}}(d3,fc),function(a,b){"use strict";b.series.cycle=function(){var c=b.util.fn.noop,d=a.scale.linear(),e=a.scale.linear(),f=function(a,b){return a.date.getDay()},g=a.scale.linear(),h=b.series.line(),i=b.util.fractionalBarWidth(.75),j=b.util.dataJoin().selector("g.cycle").element("g").attr("class","cycle"),k=function(b){b.each(function(b,k){var l=a.nest().key(f).map(b),m=Object.keys(l),n=i(m.map(d)),o=n/2,p=j(this,m);p.each(function(b,c){var f=a.select(this);f.attr("transform","translate("+d(b)+", 0)"),(g.rangeBands||g.range)([-o,o]),h.xScale(g).yScale(e),a.select(this).datum(l[b]).call(h)}),c(p,m,k)})};return k.decorate=function(a){return arguments.length?(c=a,k):c},k.xScale=function(a){return arguments.length?(d=a,k):d},k.yScale=function(a){return arguments.length?(e=a,k):e},k.xValue=function(a){return arguments.length?(f=a,k):f},k.subScale=function(a){return arguments.length?(g=a,k):g},k.subSeries=function(a){return arguments.length?(h=a,k):h},k.barWidth=function(b){return arguments.length?(i=a.functor(b),k):i},a.rebind(k,j,"key"),k}}(d3,fc),function(a,b){"use strict";b.series.line=function(){var c=b.util.fn.noop,d=a.time.scale(),e=a.scale.linear(),f=function(a,b){return a.close},g=function(a,b){return a.date},h=function(a,b){return d(g(a,b))},i=function(a,b){return e(f(a,b))},j=a.svg.line().defined(function(a,b){return!isNaN(i(a,b))}).x(h).y(i),k=b.util.dataJoin().selector("path.line").element("path").attr("class","line"),l=function(a){a.each(function(a,b){var d=k(this,[a]);d.attr("d",j),c(d,a,b)})};return l.decorate=function(a){return arguments.length?(c=a,l):c},l.xScale=function(a){return arguments.length?(d=a,l):d},l.yScale=function(a){return arguments.length?(e=a,l):e},l.xValue=function(a){return arguments.length?(g=a,l):g},l.yValue=function(a){return arguments.length?(f=a,l):f},a.rebind(l,k,"key"),a.rebind(l,j,"interpolate","tension"),l}}(d3,fc),function(a,b){"use strict";b.series.multi=function(){var c=a.time.scale(),d=a.scale.linear(),e=[],f=b.util.fn.context,g=b.util.fn.index,h=b.util.fn.noop,i=b.util.dataJoin().selector("g.multi").children(!0).attr("class","multi").element("g").key(function(a,b){var c=this.__series__||a;return g.call(this,c,b)}),j=function(b){b.each(function(b){var g=i(this,e);g.each(function(e,g){this.__series__=e,(e.xScale||e.x).call(e,c),(e.yScale||e.y).call(e,d),a.select(this).datum(f.call(b,e,g)).call(e)}),h(g)})};return j.xScale=function(a){return arguments.length?(c=a,j):c},j.yScale=function(a){return arguments.length?(d=a,j):d},j.series=function(a){return arguments.length?(e=a,j):e},j.mapping=function(a){return arguments.length?(f=a,j):f},j.key=function(a){return arguments.length?(g=a,j):g},j.decorate=function(a){return arguments.length?(h=a,j):h},j}}(d3,fc),function(a,b){"use strict";b.series.ohlc=function(c){var d=b.util.fn.noop,e=a.time.scale(),f=a.scale.linear(),g=function(a,b){return a.date},h=function(a,b){return a.open},i=function(a,b){return a.high},j=function(a,b){return a.low},k=function(a,b){return a.close},l=b.util.fractionalBarWidth(.75),m=function(a,b){return e(g(a,b))},n=b.util.dataJoin().selector("g.ohlc").element("g").attr("class","ohlc"),o=function(c){c.each(function(c,e){var g=n(this,c);g.enter().append("path");var o=b.svg.ohlc().width(l(c.map(m)));g.each(function(b,c){var d=k(b,c),e=h(b,c),g=m(b,c),l=f(e),n=f(i(b,c)),p=f(j(b,c)),q=f(d),r=a.select(this).classed({up:d>e,down:e>d}).attr("transform","translate("+g+", "+n+")");o.x(a.functor(0)).open(function(){return l-n}).high(function(){return n-n}).low(function(){return p-n}).close(function(){return q-n}),r.select("path").attr("d",o([b]))}),d(g,c,e)})};return o.decorate=function(a){return arguments.length?(d=a,o):d},o.xScale=function(a){return arguments.length?(e=a,o):e},o.yScale=function(a){return arguments.length?(f=a,o):f},o.xValue=function(a){return arguments.length?(g=a,o):g},o.yOpenValue=function(a){return arguments.length?(h=a,o):h},o.yHighValue=function(a){return arguments.length?(i=a,o):i},o.yLowValue=function(a){return arguments.length?(j=a,o):j},o.yValue=o.yCloseValue=function(a){return arguments.length?(k=a, | ||
o):k},o.barWidth=function(b){return arguments.length?(l=a.functor(b),o):l},a.rebind(o,n,"key"),o}}(d3,fc),function(a,b){"use strict";b.series.point=function(){var c=b.util.fn.noop,d=a.time.scale(),e=a.scale.linear(),f=function(a,b){return a.close},g=function(a,b){return a.date},h=a.functor(5),i=b.util.dataJoin().selector("g.point").element("g").attr("class","point"),j=function(a,b){var c=d(g(a,b)),h=e(f(a,b));return"translate("+c+", "+h+")"},k=function(a){a.each(function(a,b){var d=i(this,a);d.enter().attr("transform",j).append("circle"),d.attr("transform",j),d.select("circle").attr("r",h),c(d,a,b)})};return k.decorate=function(a){return arguments.length?(c=a,k):c},k.xScale=function(a){return arguments.length?(d=a,k):d},k.yScale=function(a){return arguments.length?(e=a,k):e},k.xValue=function(a){return arguments.length?(g=a,k):g},k.yValue=function(a){return arguments.length?(f=a,k):f},k.radius=function(a){return arguments.length?(h=a,k):h},a.rebind(k,i,"key"),k}}(d3,fc),function(a,b){"use strict";b.series.stacked.area=function(){var a=b.series.area().yValue(function(a){return a.y0+a.y}).y0Value(function(a){return a.y0}),c=b.series.stacked.stack().series(a),d=function(a){a.call(c)};return b.util.rebind(d,a,{decorate:"decorate",xScale:"xScale",yScale:"yScale",xValue:"xValue",y0Value:"y0Value",y1Value:"y1Value",yValue:"yValue"})}}(d3,fc),function(a,b){"use strict";b.series.stacked.bar=function(){var a=b.series.bar().yValue(function(a){return a.y0+a.y}).y0Value(function(a){return a.y0}),c=b.series.stacked.stack().series(a),d=function(a){a.call(c)};return b.util.rebind(d,a,{decorate:"decorate",xScale:"xScale",yScale:"yScale",xValue:"xValue",y0Value:"y0Value",y1Value:"y1Value",yValue:"yValue",barWidth:"barWidth"})}}(d3,fc),function(a,b){"use strict";b.series.stacked.line=function(){var a=b.series.line().yValue(function(a){return a.y0+a.y}),c=b.series.stacked.stack().series(a),d=function(a){a.call(c)};return b.util.rebind(d,a,{decorate:"decorate",xScale:"xScale",yScale:"yScale",xValue:"xValue",yValue:"yValue"})}}(d3,fc),function(a,b){"use strict";b.series.stacked.stack=function(){var c=b.util.fn.noop,d=function(d){d.each(function(d){var e=a.select(this),f=b.util.dataJoin().selector("g.stacked").element("g").attr("class","stacked");f(e,d).call(c)})};return d.series=function(a){return arguments.length?(c=a,d):c},d}}(d3,fc),function(a,b){"use strict";b.svg.axis=function(){function c(a,b){return function(c){return b(a(c),0)}}function d(a,b){return f()?"translate("+b+", "+a+")":"translate("+a+", "+b+")"}function e(a){return f()?a.map(function(a){return[a[1],a[0]]}):a}function f(){return"left"===j||"right"===j}function g(a,b){return h[a]?h[a].apply(h,k):b}var h=a.scale.identity(),i=b.util.fn.noop,j="bottom",k=[10],l=null,m=null,n=6,o=6,p=3,q=a.svg.line(),r=b.util.dataJoin().selector("g.tick").element("g").key(b.util.fn.identity).attr("class","tick"),s=b.util.dataJoin().selector("path.domain").element("path").attr("class","domain"),t=function(f){f.each(function(f,k){var t=this.__chart__||h;this.__chart__=h.copy();var u=null==l?g("ticks",h.domain()):l,v=null==m?g("tickFormat",b.util.fn.identity):m,w="bottom"===j||"right"===j?1:-1,x=a.select(this),y=b.util.scale.range(h),z=e([[y[0],w*n],[y[0],0],[y[1],0],[y[1],w*n]]),A=s(x,[f]);A.attr("d",q(z)),r.attr({transform:c(b.util.scale.isOrdinal(h)?h:t,d)});var B=r(x,u);B.enter().append("path");var C=w*(o+p);B.enter().append("text").attr("transform",d(0,C)),B.attr("class","tick orient-"+j),B.attr("transform",c(h,d)),B.selectAll("path").attr("d",function(a){return q(e([[0,0],[0,w*o]]))}),B.selectAll("text").attr("transform",d(0,C)).text(v),b.util.scale.isOrdinal(h)||B.exit().attr("transform",c(h,d)),i(B,f,k)})};return t.scale=function(a){return arguments.length?(h=a,t):h},t.ticks=function(a){return arguments.length?(k=arguments,t):k},t.tickValues=function(a){return arguments.length?(l=a,t):l},t.tickFormat=function(a){return arguments.length?(m=a,t):m},t.tickSize=function(a){var b=arguments.length;return b?(o=Number(a),n=Number(arguments[b-1]),t):o},t.innerTickSize=function(a){return arguments.length?(o=Number(a),t):o},t.outerTickSize=function(a){return arguments.length?(n=Number(a),t):n},t.tickPadding=function(a){return arguments.length?(p=a,t):p},t.orient=function(a){return arguments.length?(j=a,t):j},t.decorate=function(a){return arguments.length?(i=a,t):i},t}}(d3,fc),function(a,b){"use strict";b.svg.bar=function(){var b=function(a,b){return a.x},c=function(a,b){return a.y},d="center",e=function(a,b){return a.height},f=a.functor(3),g=function(a,g){return a.map(function(a,h){var i,j=b.call(this,a,g||h),k=c.call(this,a,g||h),l=e.call(this,a,g||h),m=f.call(this,a,g||h);switch(d){case"left":i=m;break;case"right":i=0;break;case"center":i=m/2;break;default:throw new Error("Invalid alignment")}var n="M"+(j-i)+","+k+"h"+m+"v"+l+"h"+-m+"z";return n},this).join("")};return g.x=function(c){return arguments.length?(b=a.functor(c),g):b},g.y=function(b){return arguments.length?(c=a.functor(b),g):c},g.width=function(b){return arguments.length?(f=a.functor(b),g):f},g.align=function(a){return arguments.length?(d=a,g):d},g.height=function(b){return arguments.length?(e=a.functor(b),g):e},g}}(d3,fc),function(a,b){"use strict";b.svg.candlestick=function(){var b=function(a,b){return a.date},c=function(a,b){return a.open},d=function(a,b){return a.high},e=function(a,b){return a.low},f=function(a,b){return a.close},g=a.functor(3),h=function(a){return a.map(function(a,h){var i=b(a,h),j=c(a,h),k=d(a,h),l=e(a,h),m=f(a,h),n=g(a,h),o="M"+(i-n/2)+","+j+"h"+n+"V"+m+"h"+-n+"V"+j+"z",p="M"+i+","+Math.min(m,j)+"V"+k,q="M"+i+","+Math.max(m,j)+"V"+l;return o+p+q}).join("")};return h.x=function(a){return arguments.length?(b=a,h):b},h.open=function(a){return arguments.length?(c=a,h):c},h.high=function(a){return arguments.length?(d=a,h):d},h.low=function(a){return arguments.length?(e=a,h):e},h.close=function(a){return arguments.length?(f=a,h):f},h.width=function(b){return arguments.length?(g=a.functor(b),h):g},h}}(d3,fc),function(a,b){"use strict";b.svg.ohlc=function(){var b=function(a,b){return a.date},c=function(a,b){return a.open},d=function(a,b){return a.high},e=function(a,b){return a.low},f=function(a,b){return a.close},g=a.functor(3),h=function(a){return a.map(function(a,h){var i=b(a,h),j=c(a,h),k=d(a,h),l=e(a,h),m=f(a,h),n=g(a,h)/2,o="M"+i+","+l,p="V"+k,q="M"+i+","+j+"h"+-n,r="M"+i+","+m+"h"+n;return o+p+q+r}).join("")};return h.x=function(a){return arguments.length?(b=a,h):b},h.open=function(a){return arguments.length?(c=a,h):c},h.high=function(a){return arguments.length?(d=a,h):d},h.low=function(a){return arguments.length?(e=a,h):e},h.close=function(a){return arguments.length?(f=a,h):f},h.width=function(b){return arguments.length?(g=a.functor(b),h):g},h}}(d3,fc),function(a,b){"use strict";b.tool.crosshair=function(){function c(c){return a.scale.identity().range(b.util.scale.range(c))}function d(){var b=a.mouse(this),c=a.select(this),d=j.apply(this,b),e=c.datum();e.push(d),c.call(q),g.trackingstart.apply(this,arguments)}function e(){var b=a.mouse(this),c=a.select(this),d=j.apply(this,b),e=c.datum();e[e.length-1]=d,c.call(q),g.trackingmove.apply(this,arguments)}function f(){var b=a.select(this),c=b.datum();c.pop(),b.call(q),g.trackingend.apply(this,arguments)}var g=a.dispatch("trackingstart","trackingmove","trackingend"),h=a.time.scale(),i=a.scale.linear(),j=function(a,c){return b.util.noSnap(h,i)(a,c)},k=b.util.fn.noop,l=function(a){return a.xInDomainUnits?h(a.x):a.x},m=function(a){return a.yInDomainUnits?i(a.y):a.y},n=b.util.dataJoin().children(!0).selector("g.crosshair").element("g").attr("class","crosshair"),o=b.annotation.line().value(m).label(function(a){return a.y}),p=b.annotation.line().orient("vertical").value(l).label(function(a){return a.x}),q=function(g){g.each(function(g,j){var q=a.select(this).style("pointer-events","all").on("mouseenter.crosshair",d).on("mousemove.crosshair",e).on("mouseleave.crosshair",f),r=q.selectAll("rect").data([g]);r.enter().append("rect").style("visibility","hidden"),q.select("rect").attr("x",b.util.scale.range(h)[0]).attr("y",b.util.scale.range(i)[1]).attr("width",b.util.scale.range(h)[1]).attr("height",b.util.scale.range(i)[0]);var s=n(q,g),t=function(a){return"translate("+l(a)+", "+m(a)+")"};s.enter().style("pointer-events","none").append("g").classed("trackball",!0).attr("transform",t).append("circle").attr("r",5),s.select("g.trackball").attr("transform",t);var u=b.series.multi().series([o,p]).xScale(c(h)).yScale(c(i)).mapping(function(){return[this]});s.call(u),k(s,g,j)})};return q.xScale=function(a){return arguments.length?(h=a,q):h},q.yScale=function(a){return arguments.length?(i=a,q):i},q.snap=function(a){return arguments.length?(j=a,q):j},q.decorate=function(a){return arguments.length?(k=a,q):k},a.rebind(q,g,"on"),b.util.rebind(q,o,{yLabel:"label"}),b.util.rebind(q,p,{xLabel:"label"}),q}}(d3,fc),function(a,b){"use strict";b.tool.fibonacciFan=function(){function c(){var b=a.select(this),c=b.datum()[0];if("DONE"!==c.state){var d=a.mouse(this),e=k.apply(this,d);if("SELECT_SOURCE"===c.state)c.source=c.target=e;else{if("SELECT_TARGET"!==c.state)throw new Error("Unknown state "+c.state);c.target=e}}}function d(){var b=a.select(this).on("click.fan",g).on("mousemove.fan",e).on("mouseleave.fan",f),d=b.datum();null==d[0]&&d.push({state:"SELECT_SOURCE"}),c.call(this),b.call(p)}function e(){var b=a.select(this);c.call(this),b.call(p)}function f(){var b=a.select(this),c=b.datum();null!=c[0]&&"SELECT_SOURCE"===c[0].state&&c.pop(),b.on("click.fan",null).on("mousemove.fan",null).on("mouseleave.fan",null)}function g(){var b=a.select(this),d=b.datum()[0];switch(d.state){case"SELECT_SOURCE":c.call(this),h.fansource.apply(this,arguments),d.state="SELECT_TARGET";break;case"SELECT_TARGET":c.call(this),h.fantarget.apply(this,arguments),d.state="DONE";break;case"DONE":h.fanclear.apply(this,arguments),d.state="SELECT_SOURCE",c.call(this);break;default:throw new Error("Unknown state "+d.state)}b.call(p)}var h=a.dispatch("fansource","fantarget","fanclear"),i=a.time.scale(),j=a.scale.linear(),k=function(a,c){return b.util.noSnap(i,j)(a,c)},l=b.util.fn.noop,m=function(a){return a.xInDomainUnits?i(a.x):a.x},n=function(a){return a.yInDomainUnits?j(a.y):a.y},o=b.util.dataJoin().selector("g.fan").element("g").attr("class","fan"),p=function(b){b.each(function(b,c){var e=a.select(this).style("pointer-events","all").on("mouseenter.fan",d),f=e.selectAll("rect").data([b]);f.enter().append("rect").style("visibility","hidden"),e.select("rect").attr("x",i.range()[0]).attr("y",j.range()[1]).attr("width",i.range()[1]).attr("height",j.range()[0]);var g=o(e,b);g.each(function(a){if(a.x=i.range()[1],a.ay=a.by=a.cy=n(a.target),m(a.source)!==m(a.target)){if("DONE"===a.state&&m(a.source)>m(a.target)){var b=a.source;a.source=a.target,a.target=b}var c=(n(a.target)-n(a.source))/(m(a.target)-m(a.source)),d=a.x-m(a.source),e=c*d;a.ay=.618*e+n(a.source),a.by=.5*e+n(a.source),a.cy=.382*e+n(a.source)}});var h=g.enter();h.append("line").attr("class","trend"),h.append("line").attr("class","a"),h.append("line").attr("class","b"),h.append("line").attr("class","c"),h.append("polygon").attr("class","area"),g.select("line.trend").attr("x1",function(a){return m(a.source)}).attr("y1",function(a){return n(a.source)}).attr("x2",function(a){return m(a.target)}).attr("y2",function(a){return n(a.target)}),g.select("line.a").attr("x1",function(a){return m(a.source)}).attr("y1",function(a){return n(a.source)}).attr("x2",function(a){return a.x}).attr("y2",function(a){return a.ay}).style("visibility",function(a){return"DONE"!==a.state?"hidden":"visible"}),g.select("line.b").attr("x1",function(a){return m(a.source)}).attr("y1",function(a){return n(a.source)}).attr("x2",function(a){return a.x}).attr("y2",function(a){return a.by}).style("visibility",function(a){return"DONE"!==a.state?"hidden":"visible"}),g.select("line.c").attr("x1",function(a){return m(a.source)}).attr("y1",function(a){return n(a.source)}).attr("x2",function(a){return a.x}).attr("y2",function(a){return a.cy}).style("visibility",function(a){return"DONE"!==a.state?"hidden":"visible"}),g.select("polygon.area").attr("points",function(a){return m(a.source)+","+n(a.source)+" "+a.x+","+a.ay+" "+a.x+","+a.cy}).style("visibility",function(a){return"DONE"!==a.state?"hidden":"visible"}),l(g,b,c)})};return p.xScale=function(a){return arguments.length?(i=a,p):i},p.yScale=function(a){return arguments.length?(j=a,p):j},p.snap=function(a){return arguments.length?(k=a,p):k},p.decorate=function(a){return arguments.length?(l=a,p):l},a.rebind(p,h,"on"),p}}(d3,fc),function(a,b){"use strict";b.tool.measure=function(){function c(){var b=a.select(this),c=b.datum()[0];if("DONE"!==c.state){var d=a.mouse(this),e=k.apply(this,d);if("SELECT_SOURCE"===c.state)c.source=c.target=e;else{if("SELECT_TARGET"!==c.state)throw new Error("Unknown state "+c.state);c.target=e}}}function d(){var b=a.select(this).on("click.measure",g).on("mousemove.measure",e).on("mouseleave.measure",f),d=b.datum();null==d[0]&&d.push({state:"SELECT_SOURCE"}),c.call(this),b.call(s)}function e(){var b=a.select(this);c.call(this),b.call(s)}function f(){var b=a.select(this),c=b.datum();null!=c[0]&&"SELECT_SOURCE"===c[0].state&&c.pop(),b.on("click.measure",null).on("mousemove.measure",null).on("mouseleave.measure",null)}function g(){var b=a.select(this),d=b.datum()[0];switch(d.state){case"SELECT_SOURCE":c.call(this),h.measuresource.apply(this,arguments),d.state="SELECT_TARGET";break;case"SELECT_TARGET":c.call(this),h.measuretarget.apply(this,arguments),d.state="DONE";break;case"DONE":h.measureclear.apply(this,arguments),d.state="SELECT_SOURCE",c.call(this);break;default:throw new Error("Unknown state "+d.state)}b.call(s)}var h=a.dispatch("measuresource","measuretarget","measureclear"),i=a.time.scale(),j=a.scale.linear(),k=function(a,c){return b.util.noSnap(i,j)(a,c)},l=b.util.fn.noop,m=a.functor(""),n=a.functor(""),o=a.functor(2),p=function(a){return a.xInDomainUnits?i(a.x):a.x},q=function(a){return a.yInDomainUnits?j(a.y):a.y},r=b.util.dataJoin().selector("g.measure").element("g").attr("class","measure"),s=function(b){b.each(function(b,c){var e=a.select(this).style("pointer-events","all").on("mouseenter.measure",d),f=e.selectAll("rect").data([b]);f.enter().append("rect").style("visibility","hidden"),e.select("rect").attr("x",i.range()[0]).attr("y",j.range()[1]).attr("width",i.range()[1]).attr("height",j.range()[0]);var g=r(e,b),h=g.enter();h.append("line").attr("class","tangent"),h.append("line").attr("class","horizontal"),h.append("line").attr("class","vertical"),h.append("text").attr("class","horizontal"),h.append("text").attr("class","vertical"),g.select("line.tangent").attr("x1",function(a){return p(a.source)}).attr("y1",function(a){return q(a.source)}).attr("x2",function(a){return p(a.target)}).attr("y2",function(a){return q(a.target)}),g.select("line.horizontal").attr("x1",function(a){return p(a.source)}).attr("y1",function(a){return q(a.source)}).attr("x2",function(a){return p(a.target)}).attr("y2",function(a){return q(a.source)}).style("visibility",function(a){return"DONE"!==a.state?"hidden":"visible"}),g.select("line.vertical").attr("x1",function(a){return p(a.target)}).attr("y1",function(a){return q(a.target)}).attr("x2",function(a){return p(a.target)}).attr("y2",function(a){return q(a.source)}).style("visibility",function(a){return"DONE"!==a.state?"hidden":"visible"});var k=o.apply(this,arguments);g.select("text.horizontal").attr("x",function(a){return p(a.source)+(p(a.target)-p(a.source))/2}).attr("y",function(a){return q(a.source)-k}).style("visibility",function(a){return"DONE"!==a.state?"hidden":"visible"}).text(m),g.select("text.vertical").attr("x",function(a){return p(a.target)+k}).attr("y",function(a){return q(a.source)+(q(a.target)-q(a.source))/2}).style("visibility",function(a){return"DONE"!==a.state?"hidden":"visible"}).text(n),l(g,b,c)})};return s.xScale=function(a){return arguments.length?(i=a,s):i},s.yScale=function(a){return arguments.length?(j=a,s):j},s.snap=function(a){return arguments.length?(k=a,s):k},s.decorate=function(a){return arguments.length?(l=a,s):l},s.xLabel=function(b){return arguments.length?(m=a.functor(b),s):m},s.yLabel=function(b){return arguments.length?(n=a.functor(b),s):n},s.padding=function(b){return arguments.length?(o=a.functor(b),s):o},a.rebind(s,h,"on"),s}}(d3,fc),function(a,b){"use strict";var c=1e-6;b.util.dataJoin=function(){var d="g",e=!1,f="g",g={},h=b.util.fn.index,i=function(i,j){var k=j||b.util.fn.identity;i.selectAll&&i.node||(i=a.select(i));var l=i.selectAll(d);e&&(l=l.filter(function(){return this.parentNode===i.node()}));var m=l.data(k,h),n=m.enter().append(f).attr(g).style("opacity",c),o=a.transition(m.exit()).style("opacity",c).remove();return m=a.transition(m).style("opacity",1),m.enter=a.functor(n),m.exit=a.functor(o),m};return i.selector=function(a){return arguments.length?(d=a,i):d},i.children=function(a){return arguments.length?(e=a,i):e},i.element=function(a){return arguments.length?(f=a,i):f},i.attr=function(a){if(!arguments.length)return g;if(1===arguments.length)g=arguments[0];else if(2===arguments.length){var b=arguments[0],c=arguments[1];g[b]=c}return i},i.key=function(a){return arguments.length?(h=a,i):h},i}}(d3,fc),function(a,b){"use strict";b.util.extent=function(b,c){return Array.isArray(b[0])||(b=[b]),Array.isArray(c)||(c=[c]),"function"!=typeof c[0]&&(c=c.map(function(a){return function(b){return b[a]}})),[a.min(b,function(b){return a.min(b,function(b){return a.min(c.map(function(a){return a(b)}))})}),a.max(b,function(b){return a.max(b,function(b){return a.max(c.map(function(a){return a(b)}))})})]}}(d3,fc),function(a,b){"use strict";b.util.fn={context:function(){return this},identity:function(a){return a},index:function(a,b){return b},noop:function(a){}}}(d3,fc),function(a,b){"use strict";b.util.fractionalBarWidth=function(b){return function(c){if(c.length<=1)return 10;c.sort();var d=a.pairs(c).map(function(a){return Math.abs(a[0]-a[1])}),e=a.min(d);return b*e}}}(d3,fc),function(a,b){"use strict";b.util.innerDimensions=function(a){var b=getComputedStyle(a);return{width:parseFloat(b.width)-parseFloat(b.paddingLeft)-parseFloat(b.paddingRight),height:parseFloat(b.height)-parseFloat(b.paddingTop)-parseFloat(b.paddingBottom)}}}(d3,fc),function(a,b){"use strict";b.util.rebind=function(b,c,d){return"object"!=typeof d?a.rebind.apply(a,arguments):(Object.keys(d).forEach(function(a){var e=c[d[a]];if("function"!=typeof e)throw new Error("The method "+d[a]+" does not exist on the source object");b[a]=function(){var a=e.apply(c,arguments);return a===c?b:a}}),b)}}(d3,fc),function(a,b){"use strict";b.util.scale={range:function(a){return b.util.scale.isOrdinal(a)?a.rangeExtent():a.range()},isOrdinal:function(a){return a.rangeExtent}}}(d3,fc),function(a,b){"use strict";b.util.noSnap=function(a,b){return function(c,d){var e={xInDomainUnits:!1,x:c,yInDomainUnits:!1,y:d};return a.invert&&(e.xInDomainUnits=!0,e.x=a.invert(c)),b.invert&&(e.yInDomainUnits=!0,e.y=b.invert(d)),e}},b.util.pointSnap=function(a,b,c,d,e,f){return f=f||function(a,b,c,d){var e=a-c,f=b-d;return Math.sqrt(e*e+f*f)},function(g,h){var i=e.map(function(e){var i=f(g,h,a(c(e)),b(d(e)));return[i,e]}).reduce(function(a,b){return a[0]>b[0]?b:a},[Number.MAX_VALUE,null])[1];return{datum:i,x:i?c(i):g,xInDomainUnits:Boolean(i),y:i?d(i):h,yInDomainUnits:Boolean(i)}}},b.util.seriesPointSnapXOnly=function(a,c){function d(a,b,c,d){var e=a-c;return Math.abs(e)}return b.util.seriesPointSnap(a,c,d)},b.util.seriesPointSnapYOnly=function(a,c){function d(a,b,c,d){var e=b-d;return Math.abs(e)}return b.util.seriesPointSnap(a,c,d)},b.util.seriesPointSnap=function(a,c,d){return function(e,f){var g=a.xScale(),h=a.yScale(),i=a.xValue(),j=(a.yValue||a.yCloseValue).call(a);return b.util.pointSnap(g,h,i,j,c,d)(e,f)}}}(d3,fc); | ||
//# sourceMappingURL=d3fc.min.js.map |
@@ -88,3 +88,3 @@ /* global module */ | ||
'node_modules/d3/d3.js', | ||
'node_modules/css-layout/src/Layout.js', | ||
'node_modules/css-layout/dist/css-layout.js', | ||
'dist/d3fc.js', | ||
@@ -126,3 +126,3 @@ 'node_modules/jquery/dist/jquery.js', | ||
cwd: 'visual-tests/src/site/assets/', | ||
src: ['**/*.css', '**/*.js'], | ||
src: ['**'], | ||
dest: 'visual-tests/dist/assets/', | ||
@@ -132,20 +132,2 @@ }, | ||
expand: true, | ||
cwd: 'node_modules/d3/', | ||
src: ['d3.js'], | ||
dest: 'visual-tests/dist/assets/', | ||
}, | ||
{ | ||
expand: true, | ||
cwd: 'node_modules/css-layout/src/', | ||
src: ['Layout.js'], | ||
dest: 'visual-tests/dist/assets/', | ||
}, | ||
{ | ||
expand: true, | ||
cwd: 'dist', | ||
src: ['d3fc.js', 'd3fc.css'], | ||
dest: 'visual-tests/dist/assets/', | ||
}, | ||
{ | ||
expand: true, | ||
cwd: 'node_modules/bootstrap/dist/', | ||
@@ -157,8 +139,2 @@ src: ['**'], | ||
expand: true, | ||
cwd: 'node_modules/jquery/dist/', | ||
src: ['jquery.min.*'], | ||
dest: 'visual-tests/dist/assets/', | ||
}, | ||
{ | ||
expand: true, | ||
cwd: 'visual-tests/src/test-fixtures/', | ||
@@ -169,6 +145,12 @@ src: ['**/*', '!**/*.hbs'], | ||
{ | ||
expand: true, | ||
cwd: 'node_modules/seedrandom/', | ||
src: ['seedrandom.min.js'], | ||
src: [ | ||
'node_modules/css-layout/dist/css-layout.js', | ||
'dist/d3fc.js', | ||
'dist/d3fc.css', | ||
'node_modules/jquery/dist/jquery.js', | ||
'node_modules/d3/d3.js', | ||
'node_modules/seedrandom/seedrandom.min.js'], | ||
dest: 'visual-tests/dist/assets/', | ||
flatten: true, | ||
expand: true | ||
} | ||
@@ -297,3 +279,3 @@ ] | ||
'node_modules/d3/d3.js', | ||
'node_modules/css-layout/src/Layout.js' | ||
'node_modules/css-layout/dist/css-layout.js' | ||
], | ||
@@ -300,0 +282,0 @@ helpers: 'tests/beforeEachSpec.js' |
{ | ||
"name": "d3fc", | ||
"version": "0.5.7", | ||
"version": "1.0.0", | ||
"description": "A collection of components that make it easy to build interactive charts with D3", | ||
"author": "Scott Logic", | ||
"dependencies": { | ||
"css-layout": "^0.0.2", | ||
"css-layout": "^0.0.6", | ||
"d3": "^3.5.4" | ||
@@ -9,0 +9,0 @@ }, |
@@ -209,2 +209,18 @@ | ||
return data; | ||
}) | ||
.decorate(function(sel) { | ||
var height = Math.abs(chart.yScale().range()[0] - chart.yScale().range()[1]); | ||
sel.enter() | ||
.selectAll('.resize.e>rect, .resize.w>rect') | ||
.style('visibility', 'visible') | ||
.attr('y', height / 4) | ||
.attr('rx', 4) | ||
.attr('ry', 4); | ||
// As a y scale is set on the brush (multi does this), | ||
// the brush component resets the height of the rect on every redraw, | ||
// as such it has to be overridden within the update selection, | ||
// rather than the enter selection | ||
sel.selectAll('.resize.e>rect, .resize.w>rect') | ||
.attr('height', height / 2); | ||
}); | ||
@@ -227,4 +243,3 @@ | ||
var dateScale = d3.time.scale() | ||
.domain([maxDate - 50 * 24 * 60 * 60 * 1000, maxDate]) | ||
.nice(); | ||
.domain([maxDate - 50 * 24 * 60 * 60 * 1000, maxDate]); | ||
data.dateDomain = dateScale.domain(); | ||
@@ -231,0 +246,0 @@ } |
@@ -33,4 +33,8 @@ --- | ||
d3fc and its dependencies (D3, [css-layout](https://github.com/facebook/css-layout)) are available via npm. Simply install as follows: | ||
d3fc and its dependencies (D3, [css-layout](https://github.com/facebook/css-layout)) are available via npm or cdnjs. | ||
### Installing with npm | ||
You can install d3fc and its dependencies via npm as follows: | ||
``` | ||
@@ -44,3 +48,3 @@ npm install d3fc | ||
<script src="node_modules/d3fc/node_modules/d3/d3.js"></script> | ||
<script src="node_modules/d3fc/node_modules/css-layout/src/Layout.js"></script> | ||
<script src="node_modules/d3fc/node_modules/css-layout/dist/css-layout.js"></script> | ||
<script src="node_modules/d3fc/dist/d3fc.js"></script> | ||
@@ -51,2 +55,14 @@ | ||
### Using cdnjs | ||
Alternatively you can link to d3fc and its dependencies directly via cdnjs: | ||
```html | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3fc/0.5.7/d3fc.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/css-layout/0.0.6/css-layout.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.js"></script> | ||
<link href="https://cdnjs.cloudflare.com/ajax/libs/d3fc/0.5.7/d3fc.css" rel="stylesheet"/> | ||
``` | ||
## A quick chart | ||
@@ -53,0 +69,0 @@ |
@@ -209,2 +209,18 @@ | ||
return data; | ||
}) | ||
.decorate(function(sel) { | ||
var height = Math.abs(chart.yScale().range()[0] - chart.yScale().range()[1]); | ||
sel.enter() | ||
.selectAll('.resize.e>rect, .resize.w>rect') | ||
.style('visibility', 'visible') | ||
.attr('y', height / 4) | ||
.attr('rx', 4) | ||
.attr('ry', 4); | ||
// As a y scale is set on the brush (multi does this), | ||
// the brush component resets the height of the rect on every redraw, | ||
// as such it has to be overridden within the update selection, | ||
// rather than the enter selection | ||
sel.selectAll('.resize.e>rect, .resize.w>rect') | ||
.attr('height', height / 2); | ||
}); | ||
@@ -227,4 +243,3 @@ | ||
var dateScale = d3.time.scale() | ||
.domain([maxDate - 50 * 24 * 60 * 60 * 1000, maxDate]) | ||
.nice(); | ||
.domain([maxDate - 50 * 24 * 60 * 60 * 1000, maxDate]); | ||
data.dateDomain = dateScale.domain(); | ||
@@ -231,0 +246,0 @@ } |
/* globals computeLayout */ | ||
(function(d3, fc, cssLayout) { | ||
(function(d3, fc, computeLayout) { | ||
'use strict'; | ||
@@ -79,9 +79,3 @@ | ||
children: getChildNodes(el), | ||
element: el, | ||
layout: { | ||
width: undefined, | ||
height: undefined, | ||
top: 0, | ||
left: 0 | ||
} | ||
element: el | ||
}; | ||
@@ -118,3 +112,3 @@ } | ||
// use the Facebook CSS goodness | ||
cssLayout.computeLayout(layoutNodes); | ||
computeLayout(layoutNodes); | ||
@@ -121,0 +115,0 @@ // apply the resultant layout |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
5493825
80257
2
427
+ Addedcss-layout@0.0.6(transitive)
- Removedcss-layout@0.0.2(transitive)
Updatedcss-layout@^0.0.6