Strings instead of values on an axis?
Posted: Thu Apr 01, 2004 12:35 pm
Hello!
1.) I have another question, that is (maybe) easy to answer: when generating a Boxplot-series at position x is there a possibility to name the corrosponding point on th bottom axis? I would like to have the string that can be found in 'name' (source below) on the bottom axis instead of 0, 1, 2, 3.....).
2.) the same with a tower-series.is there a possibility to write names on the bottom and depth axis instead of values (second code below) ?
if frmDataMining.DescriptiveColRadio.Checked then
begin
Chart1.Title.Text.Clear;
Chart1.Title.Text.Add('Boxplots / columns');
Chart1.View3D := False;
Chart1.ApplyZOrder := False;
for RunnerX := ErsteSpalte to LetzteSpalte do
begin
ValueNo := ValuesInColumn(frmMiningResults.ResultStringGrid, RunnerX, ErsteZeile, LetzteZeile);// check if there is more than text or empty fields
If ValueNo > 0 THen
Begin
Name := frmMiningResults.ResultStringGrid.Cells[RunnerX, 0]; // get the name from the table header
Chart1.AddSeries(TBoxSeries.Create(Self));
(Chart1[RunnerX - ErsteSpalte] as TBoxSeries).AreaColor := clRed;
(Chart1[RunnerX - ErsteSpalte] as TBoxSeries).Title := Name;
(Chart1[RunnerX - ErsteSpalte] as TBoxSeries).Position := RunnerX - ErsteSpalte;
(Chart1[RunnerX - ErsteSpalte] as TBoxSeries).Box.Color := clBlue;
(Chart1[RunnerX - ErsteSpalte] as TBoxSeries).AreaLinesPen.Visible := True;
(Chart1[RunnerX - ErsteSpalte] as TBoxSeries).VertAxis := aLeftAxis;
(Chart1[RunnerX - ErsteSpalte] as TBoxSeries).HorizAxis := aBottomAxis;
Repeater := 0;
SetLength (SortierteListe, ValueNo);
for RunnerY := ErsteZeile to LetzteZeile do // get all the values from the column
begin
DummyString := frmMiningResults.ResultStringGrid.Cells[RunnerX, RunnerY];
If TryStrToFloat (DummyString, DummyExtended) THen
Begin
SortierteListe [Repeater] := DummyExtended;
Inc (Repeater);
end;
end;
Quicksort (SortierteListe, 0, High (SortierteLIste)); // and sort them for the box plot
for RunnerY := 0 to High(SortierteListe) do
begin
(Chart1[RunnerX - ErsteSpalte] as TBoxSeries).Add (SortierteListe[RunnerY], name, clRed);
end;
end;
end;
end;
----------------------------------------
if frmDataMining.PercentGridRadio.Checked then
begin
Chart1.Title.Text.Clear;
Chart1.Title.Text.Add('Percent / grid');
Chart1.AddSeries(TTowerSeries.Create(Self));
(Chart1[0] as TTowerSeries).Clear;
(Chart1[0] as TTowerSeries).Title := 'Proportions in the grid';
(Chart1[0] as TTowerSeries).UseColorRange := True;
for RunnerY := LetzteZeile downto ErsteZeile do
begin
for RunnerX := ErsteSpalte to LetzteSpalte do
begin
DummyString := frmMiningResults.ResultStringGrid.Cells[RunnerX, RunnerY];
if TryStrToFloat(Copy(DummyString, 1, Length(DummyString) - 1), DummyExtended) then
begin
(Chart1[0] as TTowerSeries).AddXYZ(RunnerX - ErsteSpalte, DummyExtended, RunnerY-LetzteZeile);
end
else
begin
(Chart1[0] as TTowerSeries).Addxyz(RunnerX - ErsteSpalte, 0, RunnerY-LetzteZeile);
end;
end;
end;
end;
1.) I have another question, that is (maybe) easy to answer: when generating a Boxplot-series at position x is there a possibility to name the corrosponding point on th bottom axis? I would like to have the string that can be found in 'name' (source below) on the bottom axis instead of 0, 1, 2, 3.....).
2.) the same with a tower-series.is there a possibility to write names on the bottom and depth axis instead of values (second code below) ?
if frmDataMining.DescriptiveColRadio.Checked then
begin
Chart1.Title.Text.Clear;
Chart1.Title.Text.Add('Boxplots / columns');
Chart1.View3D := False;
Chart1.ApplyZOrder := False;
for RunnerX := ErsteSpalte to LetzteSpalte do
begin
ValueNo := ValuesInColumn(frmMiningResults.ResultStringGrid, RunnerX, ErsteZeile, LetzteZeile);// check if there is more than text or empty fields
If ValueNo > 0 THen
Begin
Name := frmMiningResults.ResultStringGrid.Cells[RunnerX, 0]; // get the name from the table header
Chart1.AddSeries(TBoxSeries.Create(Self));
(Chart1[RunnerX - ErsteSpalte] as TBoxSeries).AreaColor := clRed;
(Chart1[RunnerX - ErsteSpalte] as TBoxSeries).Title := Name;
(Chart1[RunnerX - ErsteSpalte] as TBoxSeries).Position := RunnerX - ErsteSpalte;
(Chart1[RunnerX - ErsteSpalte] as TBoxSeries).Box.Color := clBlue;
(Chart1[RunnerX - ErsteSpalte] as TBoxSeries).AreaLinesPen.Visible := True;
(Chart1[RunnerX - ErsteSpalte] as TBoxSeries).VertAxis := aLeftAxis;
(Chart1[RunnerX - ErsteSpalte] as TBoxSeries).HorizAxis := aBottomAxis;
Repeater := 0;
SetLength (SortierteListe, ValueNo);
for RunnerY := ErsteZeile to LetzteZeile do // get all the values from the column
begin
DummyString := frmMiningResults.ResultStringGrid.Cells[RunnerX, RunnerY];
If TryStrToFloat (DummyString, DummyExtended) THen
Begin
SortierteListe [Repeater] := DummyExtended;
Inc (Repeater);
end;
end;
Quicksort (SortierteListe, 0, High (SortierteLIste)); // and sort them for the box plot
for RunnerY := 0 to High(SortierteListe) do
begin
(Chart1[RunnerX - ErsteSpalte] as TBoxSeries).Add (SortierteListe[RunnerY], name, clRed);
end;
end;
end;
end;
----------------------------------------
if frmDataMining.PercentGridRadio.Checked then
begin
Chart1.Title.Text.Clear;
Chart1.Title.Text.Add('Percent / grid');
Chart1.AddSeries(TTowerSeries.Create(Self));
(Chart1[0] as TTowerSeries).Clear;
(Chart1[0] as TTowerSeries).Title := 'Proportions in the grid';
(Chart1[0] as TTowerSeries).UseColorRange := True;
for RunnerY := LetzteZeile downto ErsteZeile do
begin
for RunnerX := ErsteSpalte to LetzteSpalte do
begin
DummyString := frmMiningResults.ResultStringGrid.Cells[RunnerX, RunnerY];
if TryStrToFloat(Copy(DummyString, 1, Length(DummyString) - 1), DummyExtended) then
begin
(Chart1[0] as TTowerSeries).AddXYZ(RunnerX - ErsteSpalte, DummyExtended, RunnerY-LetzteZeile);
end
else
begin
(Chart1[0] as TTowerSeries).Addxyz(RunnerX - ErsteSpalte, 0, RunnerY-LetzteZeile);
end;
end;
end;
end;