Marks Placement when using mouse wheel
Posted: Mon Aug 20, 2018 6:17 am
Good evening
I use stacked bar charts to represent a geological column. Besides each section (strata) I place a comment using the code below:
This places the comments correctly when first displaying the graph and when called after the OnZoom, OnUndoZoom and OnScroll events. However, calling PlaceComments in the OnMouseWheel event misplaces the marks up or down as shown in the following figures.
I would be grateful if you can suggest how I might fix this.
Best regards
Errol
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