Page 1 of 1
OnGetMarkText is not fired in TContourSeries
Posted: Thu Oct 10, 2019 8:38 am
by 16584857
I have a TContourSeries with marks visible and want to display percentage values in a custom format. So I created a method GetMarkText and assigned it to the OnGetMarkText property. Lets assume it looks like this (simplified):
Code: Select all
...
serContourLines.OnGetMarkText := GetMarkText;
...
procedure TForm1.GetMarkText(Sender: TChartSeries;
ValueIndex: Integer; var MarkText: string);
begin
MarkText := MarkText + ' %';
end;
But the method never gets called. The marks on the contour lines are displayed fine, but the text is just the value coming from the data. It even regards the ValueFormat for the series. But it doesn't show the text as defined in the event method.
The code is marked as compiled (blue dots), but a break point in the method is never reached.
Is this a bug or as designed?
Re: OnGetMarkText is not fired in TContourSeries
Posted: Fri Oct 11, 2019 12:06 pm
by yeray
Hello,
The Contour Series is a bit special and it doesn't draw the marks as the other series. It internally calculates the levels and draws a mark for each level, instead of drawing a mark for each point.
However, I believe it could use the OnGetMarkText event without problems so I've added it to the public tracker (
#2253)
Since you have the sources, could you please try to add this two lines of code into the TContourSeries.DrawAllValues.DrawLevelLines method in TeeSurfa.pas?
Code: Select all
if tmpDrawMarks then
begin
// Get mark text:
case Marks.Style of
smsSeriesTitle: tmpSt:=SeriesTitleOrName(Self);
smsPointIndex: tmpSt:=IntToStr(TheLevel);
else
tmpSt:=FormatFloat(ValueFormat,UpToValue);
end;
if Assigned(OnGetMarkText) then //Fix for #2253, Line 5429
OnGetMarkText(Self,TheLevel,tmpSt);
// Get mark size:
CalculateMarkPosition(Marks,tmpSt,0,0,Position);
tmpSize.X:=Position.Width;
tmpSize.Y:=Position.Height;
end;
Re: OnGetMarkText is not fired in TContourSeries
Posted: Fri Oct 11, 2019 12:55 pm
by 16584857
Hello Yeray,
thanks a lot, that seems to do the trick.
I'm not sure it will work in general but in my case it works fine, unless the resulting text is too long. But that is to be expected.
Will this go into the next release? If so, when will that be?
Re: OnGetMarkText is not fired in TContourSeries
Posted: Mon Oct 14, 2019 7:43 am
by yeray
Hello,
I'm afraid that fix arrived just a few hours after closing v2019.28 so it will be included in the next maintenance release.
I can't say when it will be released but you get an idea knowing the latest releases dates: March 2017, June 2017, December 2017, March 2018, August 2018, December 2018, May 2019 and October 2019.
On the other hand, do you find any problem on using the latest version with the patch manually applied on top of it?
Re: OnGetMarkText is not fired in TContourSeries
Posted: Mon Oct 14, 2019 8:07 am
by 16584857
Hello Yeray,
thanks for the info.
Yeray wrote: ↑Mon Oct 14, 2019 7:43 am
On the other hand, do you find any problem on using the latest version with the patch manually applied on top of it?
No, not in general. The only issue I have with this is when I install TeeChart. One has to remember to adapt the changes after installation.