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 crucial.
Creating a Fast Bar Series
The fast bar series is represented by the NFastBarSeries 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 bar series to it
NFastBarSeries fastBar = new NFastBarSeries();
chart.Series.Add(fastBar);
|
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 UseXValues, UseZValues, and UseColors properties of the fast bar series data object. The following example adds several thousand data points to a bar series:
C# |
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