Variable builtInDataDerivationsConst

builtInDataDerivations: {
    SMA: ((arg: {
        source: string;
        window?: number;
    }) => DataSetDerivedPropertyConfig);
} = ...

Built-in convenience options for DataSetDerivedPropertyConfig

Can be used to automatically calculate properties of DataSet based on other data properties.

 // Example syntax, auto-calculate simple moving average and visualize it
const series = chart.addLineSeries({
schema: {
x: { pattern: 'progressive' },
yRaw: { pattern: null },
ySMA: { pattern: null, derived: builtInDataDerivations.SMA({ source: 'yRaw', window: 100 }) }
}
}).setDataMapping({ x: 'x', y: 'ySMA' })

series.appendSamples({ x: [...], yRaw: [...] })

Type declaration

  • SMA: ((arg: {
        source: string;
        window?: number;
    }) => DataSetDerivedPropertyConfig)
      • (arg: {
            source: string;
            window?: number;
        }): DataSetDerivedPropertyConfig
      • Simple Moving Average

        const series = chart.addLineSeries({
        schema: {
        x: { pattern: 'progressive' },
        yRaw: { pattern: null },
        ySMA: { pattern: null, derived: builtInDataDerivations.SMA({ source: 'yRaw', window: 100 }) }
        }
        }).setDataMapping({ x: 'x', y: 'ySMA' })

        series.appendSamples({ x: [...], yRaw: [...] })

        Parameters

        • arg: {
              source: string;
              window?: number;
          }
          • source: string
          • Optional window?: number

        Returns DataSetDerivedPropertyConfig