I use stacked bar charts to represent a geological column. Besides each section (strata) I place a comment using the code below:
Code: Select all
procedure TPBQuickGraph.PlaceComments;
var
s, i, tmpSize, LIndex, LMarksHeight : integer;
LComment: string;
begin
Chart.Draw;
LIndex := 0; // legend included so need to pick 2, 4, etc (0 = legend)
for s := 1 to fIntervalQueryCollection.SeriesListB.Count - 1 do
if (s mod 2 = LIndex) then // every second series in SeriesListB
with TUnitBarSeries(fIntervalQueryCollection.SeriesListB.Objects[s]) do
begin
fIntervalQueryCollection.IntervalQuery.First;
for i := 0 to TUnitBarSeries(fIntervalQueryCollection.SeriesListB.Objects[s]).Count - 1 do
begin
LComment := fIntervalQueryCollection.IntervalQuery.FieldByName('Strata Comment').AsString;
with Marks.Positions[i] do
begin
if (Labels[i] <> '') then
begin
Custom := true;
LeftTop.X := CalcXPos(0) + fBarWidth + fCommentStart;
tmpSize := CalcYSizeValue(YValue[i]);
LMarksHeight := Marks.Height;
LeftTop.Y := CalcYPos(i) - (tmpSize div 2) - (LMarksHeight div 2);
end
else
Marks.Item[i].Text.Text := '';
end;
fIntervalQueryCollection.IntervalQuery.Next;
end;
end;
end;
Best regards
Errol