Negligent Pachinko Machine

    d3-compose

    1.0.0 • Public • Published

    d3-compose

    In the D3 way of functions as objects, composition of functions needs to also inherit the properties of the functions being composed. This is what this small utility aims to acheive, think of it as the combination of two Underscore's functionalities: compose and extend.

    This allows the extention of common D3 modules such as axis, for example:

    function translate(selection, offset) {
        selection.attr("transform", "translate(0 "+offset+")");
    }
    var xAxis = d3.axisBottom(d3.scaleLinear()
        .domain([0, 10]).range([20, 180]));
     
    var svg = d3.select("#example-1")
        .append("g")
            .call(d3.compose(translate, xAxis), 50);

    For other ways of composing functions with D3 see d3-wrap.

    Install

    npm i d3-compose

    DownloadsWeekly Downloads

    11

    Version

    1.0.0

    License

    BSD-3-Clause

    Unpacked Size

    9.02 kB

    Total Files

    8

    Last publish

    Collaborators

    • au-phiware