Fast Area
In This Topic
The fast area series is used to display a series of area segments with controllable value, x value, color, and origin. It is the recommended way to display area charts when rendering very large data sets and when high performance and rendering speed are essential.
Creating a Fast Area Series
The fast area series is represented by the NFastAreaSeries 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 area series to it
NFastAreaSeries fastArea = new NFastAreaSeries();
chart.Series.Add(fastArea);
|
Passing Data
After you create the fast area series you can add some data in it. Fast area series by default have a Y values channel and intrinsic x values, and color channels. To pass data to one of the intrinsic data channels you need to first enable it using the UseXValues or the UseColors properties of the fast bar series data object. The following example adds several thousand data points to an area series:
C# |
Copy Code
|
NFastAreaSeries fastAreaSeries = new NFastAreaSeries();
chart.Series.Add(fastAreaSeries);
int count = 10000;
Random random = new Random();
fastAreaSeries.Data.SetCount(count);
unsafe
{
fixed (byte* pData = &fastAreaSeries.Data.Data[0])
{
int dataItemSize = fastAreaSeries.Data.DataItemSize;
float* pValue = (float*)fastAreaSeries.Data.GetDataChannelPointer(ENSeriesDataChannelName.YValueF, pData, 0);
for (int i = 0; i < count; i++)
{
*pValue = random.Next(100);
pValue += dataItemSize;
}
}
}
|
Controlling the Area Origin
The origin of the area series is controlled using the Origin and OriginMode properties. The following table lists the availabe options:
Origin Mode |
Description |
CustomOrigin |
The series origin value is specified by the Origin property. This is the default. |
MinValue |
The series min value is used as a series origin. |
MaxValue |
The series max value is used as a series origin. |
ScaleMin |
The min scale value is used as a series origin. |
ScaleMax |
The max scale value is used as a series origin. |
The following code changes the origin of the fast area series to a custom value:
C# |
Copy Code
|
fastArea.OriginMode = SeriesOriginMode.CustomOrigin;
fastArea.Origin = 50; |
See Also