Nevron .NET Vision
Chart for .NET / User's Guide / Chart Types / Fast Series / Fast Line

In This Topic
    Fast Line
    In This Topic

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

     Creating a Fast Line Series

    The fast line series is represented by the NFastLineSeries 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 line series to it
    NFastLineSeries fastLine = new NFastLineSeries();
    chart.Series.Add(fastLine );

     Passing Data

    Once the fast line series is created you can add some data in it. Fast line 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 line series data object. The following example adds several thousand data points to a line series:

    C#
    Copy Code

    NFastLineSeries fastLineSeries = new NFastLineSeries();
    chart.Series.Add(fastLineSeries);

    int count = 100000;
    fastLineSeries.Data.SetCount(100000);

    Random random = new Random();

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


            float* pValue = (float*)fastLineSeries.Data.GetDataChannelPointer(ENSeriesDataChannelName.YValueF, pData, 0);
            for (int i = 0; i < count; i++)
            {
                *pValue = random.Next(100);
                pValue += dataItemSize;
            }

        }
    }

    fastLineSeries.Data.OnDataChanged();

    See Also