Infinity Data Points Overview
In This Topic
Infinity data points are data points where one or more of its mandatory values are set to Double.PositiveInfinity or Double.NegativeInfinity. The control treats infinity data points similarly to empty data points, so this topic does not go into the same details.
Adding Infinity Data Points
The following code snippet shows how to add infinity data points:
C# |
Copy Code
|
NChart chart = nChartControl1.Charts[0];
NLineSeries line = new NLineSeries();
line.Values.Add(10);
line.Values.Add(20);
line.Values.Add(Double.PositiveInfinity);
line.Values.Add(40);
line.Values.Add(45);
line.Values.Add(Double.NegativeInfinity);
line.Values.Add(50);
line.Values.Add(55);
chart.Series.Add(line);
|
VB.NET |
Copy Code
|
Dim chart As NChart = NChartControl1.Charts(0)
Dim line As New NLineSeries
line.Values.Add(10)
line.Values.Add(20)
line.Values.Add(Double.PositiveInfinity)
line.Values.Add(40)
line.Values.Add(45)
line.Values.Add(Double.NegativeInfinity)
line.Values.Add(50)
line.Values.Add(55)
chart.Series.Add(line)
|
In the above example data points 3 and 6 are marked as positive and negative infinity respectively.
Infinity Data Points Processing
The processing of infinity data points is achieved at two stages:
Infinity Data Points at Data Level
At this stage the control detects infinity data points and decides whether to visualize the data point or skip it. This is controlled trough the InfinityDataPoints member of the series. The following code snippet shows infinity data points at some custom values:
C# |
Copy Code
|
line.Values.InfinityDataPoints.ValueMode = InfinityDataPointsValueMode.CustomValue;
line.Values.InfinityDataPoints.PositiveInfinityCustomValue = 100;
line.Values.InfinityDataPoints.NegativeInfinityCustomValue = -100; |
VB.NET |
Copy Code
|
line.Values.InfinityDataPoints.ValueMode = InfinityDataPointsValueMode.CustomValue
line.Values.InfinityDataPoints.PositiveInfinityCustomValue = 100
line.Values.InfinityDataPoints.NegativeInfinityCustomValue = -100 |
Infinity Data Points at Presentation Level
If the infinity data point is not skipped at data level the control will visualize it using either a custom value or average value as specified by the ValueMode property. The appearance of the infinity data point in this case is controlled from the InfinityDataPointsAppearance property of the series:
C# |
Copy Code
|
line.InfinityDataPointsAppearance.AppearanceMode = InfinityDataPointsAppearanceMode.Special;
line.InfinityDataPointsAppearance.BorderStyle.Color = Color.Red; |
VB.NET |
Copy Code
|
line.InfinityDataPointsAppearance.AppearanceMode = InfinityDataPointsAppearanceMode.Special
line.InfinityDataPointsAppearance.BorderStyle.Color = Color.Red |
Related Examples
Windows forms: Chart Gallery\Data Manipulation\Infinity Data Points
See Also