Options
All
  • Public
  • Public/Protected
  • All
Menu

An abstract base class for RenderDataTransforms. Use these to convert data immediately before drawing.

Type parameters

Hierarchy

Implements

Index

Constructors

constructor

Properties

Readonly drawingProviders

drawingProviders: Array<ISeriesDrawingProvider>

The drawingProviders on the parentSeries to which this transform applies

Protected lastIndexRange

lastIndexRange: NumberRange

Protected lastResamplingHash

lastResamplingHash: number

Readonly parentSeries

parentSeries: BaseRenderableSeries

The series the transform is attached to

pointSeries

pointSeries: T

The pointSeries that stores the result of the transform

requiresTransform

requiresTransform: boolean = true

Whether then transform will run when the series is drawn. This is set true initially, and when data changes, and is set to false when the transform does run. If your transform depends on any other property, you must set this true if that property changes

useForYRange

useForYRange: boolean = false

A flag to tell the parent series if the transformed values should be used when calculating data range

Protected wasmContext

wasmContext: TSciChart

Methods

Protected Abstract createPointSeries

  • createPointSeries(): T
  • This function must return a new pointSeries which extends BasePointSeriesResampled and matches the type specified in the class definintion It does NOT have to be the same shape as the data on the series you are transforming. A typical implementation is

    protected createPointSeries(): XyPointSeriesResampled {
      return new XyPointSeriesResampled(this.wasmContext, new NumberRange(0, 0));
    }

    Returns T

delete

  • delete(): void

Protected makeRenderPassData

onDataChange

runTransform

Protected Abstract runTransformInternal

  • Implement the transform here.

    remarks

    To do no transformation, return renderPassData.pointSeries Otherwise, clear all the vectors on this.pointSeries, push the new values, then return this.pointSeries Below is sample code which splits xy data to xyy based on the metadata

    protected runTransformInternal(renderPassData: RenderPassData): IPointSeries {
        if (!renderPassData.pointSeries) {
          return this.pointSeries;
        }
        const {
          xValues: oldX,
          yValues: oldY,
          indexes: oldI,
          resampled,
        } = renderPassData.pointSeries;
        const { xValues, yValues, y1Values, indexes } = this.pointSeries;
        // clear the vectors on the target
        xValues.clear();
        yValues.clear();
        y1Values.clear();
        indexes.clear();
        // indexRange tells the drawing to only use a subset of the data.  If data has been resampled, then always use all of it
        const iStart = resampled ? 0 : renderPassData.indexRange.min;
        const iEnd = resampled ? oldX.size() - 1 : renderPassData.indexRange?.max;
        const ds = this.parentSeries.dataSeries as XyDataSeries;
        for (let i = iStart; i <= iEnd; i++) {
          // If data has been resampled, we need the original index in order to get the correct metadata
          const index = resampled ? oldI.get(i) : i;
          const md = ds.getMetadataAt(index);
          xValues.push_back(oldX.get(i));
          indexes.push_back(index);
          if (md.isSelected) {
            yValues.push_back(Number.NaN);
            y1Values.push_back(oldY.get(i));
          } else {
            yValues.push_back(oldY.get(i));
            y1Values.push_back(Number.NaN);
          }
        }
        return this.pointSeries;
      }

    Parameters

    Returns IPointSeries

Generated using TypeDoc