Chart / Charts / Chart Types / Cartesian / Series / Fast Series / Fast Bar Series
In This Topic

    Fast Bar Series

    In This Topic

    The fast bar series is used to display a series of bars with controllable x value, z value, color, width, depth, and origin. It is the recommended way to display bar charts when rendering very large data sets and when high performance and rendering speed are essential. The images below showcase the fast bar series in 2D and 3D:

     

     Creating a Fast Bar Series

    Fast bar series are represented by the NFastBarSeries type. An instance of this type must be added to the series collection of a Cartesian chart:

    C#
    Copy Code
    NFastBarSeries fastBarSeries = new NFastBarSeries();
    chart.Series.Add(fastBarSeries);
    
     Passing Data

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

    Copy Code
    NFastBarSeries fastBarSeries = new NFastBarSeries();
    chart.Series.Add(fastBarSeries);
    int count = 10000;
    Random random = new Random();
    fastBarSeries.Data.SetCount(count);
    unsafe
    {
        fixed (byte* pData = &fastBarSeries.Data.Data[0])
        {
            int dataItemSize = fastBarSeries.Data.DataItemSize;
            float* pValue = (float*)fastBarSeries.Data.GetDataChannelPointer(ENSeriesDataChannelName.YValueF, pData, 0);
            for (int i = 0; i < count; i++)
            {
                *pValue = random.Next(100);
                pValue += dataItemSize;
            }
        }
    }
    
     Controlling the Bars Dimensions and Origin

    The width and depth dimensions as well as the origin of the bars are specified in the same way as in the regular bar series. For more information check the "Controlling the Bars Dimensions and Origin" and "Controlling the Bar Origin" section the in Standard Bar series topic.

    See Also