Can you suggest what I may be doing wrong?
Another problem that I have is if the Strata Comment field is blank in the dataset, TeeChart writes the thickness of the lithology (see the highest lithology in the image). How can I tell TeeChart to not draw a mark in this case.
Thanks in anticipation
Errol
Code: Select all
// ---------- InsertGeologicalComment ------------------------------------------
procedure TQSCollection.InsertGeologicalComment
(AFldCode,AFld:string; AIndex: integer; ADataset: TDataset);
var
i,iIndex: integer;
Ltitle : string;
// assumes IntervalQuery has been filled. EBA 20160302
begin
IntervalQuery.Open;
IntervalQuery.First;
LTitle := IntToStr(owner.Chart.SeriesList.Count);
SeriesListB.AddObject(LTitle,TUnitBarSeries.Create(Owner))
iIndex := SeriesListB.IndexOf(LTitle);
with TUnitBarSeries(SeriesListB.Objects[iIndex]) do
begin
ParentChart := self.Owner.Chart;
DataSource := IntervalQuery; // after parent chart
MultiBar := mbSelfStack;
CustomBarWidth := 60;
BarPen.Visible := False;
MarksLocation := mlCenter;
MarksOnBar := True;
Marks.Clip := True;
Marks.Shadow.Visible := False;
ShowInLegend := False;
Marks.Visible := True;
Marks.Pen.Color := clWhite;
Marks.Transparent := True;
Marks.Font.Size := 8;
ColorSource := 'Foreground';
XLabelsSource := 'Strata Comment';
XValues.ValueSource := 'ProfileDistance';
YValues.ValueSource := 'Depth';
VertAxis := aLeftAxis;
active := true;
end;
self.owner.chart.refreshdata;
self.owner.PlaceComments;
end;
// ---------- PlaceComments ----------------------------------------------------
procedure TPBQuickGraph.PlaceComments;
var
s, i, tmpSize: Integer;
begin
Chart.Draw;
for s:=0 to IntervalQueryCollection.SeriesListB.Count-1 do
if (s div 2 <> s/2) then // every second series in SeriesListB
with TUnitBarSeries(IntervalQueryCollection.SeriesListB.Objects[s]) do
begin
for i := 0 to TUnitBarSeries(IntervalQueryCollection.SeriesListB.Objects[s]).Count - 1 do
with Marks.Positions[i] do
begin
Custom := true;
LeftTop.X := CalcXPos(0) + 80;
tmpSize:=CalcYSizeValue(YValue[i]);
LeftTop.Y:=CalcYPos(i)+(tmpSize div 2)-(Marks.Height div 2);
end;
end;
end;
procedure TPBQuickGraph.BarUndoZoom(Sender: TObject);
begin
PlaceComments;
end;