How to use the d3fc.data function in d3fc

To help you get started, we’ve selected a few d3fc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ScottLogic / StockFlux / packages / stockflux-bitflux / src / assets / js / data / quandl / historic / feedAdaptor.js View on Github external
export default function() {

    var historicFeed = fc.data.feed.quandl()
            .database('WIKI')
            .columnNameMap(mapColumnNames),
        granularity,
        candles;

    // More options are allowed through the API; for now, only support daily and weekly
    var allowedPeriods = d3.map();
    allowedPeriods.set(60 * 60 * 24, 'daily');
    allowedPeriods.set(60 * 60 * 24 * 7, 'weekly');

    // Map fields for WIKI database, to use all adjusted values
    var columnNameMap = d3.map();
    columnNameMap.set('Open', 'unadjustedOpen');
    columnNameMap.set('High', 'unadjustedHigh');
    columnNameMap.set('Low', 'unadjustedLow');
    columnNameMap.set('Close', 'unadjustedClose');
github ScottLogic / StockFlux / packages / stockflux-bitflux / src / assets / js / chart / nav.js View on Github external
var brushMask = fc.series.area()
        .xValue(function(d) { return d.date; })
        .y1Value(function(d) { return d.close; })
        .y0Value(function() { return yScale.domain()[0]; })
        .decorate(function(selection) {
            selection.enter().attr('fill', 'url("#brush-gradient")');
        });

    var brushLine = fc.series.line()
        .xValue(function(d) { return d.date; })
        .yValue(function(d) { return d.close; });

    var layoutWidth;

    var sampler = fc.data.sampler.largestTriangleThreeBucket()
        .x(function(d) { return xScale(d.date); })
        .y(function(d) { return yScale(d.close); });

    var brushMaskMulti = fc.series.multi()
        .series([brushMask, brushLine])
        .xScale(xScale)
        .yScale(yScale);

    function setHide(selection, brushHide) {
        selection.select('.plot-area')
            .selectAll('.e, .w')
            .classed('hidden', brushHide);
    }

    function xEmpty(navBrush) {
        return (navBrush.extent()[0] - navBrush.extent()[1]) === 0;
github ScottLogic / StockFlux / packages / stockflux-bitflux / src / assets / js / data / generator / historic / feedAdaptor.js View on Github external
export default function() {

    var dataGenerator = fc.data.random.financial(),
        allowedPeriods = [60 * 60 * 24],
        candles,
        end,
        granularity,
        product = null;

    var dataGeneratorAdaptor = function(cb) {
        end.setHours(0, 0, 0, 0);
        var startDate = d3.time.day.offset(end, -(candles - 1));
        dataGenerator.startDate(startDate);
        var data = dataGenerator(candles);
        cb(null, data);
    };

    dataGeneratorAdaptor.candles = function(x) {
        if (!arguments.length) {