How to use the data-forge.DataFrame.prototype function in data-forge

To help you get started, we’ve selected a few data-forge 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 data-forge / data-forge-plot / src / index.ts View on Github external
plot(plotDef?: IPlotConfig, axisMap?: IAxisMap): IPlotAPI;
    }
}

const dataFramePlotDefaults: IPlotConfig = {
    legend: {
        show: true,
    },
};

function plotDataFrame(this: IDataFrame, plotDef?: IPlotConfig, axisMap?: IAxisMap): IPlotAPI {
    const serializedData = this.serialize();
    return new PlotAPI(serializedData, plotDef || {}, axisMap || {}, dataFramePlotDefaults);
}

DataFrame.prototype.startPlot = startPlot;
DataFrame.prototype.endPlot = endPlot;
DataFrame.prototype.plot = plotDataFrame;
github data-forge / data-forge-plot / src / index.ts View on Github external
}
}

const dataFramePlotDefaults: IPlotConfig = {
    legend: {
        show: true,
    },
};

function plotDataFrame(this: IDataFrame, plotDef?: IPlotConfig, axisMap?: IAxisMap): IPlotAPI {
    const serializedData = this.serialize();
    return new PlotAPI(serializedData, plotDef || {}, axisMap || {}, dataFramePlotDefaults);
}

DataFrame.prototype.startPlot = startPlot;
DataFrame.prototype.endPlot = endPlot;
DataFrame.prototype.plot = plotDataFrame;
github data-forge / data-forge-indicators / src / indicators / bollinger-percent-b.ts View on Github external
}

/**
 * Compute the percent bandwidth indicator from Bollinger Bands.
 * 
 * %b (pronounced "percent b") is derived from the formula for stochastics and shows where price is in relation to the bands. 
 * %b equals 1 at the upper band and 0 at the lower band. 
 * 
 * https://en.wikipedia.org/wiki/Bollinger_Bands#Indicators_derived_from_Bollinger_Bands
 *
 */
function percentB(this: IDataFrame): ISeries {
    return this.deflate(band => (band.value - band.lower) / (band.upper - band.lower));
};

DataFrame.prototype.percentB = percentB;
github data-forge / data-forge-indicators / src / indicators / gaps.ts View on Github external
function gaps(this: IDataFrame): ISeries {

    return this.rollingWindow(2)
        .select<[IndexT, number]>(window => {
            const day1 = window.first().close;
            const day2 = window.last().open;
            return [
                window.getIndex().last(),
                ((day2 - day1) / day1) * 100,
            ];
        })
        .withIndex(pair => pair[0])
        .select(pair => pair[1]);
}

DataFrame.prototype.gaps = gaps;
github data-forge / data-forge-plot / src / index.ts View on Github external
}

const dataFramePlotDefaults: IPlotConfig = {
    legend: {
        show: true,
    },
};

function plotDataFrame(this: IDataFrame, plotDef?: IPlotConfig, axisMap?: IAxisMap): IPlotAPI {
    const serializedData = this.serialize();
    return new PlotAPI(serializedData, plotDef || {}, axisMap || {}, dataFramePlotDefaults);
}

DataFrame.prototype.startPlot = startPlot;
DataFrame.prototype.endPlot = endPlot;
DataFrame.prototype.plot = plotDataFrame;

data-forge

JavaScript data transformation and analysis toolkit inspired by Pandas and LINQ.

MIT
Latest version published 9 months ago

Package Health Score

64 / 100
Full package analysis