import { max } from "d3-array";
/**
    @module lineBuffer
    Adds a buffer to either side of the non-discrete axis.


    @param buffer Defaults to the radius of the largest Circle.
    @private
*/ export default function(param) {
    var _this = this;
    var data = param.data, x = param.x, y = param.y, x2 = param.x2, y2 = param.y2;
    var xKey = x2 ? "x2" : "x";
    var yKey = y2 ? "y2" : "y";
    var s = this._discrete === "x" ? y : x;
    var d = s.domain().slice();
    if (this._discrete === "x") d.reverse();
    var vals = data.map(function(d) {
        return d[_this._discrete === "x" ? yKey : xKey];
    });
    var b = s.invert(s(max(vals)) + (this._discrete === "x" ? -10 : 10));
    if (b > d[1]) d[1] = b;
    if (this._discrete === "x") d.reverse();
    s.domain(d);
    return [
        x,
        y
    ];
}
