Switching axes
Posted: Mon Nov 21, 2016 1:20 pm
Is it possible to switch the axes of chart so that x becomes y and vice versa without having to replot it as such - if so, how?
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var x, z: Integer;
begin
Series1.Marks.Visible:=true;
Series1.AddXYZ(0, 0, 0);
Series1.AddXYZ(1, 1, 0);
Series1.AddXYZ(2, 0, 0);
Series1.AddXYZ(3, 1, 0);
Series1.AddXYZ(0, 1, 1);
Series1.AddXYZ(1, 1, 1);
Series1.AddXYZ(2, 1, 1);
Series1.AddXYZ(3, 1, 1);
Series1.AddXYZ(0, 0, 2);
Series1.AddXYZ(1, 0, 2);
Series1.AddXYZ(2, 0, 2);
Series1.AddXYZ(3, 0, 2);
Series1.AddXYZ(0, 0, 3);
Series1.AddXYZ(1, 0, 3);
Series1.AddXYZ(2, 1, 3);
Series1.AddXYZ(3, 1, 3);
end;
procedure TForm1.Button1Click(Sender: TObject);
var tmpGrid: TColorGridSeries;
x, z: Integer;
begin
tmpGrid:=TColorGridSeries.Create(Self);
for x:=0 to Series1.NumXValues-1 do
for z:=0 to Series1.NumZValues-1 do
tmpGrid.AddXYZ((Series1.NumZValues-1)-z, Series1.YValue[(z*Series1.NumXValues)+x], x);
Series1.DataSource:=tmpGrid;
end;