In This Topic
A ternary plot is a barycentric plot on three variables which sum to a constant. It graphically depicts the ratios of the three variables as positions in an equilateral triangle. The following figure displays a ternary chart.
Figure 1.
Creating a Ternary Point Chart
Ternary point series are represented by the NTernaryPoint series type. An instance of this type must be added to the series collection of a Ternary Chart (NTernaryChart object).
C# |
Copy Code
|
nChartControl1.Panels.Clear();
NTernaryChart ternaryChart = new NTernaryChart();
nChartControl1.Panels.Add(ternaryChart);
NTernaryPointSeries ternaryPoint = new NTernaryPointSeries();
ternaryPoint.AValues.Add(20);
ternaryPoint.BValues.Add(30);
ternaryPoint.CValues.Add(50);
ternaryChart.Series.Add(ternaryPoint);
|
Visual Basic |
Copy Code
|
NChartControl1.Panels.Clear()
Dim ternaryChart As New NTernaryChart
NChartControl1.Panels.Add(ternaryChart)
Dim ternaryPoint As New NTernaryPointSeries
ternaryPoint.AValues.Add(20)
ternaryPoint.BValues.Add(30)
ternaryPoint.CValues.Add(50)
ternaryChart.Series.Add(ternaryPoint)
|
Creating a Ternary Bubble Series
Ternary point series are represented by the NTernaryBubble series type. An instance of this type must be added to the series collection of a Ternary Chart (NTernaryChart object).
C# |
Copy Code
|
nChartControl1.Panels.Clear();
NTernaryChart ternaryChart = new NTernaryChart();
nChartControl1.Panels.Add(ternaryChart);
NTernaryBubbleSeries ternaryBubble = new NTernaryBubbleSeries();
ternaryBubble.MinSize = new NLength(10);
ternaryBubble.MaxSize = new NLength(30);
ternaryBubble.AValues.Add(20);
ternaryBubble.BValues.Add(30);
ternaryBubble.CValues.Add(50);
ternaryBubble.Sizes.Add(10);
ternaryBubble.AValues.Add(40);
ternaryBubble.BValues.Add(30);
ternaryBubble.CValues.Add(30);
ternaryBubble.Sizes.Add(20);
ternaryChart.Series.Add(ternaryBubble);
|
Visual Basic |
Copy Code
|
NChartControl1.Panels.Clear()
Dim ternaryChart As New NTernaryChart
NChartControl1.Panels.Add(ternaryChart)
Dim ternaryBubble As New NTernaryBubbleSeries
ternaryBubble.MinSize = New NLength(10)
ternaryBubble.MaxSize = New NLength(30)
ternaryBubble.AValues.Add(20)
ternaryBubble.BValues.Add(30)
ternaryBubble.CValues.Add(50)
ternaryBubble.Sizes.Add(10)
ternaryBubble.AValues.Add(40)
ternaryBubble.BValues.Add(30)
ternaryBubble.CValues.Add(30)
ternaryBubble.Sizes.Add(20)
ternaryChart.Series.Add(ternaryBubble)
|
The rest of the properties of the NTernaryBubbleSeries object are equivalent to the properties of the NBubbleSeries object.
Ternary Axes
The ternary chart by default has three axes which are called TernaryA, TernaryB and TernaryC. In some cases you may want to change the range of those axes - the following code shows how to create a ternary chart where the axes scale from 0 to 1000. It also shows how to change the normalization value of the ternary point/bubble series:
C# |
Copy Code
|
nChartControl1.Panels.Clear();
NTernaryChart ternaryChart = new NTernaryChart();
nChartControl1.Panels.Add(ternaryChart);
ternaryChart.Axis(StandardAxis.TernaryA).View = new NRangeAxisView(new NRange1DD(0, 1000));
ternaryChart.Axis(StandardAxis.TernaryB).View = new NRangeAxisView(new NRange1DD(0, 1000));
ternaryChart.Axis(StandardAxis.TernaryC).View = new NRangeAxisView(new NRange1DD(0, 1000));
NTernaryPointSeries ternaryPoint = new NTernaryPointSeries();
ternaryPoint.NormalizationValue = 1000;
ternaryPoint.AValues.Add(20);
ternaryPoint.BValues.Add(30);
ternaryPoint.CValues.Add(50);
ternaryPoint.AValues.Add(40);
ternaryPoint.BValues.Add(30);
ternaryPoint.CValues.Add(30);
ternaryChart.Series.Add(ternaryPoint);
|
Visual Basic |
Copy Code
|
NChartControl1.Panels.Clear()
Dim ternaryChart As New NTernaryChart
NChartControl1.Panels.Add(ternaryChart)
ternaryChart.Axis(StandardAxis.TernaryA).View = New NRangeAxisView(New NRange1DD(0, 1000))
ternaryChart.Axis(StandardAxis.TernaryB).View = New NRangeAxisView(New NRange1DD(0, 1000))
ternaryChart.Axis(StandardAxis.TernaryC).View = New NRangeAxisView(New NRange1DD(0, 1000))
Dim ternaryPoint As New NTernaryPointSeries
ternaryPoint.NormalizationValue = 1000
ternaryPoint.AValues.Add(20)
ternaryPoint.BValues.Add(30)
ternaryPoint.CValues.Add(50)
ternaryPoint.AValues.Add(40)
ternaryPoint.BValues.Add(30)
ternaryPoint.CValues.Add(30)
ternaryChart.Series.Add(ternaryPoint)
|
Formatting Commands
The NTernarySeries class extends the formatting commands set inherited from the NSeries base class with the following formatting commands:
<avalue> - the current data point A value (extracted from the AValues data series)
<bvalue> - the current data point B value (extracted from the BValues data series)
<cvalue> - the current data point C value (extracted from the CValues data series)
Related Examples
Windows forms: Chart Gallery\Ternary\Ternary Point
Windows forms: Chart Gallery\Ternary\Ternary Bubble
See Also