Chart for .NET / User's Guide / Chart Types / Fast Series / Fast Point

In This Topic
    Fast Point
    In This Topic

    The fast point series is used to display point clouds with controllable x value, z value, and color. It is the recommended way to display point charts when rendering very large data sets and when high performance and rendering speed are crucial.

     Creating a Fast Point Series

    The fast point series is represented by the NFastPointSeries type. An instance of this type must be added to the series collection of a Cartesian chart.

    C#
    Copy Code

    // obtain a reference to the Cartesian chart that is created by default
    NCartesianChart chart = (NCartesianChart)chartControl.Charts[0];

    // add fast point series to it
    NFastPointSeries fastPoint = new NFastPointSeries();
    chart.Series.Add(fastPoint);

     Passing Data

    Once the fast point series is created you can add some data in it. Fast point series by default have a Y values channel and intrinsic x values, z values (depth) and color channels. To pass data for one of the intrinsic data channels you need to first enable it using the UseXValues, UseZValues, and UseColors properties of the fast point series data object. The following example adds several thousand data points to a point series:

    C#
    Copy Code

    NFastPointSeries fastPointSeries = new NFastPointSeries();
    chart.Series.Add(fastPointSeries);

    int count = 10000;
    fastPointSeries.Data.UseXValues = true;
    fastPointSeries.Data.SetCount(count);

    Random random = new Random();

    unsafe
    {
        fixed (byte* pData = &fastPointSeries.Data.Data[0])
        {
            int dataItemSize = fastPointSeries.Data.DataItemSize;
            float* pYValues = (float*)fastPointSeries.Data.GetDataChannelPointer(ENSeriesDataChannelName.YValueF, pData);
            float* pXValues = (float*)fastPointSeries.Data.GetDataChannelPointer(ENSeriesDataChannelName.XValueF, pData);


            for (int i = 0; i < count; i++)
            {
                *pXValues = random.Next();
                pXValues += dataItemSize;

                *pYValues = random.Next();
                pYValues += dataItemSize;
            }
        }
    }

    fastPointSeries.Data.OnDataChanged();

    See Also