The current Ternary Series implementation in TeeChart needs a revamp. It does not suit a lot of users who wish to plot data in a similar format to a regular XY plot, without having to implement a lot of special code. A ternary plot is basically an XY plot, as there are only 2 independent variables (Z is always equal to 100  X%  Y% where X% = X/(X+Y+Z)*100 and Y% = Y/(X+Y+Z)*100). This means there is no need to use 3D charting code. In fact, ternary data can be plotted on a simple XY chart, but it doesn't look so good and is less easy to understand, so special triangular axes are employed.
I have attached a spreadsheet which shows my thinking. On the first spreadsheet, data is plotted on a simple XY plot. The Zaxis is in the direction of the blue arrow, at rightangles to the diagonal edge of the chart. As you can see, the Zvalues are correctly located at 80, 60 and 40% respectively, as shown below.
In the second sheet, I have drawn sloping "axes", and again plotted XY data. To do this, the X% and Y% values need to be recalculated using the following formulae:
X% Ternary = X% + Y% * cos(60°)
Y% Ternary = Y% * sin(60°)
Examining the chart, it is clear that the X%, Y% and Z% values are plotted correctly.
Finally, XValues (in TeeChart) should always correspond to the value at the right vertex of the graph, and YValues to the top vertex of the graph. In the current formulation, XValues corresponds to the top vertex and YValues to the right vertex, apparently following the clockwise rotation of the axes in one configuration. however, the order or rotation of the axes is arbitrary, and the true axis direction for each vertex is a line from the midpoint of the side opposite the vertex to the corresponding vertex. It is just convention to draw the axis on one adjacent side of the triangle or the other. In the third spreadsheet, I have shown three axis configurations commonly in use, an apparent clockwise rotation, and anticlockwise rotation and where just the xaxis and the yaxis are shown. The data is plotted in exactly the same place for all three configurations. The important aspect is the location of the vertex, so whatever is at the right vertex uses XValues and whatever is at the top axis uses YValues.
The advantage of an implementation like this is that Custom Line Series, Point Series and FastLine Series should be able to be used, just as for a regular XY plot. The implementation should offer the choice of the three axis configurations, and hopefully the chart will be able to be zoomed just like a regular XY plot. Also, many special ternary graphs require a template of lines demarcating different areas of interest on the graph. These will be able to be drawn as simple line series, with all the tools to change colours, line widths and symbols, rather than having to implement a series after draw for such details.
Best regards
Errol
A new implementation for Ternary Graphs
A new implementation for Ternary Graphs
 Attachments

 TernaryPlot_Steema.zip
 (22.26 KiB) Downloaded 51 times