Page 1 of 1

Limit TMarksTipTool popup

Posted: Thu Jun 06, 2013 6:58 pm
by 10049920
I currently have a TMarksTipTool and it pops up every time the mouse is anywhere on the chart (See popup 1).
However, it only updates (calls OnGetText) if the mouse is over actual data in the graph. (See popup 3).

Is there a way to make it so that the popup doesn't happen unless it is over a data item.

Or why does it not call OnGetText before it shows every time, instead of just when it is over new data?

Thanks,

Re: Limit TMarksTipTool popup

Posted: Fri Jun 07, 2013 8:47 am
by yeray
Hi,

Is that a TBarSeries? I've tried to reproduce the problem here but the code below seems to work fine for me:

Code: Select all

uses Series, TeeTools;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;
  Chart1.AddSeries(TBarSeries).FillSampleValues;
 Chart1.Tools.Add(TMarksTipTool);
end;
I see the popup only when I stop moving the mouse over a bar, and not over an empty space in the chart.
I've also tried assigning a dummy OnGetText event:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;

  Chart1.AddSeries(TBarSeries).FillSampleValues;

  with Chart1.Tools.Add(TMarksTipTool) as TMarksTipTool do
  begin
    OnGetText:=MarkTipsGetText;
  end;
end;

procedure TForm1.MarkTipsGetText(Sender:TMarksTipTool; var Text:String);
begin
  Text:='hello';
end;
But I get a similar result. The popup is only shown when I'm over the series.

Could you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.

Re: Limit TMarksTipTool popup

Posted: Fri Jun 07, 2013 3:00 pm
by 10049920
There are several things in the cart. The one producing the bars is an Area.

Re: Limit TMarksTipTool popup

Posted: Mon Jun 10, 2013 8:36 am
by yeray
Hi,

I tried now with this code and the MarkTips tool still doesn't appear when I'm above a part of the chart without any series drawn:

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;

  Chart1.AddSeries(TLineSeries).FillSampleValues;
  Chart1.AddSeries(THorizLineSeries).FillSampleValues;
  Chart1.AddSeries(TAreaSeries).FillSampleValues;
  Chart1.AddSeries(TPointSeries).FillSampleValues;
  Chart1.AddSeries(TAreaSeries).FillSampleValues;
  Chart1.AddSeries(TPointSeries).FillSampleValues;
  Chart1.AddSeries(TLineSeries).FillSampleValues;

  with Chart1.Tools.Add(TMarksTipTool) as TMarksTipTool do
  begin
    OnGetText:=MarkTipsGetText;
  end;
end;

procedure TForm1.MarkTipsGetText(Sender:TMarksTipTool; var Text:String);
begin
  Text:='hello';
end;
Pleas, arrange a simple example project we can run as-is to reproduce the problem here.
Thanks in advance.

Re: Limit TMarksTipTool popup

Posted: Tue Jun 11, 2013 3:33 pm
by 10049920
Here is a simple Form that has the problem.

It doesn't start showing the popup text right away, you have to scroll over a bar for a while first and then move back over the empty space.

It calls the GetText every time you go over a bar, but just displays the last one when you are over the empty area.

Re: Limit TMarksTipTool popup

Posted: Tue Jun 11, 2013 3:36 pm
by 10049920
Didn't accept the dcu and dfm, so I put it in a zip.

Re: Limit TMarksTipTool popup

Posted: Thu Jun 13, 2013 11:07 am
by narcis
Hi INL2,

.dcu files are not necessary, they are generated with the compilation process. However, the .pas files are necessary. Could you please also send form's .pas and, if possible, project's .dpr?

Thanks in advance.

Re: Limit TMarksTipTool popup

Posted: Mon Jun 17, 2013 1:53 pm
by 10049920
Sorry, I meant to send the .pas, lets try this again.

Re: Limit TMarksTipTool popup

Posted: Wed Jun 19, 2013 11:09 am
by yeray
Hi,

The project uses TestForm unit that isn't included in the zip. Since I saw FormMain2 is included but not used, I changed one for the other.
MainFiles.zip
(4.21 KiB) Downloaded 715 times
If I deactivate the series that don't have a MarkTips tool assigned, it seems to work fine. Could you please confirm this?

Re: Limit TMarksTipTool popup

Posted: Tue Jun 25, 2013 1:03 pm
by 10049920
Still has issues for me.
(See pictures)
The # in the popup is the same.
It pops up when not on the bars.


I remembered we are a version behind because we had some conflicts with your latest version. Is this an issue that has already been fixed.

Re: Limit TMarksTipTool popup

Posted: Thu Jun 27, 2013 11:09 am
by narcis
Hello,

The issue is much simpler. It's just a problem of having 2 area series in a chart with an associated MarkTips tool each. You can reproduce it with the attached project. I think this is a bug and added it (TV52016624) to the defect list to be fixed for future releases. The solution is pretty simple though, you should just have a single MarkTips tool for all series, not associated to any particular series.

Re: Limit TMarksTipTool popup

Posted: Wed Aug 28, 2013 9:17 pm
by 10049920
Sorry for the long delay, but project got postponed.

If I make one MarkTips for all the series, how do I know what series I am dealing with inside the function MarkTips___GetText(Sender : TMarksTipTool; var Text : string)

Since sender.Series is nil when you have the "Mark Tips" "Series" assigned to "(all)"

Thanks

Re: Limit TMarksTipTool popup

Posted: Fri Aug 30, 2013 11:04 am
by yeray
Hi,

You could know it doing something like this:

Code: Select all

procedure TForm1.ChartTool1GetText(Sender: TMarksTipTool;
  var Text: String);
var i: Integer;
    MousePos: TPoint;
begin
  MousePos:=Chart1.GetCursorPos;

  for i:=Chart1.SeriesCount-1 downto 0 do
  begin
    if Chart1[i].Clicked(MousePos)>-1 then
    begin
      Caption:='SeriesIndex: ' + IntToStr(i);
      exit;
    end;
  end;
end;