diff --git a/.gitmodules b/.gitmodules index b5ce0a87..0660dc5f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -61,3 +61,6 @@ [submodule "examples/svg/arrow"] path = examples/svg/arrow url = https://gist.github.com/26f67acd490c4e48fe0e.git +[submodule "examples/plot/tick"] + path = examples/plot/tick + url = https://gist.github.com/f6b6f776becc34b9c71a.git diff --git a/dist/techan.js b/dist/techan.js index 50aa8551..e1852bfe 100644 --- a/dist/techan.js +++ b/dist/techan.js @@ -1,9 +1,9 @@ /* - TechanJS v0.6.0-3 + TechanJS v0.6.0-4 (c) 2014 - 2015 Andre Dumas | https://github.com/andredumas/techan.js */ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.techan = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o=f.period?d(f.accessor.d(a),c):d(f.accessor.d(a))}).filter(function(a){return null!==a.value})}var f={},g=c(),h=null,i=0,j=0;return e.init=function(){return g.accessor(e.accessor()).period(f.period).init(),h=null,i=0,j=0,e},e.atr=function(a){var b=null===h?f.accessor.h(a)-f.accessor.l(a):Math.max(f.accessor.h(a)-f.accessor.l(a),Math.abs(f.accessor.h(a)-f.accessor.c(h)),Math.abs(f.accessor.l(a)-f.accessor.c(h)));return h=a,i=j++<=f.period?g.average(b):(i*(f.period-1)+b)/f.period},a(e,f).accessor(b()).period(14),e}}},{}],12:[function(a,b,c){"use strict";b.exports=function(a,b,c){return function(){function d(a){return g.accessor(e.accessor).period(e.period).init(),a.map(function(a,b){var c=e.accessor.c(a),d=g.atr(a)*f;return b>=e.period?{date:e.accessor.d(a),close:c,up:c-d,down:c+d}:{date:e.accessor.d(a),up:null,down:null}}).filter(function(a){return null!==a.up&&null!==a.down}).reduce(function(a,b,c){var d=a[c-1],e=0===c?b.up:null,f=null;return d&&null!==d.up&&(b.close>d.up?e=Math.max(b.up,d.up):f=b.down),d&&null!==d.down&&(b.close=0;d--)c[d]=g(b,a,d);return c}function g(a,b,c){for(var g=b[c],i=h.accessor.l(g),j=h.accessor.h(g),k=d(a,h.accessor.d(g),h.accessor.c(g)),l=0,m=l+1;l=0;l++,m=l+1)g=b[c-l],i=Math.min(i,h.accessor.l(g)),j=Math.max(j,h.accessor.h(g)),k.tenkanSen=m===a.tenkanSen?f(i,j):k.tenkanSen,k.kijunSen=m===a.kijunSen?f(i,j):k.kijunSen,k.senkouSpanB=m===a.senkouSpanB?f(i,j):k.senkouSpanB;return k.senkouSpanA=e(k.tenkanSen,k.kijunSen),k}var h={},i=9,j=26,k=52;return c.tenkanSen=function(a){return arguments.length?(i=a,c):i},c.kijunSen=function(a){return arguments.length?(j=a,c):j},c.senkouSpanB=function(a){return arguments.length?(k=a,c):k},a(c,h).accessor(b()),c}}},{}],15:[function(a,b,c){"use strict";function d(a){return 2/(a+1)}function e(a){return 1/a}b.exports=function(){var b=a("./indicatormixin")(),c=a("../accessor")(),f=a("./ema"),g=f(b,c.ohlc,d),h=a("./sma")(b,c.ohlc),i=a("./atr")(b,c.ohlc,h);return{atr:i,atrtrailingstop:a("./atrtrailingstop")(b,c.ohlc,i),ema:g,ichimoku:a("./ichimoku")(b,c.ohlc),macd:a("./macd")(b,c.ohlc,g),rsi:a("./rsi")(b,c.ohlc,g),sma:h,wilderma:f(b,c.ohlc,e)}}},{"../accessor":4,"./atr":11,"./atrtrailingstop":12,"./ema":13,"./ichimoku":14,"./indicatormixin":16,"./macd":17,"./rsi":18,"./sma":19}],16:[function(a,b,c){"use strict";b.exports=function(){return function(a,b){var c={};return c.period=function(d){return b.period=d,a.period=function(c){return arguments.length?(b.period=c,a):b.period},c},c.accessor=function(d){return b.accessor=d,a.accessor=function(c){return arguments.length?(b.accessor=c,a):b.accessor},c},c}}},{}],17:[function(a,b,c){"use strict";function d(a,b,c,d,e){return b?{date:a,macd:b,signal:c,difference:d,zero:e}:{date:a,macd:null,signal:null,difference:null,zero:null}}b.exports=function(a,b,c){return function(){function e(a){var b=Math.max(g,h)-1,c=b+i-1;return j.accessor(e.accessor()).period(i).init(),k.accessor(e.accessor()).period(g).init(),l.accessor(e.accessor()).period(h).init(),a.map(function(a,e){h=k.average(f.accessor(a)),g=l.average(f.accessor(a));var i=h-g,m=e>=b?j.average(i):null;return e>=c?d(f.accessor.d(a),i,m,i-m,0):d(f.accessor.d(a))}).filter(function(a){return null!==a.macd})}var f={},g=12,h=26,i=9,j=c(),k=c(),l=c();return e.fast=function(a){return arguments.length?(g=a,e):g},e.slow=function(a){return arguments.length?(h=a,e):h},e.signal=function(a){return arguments.length?(i=a,e):i},a(e,f).accessor(b()),e}}},{}],18:[function(a,b,c){"use strict";function d(a,b,c,d,e){return b?{date:a,rsi:b,middle:c,overbought:d,oversold:e}:{date:a,rsi:null,middle:null,overbought:null,oversold:null}}b.exports=function(a,b,c){return function(){function e(a){return j.accessor(e.accessor()).period(f.period).init(),k.accessor(e.accessor()).period(f.period).init(),a.map(function(b,c){if(1>c)return d(f.accessor.d(b));var e=f.accessor(b)-f.accessor(a[c-1]),l=k.average(Math.max(e,0)),m=Math.abs(j.average(Math.min(e,0)));if(c>=f.period){var n=100-100/(1+l/m);return d(f.accessor.d(b),n,h,g,i)}return d(f.accessor.d(b))}).filter(function(a){return null!==a.rsi})}var f={},g=70,h=50,i=30,j=c(),k=c();return e.overbought=function(a){return arguments.length?(g=a,e):g},e.middle=function(a){return arguments.length?(h=a,e):h},e.oversold=function(a){return arguments.length?(i=a,e):i},a(e,f).accessor(b()).period(14),e}}},{}],19:[function(a,b,c){"use strict";b.exports=function(a,b){return function(){function c(a){return c.init(),a.map(d).filter(function(a){return null!==a.value})}function d(a,b){var d=c.average(h.accessor(a));return b+1e?[e,f]:[f,e],c.filter(function(c){if(!a(c))return!1;var e=b(a(c));return e&&!isNaN(e)&&d[0]<=e&&e<=d[1]})}}function f(a,b,c,d){var e=c.scale();switch(c.orient()){case"left":case"right":a.attr({x:d*(Math.max(c.innerTickSize(),0)+c.tickPadding()),y:g(b,e),dy:".32em"}).style("text-anchor",0>d?"end":"start");break;case"top":case"bottom":a.attr({x:g(b,e),y:d*(Math.max(c.innerTickSize(),0)+c.tickPadding()),dy:0>d?"0em":".72em"}).style("text-anchor","middle")}}function g(a,b){return function(c){return b(a(c))}}function h(a,b){return function(c){return b(a(c))}}function i(a,b,c,d,e,f){return function(g){var h=b.scale(),i=h(a(g)),j=e;switch(b.orient()){case"left":case"right":var k=0;return e>c/2?j=c/2:k=c/2-e,["M",0,i,"l",f*b.innerTickSize(),-j,"l",0,-k,"l",f*d,0,"l",0,c,"l",f*-d,0,"l",0,-k].join(" ");case"top":case"bottom":var l=0;return e>d/2?j=d/2:l=d/2-e,["M",i,0,"l",-j,f*b.innerTickSize(),"l",-l,0,"l",0,f*c,"l",d,0,"l",0,f*-c,"l",-l,0].join(" ");default:throw"Unsupported axis.orient() = "+b.orient()}}}b.exports=function(a,b,c,e){return function(){function f(a){a.selectAll("g.translate").data(c.dataMapper.array).enter().append("g").attr("class","translate"),f.refresh(a)}var g,h={},i=a(),j=4,k=14,l=50,m=[0,0];return f.refresh=function(a){var b=g?g:i.tickFormat()?i.tickFormat():i.scale().tickFormat();d(a,c,h.accessor,i,b,k,l,j,m)},f.axis=function(a){return arguments.length?(i=a,f):i},f.format=function(a){return arguments.length?(g=a,f):g},f.height=function(a){return arguments.length?(k=a,f):k},f.width=function(a){return arguments.length?(l=a,f):l},f.translate=function(a){return arguments.length?(m=a,f):m},e(f,h).accessor(b()),f}}},{}],22:[function(a,b,c){"use strict";function d(a,b,c,d){return function(e){var f=[],g=c(a.o(e)),h=c(a.c(e)),i=d(b),j=b(a.d(e))-i/2;return f.push("M",j,g,"l",i,0),g!=h&&f.push("L",j+i,h,"l",-i,0,"L",j,g),f.join(" ")}}function e(a,b,c,d){return function(e){var f=[],g=c(a.o(e)),h=c(a.c(e)),i=d(b),j=b(a.d(e)),k=j-i/2;return f.push("M",j,c(a.h(e)),"L",j,Math.min(g,h)),g==h&&f.push("M",k,g,"l",i,0),f.push("M",j,Math.max(g,h),"L",j,c(a.l(e))),f.join(" ")}}b.exports=function(a,b,c,f,g){return function(){function a(b){var c=f.groupSelect(b,f.dataMapper.array,k.accessor.d),d=f.groupUpDownEqual(b.datum(),k.accessor);f.appendUpDownEqual(c.selection,k.accessor,["candle","body"],d),f.appendUpDownEqual(c.selection,k.accessor,["candle","wick"],d),a.refresh(b)}function b(){h=f.joinPath(k.accessor,k.xScale,k.yScale,d),i=f.joinPath(k.accessor,k.xScale,k.yScale,e),j=f.lineWidth(k.xScale,1,4)}var h,i,j,k={};return a.refresh=function(a){a.selectAll("path.candle.body").attr("d",h),a.selectAll("path.candle.wick").attr("d",i).style("stroke-width",j)},g(a,k).plot(c(),b),a}}},{}],23:[function(a,b,c){"use strict";function d(a,b){a.select("g.data.top").style("display",b)}function e(a,b){return function(c){if(!c)return"M 0 0";var d=a(c);return["M",b[0],d,"L",b[b.length-1],d].join(" ")}}function f(a,b){return function(c){if(!c)return"M 0 0";var d=a(c);return["M",d,b[0],"L",d,b[b.length-1]].join(" ")}}b.exports=function(a,b,c,g,h,i){return function(){function a(b){var c=b.selectAll("g.data.top").data([q],function(a){return a}),d=c.enter(),e=d.append("g").attr("class","data top").style("display","none");c.exit().remove(),e.append("path").attr("class","horizontal wire"),e.append("path").attr("class","vertical wire"),h.annotation.append(e,o,"x"),h.annotation.append(e,p,"y"),b.selectAll("rect").data([0]).enter().append("rect").style({fill:"none","pointer-events":"all"}),a.refresh(b)}function b(a,b,d,e){return function(){var f=c(this),g=m.xScale.invert(f[0]),i=m.yScale.invert(f[1]);j(a.datum(g),b.datum(i),d.each(h.annotation.update(o,f[0])),e.each(h.annotation.update(p,f[1]))),n.move([g,i])}}function j(a,b,c,d){var g=m.xScale,i=m.yScale;a.attr("d",f(g,k||i.range())),b.attr("d",e(i,l||g.range())),c.each(h.annotation.refresh(o)),d.each(h.annotation.refresh(p))}var k,l,m={},n=g("enter","out","move"),o=[],p=[],q=0;return a.refresh=function(a){var c=m.xScale.range(),e=m.yScale.range(),f=a.selectAll("g.data"),g=a.selectAll("rect"),h=f.selectAll("path.vertical"),i=f.selectAll("path.horizontal"),k=f.selectAll("g.axisannotation.x > g"),l=f.selectAll("g.axisannotation.y > g");g.attr({x:Math.min.apply(null,c),y:Math.min.apply(null,e),height:Math.abs(e[e.length-1]-e[0]),width:Math.abs(c[c.length-1]-c[0])}).on("mouseenter",function(){d(a,"inline"),n.enter()}).on("mouseout",function(){d(a,"none"),n.out()}).on("mousemove",b(h,i,k,l)),j(h,i,k,l)},a.xAnnotation=function(b){return arguments.length?(o=b instanceof Array?b:[b],q++,a):o},a.yAnnotation=function(b){return arguments.length?(p=b instanceof Array?b:[b],q++,a):p},a.verticalWireRange=function(b){return arguments.length?(k=b,a):k},a.horizontalWireRange=function(b){return arguments.length?(l=b,a):l},i(a,m).xScale().yScale().on(n),a}}},{}],24:[function(a,b,c){"use strict";function d(a){return function(b){return-a(b)}}function e(){return Math.random().toString(36).substr(2,9)}b.exports=function(a,b,c,f){return function(){function g(a){var b=c.groupSelect(a,c.dataMapper.array),d="kumoclipup-"+e(),f="kumoclipdown-"+e();b.entry.append("clipPath").attr({id:f,"class":"kumoclipdown"}).append("path"),b.entry.append("clipPath").attr({id:d,"class":"kumoclipup"}).append("path"),b.entry.append("path").attr({"class":"kumo down","clip-path":"url(#"+f+")"}),b.entry.append("path").attr({"class":"kumo up","clip-path":"url(#"+d+")"}),b.entry.append("path").attr("class","senkouspanb"),b.entry.append("path").attr("class","senkouspana"),b.entry.append("path").attr("class","chikouspan"),b.entry.append("path").attr("class","kijunsen"),b.entry.append("path").attr("class","tenkansen"),g.refresh(a)}function h(a,b){a.selectAll(".kumoclipdown path").attr("d",m.y1(b.range()[0])),a.selectAll(".kumoclipup path").attr("d",m.y1(b.range()[1])),a.selectAll("path.kumo.down").attr("d",n),a.selectAll("path.kumo.up").attr("d",n),a.selectAll("path.senkouspanb").attr("d",p),a.selectAll("path.senkouspana").attr("d",o),a.selectAll("path.chikouspan").attr("d",q),a.selectAll("path.kijunsen").attr("d",s),a.selectAll("path.tenkansen").attr("d",r)}function i(){o.init(l.accessor.d,l.xScale,l.accessor.sa,l.yScale,l.accessor.pks),p.init(l.accessor.d,l.xScale,l.accessor.sb,l.yScale,l.accessor.pks),q.init(l.accessor.d,l.xScale,l.accessor.c,l.yScale,d(l.accessor.pks)),r.init(l.accessor.d,l.xScale,l.accessor.ts,l.yScale),s.init(l.accessor.d,l.xScale,l.accessor.ks,l.yScale)}function j(){return a().interpolate("monotone").defined(function(a){return null!==l.accessor.sb(a)}).x(function(a){return l.xScale(l.accessor.d(a),l.accessor.pks(a))}).y0(function(a){return l.yScale(l.accessor.sb(a))})}function k(){return a().interpolate("monotone").defined(function(a){return null!==l.accessor.sa(a)&&null!==l.accessor.sb(a)}).x(function(a){return l.xScale(l.accessor.d(a),l.accessor.pks(a))}).y0(function(a){return l.yScale(l.accessor.sa(a))}).y1(function(a){return l.yScale(l.accessor.sb(a))})}var l={},m=j(),n=k(),o=c.pathLine(),p=c.pathLine(),q=c.pathLine(),r=c.pathLine(),s=c.pathLine();return g.refresh=function(a){h(a,l.yScale)},f(g,l).plot(b(),i),i(),g}}},{}],25:[function(a,b,c){"use strict";function d(){return d3.event}b.exports=function(b){var c=a("../scale")(b),e=a("../accessor")(),f=a("./plot")(b.svg.line,b.select),g=a("./plotmixin")(b.scale.linear,c.financetime),h=a("./line"),i=a("./axisannotation")(b.svg.axis,e.value,f,g);return{atr:h(e.value,f,g),atrtrailingstop:a("./atrtrailingstop")(e.atrtrailingstop,f,g),axisannotation:i,candlestick:a("./candlestick")(b.scale.linear,b.extent,e.ohlc,f,g),crosshair:a("./crosshair")(b.select,d,b.mouse,b.dispatch,f,g),ema:h(e.value,f,g),ichimoku:a("./ichimoku")(b.svg.area,e.ichimoku,f,g),ohlc:a("./ohlc")(b.scale.linear,b.extent,e.ohlc,f,g),close:h(e.ohlc,f,g),volume:a("./volume")(e.volume,f,g),rsi:a("./rsi")(e.rsi,f,g),macd:a("./macd")(e.macd,f,g),momentum:h(e.value,f,g,!0),moneyflow:h(e.value,f,g,!0),sma:h(e.value,f,g),supstance:a("./supstance")(b.behavior.drag,d,b.select,b.dispatch,e.value,f,g),trendline:a("./trendline")(b.behavior.drag,d,b.select,b.dispatch,e.trendline,f,g),wilderma:h(e.value,f,g)}}},{"../accessor":4,"../scale":36,"./atrtrailingstop":20,"./axisannotation":21,"./candlestick":22,"./crosshair":23,"./ichimoku":24,"./line":26,"./macd":27,"./ohlc":28,"./plot":29,"./plotmixin":30,"./rsi":31,"./supstance":32,"./trendline":33,"./volume":34}],26:[function(a,b,c){"use strict";function d(a,b,c,d,e,f,g){a.selectAll("path.line").attr("d",f),g&&a.selectAll("path.zero").attr("d",e.horizontalPathLine(c,b.z,d))}b.exports=function(a,b,c,e){return e=e||!1,function(){function f(a){var c=b.groupSelect(a,b.dataMapper.array);c.entry.append("path").attr("class","line"),e&&c.selection.append("path").attr("class","zero"),f.refresh(a)}function g(){i.init(h.accessor.d,h.xScale,h.accessor,h.yScale)}var h={},i=b.pathLine();return f.refresh=function(a){d(a,h.accessor,h.xScale,h.yScale,b,i,e)},c(f,h).plot(a(),g),g(),f}}},{}],27:[function(a,b,c){"use strict";function d(a,b,c,d,e,f,g,h){a.selectAll("path.difference").attr("d",f),a.selectAll("path.zero").attr("d",e.horizontalPathLine(b.d,c,b.z,d)),a.selectAll("path.macd").attr("d",g),a.selectAll("path.signal").attr("d",h)}function e(a,b,c,d){return function(e){var f=c(0),g=c(a.dif(e))-f,h=d(b),i=b(a.d(e))-h/2;return["M",i,f,"l",0,g,"l",h,0,"l",0,-g].join(" ")}}b.exports=function(a,b,c){return function(){function f(a){var c=b.groupSelect(a,b.dataMapper.array,i.accessor.d);c.selection.append("path").attr("class","difference"),c.selection.append("path").attr("class","zero"),c.selection.append("path").attr("class","macd"),c.selection.append("path").attr("class","signal"),f.refresh(a)}function g(){h=b.joinPath(i.accessor,i.xScale,i.yScale,e),j.init(i.accessor.d,i.xScale,i.accessor.m,i.yScale),k.init(i.accessor.d,i.xScale,i.accessor.s,i.yScale)}var h,i={},j=b.pathLine(),k=b.pathLine();return f.refresh=function(a){d(a,i.accessor,i.xScale,i.yScale,b,h,j,k)},c(f,i).plot(a(),g),g(),f}}},{}],28:[function(a,b,c){"use strict";function d(a,b,c,d){return function(e){var f=c(a.o(e)),g=c(a.c(e)),h=d(b),i=b(a.d(e)),j=i-h/2;return["M",j,f,"l",h/2,0,"M",i,c(a.h(e)),"L",i,c(a.l(e)),"M",i,g,"l",h/2,0].join(" ")}}b.exports=function(a,b,c,e,f){return function(){function a(b){var c=e.groupSelect(b,e.dataMapper.array,i.accessor.d);e.appendUpDownEqual(c.selection,i.accessor,"ohlc"),a.refresh(b)}function b(){g=e.joinPath(i.accessor,i.xScale,i.yScale,d),h=e.lineWidth(i.xScale,1,2)}var g,h,i={};return a.refresh=function(a){a.selectAll("path.ohlc").attr("d",g).style("stroke-width",h)},f(a,i).plot(c(),b),a}}},{}],29:[function(a,b,c){"use strict";b.exports=function(a,b){function c(a,b,c){var d=a.selectAll("g.data").data(b,c);return d.exit().remove(),d}function d(a){return a.enter().append("g").attr("class","data")}function e(){function b(a){return c(a)}var c=a().interpolate("monotone");return b.init=function(a,b,d,e,f){return c.defined(function(a){return null!==d(a)}).x(function(c){return b(a(c),void 0===f?f:f(c))}).y(function(a){return e(d(a))})},b.d3=function(){return c},b}function f(a,b){return a.o(b)a.c(b)}function h(a,b){return a.reduce(function(a,c){return f(b,c)?a.up.push(c):g(b,c)?a.down.push(c):a.equal.push(c),a},{up:[],down:[],equal:[]})}function i(a,b,c,d){var e=c instanceof Array?c:[c];d=d||h(a.datum(),b),j(a,d.up,e,"up"),j(a,d.down,e,"down"),j(a,d.equal,e,"equal")}function j(a,b,c,d){a.selectAll("path."+c.join(".")+"."+d).data([b]).enter().append("path").attr("class",c.join(" ")+" "+d)}function k(a){return Math.max(a.band(),1)}return{dataMapper:{unity:function(a){return a},array:function(a){return[a]}},dataSelection:c,dataEntry:d,groupSelect:function(a,b,e){var f=c(a,b,e),g=d(f);return{selection:f,entry:g}},groupUpDownEqual:h,appendUpDownEqual:i,horizontalPathLine:function(a,b,c,d){return function(e){var f=e[0],g=e[e.length-1];return["M",b(a(f)),d(c(f)),"L",b(a(g)),d(c(g))].join(" ")}},pathLine:e,barWidth:k,lineWidth:function(a,b,c){return b=b||1,c=c||1,function(){return Math.min(b,k(a)/c)}},joinPath:function(a,b,c,d){return function(e){return e.map(d(a,b,c,k)).join(" ")}},interaction:{mousedispatch:function(a){return function(c){return c.on("mouseenter",function(c){b(this.parentNode).classed("mouseover",!0),a.mouseenter(c)}).on("mouseleave",function(c){var d=b(this.parentNode);d.classed("dragging")||(d.classed("mouseover",!1),a.mouseout(c))}).on("mousemove",function(b){a.mousemove(b)})}},dragStartEndDispatch:function(a,c){return a.on("dragstart",function(a){b(this.parentNode.parentNode).classed("dragging",!0),c.dragstart(a)}).on("dragend",function(a){b(this.parentNode.parentNode).classed("dragging",!1),c.dragend(a)})}},annotation:{append:function(a,c,d,e,f){var g=arguments.length,h=a.append("g").attr("class","axisannotation "+d).selectAll("g").data(function(a){var b=g>3?f(e(a)):null;return c.map(function(a){var c=g>3?a.axis().scale().invert(b):null;return[{value:c}]})});h.enter().append("g").attr("class",function(a,b){return b}).each(function(a,d){this.__annotation__=d,c[d](b(this))})},update:function(a,b){return function(c){var d=a[this.__annotation__];c[0].value=d.axis().scale().invert(b)}},refresh:function(a){return function(){a[this.__annotation__].refresh(b(this))}}}}}},{}],30:[function(a,b,c){"use strict";b.exports=function(a,b){return function(c,d){var e={};return e.xScale=function(a){return d.xScale=b(),c.xScale=function(b){return arguments.length?(d.xScale=b,a&&a(),c):d.xScale},e},e.yScale=function(b){return d.yScale=a(),c.yScale=function(a){return arguments.length?(d.yScale=a,b&&b(),c):d.yScale},e},e.accessor=function(a,b){return d.accessor=a,c.accessor=function(a){return arguments.length?(d.accessor=a,b&&b(),c):d.accessor},e},e.on=function(a,b){return c.on=function(d,e){return a.on(d,e),b&&b(),c},e},e.plot=function(a,b){return e.xScale(b).yScale(b).accessor(a,b)},e}}},{}],31:[function(a,b,c){"use strict";function d(a,b,c,d,e,f){a.selectAll("path.overbought").attr("d",e.horizontalPathLine(b.d,c,b.ob,d)),a.selectAll("path.middle").attr("d",e.horizontalPathLine(b.d,c,b.m,d)),a.selectAll("path.oversold").attr("d",e.horizontalPathLine(b.d,c,b.os,d)),a.selectAll("path.rsi").attr("d",f)}b.exports=function(a,b,c){return function(){function e(a){var c=b.groupSelect(a,b.dataMapper.array,g.accessor.d);c.entry.append("path").attr("class","overbought"),c.entry.append("path").attr("class","middle"),c.entry.append("path").attr("class","oversold"),c.entry.append("path").attr("class","rsi"),e.refresh(a)}function f(){h.init(g.accessor.d,g.xScale,g.accessor.r,g.yScale)}var g={},h=b.pathLine();return e.refresh=function(a){d(a,g.accessor,g.xScale,g.yScale,b,h)},c(e,g).plot(a(),f),f(),e}}},{}],32:[function(a,b,c){"use strict";function d(a,b,c,d,f,g,h){a.selectAll(".supstance path").attr("d",e(c,d,f)),a.selectAll(".interaction path").attr("d",e(c,d,f)),g.each(b.annotation.refresh(h))}function e(a,b,c){return function(d){var e=[],f=b.range();return e.push("M",f[0],c(a(d))),e.push("L",f[f.length-1],c(a(d))),e.join(" ")}}b.exports=function(a,b,c,e,f,g,h){function i(){function a(d){var e=g.groupSelect(d,g.dataMapper.unity);e.entry.append("g").attr("class","supstance").append("path"),g.annotation.append(e.entry,i,"y",b.accessor,b.yScale);var f=e.entry.append("g").attr("class","interaction").style({opacity:0,fill:"none"}).call(g.interaction.mousedispatch(c));f.append("path").style("stroke-width",16),a.refresh(d)}var b={},c=e("mouseenter","mouseout","mousemove","drag","dragstart","dragend"),i=[];return a.refresh=function(a){d(a,g,b.accessor,b.xScale,b.yScale,a.selectAll(".axisannotation.y > g"),i)},a.drag=function(a){a.selectAll(".interaction path").call(j(c,b.accessor,b.xScale,b.yScale,i))},a.annotation=function(b){return arguments.length?(i=b instanceof Array?b:[b],a):i},h(a,b).plot(f()).on(c),a}function j(e,f,h,i,j){var k=a().origin(function(a){return{x:0,y:i(f(a))}}).on("drag",function(a){var k=i.invert(b().y),l=c(this.parentNode.parentNode),m=l.selectAll(".axisannotation.y > g");f.v(a,k),m.each(g.annotation.update(j,b().y)),d(l,g,f,h,i,m,j),e.drag(a)});return g.interaction.dragStartEndDispatch(k,e)}return i}},{}],33:[function(a,b,c){"use strict";function d(a,b,c,d){a.selectAll(".trendline path.body").attr("d",e(b,c,d)),a.selectAll(".trendline circle.start").attr(f(b.sd,c,b.sv,d)),a.selectAll(".trendline circle.end").attr(f(b.ed,c,b.ev,d)),a.selectAll(".interaction path.body").attr("d",e(b,c,d)),a.selectAll(".interaction circle.start").attr(f(b.sd,c,b.sv,d)),a.selectAll(".interaction circle.end").attr(f(b.ed,c,b.ev,d))}function e(a,b,c){return function(d){var e=[];return e.push("M",b(a.sd(d)),c(a.sv(d))),e.push("L",b(a.ed(d)),c(a.ev(d))),e.join(" ")}}function f(a,b,c,d){return{cx:function(c){return b(a(c))},cy:function(a){return d(c(a))}}}b.exports=function(a,b,c,e,f,g,h){function i(){function a(b){var d=g.groupSelect(b,g.dataMapper.unity),e=d.entry.append("g").attr("class","trendline");e.append("path").attr("class","body"),e.append("circle").attr({"class":"start",r:1}),e.append("circle").attr({"class":"end",r:1});var f=d.entry.append("g").attr("class","interaction").style({opacity:0,fill:"none"}).call(g.interaction.mousedispatch(c));f.append("path").attr("class","body").style("stroke-width",16),f.append("circle").attr({"class":"start",r:8}),f.append("circle").attr({"class":"end",r:8}),a.refresh(b)}var b={},c=e("mouseenter","mouseout","mousemove","drag","dragstart","dragend");return a.refresh=function(a){d(a,b.accessor,b.xScale,b.yScale)},a.drag=function(a){a.selectAll(".interaction circle.start").call(j(c,b.accessor,b.accessor.sd,b.xScale,b.accessor.sv,b.yScale)),a.selectAll(".interaction circle.end").call(j(c,b.accessor,b.accessor.ed,b.xScale,b.accessor.ev,b.yScale)),a.selectAll(".interaction path.body").call(k(c,b.accessor,b.xScale,b.yScale))},h(a,b).plot(f()).on(c),a}function j(e,f,h,i,j,k){var m=a();return m.origin(function(a){return{x:i(h(a)),y:k(j(a))}}).on("drag",function(a){l(h,i,b().x,j,k,b().y,a),d(c(this.parentNode.parentNode),f,i,k),e.drag(a)}),g.interaction.dragStartEndDispatch(m,e)}function k(e,f,h,i){var j={},k=a();return k.origin(function(a){return j.start={date:h(f.sd(a)),value:i(f.sv(a))},j.end={date:h(f.ed(a)),value:i(f.ev(a))},{x:0,y:0}}).on("drag",function(a){l(f.sd,h,b().x+j.start.date,f.sv,i,b().y+j.start.value,a),l(f.ed,h,b().x+j.end.date,f.ev,i,b().y+j.end.value,a),d(c(this.parentNode.parentNode),f,h,i),e.drag(a)}),g.interaction.dragStartEndDispatch(k,e)}function l(a,b,c,d,e,f,g){var h=b.invert(c);h&&a(g,h),d(g,e.invert(f))}return i}},{}],34:[function(a,b,c){"use strict";function d(a,b,c,d){return function(e){var f=a.v(e);if(isNaN(f))return null;var g=c(0),h=c(f)-g,i=d(b),j=b(a.d(e))-i/2;return["M",j,g,"l",0,h,"l",i,0,"l",0,-h].join(" ")}}b.exports=function(a,b,c){return function(){function e(a){var c=b.groupSelect(a,b.dataMapper.array,h.accessor.d);h.accessor.o&&h.accessor.c?b.appendUpDownEqual(c.selection,h.accessor,"volume"):c.entry.append("path").attr("class","volume"), -e.refresh(a)}function f(){g=b.joinPath(h.accessor,h.xScale,h.yScale,d)}var g,h={};return e.refresh=function(a){a.selectAll("path.volume").attr("d",g)},c(e,h).plot(a(),f),e}}},{}],35:[function(a,b,c){"use strict";b.exports=function(a,b,c,d,e,f){function g(b,i,n,o,p){function q(a,d){var e=v[+a];return d=d||0,void 0===e&&(e=i[0]>a?-1:c(i,a)),b(e+d)}function r(){return x=h(b,i,n),q}function s(){v=k(i)}function u(){return s(),b.domain([0,i.length-1]),r(),b.domain(b.range().map(e(o,x)).map(b.invert)),p=b.domain(),r()}var v,w={tickFormat:t[t.length-1][2]},x=3;return b=b||a(),i=i||[new Date(0),new Date(1)],n=void 0===n?.2:n,o=void 0===o?.65:o,p=p||b.domain(),q.invert=function(a){var b=i[q.invertToIndex(a)];return b?b:null},q.invertToIndex=function(a){return Math.round(b.invert(a))},q.domain=function(a){if(!arguments.length){var c=b.domain();return c[0]<0&&c[c.length-1]<0?[]:(c=[Math.max(Math.ceil(c[0]),0),Math.min(Math.floor(c[c.length-1]),i.length-1)],i.slice(c[0],c[c.length-1]+1))}return i=a,u()},q.copy=function(){return g(b.copy(),i,n,o,p)},q.band=function(){return x},q.outerPadding=function(a){return arguments.length?(o=a,u()):o},q.padding=function(a){return arguments.length?(n=a,u()):n},q.zoomable=function(){return f(b,r,p)},q.ticks=function(a,c){var d=q.domain(),e=b.domain();if(!d.length)return[];var f=void 0===a?j(d,e,10):"number"==typeof a?j(d,e,a):null;w.tickFormat=f?f[2]:j(d,e,10)[2],f&&(a=f[0],c=f[1]);var g=a.range(d[0],+d[d.length-1]+1,c);return g.map(l(d)).reduce(m,[])},q.tickFormat=function(){return function(a){return w.tickFormat(a)}},d(q,b,r,"range"),s(),r()}function h(a,b,c){return Math.abs(a(b.length-1)-a(0))/Math.max(1,b.length-1)*(1-c)}function i(a,b){return a.length/(b[b.length-1]-b[0])}function j(a,b,d){if(1==a.length)return q;var e=a[a.length-1]-a[0],f=1>e/r,g=f?v:t,h=f?u:s,j=Math.min(Math.round(i(a,b)*d),d),k=e/j,l=c(h,k);return l==g.length?g[l-1]:l?g[k/h[l-1]0?a.extent(b,c).map(f(d)):[]}function e(a,b,c,e){return a.scale.linear().domain(d(a,b,c,e)).range([1,0])}function f(a,b){return a=a||0,function(c,d,e){if(e.length>2)throw"array.length > 2 unsupported. array.length = "+e.length;return b=b||e[e.length-1]-e[0],c+(2*d-1)*b*a}}function g(a,b){return a.map(b).reduce(function(a,b){return a.concat(b)}).filter(function(a){return null!==a})}b.exports=function(b){var c=a("./zoomable")(),d=a("../util")(),h=a("../accessor")(),i=a("./financetime")(b.scale.linear,b.time,b.bisect,d.rebindCallback,f,c);return{financetime:i,analysis:{supstance:function(a,c){return b.scale.linear()},trendline:function(a,c){return b.scale.linear()}},plot:{time:function(a,b){return b=b||h.value(),i().domain(a.map(b.d))},atr:function(a,c){return c=c||h.value(),e(b,a,c,.04)},ichimoku:function(a,c){c=c||h.ichimoku();var d=g(a,function(b,d){var e=a[d+c.pks(b)],f=a[d-c.pks(b)];return[c.ts(b),c.ks(b),f?c.sa(f):null,f?c.sb(f):null,e?c.c(e):null]});return b.scale.linear().domain(b.extent(d).map(f(.02))).range([1,0])},percent:function(a,b){var c=a.domain();return b=b||c[0],a.copy().domain([c[0],c[c.length-1]].map(function(a){return(a-b)/b}))},ohlc:function(a,c){return c=c||h.ohlc(),b.scale.linear().domain([b.min(a.map(c.low())),b.max(a.map(c.high()))].map(f(.02))).range([1,0])},volume:function(a,c){return c=c||h.ohlc().v,b.scale.linear().domain([0,1.15*b.max(a.map(c))]).range([1,0])},atrtrailingstop:function(a,c){c=c||h.atrtrailingstop();var d=g(a,function(a){return[c.up(a),c.dn(a)]});return b.scale.linear().domain(b.extent(d).map(f(.04))).range([1,0])},rsi:function(){return b.scale.linear().domain([0,100]).range([1,0])},momentum:function(a,c){return c=c||h.value(),e(b,a,c,.04)},moneyflow:function(a,c){return c=c||h.value(),e(b,a,c,.04)},macd:function(a,c){return c=c||h.macd(),e(b,a,c,.04)},movingaverage:function(a,c){return c=c||h.value(),e(b,a,c)}},position:{}}}},{"../accessor":4,"../util":41,"./financetime":35,"./zoomable":37}],37:[function(a,b,c){"use strict";b.exports=function(){function a(b,c,d){var e={},f=!0;return e.invert=b.invert,e.domain=function(a){return arguments.length?(f?b.domain([Math.max(d[0],a[0]),Math.min(d[1],a[1])]):b.domain(a),c&&c(),e):b.domain()},e.range=function(a){if(!arguments.length)return b.range();throw"zoomable is a read only range. Use this scale for zooming only"},e.copy=function(){return a(b.copy(),c,d)},e.clamp=function(a){return arguments.length?(f=a,e):f},e}return a}},{}],38:[function(a,b,c){"use strict";b.exports=function(a){return function(){function b(a,b){var i=[],j=c(a,b),k=d(a,b),l=e(a,b),m=f(a,b),n=g(a,b),o=h(a,b),p="left"===n||"up"===n?1:-1,q=l/3,r=l/2,s=o?m/2:m;switch(i.push("M",j,k),n){case"up":case"down":i.push("l",-r,p*s,"l",q,0),o&&i.push("l",0,p*s),i.push("l",q,0),o&&i.push("l",0,-p*s),i.push("l",q,0);break;case"left":case"right":i.push("l",p*s,-r,"l",0,q),o&&i.push("l",p*s,0),i.push("l",0,q),o&&i.push("l",-p*s,0),i.push("l",0,q);break;default:throw"Unsupported arrow.orient() = "+g}return i.push("z"),i.join(" ")}var c=a(0),d=a(0),e=a(12),f=a(15),g=a("up"),h=a(!0);return b.x=function(d){return arguments.length?(c=a(d),b):c},b.y=function(c){return arguments.length?(d=a(c),b):d},b.height=function(c){return arguments.length?(f=a(c),b):f},b.width=function(c){return arguments.length?(e=a(c),b):e},b.orient=function(c){return arguments.length?(g=a(c),b):g},b.tail=function(c){return arguments.length?(h=a(c),b):h},b}}},{}],39:[function(a,b,c){"use strict";b.exports=function(b){return{arrow:a("./arrow")(b.functor)}}},{"./arrow":38}],40:[function(a,b,c){"use strict";var d;if("undefined"!=typeof window)d=window.d3;else{if("object"!=typeof b)throw"Unsupported runtime environment: Could not find d3. Ensure defined globally on window, or available as dependency.";d=a("d3")}b.exports=function(b){return{version:a("../build/version"),accessor:a("./accessor")(),indicator:a("./indicator")(),plot:a("./plot")(b),scale:a("./scale")(b),svg:a("./svg")(b)}}(d)},{"../build/version":1,"./accessor":4,"./indicator":15,"./plot":25,"./scale":36,"./svg":39,d3:"d3"}],41:[function(a,b,c){"use strict";function d(a,b,c){for(var d,f=2,g=arguments.length;++f=f.period?d(f.accessor.d(a),c):d(f.accessor.d(a))}).filter(function(a){return null!==a.value})}var f={},g=c(),h=null,i=0,j=0;return e.init=function(){return g.accessor(e.accessor()).period(f.period).init(),h=null,i=0,j=0,e},e.atr=function(a){var b=null===h?f.accessor.h(a)-f.accessor.l(a):Math.max(f.accessor.h(a)-f.accessor.l(a),Math.abs(f.accessor.h(a)-f.accessor.c(h)),Math.abs(f.accessor.l(a)-f.accessor.c(h)));return h=a,i=j++<=f.period?g.average(b):(i*(f.period-1)+b)/f.period},a(e,f).accessor(b()).period(14),e}}},{}],13:[function(a,b,c){"use strict";b.exports=function(a,b,c){return function(){function d(a){return g.accessor(e.accessor).period(e.period).init(),a.map(function(a,b){var c=e.accessor.c(a),d=g.atr(a)*f;return b>=e.period?{date:e.accessor.d(a),close:c,up:c-d,down:c+d}:{date:e.accessor.d(a),up:null,down:null}}).filter(function(a){return null!==a.up&&null!==a.down}).reduce(function(a,b,c){var d=a[c-1],e=0===c?b.up:null,f=null;return d&&null!==d.up&&(b.close>d.up?e=Math.max(b.up,d.up):f=b.down),d&&null!==d.down&&(b.close=0;d--)c[d]=g(b,a,d);return c}function g(a,b,c){for(var g=b[c],i=h.accessor.l(g),j=h.accessor.h(g),k=d(a,h.accessor.d(g),h.accessor.c(g)),l=0,m=l+1;l=0;l++,m=l+1)g=b[c-l],i=Math.min(i,h.accessor.l(g)),j=Math.max(j,h.accessor.h(g)),k.tenkanSen=m===a.tenkanSen?f(i,j):k.tenkanSen,k.kijunSen=m===a.kijunSen?f(i,j):k.kijunSen,k.senkouSpanB=m===a.senkouSpanB?f(i,j):k.senkouSpanB;return k.senkouSpanA=e(k.tenkanSen,k.kijunSen),k}var h={},i=9,j=26,k=52;return c.tenkanSen=function(a){return arguments.length?(i=a,c):i},c.kijunSen=function(a){return arguments.length?(j=a,c):j},c.senkouSpanB=function(a){return arguments.length?(k=a,c):k},a(c,h).accessor(b()),c}}},{}],16:[function(a,b,c){"use strict";function d(a){return 2/(a+1)}function e(a){return 1/a}b.exports=function(){var b=a("./indicatormixin")(),c=a("../accessor")(),f=a("./ema"),g=f(b,c.ohlc,d),h=a("./sma")(b,c.ohlc),i=a("./atr")(b,c.ohlc,h);return{atr:i,atrtrailingstop:a("./atrtrailingstop")(b,c.ohlc,i),ema:g,ichimoku:a("./ichimoku")(b,c.ohlc),macd:a("./macd")(b,c.ohlc,g),rsi:a("./rsi")(b,c.ohlc,g),sma:h,wilderma:f(b,c.ohlc,e)}}},{"../accessor":4,"./atr":12,"./atrtrailingstop":13,"./ema":14,"./ichimoku":15,"./indicatormixin":17,"./macd":18,"./rsi":19,"./sma":20}],17:[function(a,b,c){"use strict";b.exports=function(){return function(a,b){var c={};return c.period=function(d){return b.period=d,a.period=function(c){return arguments.length?(b.period=c,a):b.period},c},c.accessor=function(d){return b.accessor=d,a.accessor=function(c){return arguments.length?(b.accessor=c,a):b.accessor},c},c}}},{}],18:[function(a,b,c){"use strict";function d(a,b,c,d,e){return b?{date:a,macd:b,signal:c,difference:d,zero:e}:{date:a,macd:null,signal:null,difference:null,zero:null}}b.exports=function(a,b,c){return function(){function e(a){var b=Math.max(g,h)-1,c=b+i-1;return j.accessor(e.accessor()).period(i).init(),k.accessor(e.accessor()).period(g).init(),l.accessor(e.accessor()).period(h).init(),a.map(function(a,e){h=k.average(f.accessor(a)),g=l.average(f.accessor(a));var i=h-g,m=e>=b?j.average(i):null;return e>=c?d(f.accessor.d(a),i,m,i-m,0):d(f.accessor.d(a))}).filter(function(a){return null!==a.macd})}var f={},g=12,h=26,i=9,j=c(),k=c(),l=c();return e.fast=function(a){return arguments.length?(g=a,e):g},e.slow=function(a){return arguments.length?(h=a,e):h},e.signal=function(a){return arguments.length?(i=a,e):i},a(e,f).accessor(b()),e}}},{}],19:[function(a,b,c){"use strict";function d(a,b,c,d,e){return b?{date:a,rsi:b,middle:c,overbought:d,oversold:e}:{date:a,rsi:null,middle:null,overbought:null,oversold:null}}b.exports=function(a,b,c){return function(){function e(a){return j.accessor(e.accessor()).period(f.period).init(),k.accessor(e.accessor()).period(f.period).init(),a.map(function(b,c){if(1>c)return d(f.accessor.d(b));var e=f.accessor(b)-f.accessor(a[c-1]),l=k.average(Math.max(e,0)),m=Math.abs(j.average(Math.min(e,0)));if(c>=f.period){var n=100-100/(1+l/m);return d(f.accessor.d(b),n,h,g,i)}return d(f.accessor.d(b))}).filter(function(a){return null!==a.rsi})}var f={},g=70,h=50,i=30,j=c(),k=c();return e.overbought=function(a){return arguments.length?(g=a,e):g},e.middle=function(a){return arguments.length?(h=a,e):h},e.oversold=function(a){return arguments.length?(i=a,e):i},a(e,f).accessor(b()).period(14),e}}},{}],20:[function(a,b,c){"use strict";b.exports=function(a,b){return function(){function c(a){return c.init(),a.map(d).filter(function(a){return null!==a.value})}function d(a,b){var d=c.average(h.accessor(a));return b+1e?[e,f]:[f,e],c.filter(function(c){if(!a(c))return!1;var e=b(a(c));return e&&!isNaN(e)&&d[0]<=e&&e<=d[1]})}}function f(a,b,c,d){var e=c.scale();switch(c.orient()){case"left":case"right":a.attr({x:d*(Math.max(c.innerTickSize(),0)+c.tickPadding()),y:g(b,e),dy:".32em"}).style("text-anchor",0>d?"end":"start");break;case"top":case"bottom":a.attr({x:g(b,e),y:d*(Math.max(c.innerTickSize(),0)+c.tickPadding()),dy:0>d?"0em":".72em"}).style("text-anchor","middle")}}function g(a,b){return function(c){return b(a(c))}}function h(a,b){return function(c){return b(a(c))}}function i(a,b,c,d,e,f){return function(g){var h=b.scale(),i=h(a(g)),j=e;switch(b.orient()){case"left":case"right":var k=0;return e>c/2?j=c/2:k=c/2-e,["M",0,i,"l",f*b.innerTickSize(),-j,"l",0,-k,"l",f*d,0,"l",0,c,"l",f*-d,0,"l",0,-k].join(" ");case"top":case"bottom":var l=0;return e>d/2?j=d/2:l=d/2-e,["M",i,0,"l",-j,f*b.innerTickSize(),"l",-l,0,"l",0,f*c,"l",d,0,"l",0,f*-c,"l",-l,0].join(" ");default:throw"Unsupported axis.orient() = "+b.orient()}}}b.exports=function(a,b,c,e){return function(){function f(a){a.selectAll("g.translate").data(c.dataMapper.array).enter().append("g").attr("class","translate"),f.refresh(a)}var g,h={},i=a(),j=4,k=14,l=50,m=[0,0];return f.refresh=function(a){var b=g?g:i.tickFormat()?i.tickFormat():i.scale().tickFormat();d(a,c,h.accessor,i,b,k,l,j,m)},f.axis=function(a){return arguments.length?(i=a,f):i},f.format=function(a){return arguments.length?(g=a,f):g},f.height=function(a){return arguments.length?(k=a,f):k},f.width=function(a){return arguments.length?(l=a,f):l},f.translate=function(a){return arguments.length?(m=a,f):m},e(f,h).accessor(b()),f}}},{}],23:[function(a,b,c){"use strict";function d(a,b,c,d){return function(e){var f=[],g=c(a.o(e)),h=c(a.c(e)),i=d(b),j=b(a.d(e))-i/2;return f.push("M",j,g,"l",i,0),g!=h&&f.push("L",j+i,h,"l",-i,0,"L",j,g),f.join(" ")}}function e(a,b,c,d){return function(e){var f=[],g=c(a.o(e)),h=c(a.c(e)),i=d(b),j=b(a.d(e)),k=j-i/2;return f.push("M",j,c(a.h(e)),"L",j,Math.min(g,h)),g==h&&f.push("M",k,g,"l",i,0),f.push("M",j,Math.max(g,h),"L",j,c(a.l(e))),f.join(" ")}}b.exports=function(a,b,c,f,g){return function(){function a(b){var c=f.groupSelect(b,f.dataMapper.array,k.accessor.d),d=f.groupUpDownEqual(b.datum(),k.accessor);f.appendUpDownEqual(c.selection,k.accessor,["candle","body"],d),f.appendUpDownEqual(c.selection,k.accessor,["candle","wick"],d),a.refresh(b)}function b(){h=f.joinPath(k.accessor,k.xScale,k.yScale,d),i=f.joinPath(k.accessor,k.xScale,k.yScale,e),j=f.lineWidth(k.xScale,1,4)}var h,i,j,k={};return a.refresh=function(a){a.selectAll("path.candle.body").attr("d",h),a.selectAll("path.candle.wick").attr("d",i).style("stroke-width",j)},g(a,k).plot(c(),b),a}}},{}],24:[function(a,b,c){"use strict";function d(a,b){a.select("g.data.top").style("display",b)}function e(a,b){return function(c){if(!c)return"M 0 0";var d=a(c);return["M",b[0],d,"L",b[b.length-1],d].join(" ")}}function f(a,b){return function(c){if(!c)return"M 0 0";var d=a(c);return["M",d,b[0],"L",d,b[b.length-1]].join(" ")}}b.exports=function(a,b,c,g,h,i){return function(){function a(b){var c=b.selectAll("g.data.top").data([q],function(a){return a}),d=c.enter(),e=d.append("g").attr("class","data top").style("display","none");c.exit().remove(),e.append("path").attr("class","horizontal wire"),e.append("path").attr("class","vertical wire"),h.annotation.append(e,o,"x"),h.annotation.append(e,p,"y"),b.selectAll("rect").data([0]).enter().append("rect").style({fill:"none","pointer-events":"all"}),a.refresh(b)}function b(a,b,d,e){return function(){var f=c(this),g=m.xScale.invert(f[0]),i=m.yScale.invert(f[1]);j(a.datum(g),b.datum(i),d.each(h.annotation.update(o,f[0])),e.each(h.annotation.update(p,f[1]))),n.move([g,i])}}function j(a,b,c,d){var g=m.xScale,i=m.yScale;a.attr("d",f(g,k||i.range())),b.attr("d",e(i,l||g.range())),c.each(h.annotation.refresh(o)),d.each(h.annotation.refresh(p))}var k,l,m={},n=g("enter","out","move"),o=[],p=[],q=0;return a.refresh=function(a){var c=m.xScale.range(),e=m.yScale.range(),f=a.selectAll("g.data"),g=a.selectAll("rect"),h=f.selectAll("path.vertical"),i=f.selectAll("path.horizontal"),k=f.selectAll("g.axisannotation.x > g"),l=f.selectAll("g.axisannotation.y > g");g.attr({x:Math.min.apply(null,c),y:Math.min.apply(null,e),height:Math.abs(e[e.length-1]-e[0]),width:Math.abs(c[c.length-1]-c[0])}).on("mouseenter",function(){d(a,"inline"),n.enter()}).on("mouseout",function(){d(a,"none"),n.out()}).on("mousemove",b(h,i,k,l)),j(h,i,k,l)},a.xAnnotation=function(b){return arguments.length?(o=b instanceof Array?b:[b],q++,a):o},a.yAnnotation=function(b){return arguments.length?(p=b instanceof Array?b:[b],q++,a):p},a.verticalWireRange=function(b){return arguments.length?(k=b,a):k},a.horizontalWireRange=function(b){return arguments.length?(l=b,a):l},i(a,m).xScale().yScale().on(n),a}}},{}],25:[function(a,b,c){"use strict";function d(a){return function(b){return-a(b)}}function e(){return Math.random().toString(36).substr(2,9)}b.exports=function(a,b,c,f){return function(){function g(a){var b=c.groupSelect(a,c.dataMapper.array),d="kumoclipup-"+e(),f="kumoclipdown-"+e();b.entry.append("clipPath").attr({id:f,"class":"kumoclipdown"}).append("path"),b.entry.append("clipPath").attr({id:d,"class":"kumoclipup"}).append("path"),b.entry.append("path").attr({"class":"kumo down","clip-path":"url(#"+f+")"}),b.entry.append("path").attr({"class":"kumo up","clip-path":"url(#"+d+")"}),b.entry.append("path").attr("class","senkouspanb"),b.entry.append("path").attr("class","senkouspana"),b.entry.append("path").attr("class","chikouspan"),b.entry.append("path").attr("class","kijunsen"),b.entry.append("path").attr("class","tenkansen"),g.refresh(a)}function h(a,b){a.selectAll(".kumoclipdown path").attr("d",m.y1(b.range()[0])),a.selectAll(".kumoclipup path").attr("d",m.y1(b.range()[1])),a.selectAll("path.kumo.down").attr("d",n),a.selectAll("path.kumo.up").attr("d",n),a.selectAll("path.senkouspanb").attr("d",p),a.selectAll("path.senkouspana").attr("d",o),a.selectAll("path.chikouspan").attr("d",q),a.selectAll("path.kijunsen").attr("d",s),a.selectAll("path.tenkansen").attr("d",r)}function i(){o.init(l.accessor.d,l.xScale,l.accessor.sa,l.yScale,l.accessor.pks),p.init(l.accessor.d,l.xScale,l.accessor.sb,l.yScale,l.accessor.pks),q.init(l.accessor.d,l.xScale,l.accessor.c,l.yScale,d(l.accessor.pks)),r.init(l.accessor.d,l.xScale,l.accessor.ts,l.yScale),s.init(l.accessor.d,l.xScale,l.accessor.ks,l.yScale)}function j(){return a().interpolate("monotone").defined(function(a){return null!==l.accessor.sb(a)}).x(function(a){return l.xScale(l.accessor.d(a),l.accessor.pks(a))}).y0(function(a){return l.yScale(l.accessor.sb(a))})}function k(){return a().interpolate("monotone").defined(function(a){return null!==l.accessor.sa(a)&&null!==l.accessor.sb(a)}).x(function(a){return l.xScale(l.accessor.d(a),l.accessor.pks(a))}).y0(function(a){return l.yScale(l.accessor.sa(a))}).y1(function(a){return l.yScale(l.accessor.sb(a))})}var l={},m=j(),n=k(),o=c.pathLine(),p=c.pathLine(),q=c.pathLine(),r=c.pathLine(),s=c.pathLine();return g.refresh=function(a){h(a,l.yScale)},f(g,l).plot(b(),i),i(),g}}},{}],26:[function(a,b,c){"use strict";function d(){return d3.event}b.exports=function(b){var c=a("../scale")(b),e=a("../accessor")(),f=a("./plot")(b.svg.line,b.select),g=a("./plotmixin")(b.scale.linear,c.financetime),h=a("./line"),i=a("./axisannotation")(b.svg.axis,e.value,f,g);return{atr:h(e.value,f,g),atrtrailingstop:a("./atrtrailingstop")(e.atrtrailingstop,f,g),axisannotation:i,candlestick:a("./candlestick")(b.scale.linear,b.extent,e.ohlc,f,g),crosshair:a("./crosshair")(b.select,d,b.mouse,b.dispatch,f,g),ema:h(e.value,f,g),ichimoku:a("./ichimoku")(b.svg.area,e.ichimoku,f,g),ohlc:a("./ohlc")(b.scale.linear,b.extent,e.ohlc,f,g),tick:a("./tick")(b.scale.linear,b.extent,e.tick,f,g),close:h(e.ohlc,f,g),volume:a("./volume")(e.volume,f,g),rsi:a("./rsi")(e.rsi,f,g),macd:a("./macd")(e.macd,f,g),momentum:h(e.value,f,g,!0),moneyflow:h(e.value,f,g,!0),sma:h(e.value,f,g),supstance:a("./supstance")(b.behavior.drag,d,b.select,b.dispatch,e.value,f,g),trendline:a("./trendline")(b.behavior.drag,d,b.select,b.dispatch,e.trendline,f,g),wilderma:h(e.value,f,g)}}},{"../accessor":4,"../scale":38,"./atrtrailingstop":21,"./axisannotation":22,"./candlestick":23,"./crosshair":24,"./ichimoku":25,"./line":27,"./macd":28,"./ohlc":29,"./plot":30,"./plotmixin":31,"./rsi":32,"./supstance":33,"./tick":34,"./trendline":35,"./volume":36}],27:[function(a,b,c){"use strict";function d(a,b,c,d,e,f,g){a.selectAll("path.line").attr("d",f),g&&a.selectAll("path.zero").attr("d",e.horizontalPathLine(c,b.z,d))}b.exports=function(a,b,c,e){return e=e||!1,function(){function f(a){var c=b.groupSelect(a,b.dataMapper.array);c.entry.append("path").attr("class","line"),e&&c.selection.append("path").attr("class","zero"),f.refresh(a)}function g(){i.init(h.accessor.d,h.xScale,h.accessor,h.yScale)}var h={},i=b.pathLine();return f.refresh=function(a){d(a,h.accessor,h.xScale,h.yScale,b,i,e)},c(f,h).plot(a(),g),g(),f}}},{}],28:[function(a,b,c){"use strict";function d(a,b,c,d,e,f,g,h){a.selectAll("path.difference").attr("d",f),a.selectAll("path.zero").attr("d",e.horizontalPathLine(b.d,c,b.z,d)),a.selectAll("path.macd").attr("d",g),a.selectAll("path.signal").attr("d",h)}function e(a,b,c,d){return function(e){var f=c(0),g=c(a.dif(e))-f,h=d(b),i=b(a.d(e))-h/2;return["M",i,f,"l",0,g,"l",h,0,"l",0,-g].join(" ")}}b.exports=function(a,b,c){return function(){function f(a){var c=b.groupSelect(a,b.dataMapper.array,i.accessor.d);c.selection.append("path").attr("class","difference"),c.selection.append("path").attr("class","zero"),c.selection.append("path").attr("class","macd"),c.selection.append("path").attr("class","signal"),f.refresh(a)}function g(){h=b.joinPath(i.accessor,i.xScale,i.yScale,e),j.init(i.accessor.d,i.xScale,i.accessor.m,i.yScale),k.init(i.accessor.d,i.xScale,i.accessor.s,i.yScale)}var h,i={},j=b.pathLine(),k=b.pathLine();return f.refresh=function(a){d(a,i.accessor,i.xScale,i.yScale,b,h,j,k)},c(f,i).plot(a(),g),g(),f}}},{}],29:[function(a,b,c){"use strict";function d(a,b,c,d){return function(e){var f=c(a.o(e)),g=c(a.c(e)),h=d(b),i=b(a.d(e)),j=i-h/2;return["M",j,f,"l",h/2,0,"M",i,c(a.h(e)),"L",i,c(a.l(e)),"M",i,g,"l",h/2,0].join(" ")}}b.exports=function(a,b,c,e,f){return function(){function a(b){var c=e.groupSelect(b,e.dataMapper.array,i.accessor.d);e.appendUpDownEqual(c.selection,i.accessor,"ohlc"),a.refresh(b)}function b(){g=e.joinPath(i.accessor,i.xScale,i.yScale,d),h=e.lineWidth(i.xScale,1,2)}var g,h,i={};return a.refresh=function(a){a.selectAll("path.ohlc").attr("d",g).style("stroke-width",h)},f(a,i).plot(c(),b),a}}},{}],30:[function(a,b,c){"use strict";b.exports=function(a,b){function c(a,b,c){var d=a.selectAll("g.data").data(b,c);return d.exit().remove(),d}function d(a){return a.enter().append("g").attr("class","data")}function e(){function b(a){return c(a)}var c=a().interpolate("monotone");return b.init=function(a,b,d,e,f){return c.defined(function(a){return null!==d(a)}).x(function(c){return b(a(c),void 0===f?f:f(c))}).y(function(a){return e(d(a))})},b.d3=function(){return c},b}function f(a,b){return a.o(b)a.c(b)}function h(a,b){return a.reduce(function(a,c){return f(b,c)?a.up.push(c):g(b,c)?a.down.push(c):a.equal.push(c),a},{up:[],down:[],equal:[]})}function i(a,b,c,d){var e=c instanceof Array?c:[c];d=d||h(a.datum(),b),j(a,d.up,e,"up"),j(a,d.down,e,"down"),j(a,d.equal,e,"equal")}function j(a,b,c,d){a.selectAll("path."+c.join(".")+"."+d).data([b]).enter().append("path").attr("class",c.join(" ")+" "+d)}function k(a){return Math.max(a.band(),1)}return{dataMapper:{unity:function(a){return a},array:function(a){return[a]}},dataSelection:c,dataEntry:d,groupSelect:function(a,b,e){var f=c(a,b,e),g=d(f);return{selection:f,entry:g}},groupUpDownEqual:h,appendUpDownEqual:i,horizontalPathLine:function(a,b,c,d){return function(e){var f=e[0],g=e[e.length-1];return["M",b(a(f)),d(c(f)),"L",b(a(g)),d(c(g))].join(" ")}},pathLine:e,barWidth:k,lineWidth:function(a,b,c){return b=b||1,c=c||1,function(){return Math.min(b,k(a)/c)}},joinPath:function(a,b,c,d){return function(e){return e.map(d(a,b,c,k)).join(" ")}},interaction:{mousedispatch:function(a){return function(c){return c.on("mouseenter",function(c){b(this.parentNode).classed("mouseover",!0),a.mouseenter(c)}).on("mouseleave",function(c){var d=b(this.parentNode);d.classed("dragging")||(d.classed("mouseover",!1),a.mouseout(c))}).on("mousemove",function(b){a.mousemove(b)})}},dragStartEndDispatch:function(a,c){return a.on("dragstart",function(a){b(this.parentNode.parentNode).classed("dragging",!0),c.dragstart(a)}).on("dragend",function(a){b(this.parentNode.parentNode).classed("dragging",!1),c.dragend(a)})}},annotation:{append:function(a,c,d,e,f){var g=arguments.length,h=a.append("g").attr("class","axisannotation "+d).selectAll("g").data(function(a){var b=g>3?f(e(a)):null;return c.map(function(a){var c=g>3?a.axis().scale().invert(b):null;return[{value:c}]})});h.enter().append("g").attr("class",function(a,b){return b}).each(function(a,d){this.__annotation__=d,c[d](b(this))})},update:function(a,b){return function(c){var d=a[this.__annotation__];c[0].value=d.axis().scale().invert(b)}},refresh:function(a){return function(){a[this.__annotation__].refresh(b(this))}}}}}},{}],31:[function(a,b,c){"use strict";b.exports=function(a,b){return function(c,d){var e={};return e.xScale=function(a){return d.xScale=b(),c.xScale=function(b){return arguments.length?(d.xScale=b,a&&a(),c):d.xScale},e},e.yScale=function(b){return d.yScale=a(),c.yScale=function(a){return arguments.length?(d.yScale=a,b&&b(),c):d.yScale},e},e.accessor=function(a,b){return d.accessor=a,c.accessor=function(a){return arguments.length?(d.accessor=a,b&&b(),c):d.accessor},e},e.on=function(a,b){return c.on=function(d,e){return a.on(d,e),b&&b(),c},e},e.plot=function(a,b){return e.xScale(b).yScale(b).accessor(a,b)},e}}},{}],32:[function(a,b,c){"use strict";function d(a,b,c,d,e,f){a.selectAll("path.overbought").attr("d",e.horizontalPathLine(b.d,c,b.ob,d)),a.selectAll("path.middle").attr("d",e.horizontalPathLine(b.d,c,b.m,d)),a.selectAll("path.oversold").attr("d",e.horizontalPathLine(b.d,c,b.os,d)),a.selectAll("path.rsi").attr("d",f)}b.exports=function(a,b,c){return function(){function e(a){var c=b.groupSelect(a,b.dataMapper.array,g.accessor.d);c.entry.append("path").attr("class","overbought"),c.entry.append("path").attr("class","middle"),c.entry.append("path").attr("class","oversold"),c.entry.append("path").attr("class","rsi"),e.refresh(a)}function f(){h.init(g.accessor.d,g.xScale,g.accessor.r,g.yScale)}var g={},h=b.pathLine();return e.refresh=function(a){d(a,g.accessor,g.xScale,g.yScale,b,h)},c(e,g).plot(a(),f),f(),e}}},{}],33:[function(a,b,c){"use strict";function d(a,b,c,d,f,g,h){a.selectAll(".supstance path").attr("d",e(c,d,f)),a.selectAll(".interaction path").attr("d",e(c,d,f)),g.each(b.annotation.refresh(h))}function e(a,b,c){return function(d){var e=[],f=b.range();return e.push("M",f[0],c(a(d))),e.push("L",f[f.length-1],c(a(d))),e.join(" ")}}b.exports=function(a,b,c,e,f,g,h){function i(){function a(d){var e=g.groupSelect(d,g.dataMapper.unity);e.entry.append("g").attr("class","supstance").append("path"),g.annotation.append(e.entry,i,"y",b.accessor,b.yScale);var f=e.entry.append("g").attr("class","interaction").style({opacity:0,fill:"none"}).call(g.interaction.mousedispatch(c));f.append("path").style("stroke-width",16),a.refresh(d)}var b={},c=e("mouseenter","mouseout","mousemove","drag","dragstart","dragend"),i=[];return a.refresh=function(a){d(a,g,b.accessor,b.xScale,b.yScale,a.selectAll(".axisannotation.y > g"),i)},a.drag=function(a){a.selectAll(".interaction path").call(j(c,b.accessor,b.xScale,b.yScale,i))},a.annotation=function(b){return arguments.length?(i=b instanceof Array?b:[b],a):i},h(a,b).plot(f()).on(c),a}function j(e,f,h,i,j){var k=a().origin(function(a){return{x:0,y:i(f(a))}}).on("drag",function(a){var k=i.invert(b().y),l=c(this.parentNode.parentNode),m=l.selectAll(".axisannotation.y > g");f.v(a,k),m.each(g.annotation.update(j,b().y)),d(l,g,f,h,i,m,j),e.drag(a)});return g.interaction.dragStartEndDispatch(k,e)}return i}},{}],34:[function(a,b,c){"use strict";function d(a,b,c,d){return function(e){var f=c(a.h(e)),g=c(a.l(e)),h=d(b),i=b(a.d(e)),j=i-h/2;return["M",j,f,"l",h,0,"M",i,f,"L",i,g,"M",j,g,"l",h,0].join(" ")}}b.exports=function(a,b,c,e,f){return function(){function a(b){var c=e.groupSelect(b,e.dataMapper.array,i.accessor.d);c.entry.append("path").attr("class","tick"),a.refresh(b)}function b(){g=e.joinPath(i.accessor,i.xScale,i.yScale,d),h=e.lineWidth(i.xScale,1,2)}var g,h,i={};return a.refresh=function(a){a.selectAll("path.tick").attr("d",g).style("stroke-width",h)},f(a,i).plot(c(),b),a}}},{}],35:[function(a,b,c){"use strict";function d(a,b,c,d){a.selectAll(".trendline path.body").attr("d",e(b,c,d)),a.selectAll(".trendline circle.start").attr(f(b.sd,c,b.sv,d)),a.selectAll(".trendline circle.end").attr(f(b.ed,c,b.ev,d)),a.selectAll(".interaction path.body").attr("d",e(b,c,d)),a.selectAll(".interaction circle.start").attr(f(b.sd,c,b.sv,d)),a.selectAll(".interaction circle.end").attr(f(b.ed,c,b.ev,d))}function e(a,b,c){return function(d){var e=[];return e.push("M",b(a.sd(d)),c(a.sv(d))),e.push("L",b(a.ed(d)),c(a.ev(d))),e.join(" ")}}function f(a,b,c,d){return{cx:function(c){return b(a(c))},cy:function(a){return d(c(a))}}}b.exports=function(a,b,c,e,f,g,h){function i(){function a(b){var d=g.groupSelect(b,g.dataMapper.unity),e=d.entry.append("g").attr("class","trendline");e.append("path").attr("class","body"),e.append("circle").attr({"class":"start",r:1}),e.append("circle").attr({"class":"end",r:1});var f=d.entry.append("g").attr("class","interaction").style({opacity:0,fill:"none"}).call(g.interaction.mousedispatch(c));f.append("path").attr("class","body").style("stroke-width",16),f.append("circle").attr({"class":"start",r:8}),f.append("circle").attr({"class":"end",r:8}),a.refresh(b)}var b={},c=e("mouseenter","mouseout","mousemove","drag","dragstart","dragend");return a.refresh=function(a){d(a,b.accessor,b.xScale,b.yScale)},a.drag=function(a){a.selectAll(".interaction circle.start").call(j(c,b.accessor,b.accessor.sd,b.xScale,b.accessor.sv,b.yScale)),a.selectAll(".interaction circle.end").call(j(c,b.accessor,b.accessor.ed,b.xScale,b.accessor.ev,b.yScale)),a.selectAll(".interaction path.body").call(k(c,b.accessor,b.xScale,b.yScale)); +},h(a,b).plot(f()).on(c),a}function j(e,f,h,i,j,k){var m=a();return m.origin(function(a){return{x:i(h(a)),y:k(j(a))}}).on("drag",function(a){l(h,i,b().x,j,k,b().y,a),d(c(this.parentNode.parentNode),f,i,k),e.drag(a)}),g.interaction.dragStartEndDispatch(m,e)}function k(e,f,h,i){var j={},k=a();return k.origin(function(a){return j.start={date:h(f.sd(a)),value:i(f.sv(a))},j.end={date:h(f.ed(a)),value:i(f.ev(a))},{x:0,y:0}}).on("drag",function(a){l(f.sd,h,b().x+j.start.date,f.sv,i,b().y+j.start.value,a),l(f.ed,h,b().x+j.end.date,f.ev,i,b().y+j.end.value,a),d(c(this.parentNode.parentNode),f,h,i),e.drag(a)}),g.interaction.dragStartEndDispatch(k,e)}function l(a,b,c,d,e,f,g){var h=b.invert(c);h&&a(g,h),d(g,e.invert(f))}return i}},{}],36:[function(a,b,c){"use strict";function d(a,b,c,d){return function(e){var f=a.v(e);if(isNaN(f))return null;var g=c(0),h=c(f)-g,i=d(b),j=b(a.d(e))-i/2;return["M",j,g,"l",0,h,"l",i,0,"l",0,-h].join(" ")}}b.exports=function(a,b,c){return function(){function e(a){var c=b.groupSelect(a,b.dataMapper.array,h.accessor.d);h.accessor.o&&h.accessor.c?b.appendUpDownEqual(c.selection,h.accessor,"volume"):c.entry.append("path").attr("class","volume"),e.refresh(a)}function f(){g=b.joinPath(h.accessor,h.xScale,h.yScale,d)}var g,h={};return e.refresh=function(a){a.selectAll("path.volume").attr("d",g)},c(e,h).plot(a(),f),e}}},{}],37:[function(a,b,c){"use strict";b.exports=function(a,b,c,d,e,f){function g(b,i,n,o,p){function q(a,d){var e=v[+a];return d=d||0,void 0===e&&(e=i[0]>a?-1:c(i,a)),b(e+d)}function r(){return x=h(b,i,n),q}function s(){v=k(i)}function u(){return s(),b.domain([0,i.length-1]),r(),b.domain(b.range().map(e(o,x)).map(b.invert)),p=b.domain(),r()}var v,w={tickFormat:t[t.length-1][2]},x=3;return b=b||a(),i=i||[new Date(0),new Date(1)],n=void 0===n?.2:n,o=void 0===o?.65:o,p=p||b.domain(),q.invert=function(a){var b=i[q.invertToIndex(a)];return b?b:null},q.invertToIndex=function(a){return Math.round(b.invert(a))},q.domain=function(a){if(!arguments.length){var c=b.domain();return c[0]<0&&c[c.length-1]<0?[]:(c=[Math.max(Math.ceil(c[0]),0),Math.min(Math.floor(c[c.length-1]),i.length-1)],i.slice(c[0],c[c.length-1]+1))}return i=a,u()},q.copy=function(){return g(b.copy(),i,n,o,p)},q.band=function(){return x},q.outerPadding=function(a){return arguments.length?(o=a,u()):o},q.padding=function(a){return arguments.length?(n=a,u()):n},q.zoomable=function(){return f(b,r,p)},q.ticks=function(a,c){var d=q.domain(),e=b.domain();if(!d.length)return[];var f=void 0===a?j(d,e,10):"number"==typeof a?j(d,e,a):null;w.tickFormat=f?f[2]:j(d,e,10)[2],f&&(a=f[0],c=f[1]);var g=a.range(d[0],+d[d.length-1]+1,c);return g.map(l(d)).reduce(m,[])},q.tickFormat=function(){return function(a){return w.tickFormat(a)}},d(q,b,r,"range"),s(),r()}function h(a,b,c){return Math.abs(a(b.length-1)-a(0))/Math.max(1,b.length-1)*(1-c)}function i(a,b){return a.length/(b[b.length-1]-b[0])}function j(a,b,d){if(1==a.length)return q;var e=a[a.length-1]-a[0],f=1>e/r,g=f?v:t,h=f?u:s,j=Math.min(Math.round(i(a,b)*d),d),k=e/j,l=c(h,k);return l==g.length?g[l-1]:l?g[k/h[l-1]0?a.extent(b,c).map(f(d)):[]}function e(a,b,c,e){return a.scale.linear().domain(d(a,b,c,e)).range([1,0])}function f(a,b){return a=a||0,function(c,d,e){if(e.length>2)throw"array.length > 2 unsupported. array.length = "+e.length;return b=b||e[e.length-1]-e[0],c+(2*d-1)*b*a}}function g(a,b){return a.map(b).reduce(function(a,b){return a.concat(b)}).filter(function(a){return null!==a})}b.exports=function(b){var c=a("./zoomable")(),d=a("../util")(),h=a("../accessor")(),i=a("./financetime")(b.scale.linear,b.time,b.bisect,d.rebindCallback,f,c);return{financetime:i,analysis:{supstance:function(a,c){return b.scale.linear()},trendline:function(a,c){return b.scale.linear()}},plot:{time:function(a,b){return b=b||h.value(),i().domain(a.map(b.d))},atr:function(a,c){return c=c||h.value(),e(b,a,c,.04)},ichimoku:function(a,c){c=c||h.ichimoku();var d=g(a,function(b,d){var e=a[d+c.pks(b)],f=a[d-c.pks(b)];return[c.ts(b),c.ks(b),f?c.sa(f):null,f?c.sb(f):null,e?c.c(e):null]});return b.scale.linear().domain(b.extent(d).map(f(.02))).range([1,0])},percent:function(a,b){var c=a.domain();return b=b||c[0],a.copy().domain([c[0],c[c.length-1]].map(function(a){return(a-b)/b}))},ohlc:function(a,c){return c=c||h.ohlc(),b.scale.linear().domain([b.min(a.map(c.low())),b.max(a.map(c.high()))].map(f(.02))).range([1,0])},volume:function(a,c){return c=c||h.ohlc().v,b.scale.linear().domain([0,1.15*b.max(a.map(c))]).range([1,0])},atrtrailingstop:function(a,c){c=c||h.atrtrailingstop();var d=g(a,function(a){return[c.up(a),c.dn(a)]});return b.scale.linear().domain(b.extent(d).map(f(.04))).range([1,0])},rsi:function(){return b.scale.linear().domain([0,100]).range([1,0])},momentum:function(a,c){return c=c||h.value(),e(b,a,c,.04)},moneyflow:function(a,c){return c=c||h.value(),e(b,a,c,.04)},macd:function(a,c){return c=c||h.macd(),e(b,a,c,.04)},movingaverage:function(a,c){return c=c||h.value(),e(b,a,c)}},position:{}}}},{"../accessor":4,"../util":43,"./financetime":37,"./zoomable":39}],39:[function(a,b,c){"use strict";b.exports=function(){function a(b,c,d){var e={},f=!0;return e.invert=b.invert,e.domain=function(a){return arguments.length?(f?b.domain([Math.max(d[0],a[0]),Math.min(d[1],a[1])]):b.domain(a),c&&c(),e):b.domain()},e.range=function(a){if(!arguments.length)return b.range();throw"zoomable is a read only range. Use this scale for zooming only"},e.copy=function(){return a(b.copy(),c,d)},e.clamp=function(a){return arguments.length?(f=a,e):f},e}return a}},{}],40:[function(a,b,c){"use strict";b.exports=function(a){return function(){function b(a,b){var i=[],j=c(a,b),k=d(a,b),l=e(a,b),m=f(a,b),n=g(a,b),o=h(a,b),p="left"===n||"up"===n?1:-1,q=l/3,r=l/2,s=o?m/2:m;switch(i.push("M",j,k),n){case"up":case"down":i.push("l",-r,p*s,"l",q,0),o&&i.push("l",0,p*s),i.push("l",q,0),o&&i.push("l",0,-p*s),i.push("l",q,0);break;case"left":case"right":i.push("l",p*s,-r,"l",0,q),o&&i.push("l",p*s,0),i.push("l",0,q),o&&i.push("l",-p*s,0),i.push("l",0,q);break;default:throw"Unsupported arrow.orient() = "+g}return i.push("z"),i.join(" ")}var c=a(0),d=a(0),e=a(12),f=a(15),g=a("up"),h=a(!0);return b.x=function(d){return arguments.length?(c=a(d),b):c},b.y=function(c){return arguments.length?(d=a(c),b):d},b.height=function(c){return arguments.length?(f=a(c),b):f},b.width=function(c){return arguments.length?(e=a(c),b):e},b.orient=function(c){return arguments.length?(g=a(c),b):g},b.tail=function(c){return arguments.length?(h=a(c),b):h},b}}},{}],41:[function(a,b,c){"use strict";b.exports=function(b){return{arrow:a("./arrow")(b.functor)}}},{"./arrow":40}],42:[function(a,b,c){"use strict";var d;if("undefined"!=typeof window)d=window.d3;else{if("object"!=typeof b)throw"Unsupported runtime environment: Could not find d3. Ensure defined globally on window, or available as dependency.";d=a("d3")}b.exports=function(b){return{version:a("../build/version"),accessor:a("./accessor")(),indicator:a("./indicator")(),plot:a("./plot")(b),scale:a("./scale")(b),svg:a("./svg")(b)}}(d)},{"../build/version":1,"./accessor":4,"./indicator":16,"./plot":26,"./scale":38,"./svg":41,d3:"d3"}],43:[function(a,b,c){"use strict";function d(a,b,c){for(var d,f=2,g=arguments.length;++f