From 4bdb9ab4efab1fcb180a40eb0a4526fd630f521f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20Dumas?= Date: Wed, 10 Sep 2014 21:56:27 +1000 Subject: [PATCH] Release 0.2.0 --- dist/techan.js | 4 ++-- dist/techan.min.js | 4 ++-- dist/techan.min.js.map | 2 +- package.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dist/techan.js b/dist/techan.js index 34d16cd5..0c232ef4 100644 --- a/dist/techan.js +++ b/dist/techan.js @@ -1,9 +1,9 @@ /* - TechanJS v0.2.0-3 + TechanJS v0.2.0 (c) 2014 - 2014 Andre Dumas | https://github.com/andredumas/techan.js */ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.techan=e()}}(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);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;ob+1&&(d=null),{date:i.accessor.d(a),value:d}}var e,f,g,h,i={},j=10;return c.init=function(){return e=null,f=2/(j+1),g=0,h=0,c},c.average=function(a){return j>h?(g+=a)/++h:(h===j&&(e=g/h++),e+=f*(a-e))},c.period=function(a){return arguments.length?(j=a,c):j},a(c,i,b()),c}}},{}],10:[function(a,b){"use strict";b.exports=function(){var b=a("./indicatormixin")(),c=a("../accessor")(),d=a("./ema")(b,c.ohlc);return{ema:d,macd:a("./macd")(b,c.ohlc,d),rsi:a("./rsi")(b,c.ohlc,d),sma:a("./sma")(b,c.ohlc)}}},{"../accessor":2,"./ema":9,"./indicatormixin":11,"./macd":12,"./rsi":13,"./sma":14}],11:[function(a,b){"use strict";b.exports=function(){return function(a,b,c){function d(){return b.accessor=c,a}a.accessor=function(a){return arguments.length?(c=a,d()):c},d()}}},{}],12:[function(a,b){"use strict";function c(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,d){return function(){function e(a){var b=Math.max(g,h)-1,j=b+i-1,k=d().accessor(e.accessor()).period(i).init(),l=d().accessor(e.accessor()).period(g).init(),m=d().accessor(e.accessor()).period(h).init();return a.map(function(a,d){h=l.average(f.accessor(a)),g=m.average(f.accessor(a));var e=h-g,i=d>=b?k.average(e):null;return d>=j?c(f.accessor.d(a),e,i,e-i,0):c(f.accessor.d(a))}).filter(function(a){return a.macd})}var f={},g=12,h=26,i=9;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,b()),e}}},{}],13:[function(a,b){"use strict";function c(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,d){return function(){function e(a){var b=d().accessor(e.accessor()).period(g).init(),k=d().accessor(e.accessor()).period(g).init();return a.map(function(d,e){if(1>e)return c(f.accessor.d(d));var l=f.accessor(d)-f.accessor(a[e-1]),m=k.average(Math.max(l,0)),n=Math.abs(b.average(Math.min(l,0)));if(e>=g){var o=100-100/(1+m/n);return c(f.accessor.d(d),o,i,h,j)}return c(f.accessor.d(d))}).filter(function(a){return a.rsi})}var f={},g=14,h=70,i=50,j=30;return e.period=function(a){return arguments.length?(g=a,e):g},e.overbought=function(a){return arguments.length?(h=a,e):h},e.middle=function(a){return arguments.length?(i=a,e):i},e.oversold=function(a){return arguments.length?(j=a,e):j},a(e,f,b()),e}}},{}],14:[function(a,b){"use strict";b.exports=function(a,b){return function(){function c(a){return c.init(),a.map(d).filter(function(a){return a.value})}function d(a,b){var d=c.average(h.accessor(a));return i>b+1&&(d=null),{date:h.accessor.d(a),value:d}}var e,f,g,h={},i=10;return c.init=function(){return g=0,e=[],f=0,c},c.average=function(a){return g+=a,e.length+1d?[d,e]:[e,d],b.filter(function(b){if(!b.value)return!1;var d=a(b.value);return d&&!isNaN(d)&&c[0]<=d&&d<=c[1]})}}function e(a,b,c){var d=b.scale();switch(b.orient()){case"left":case"right":a.attr({x:c*(Math.max(b.innerTickSize(),0)+b.tickPadding()),y:f(d),dy:".32em"}).style("text-anchor",0>c?"end":"start");break;case"top":case"bottom":a.attr({x:f(d),y:c*(Math.max(b.innerTickSize(),0)+b.tickPadding()),dy:0>c?"0em":".72em"}).style("text-anchor","middle")}}function f(a){return function(b){return a(b.value)}}function g(a){return function(b){return a(b.value)}}function h(a,b,c,d,e){return function(f){var g=a.scale(),h=g(f.value),i=d;switch(a.orient()){case"left":case"right":var j=0;return d>b/2?i=b/2:j=b/2-d,["M",0,h,"l",e*a.innerTickSize(),-i,"l",0,-j,"l",e*c,0,"l",0,b,"l",e*-c,0,"l",0,-j].join(" ");case"top":case"bottom":var k=0;return d>c/2?i=c/2:k=c/2-d,["M",h,0,"l",-i,e*a.innerTickSize(),"l",-k,0,"l",0,e*b,"l",c,0,"l",0,e*-b,"l",-k,0].join(" ");default:throw"Unsupported axis.orient() = "+a.orient()}}}b.exports=function(a,b){return function(){function d(a){a.selectAll("g.translate").data(b.dataMapper.array).enter().append("g").attr("class","translate"),d.refresh(a)}var e,f=a(),g=4,h=14,i=50,j=[0,0];return d.refresh=function(a){var d=e?e:f.tickFormat()?f.tickFormat():f.scale().tickFormat();c(a,b,f,d,h,i,g,j)},d.axis=function(a){return arguments.length?(f=a,d):f},d.format=function(a){return arguments.length?(e=a,d):e},d.height=function(a){return arguments.length?(h=a,d):h},d.width=function(a){return arguments.length?(i=a,d):i},d.translate=function(a){return arguments.length?(j=a,d):j},d}}},{}],16:[function(a,b){"use strict";function c(a,b,c,f,g){a.selectAll("path.candle.body").attr("d",d(c,f,g)).classed(b.classedUpDown(c)),a.selectAll("path.candle.wick").attr("d",e(c,f,g)).classed(b.classedUpDown(c))}function d(a,b,c){return function(d){var e=[],f=c(a.o(d)),g=c(a.c(d)),h=b.band(),i=b(a.d(d))-h/2;return e.push("M",i,f,"l",h,0),f!=g&&e.push("L",i+h,g,"l",-h,0,"L",i,f),e.join(" ")}}function e(a,b,c){return function(d){var e=[],f=c(a.o(d)),g=c(a.c(d)),h=b.band(),i=b(a.d(d)),j=i-h/2;return e.push("M",i,c(a.h(d)),"L",i,Math.min(f,g)),f==g&&e.push("M",j,f,"l",h,0),e.push("M",i,Math.max(f,g),"L",i,c(a.l(d))),e.join(" ")}}function f(a,b,c,d){var e=a.selectAll("g.data"),f=b().domain(c(e.data().map(d).filter(function(a){return!isNaN(a)}))).range([.2,1]);e.selectAll("path.candle").style("opacity",function(a){var b=d(a);return isNaN(b)?null:f(b)})}b.exports=function(a,b,d,e,g){return function(){function h(a){var b=e.groupSelect(a,e.dataMapper.unity,i.accessor.d);b.entry.append("path").attr("class","candle body"),b.entry.append("path").attr("class","candle wick"),h.refresh(a)}var i={},j=!1;return h.refresh=function(d){j&&f(d,a,b,i.accessor.v),c(d,e,i.accessor,i.xScale,i.yScale)},h.volumeOpacity=function(a){return arguments.length?(j=a,h):j},g(h,i,d()),h}}},{}],17:[function(a,b){"use strict";function c(a,b){return function(){a.selectAll("g.data").style("display",b)}}function d(a,b,c,d,f,g,i){return function(){var j=c(this),k=d[0].axis().scale(),l=f[0].axis().scale();e(b,d,f,a.select("path.vertical").datum(k.invert(j[0])),a.select("path.horizontal").datum(l.invert(j[1])),a.selectAll("g.axisannotation.x > g").each(h(d,j[0])),a.selectAll("g.axisannotation.y > g").each(h(f,j[1])),g,i)}}function e(a,b,c,d,e,h,i,k,l){var m=b[0].axis().scale(),n=c[0].axis().scale();d.attr("d",g(m,k||n.range())),e.attr("d",f(n,l||m.range())),h.each(j(a,b)),i.each(j(a,c))}function f(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 g(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(" ")}}function h(a,b){return function(c,d){c[0].value=a[d].axis().scale().invert(b)}}function i(a,b,c,d,e){b.append("g").attr("class",d.join(" "));var f=a.select("g."+d.join(".")).selectAll("g").data(e.map(function(){return[{value:null}]}));f.exit().remove(),f.enter().append("g").attr("class",function(a,b){return b}).each(function(a,b){e[b](c(this))})}function j(a,b){return function(c,d){b[d].refresh(a(this))}}b.exports=function(a,b,f,g){return function(){function b(d){var e=d.selectAll("g.data").data([0]),f=e.enter().append("g").attr("class","data").call(c,"none");f.append("path").attr("class","horizontal wire"),f.append("path").attr("class","vertical wire"),i(e,f,a,["axisannotation","x"],k),i(e,f,a,["axisannotation","y"],l),d.selectAll("rect").data([0]).enter().append("rect").style({fill:"none","pointer-events":"all"}),b.refresh(d)}var h,j,k=[g()],l=[g()];return b.refresh=function(b){var g=k[0].axis().scale().range(),i=l[0].axis().scale().range(),m=b.selectAll("g.data"),n=b.selectAll("rect");n.attr({x:Math.min(g[0],g[g.length-1]),y:Math.min(i[0],i[i.length-1]),height:Math.abs(i[i.length-1]-i[0]),width:Math.abs(g[g.length-1]-g[0])}).on("mouseenter",c(b,"inline")).on("mouseout",c(b,"none")).on("mousemove",d(m,a,f,k,l,h,j)),e(a,k,l,b.select("path.vertical"),b.select("path.horizontal"),b.selectAll("g.axisannotation.x > g"),b.selectAll("g.axisannotation.y > g"),h,j)},b.xAnnotation=function(a){return arguments.length?(k=a instanceof Array?a:[a],b):k},b.yAnnotation=function(a){return arguments.length?(l=a instanceof Array?a:[a],b):l},b.verticalWireRange=function(a){return arguments.length?(h=a,b):h},b.horizontalWireRange=function(a){return arguments.length?(j=a,b):j},b}}},{}],18:[function(a,b){"use strict";function c(){return d3.event}b.exports=function(b){var d=a("../scale")(b),e=a("../accessor")(),f=a("./plot")(b),g=a("./plotmixin")(b.scale.linear,d.financetime),h=a("./line"),i=a("./axisannotation")(b.svg.axis,f);return{axisannotation:i,candlestick:a("./candlestick")(b.scale.linear,b.extent,e.ohlc,f,g),crosshair:a("./crosshair")(b.select,c,b.mouse,i),ema:h(e.value,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,c,b.select,e.value,f,g),trendline:a("./trendline")(b.behavior.drag,c,b.select,e.trendline,f,g)}}},{"../accessor":2,"../scale":29,"./axisannotation":15,"./candlestick":16,"./crosshair":17,"./line":19,"./macd":20,"./ohlc":21,"./plot":22,"./plotmixin":23,"./rsi":24,"./supstance":25,"./trendline":26,"./volume":27}],19:[function(a,b){"use strict";function c(a,b,c,d,e,f){a.selectAll("path.line").attr("d",e.pathLine(b.d,c,b,d)),f&&a.selectAll("path.zero").attr("d",e.horizontalPathLine(c,b.z,d))}b.exports=function(a,b,d,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)}var g={};return f.refresh=function(a){c(a,g.accessor,g.xScale,g.yScale,b,e)},d(f,g,a()),f}}},{}],20:[function(a,b){"use strict";function c(a,b,c,e,f){a.selectAll("path.difference").attr("d",d(b,c,e)),a.selectAll("path.zero").attr("d",f.horizontalPathLine(b.d,c,b.z,e)),a.selectAll("path.macd").attr("d",f.pathLine(b.d,c,b.m,e)),a.selectAll("path.signal").attr("d",f.pathLine(b.d,c,b.s,e))}function d(a,b,c){return function(d){var e=c(0),f=c(a.dif(d))-e,g=b.band(),h=b(a.d(d))-g/2;return["M",h,e,"l",0,f,"l",g,0,"l",0,-f].join(" ")}}b.exports=function(a,b,d){return function(){function e(a){var c=b.groupSelect(a,b.dataMapper.array,f.accessor.d),d=c.selection.append("g").attr("class","difference").selectAll("g.difference").data(function(a){return a});d.exit().remove(),d.enter().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"),e.refresh(a)}var f={};return e.refresh=function(a){c(a,f.accessor,f.xScale,f.yScale,b)},d(e,f,a()),e}}},{}],21:[function(a,b){"use strict";function c(a,b,c,e,f){a.selectAll("path.ohlc").attr({d:d(c,e,f)}).classed(b.classedUpDown(c))}function d(a,b,c){return function(d){var e=c(a.o(d)),f=c(a.c(d)),g=b.band(),h=b(a.d(d)),i=h-g/2;return["M",i,e,"l",g/2,0,"M",h,c(a.h(d)),"L",h,c(a.l(d)),"M",h,f,"l",g/2,0].join(" ")}}b.exports=function(a,b,d,e,f){return function(){function a(c){e.groupSelect(c,e.dataMapper.unity,b.accessor.d).entry.append("path").attr({"class":"ohlc"}),a.refresh(c)}var b={};return a.refresh=function(a){c(a,e,b.accessor,b.xScale,b.yScale)},f(a,b,d()),a}}},{}],22:[function(a,b){"use strict";b.exports=function(a){function b(a,b,c){var d=a.selectAll("g.data").data(b,c);return d.exit().remove(),d}function c(a){return a.enter().append("g").attr("class","data")}return{dataMapper:{unity:function(a){return a},array:function(a){return[a]}},dataSelection:b,dataEntry:c,groupSelect:function(a,d,e){var f=b(a,d,e),g=c(f);return{selection:f,entry:g}},classedUpDown:function(a){return{up:function(b){return a.o(b)a.c(b)}}},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:function(b,c,d,e){return a.svg.line().interpolate("monotone").x(function(a){return c(b(a))}).y(function(a){return e(d(a))})}}}},{}],23:[function(a,b){"use strict";b.exports=function(a,b){function c(c,d,e){function f(){return d.xScale=g,d.yScale=h,d.accessor=e,c}var g=b(),h=a();c.accessor=function(a){return arguments.length?(e=a,f()):e},c.xScale=function(a){return arguments.length?(g=a,f()):g},c.yScale=function(a){return arguments.length?(h=a,f()):h},f()}return c}},{}],24:[function(a,b){"use strict";function c(a,b,c,d,e){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",e.pathLine(b.d,c,b.r,d))}b.exports=function(a,b,d){return function(){function e(a){var c=b.groupSelect(a,b.dataMapper.array,f.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)}var f={};return e.refresh=function(a){c(a,f.accessor,f.xScale,f.yScale,b)},d(e,f,a()),e}}},{}],25:[function(a,b){"use strict";function c(a,b,c,e){a.selectAll("path.supstance").attr("d",d(b,c,e)),a.selectAll(".interaction path").attr("d",d(b,c,e))}function d(a,b,c){return function(d){var e=[],f=b.range();return e.push("M",f[0],c(a.v(d))),e.push("L",f[f.length-1],c(a.v(d))),e.join(" ")}}function e(a,b,d,e,f,g){return a().origin(function(a){return{x:0,y:g(e.v(a))}}).on("drag",function(a){e.v(a,g.invert(b().y)),c(d(this.parentNode.parentNode),e,f,g)})}b.exports=function(a,b,d,f,g,h){return function(){function i(a){var b=g.groupSelect(a,g.dataMapper.unity);b.entry.append("path").attr("class","supstance"),b.entry.append("g").attr("class","interaction").style({opacity:0,fill:"none"}).append("path").style("stroke-width",16),i.refresh(a)}var j={};return i.refresh=function(a){c(a,j.accessor,j.xScale,j.yScale)},i.drag=function(c){c.selectAll(".interaction path").call(e(a,b,d,j.accessor,j.xScale,j.yScale))},h(i,j,f()),i}}},{}],26:[function(a,b){"use strict";function c(a,b,c,f){a.selectAll("path.trendline").attr("d",d(b,c,f)),a.selectAll(".interaction path.body").attr("d",d(b,c,f)),a.selectAll(".interaction circle.start").attr(e(b.sd,c,b.sv,f)),a.selectAll(".interaction circle.end").attr(e(b.ed,c,b.ev,f))}function d(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 e(a,b,c,d){return{cx:function(c){return b(a(c))},cy:function(a){return d(c(a))}}}function f(a,b,d,e,f,g,i,j){return a().origin(function(a){return{x:g(f(a)),y:j(i(a))}}).on("drag",function(a){h(f,g,b().x,i,j,b().y,a),c(d(this.parentNode.parentNode),e,g,j)})}function g(a,b,d,e,f,g){var i={};return a().origin(function(a){return i.start={date:f(e.sd(a)),value:g(e.sv(a))},i.end={date:f(e.ed(a)),value:g(e.ev(a))},{x:0,y:0}}).on("drag",function(a){h(e.sd,f,b().x+i.start.date,e.sv,g,b().y+i.start.value,a),h(e.ed,f,b().x+i.end.date,e.ev,g,b().y+i.end.value,a),c(d(this.parentNode.parentNode),e,f,g)})}function h(a,b,c,d,e,f,g){var h=b.invert(c);h&&a(g,h),d(g,e.invert(f))}b.exports=function(a,b,d,e,h,i){return function(){function j(a){var b=h.groupSelect(a,h.dataMapper.unity);b.entry.append("path").attr("class","trendline");var c=b.entry.append("g").attr("class","interaction").style({opacity:0,fill:"none"});c.append("path").attr("class","body").style("stroke-width",16),c.append("circle").attr({"class":"start",r:8}),c.append("circle").attr({"class":"end",r:8}),j.refresh(a)}var k={};return j.refresh=function(a){c(a,k.accessor,k.xScale,k.yScale)},j.drag=function(c){c.selectAll(".interaction circle.start").call(f(a,b,d,k.accessor,k.accessor.sd,k.xScale,k.accessor.sv,k.yScale)),c.selectAll(".interaction circle.end").call(f(a,b,d,k.accessor,k.accessor.ed,k.xScale,k.accessor.ev,k.yScale)),c.selectAll(".interaction path.body").call(g(a,b,d,k.accessor,k.xScale,k.yScale))},i(j,k,e()),j}}},{}],27:[function(a,b){"use strict";function c(a,b,c,e){a.selectAll("path.volume").attr("d",d(b,c,e))}function d(a,b,c){return function(d){var e=a.v(d);if(isNaN(e))return null;var f=c(0),g=c(e)-f,h=b.band(),i=b(a.d(d))-h/2;return["M",i,f,"l",0,g,"l",h,0,"l",0,-g].join(" ")}}b.exports=function(a,b,d){return function(){function e(a){var c=b.groupSelect(a,b.dataMapper.unity,f.accessor.d).entry.append("path").attr("class","volume");f.accessor.o&&f.accessor.c&&c.classed(b.classedUpDown(f.accessor)),e.refresh(a)}var f={};return e.refresh=function(a){c(a,f.accessor,f.xScale,f.yScale)},d(e,f,a()),e}}},{}],28:[function(a,b){"use strict";b.exports=function(a,b,c,d,e,f){function g(b,m){function n(a){var d=r[+a];return void 0===d&&(d=m[0]>a?-1:c(m,a)),b(d)}function o(){return t=h(b,m),n}function q(){r=j(m)}var r,s={tickFormat:p[p.length-1][2]},t=3;return b=b||a(),m=m||[new Date(0),new Date(1)],n.invert=function(a){var b=n.invertToIndex(a);return null===b?null:m[b]},n.invertToIndex=function(a){var c=Math.round(b.invert(a));return m[c]?Math.abs(c):null},n.domain=function(a){if(!arguments.length){var c=b.domain();return c=[Math.ceil(c[0]),Math.floor(c[c.length-1])],m.slice(c[0],c[c.length-1]+1)}return m=a,q(),b.domain([0,m.length-1]),o(),b.domain(b.range().map(e(.65,t)).map(b.invert)),o()},n.copy=function(){return g(b.copy(),m)},n.band=function(){return t},n.zoomable=function(){return f(b,o)},n.ticks=function(a,b){var c=n.domain();if(!c.length)return[];var d=void 0===a?i(c,10):"number"==typeof a?i(c,a):null;s.tickFormat=d?d[2]:i(c,10)[2],d&&(a=d[0],b=d[1]);var e=a.range(c[0],+c[c.length-1]+1,b);return e.map(k(c)).reduce(l,[])},n.tickFormat=function(){return function(a){return s.tickFormat(a)}},d(n,b,o,"range","interpolate","clamp","nice"),q(),o()}function h(a,b){return Math.abs(a(b.length-1)-a(0))/Math.max(1,b.length-1)*.8}function i(a,b){var d=p,e=o,f=(a[a.length-1]-a[0])/b,g=c(e,f);return g?d[f/e[g-1]0?a.extent(b,c).map(e(d)):null}function d(a,b,d,e){return a.scale.linear().domain(c(a,b,d,e)).range([1,0])}function e(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}}b.exports=function(b){var c=a("./zoomable")(),f=a("../util")(),g=a("../accessor")(),h=a("./financetime")(b.scale.linear,b.time,b.bisect,f.rebindCallback,e,c);return{financetime:h,analysis:{supstance:function(){return b.scale.linear()},trendline:function(){return b.scale.linear()}},plot:{time:function(a,b){return b=b||g.value(),h().domain(a.map(b.d))},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||g.ohlc(),b.scale.linear().domain([b.min(a.map(c.low())),b.max(a.map(c.high()))].map(e(.02))).range([1,0])},volume:function(a,c){return c=c||g.ohlc().v,b.scale.linear().domain([0,1.15*b.max(a.map(c))]).range([1,0])},rsi:function(){return b.scale.linear().domain([0,100]).range([1,0])},momentum:function(a,c){return c=c||g.value(),d(b,a,c,.04)},moneyflow:function(a,c){return c=c||g.value(),d(b,a,c,.04)},macd:function(a,c){return c=c||g.macd(),d(b,a,c,.04)},movingaverage:function(a,c){return c=c||g.value(),d(b,a,c)}},position:{}}}},{"../accessor":2,"../util":32,"./financetime":28,"./zoomable":30}],30:[function(a,b){"use strict";b.exports=function(){function a(b,c){var d={},e=b.domain();return d.invert=b.invert,d.domain=function(a){if(!arguments.length)throw"zoomable is a write only domain. Use this scale for zooming only";return b.domain([Math.max(e[0],a[0]),Math.min(e[1],a[1])]),c&&c(),d},d.range=function(){if(!arguments.length)return b.range();throw"zoomable is a read only range. Use this scale for zooming only"},d.copy=function(){return a(b.copy(),c)},d}return a}},{}],31:[function(a,b){"use strict";b.exports=function(b){return{version:a("../build/version"),accessor:a("./accessor")(),indicator:a("./indicator")(),plot:a("./plot")(b),scale:a("./scale")(b)}}(d3)},{"../build/version":1,"./accessor":2,"./indicator":10,"./plot":18,"./scale":29}],32:[function(a,b){"use strict";function c(a,b,c){for(var e,f=2,g=arguments.length;++fb+1&&(d=null),{date:i.accessor.d(a),value:d}}var e,f,g,h,i={},j=10;return c.init=function(){return e=null,f=2/(j+1),g=0,h=0,c},c.average=function(a){return j>h?(g+=a)/++h:(h===j&&(e=g/h++),e+=f*(a-e))},c.period=function(a){return arguments.length?(j=a,c):j},a(c,i,b()),c}}},{}],10:[function(a,b){"use strict";b.exports=function(){var b=a("./indicatormixin")(),c=a("../accessor")(),d=a("./ema")(b,c.ohlc);return{ema:d,macd:a("./macd")(b,c.ohlc,d),rsi:a("./rsi")(b,c.ohlc,d),sma:a("./sma")(b,c.ohlc)}}},{"../accessor":2,"./ema":9,"./indicatormixin":11,"./macd":12,"./rsi":13,"./sma":14}],11:[function(a,b){"use strict";b.exports=function(){return function(a,b,c){function d(){return b.accessor=c,a}a.accessor=function(a){return arguments.length?(c=a,d()):c},d()}}},{}],12:[function(a,b){"use strict";function c(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,d){return function(){function e(a){var b=Math.max(g,h)-1,j=b+i-1,k=d().accessor(e.accessor()).period(i).init(),l=d().accessor(e.accessor()).period(g).init(),m=d().accessor(e.accessor()).period(h).init();return a.map(function(a,d){h=l.average(f.accessor(a)),g=m.average(f.accessor(a));var e=h-g,i=d>=b?k.average(e):null;return d>=j?c(f.accessor.d(a),e,i,e-i,0):c(f.accessor.d(a))}).filter(function(a){return a.macd})}var f={},g=12,h=26,i=9;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,b()),e}}},{}],13:[function(a,b){"use strict";function c(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,d){return function(){function e(a){var b=d().accessor(e.accessor()).period(g).init(),k=d().accessor(e.accessor()).period(g).init();return a.map(function(d,e){if(1>e)return c(f.accessor.d(d));var l=f.accessor(d)-f.accessor(a[e-1]),m=k.average(Math.max(l,0)),n=Math.abs(b.average(Math.min(l,0)));if(e>=g){var o=100-100/(1+m/n);return c(f.accessor.d(d),o,i,h,j)}return c(f.accessor.d(d))}).filter(function(a){return a.rsi})}var f={},g=14,h=70,i=50,j=30;return e.period=function(a){return arguments.length?(g=a,e):g},e.overbought=function(a){return arguments.length?(h=a,e):h},e.middle=function(a){return arguments.length?(i=a,e):i},e.oversold=function(a){return arguments.length?(j=a,e):j},a(e,f,b()),e}}},{}],14:[function(a,b){"use strict";b.exports=function(a,b){return function(){function c(a){return c.init(),a.map(d).filter(function(a){return a.value})}function d(a,b){var d=c.average(h.accessor(a));return i>b+1&&(d=null),{date:h.accessor.d(a),value:d}}var e,f,g,h={},i=10;return c.init=function(){return g=0,e=[],f=0,c},c.average=function(a){return g+=a,e.length+1d?[d,e]:[e,d],b.filter(function(b){if(!b.value)return!1;var d=a(b.value);return d&&!isNaN(d)&&c[0]<=d&&d<=c[1]})}}function e(a,b,c){var d=b.scale();switch(b.orient()){case"left":case"right":a.attr({x:c*(Math.max(b.innerTickSize(),0)+b.tickPadding()),y:f(d),dy:".32em"}).style("text-anchor",0>c?"end":"start");break;case"top":case"bottom":a.attr({x:f(d),y:c*(Math.max(b.innerTickSize(),0)+b.tickPadding()),dy:0>c?"0em":".72em"}).style("text-anchor","middle")}}function f(a){return function(b){return a(b.value)}}function g(a){return function(b){return a(b.value)}}function h(a,b,c,d,e){return function(f){var g=a.scale(),h=g(f.value),i=d;switch(a.orient()){case"left":case"right":var j=0;return d>b/2?i=b/2:j=b/2-d,["M",0,h,"l",e*a.innerTickSize(),-i,"l",0,-j,"l",e*c,0,"l",0,b,"l",e*-c,0,"l",0,-j].join(" ");case"top":case"bottom":var k=0;return d>c/2?i=c/2:k=c/2-d,["M",h,0,"l",-i,e*a.innerTickSize(),"l",-k,0,"l",0,e*b,"l",c,0,"l",0,e*-b,"l",-k,0].join(" ");default:throw"Unsupported axis.orient() = "+a.orient()}}}b.exports=function(a,b){return function(){function d(a){a.selectAll("g.translate").data(b.dataMapper.array).enter().append("g").attr("class","translate"),d.refresh(a)}var e,f=a(),g=4,h=14,i=50,j=[0,0];return d.refresh=function(a){var d=e?e:f.tickFormat()?f.tickFormat():f.scale().tickFormat();c(a,b,f,d,h,i,g,j)},d.axis=function(a){return arguments.length?(f=a,d):f},d.format=function(a){return arguments.length?(e=a,d):e},d.height=function(a){return arguments.length?(h=a,d):h},d.width=function(a){return arguments.length?(i=a,d):i},d.translate=function(a){return arguments.length?(j=a,d):j},d}}},{}],16:[function(a,b){"use strict";function c(a,b,c,f,g){a.selectAll("path.candle.body").attr("d",d(c,f,g)).classed(b.classedUpDown(c)),a.selectAll("path.candle.wick").attr("d",e(c,f,g)).classed(b.classedUpDown(c))}function d(a,b,c){return function(d){var e=[],f=c(a.o(d)),g=c(a.c(d)),h=b.band(),i=b(a.d(d))-h/2;return e.push("M",i,f,"l",h,0),f!=g&&e.push("L",i+h,g,"l",-h,0,"L",i,f),e.join(" ")}}function e(a,b,c){return function(d){var e=[],f=c(a.o(d)),g=c(a.c(d)),h=b.band(),i=b(a.d(d)),j=i-h/2;return e.push("M",i,c(a.h(d)),"L",i,Math.min(f,g)),f==g&&e.push("M",j,f,"l",h,0),e.push("M",i,Math.max(f,g),"L",i,c(a.l(d))),e.join(" ")}}function f(a,b,c,d){var e=a.selectAll("g.data"),f=b().domain(c(e.data().map(d).filter(function(a){return!isNaN(a)}))).range([.2,1]);e.selectAll("path.candle").style("opacity",function(a){var b=d(a);return isNaN(b)?null:f(b)})}b.exports=function(a,b,d,e,g){return function(){function h(a){var b=e.groupSelect(a,e.dataMapper.unity,i.accessor.d);b.entry.append("path").attr("class","candle body"),b.entry.append("path").attr("class","candle wick"),h.refresh(a)}var i={},j=!1;return h.refresh=function(d){j&&f(d,a,b,i.accessor.v),c(d,e,i.accessor,i.xScale,i.yScale)},h.volumeOpacity=function(a){return arguments.length?(j=a,h):j},g(h,i,d()),h}}},{}],17:[function(a,b){"use strict";function c(a,b){return function(){a.selectAll("g.data").style("display",b)}}function d(a,b,c,d,f,g,i){return function(){var j=c(this),k=d[0].axis().scale(),l=f[0].axis().scale();e(b,d,f,a.select("path.vertical").datum(k.invert(j[0])),a.select("path.horizontal").datum(l.invert(j[1])),a.selectAll("g.axisannotation.x > g").each(h(d,j[0])),a.selectAll("g.axisannotation.y > g").each(h(f,j[1])),g,i)}}function e(a,b,c,d,e,h,i,k,l){var m=b[0].axis().scale(),n=c[0].axis().scale();d.attr("d",g(m,k||n.range())),e.attr("d",f(n,l||m.range())),h.each(j(a,b)),i.each(j(a,c))}function f(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 g(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(" ")}}function h(a,b){return function(c,d){c[0].value=a[d].axis().scale().invert(b)}}function i(a,b,c,d,e){b.append("g").attr("class",d.join(" "));var f=a.select("g."+d.join(".")).selectAll("g").data(e.map(function(){return[{value:null}]}));f.exit().remove(),f.enter().append("g").attr("class",function(a,b){return b}).each(function(a,b){e[b](c(this))})}function j(a,b){return function(c,d){b[d].refresh(a(this))}}b.exports=function(a,b,f,g){return function(){function b(d){var e=d.selectAll("g.data").data([0]),f=e.enter().append("g").attr("class","data").call(c,"none");f.append("path").attr("class","horizontal wire"),f.append("path").attr("class","vertical wire"),i(e,f,a,["axisannotation","x"],k),i(e,f,a,["axisannotation","y"],l),d.selectAll("rect").data([0]).enter().append("rect").style({fill:"none","pointer-events":"all"}),b.refresh(d)}var h,j,k=[g()],l=[g()];return b.refresh=function(b){var g=k[0].axis().scale().range(),i=l[0].axis().scale().range(),m=b.selectAll("g.data"),n=b.selectAll("rect");n.attr({x:Math.min(g[0],g[g.length-1]),y:Math.min(i[0],i[i.length-1]),height:Math.abs(i[i.length-1]-i[0]),width:Math.abs(g[g.length-1]-g[0])}).on("mouseenter",c(b,"inline")).on("mouseout",c(b,"none")).on("mousemove",d(m,a,f,k,l,h,j)),e(a,k,l,b.select("path.vertical"),b.select("path.horizontal"),b.selectAll("g.axisannotation.x > g"),b.selectAll("g.axisannotation.y > g"),h,j)},b.xAnnotation=function(a){return arguments.length?(k=a instanceof Array?a:[a],b):k},b.yAnnotation=function(a){return arguments.length?(l=a instanceof Array?a:[a],b):l},b.verticalWireRange=function(a){return arguments.length?(h=a,b):h},b.horizontalWireRange=function(a){return arguments.length?(j=a,b):j},b}}},{}],18:[function(a,b){"use strict";function c(){return d3.event}b.exports=function(b){var d=a("../scale")(b),e=a("../accessor")(),f=a("./plot")(b),g=a("./plotmixin")(b.scale.linear,d.financetime),h=a("./line"),i=a("./axisannotation")(b.svg.axis,f);return{axisannotation:i,candlestick:a("./candlestick")(b.scale.linear,b.extent,e.ohlc,f,g),crosshair:a("./crosshair")(b.select,c,b.mouse,i),ema:h(e.value,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,c,b.select,e.value,f,g),trendline:a("./trendline")(b.behavior.drag,c,b.select,e.trendline,f,g)}}},{"../accessor":2,"../scale":29,"./axisannotation":15,"./candlestick":16,"./crosshair":17,"./line":19,"./macd":20,"./ohlc":21,"./plot":22,"./plotmixin":23,"./rsi":24,"./supstance":25,"./trendline":26,"./volume":27}],19:[function(a,b){"use strict";function c(a,b,c,d,e,f){a.selectAll("path.line").attr("d",e.pathLine(b.d,c,b,d)),f&&a.selectAll("path.zero").attr("d",e.horizontalPathLine(c,b.z,d))}b.exports=function(a,b,d,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)}var g={};return f.refresh=function(a){c(a,g.accessor,g.xScale,g.yScale,b,e)},d(f,g,a()),f}}},{}],20:[function(a,b){"use strict";function c(a,b,c,e,f){a.selectAll("path.difference").attr("d",d(b,c,e)),a.selectAll("path.zero").attr("d",f.horizontalPathLine(b.d,c,b.z,e)),a.selectAll("path.macd").attr("d",f.pathLine(b.d,c,b.m,e)),a.selectAll("path.signal").attr("d",f.pathLine(b.d,c,b.s,e))}function d(a,b,c){return function(d){var e=c(0),f=c(a.dif(d))-e,g=b.band(),h=b(a.d(d))-g/2;return["M",h,e,"l",0,f,"l",g,0,"l",0,-f].join(" ")}}b.exports=function(a,b,d){return function(){function e(a){var c=b.groupSelect(a,b.dataMapper.array,f.accessor.d),d=c.selection.append("g").attr("class","difference").selectAll("g.difference").data(function(a){return a});d.exit().remove(),d.enter().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"),e.refresh(a)}var f={};return e.refresh=function(a){c(a,f.accessor,f.xScale,f.yScale,b)},d(e,f,a()),e}}},{}],21:[function(a,b){"use strict";function c(a,b,c,e,f){a.selectAll("path.ohlc").attr({d:d(c,e,f)}).classed(b.classedUpDown(c))}function d(a,b,c){return function(d){var e=c(a.o(d)),f=c(a.c(d)),g=b.band(),h=b(a.d(d)),i=h-g/2;return["M",i,e,"l",g/2,0,"M",h,c(a.h(d)),"L",h,c(a.l(d)),"M",h,f,"l",g/2,0].join(" ")}}b.exports=function(a,b,d,e,f){return function(){function a(c){e.groupSelect(c,e.dataMapper.unity,b.accessor.d).entry.append("path").attr({"class":"ohlc"}),a.refresh(c)}var b={};return a.refresh=function(a){c(a,e,b.accessor,b.xScale,b.yScale)},f(a,b,d()),a}}},{}],22:[function(a,b){"use strict";b.exports=function(a){function b(a,b,c){var d=a.selectAll("g.data").data(b,c);return d.exit().remove(),d}function c(a){return a.enter().append("g").attr("class","data")}return{dataMapper:{unity:function(a){return a},array:function(a){return[a]}},dataSelection:b,dataEntry:c,groupSelect:function(a,d,e){var f=b(a,d,e),g=c(f);return{selection:f,entry:g}},classedUpDown:function(a){return{up:function(b){return a.o(b)a.c(b)}}},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:function(b,c,d,e){return a.svg.line().interpolate("monotone").x(function(a){return c(b(a))}).y(function(a){return e(d(a))})}}}},{}],23:[function(a,b){"use strict";b.exports=function(a,b){function c(c,d,e){function f(){return d.xScale=g,d.yScale=h,d.accessor=e,c}var g=b(),h=a();c.accessor=function(a){return arguments.length?(e=a,f()):e},c.xScale=function(a){return arguments.length?(g=a,f()):g},c.yScale=function(a){return arguments.length?(h=a,f()):h},f()}return c}},{}],24:[function(a,b){"use strict";function c(a,b,c,d,e){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",e.pathLine(b.d,c,b.r,d))}b.exports=function(a,b,d){return function(){function e(a){var c=b.groupSelect(a,b.dataMapper.array,f.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)}var f={};return e.refresh=function(a){c(a,f.accessor,f.xScale,f.yScale,b)},d(e,f,a()),e}}},{}],25:[function(a,b){"use strict";function c(a,b,c,e){a.selectAll("path.supstance").attr("d",d(b,c,e)),a.selectAll(".interaction path").attr("d",d(b,c,e))}function d(a,b,c){return function(d){var e=[],f=b.range();return e.push("M",f[0],c(a.v(d))),e.push("L",f[f.length-1],c(a.v(d))),e.join(" ")}}function e(a,b,d,e,f,g){return a().origin(function(a){return{x:0,y:g(e.v(a))}}).on("drag",function(a){e.v(a,g.invert(b().y)),c(d(this.parentNode.parentNode),e,f,g)})}b.exports=function(a,b,d,f,g,h){return function(){function i(a){var b=g.groupSelect(a,g.dataMapper.unity);b.entry.append("path").attr("class","supstance"),b.entry.append("g").attr("class","interaction").style({opacity:0,fill:"none"}).append("path").style("stroke-width",16),i.refresh(a)}var j={};return i.refresh=function(a){c(a,j.accessor,j.xScale,j.yScale)},i.drag=function(c){c.selectAll(".interaction path").call(e(a,b,d,j.accessor,j.xScale,j.yScale))},h(i,j,f()),i}}},{}],26:[function(a,b){"use strict";function c(a,b,c,f){a.selectAll("path.trendline").attr("d",d(b,c,f)),a.selectAll(".interaction path.body").attr("d",d(b,c,f)),a.selectAll(".interaction circle.start").attr(e(b.sd,c,b.sv,f)),a.selectAll(".interaction circle.end").attr(e(b.ed,c,b.ev,f))}function d(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 e(a,b,c,d){return{cx:function(c){return b(a(c))},cy:function(a){return d(c(a))}}}function f(a,b,d,e,f,g,i,j){return a().origin(function(a){return{x:g(f(a)),y:j(i(a))}}).on("drag",function(a){h(f,g,b().x,i,j,b().y,a),c(d(this.parentNode.parentNode),e,g,j)})}function g(a,b,d,e,f,g){var i={};return a().origin(function(a){return i.start={date:f(e.sd(a)),value:g(e.sv(a))},i.end={date:f(e.ed(a)),value:g(e.ev(a))},{x:0,y:0}}).on("drag",function(a){h(e.sd,f,b().x+i.start.date,e.sv,g,b().y+i.start.value,a),h(e.ed,f,b().x+i.end.date,e.ev,g,b().y+i.end.value,a),c(d(this.parentNode.parentNode),e,f,g)})}function h(a,b,c,d,e,f,g){var h=b.invert(c);h&&a(g,h),d(g,e.invert(f))}b.exports=function(a,b,d,e,h,i){return function(){function j(a){var b=h.groupSelect(a,h.dataMapper.unity);b.entry.append("path").attr("class","trendline");var c=b.entry.append("g").attr("class","interaction").style({opacity:0,fill:"none"});c.append("path").attr("class","body").style("stroke-width",16),c.append("circle").attr({"class":"start",r:8}),c.append("circle").attr({"class":"end",r:8}),j.refresh(a)}var k={};return j.refresh=function(a){c(a,k.accessor,k.xScale,k.yScale)},j.drag=function(c){c.selectAll(".interaction circle.start").call(f(a,b,d,k.accessor,k.accessor.sd,k.xScale,k.accessor.sv,k.yScale)),c.selectAll(".interaction circle.end").call(f(a,b,d,k.accessor,k.accessor.ed,k.xScale,k.accessor.ev,k.yScale)),c.selectAll(".interaction path.body").call(g(a,b,d,k.accessor,k.xScale,k.yScale))},i(j,k,e()),j}}},{}],27:[function(a,b){"use strict";function c(a,b,c,e){a.selectAll("path.volume").attr("d",d(b,c,e))}function d(a,b,c){return function(d){var e=a.v(d);if(isNaN(e))return null;var f=c(0),g=c(e)-f,h=b.band(),i=b(a.d(d))-h/2;return["M",i,f,"l",0,g,"l",h,0,"l",0,-g].join(" ")}}b.exports=function(a,b,d){return function(){function e(a){var c=b.groupSelect(a,b.dataMapper.unity,f.accessor.d).entry.append("path").attr("class","volume");f.accessor.o&&f.accessor.c&&c.classed(b.classedUpDown(f.accessor)),e.refresh(a)}var f={};return e.refresh=function(a){c(a,f.accessor,f.xScale,f.yScale)},d(e,f,a()),e}}},{}],28:[function(a,b){"use strict";b.exports=function(a,b,c,d,e,f){function g(b,m){function n(a){var d=r[+a];return void 0===d&&(d=m[0]>a?-1:c(m,a)),b(d)}function o(){return t=h(b,m),n}function q(){r=j(m)}var r,s={tickFormat:p[p.length-1][2]},t=3;return b=b||a(),m=m||[new Date(0),new Date(1)],n.invert=function(a){var b=n.invertToIndex(a);return null===b?null:m[b]},n.invertToIndex=function(a){var c=Math.round(b.invert(a));return m[c]?Math.abs(c):null},n.domain=function(a){if(!arguments.length){var c=b.domain();return c=[Math.ceil(c[0]),Math.floor(c[c.length-1])],m.slice(c[0],c[c.length-1]+1)}return m=a,q(),b.domain([0,m.length-1]),o(),b.domain(b.range().map(e(.65,t)).map(b.invert)),o()},n.copy=function(){return g(b.copy(),m)},n.band=function(){return t},n.zoomable=function(){return f(b,o)},n.ticks=function(a,b){var c=n.domain();if(!c.length)return[];var d=void 0===a?i(c,10):"number"==typeof a?i(c,a):null;s.tickFormat=d?d[2]:i(c,10)[2],d&&(a=d[0],b=d[1]);var e=a.range(c[0],+c[c.length-1]+1,b);return e.map(k(c)).reduce(l,[])},n.tickFormat=function(){return function(a){return s.tickFormat(a)}},d(n,b,o,"range","interpolate","clamp","nice"),q(),o()}function h(a,b){return Math.abs(a(b.length-1)-a(0))/Math.max(1,b.length-1)*.8}function i(a,b){var d=p,e=o,f=(a[a.length-1]-a[0])/b,g=c(e,f);return g?d[f/e[g-1]0?a.extent(b,c).map(e(d)):null}function d(a,b,d,e){return a.scale.linear().domain(c(a,b,d,e)).range([1,0])}function e(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}}b.exports=function(b){var c=a("./zoomable")(),f=a("../util")(),g=a("../accessor")(),h=a("./financetime")(b.scale.linear,b.time,b.bisect,f.rebindCallback,e,c);return{financetime:h,analysis:{supstance:function(){return b.scale.linear()},trendline:function(){return b.scale.linear()}},plot:{time:function(a,b){return b=b||g.value(),h().domain(a.map(b.d))},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||g.ohlc(),b.scale.linear().domain([b.min(a.map(c.low())),b.max(a.map(c.high()))].map(e(.02))).range([1,0])},volume:function(a,c){return c=c||g.ohlc().v,b.scale.linear().domain([0,1.15*b.max(a.map(c))]).range([1,0])},rsi:function(){return b.scale.linear().domain([0,100]).range([1,0])},momentum:function(a,c){return c=c||g.value(),d(b,a,c,.04)},moneyflow:function(a,c){return c=c||g.value(),d(b,a,c,.04)},macd:function(a,c){return c=c||g.macd(),d(b,a,c,.04)},movingaverage:function(a,c){return c=c||g.value(),d(b,a,c)}},position:{}}}},{"../accessor":2,"../util":32,"./financetime":28,"./zoomable":30}],30:[function(a,b){"use strict";b.exports=function(){function a(b,c){var d={},e=b.domain();return d.invert=b.invert,d.domain=function(a){if(!arguments.length)throw"zoomable is a write only domain. Use this scale for zooming only";return b.domain([Math.max(e[0],a[0]),Math.min(e[1],a[1])]),c&&c(),d},d.range=function(){if(!arguments.length)return b.range();throw"zoomable is a read only range. Use this scale for zooming only"},d.copy=function(){return a(b.copy(),c)},d}return a}},{}],31:[function(a,b){"use strict";b.exports=function(b){return{version:a("../build/version"),accessor:a("./accessor")(),indicator:a("./indicator")(),plot:a("./plot")(b),scale:a("./scale")(b)}}(d3)},{"../build/version":1,"./accessor":2,"./indicator":10,"./plot":18,"./scale":29}],32:[function(a,b){"use strict";function c(a,b,c){for(var e,f=2,g=arguments.length;++f