OnGetMarkText is not fired in TContourSeries

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
vejazi
Newbie
Newbie
Posts: 5
Joined: Wed Nov 07, 2018 12:00 am

OnGetMarkText is not fired in TContourSeries

Post by vejazi » Thu Oct 10, 2019 8:38 am

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?

Yeray
Site Admin
Site Admin
Posts: 8971
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: OnGetMarkText is not fired in TContourSeries

Post by Yeray » Fri Oct 11, 2019 12:06 pm

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;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

vejazi
Newbie
Newbie
Posts: 5
Joined: Wed Nov 07, 2018 12:00 am

Re: OnGetMarkText is not fired in TContourSeries

Post by vejazi » Fri Oct 11, 2019 12:55 pm

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?

Yeray
Site Admin
Site Admin
Posts: 8971
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: OnGetMarkText is not fired in TContourSeries

Post by Yeray » Mon Oct 14, 2019 7:43 am

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?
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

vejazi
Newbie
Newbie
Posts: 5
Joined: Wed Nov 07, 2018 12:00 am

Re: OnGetMarkText is not fired in TContourSeries

Post by vejazi » Mon Oct 14, 2019 8:07 am

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.

Post Reply