Drag mark doesn't follow the mouse pointer during a panning

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
SiA
Newbie
Newbie
Posts: 43
Joined: Wed Mar 10, 2004 5:00 am

Drag mark doesn't follow the mouse pointer during a panning

Post by SiA » Fri Jul 11, 2008 9:12 am

Hi Steema support,

We have a trouble with drag mark when it doesn't follow the chart during a panning.
Please see more detail in images that we uploaded on your upload page.
There are two images: [Dragmark.jpg] and [Dragmark_Defect.jpg] with user is SiA.

Thanks and best regards.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Jul 11, 2008 9:24 am

Hi SiA,

For this to work you need to set custom marks positions set to a relative position in the chart and update them when chart is being zoomed or scrolled. You'll find an example here.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

SiA
Newbie
Newbie
Posts: 43
Joined: Wed Mar 10, 2004 5:00 am

Post by SiA » Mon Jul 14, 2008 9:05 am

Thanks for your reply,

We tried to apply your idea on our situation.
But we couldn't keep a modified drag mark following the mouse pointer during panning and set it to new relative position.
In fact, we only can reset drag mark position after panning by clearing all marks position and repaint.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Jul 14, 2008 9:14 am

Hi SiA,

Could you please send us a simple example project we can run "as-is" to reproduce the problem here and let us know the exact TeeChart version you are using?

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

SiA
Newbie
Newbie
Posts: 43
Joined: Wed Mar 10, 2004 5:00 am

Post by SiA » Mon Jul 14, 2008 11:19 am

Hi Narcis,

With this code, we can set the drag mark following the mouse pointer during panning, zooming and reset drag mark position after panning by clearing all marks position.

procedure TTeeChartExample.UpdateMarks;
var i: Integer;
begin
{Chart1.Draw();
for i:=0 to Chart1.Series[0].Count-1 do
begin
With Chart1.Series[0].Marks.Positions.Position do
Begin
Custom:=True;
LeftTop.X := Chart1.Series[0].CalcXPos(i);
LeftTop.Y := Chart1.Series[0].CalcYPos(i) - 10;
end;
end;
Chart1.Series[0].Marks.Arrow.Visible:=false;
Chart1.Series[0].Repaint;}
Chart1.Series[0].Marks.Positions.Clear;
Chart1.Series[0].Marks.ParentSeries.Repaint;
end;

procedure TTeeChartExample.Chart1Zoom(Sender: TObject);
begin
UpdateMarks;
end;

procedure TTeeChartExample.Chart1Scroll(Sender: TObject);
begin
UpdateMarks;
end;

procedure TTeeChartExample.Chart1UndoZoom(Sender: TObject);
begin
UpdateMarks;
end;


but we don't know how to set a modified drag mark position to new relative position.
Please find the DragMarkTeeChartExample.zip and ExpectedBehavior.doc that we uploaded for your more detail(name : Sia, email: lquocthanh@yahoo.com).

Thanks and best regards.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Jul 14, 2008 11:49 am

Hi SiA,

Thanks for the information. In that case you can achieve what you request like this:

Code: Select all

procedure TTeeChartExample.TeeChart1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if (Button = mbRight) then
  begin
    if(FastLineSeries1.Marks.Visible = false) then
      ShowMarks1.Caption := 'Show Marks'
    else
      ShowMarks1.Caption := 'Hide Marks';
    PopupMenu1.Popup(X+Left,Y+Top);
  end;

  if (Button = TeeChart1.ScrollMouseButton) then
  begin
    X0:=X;
    Y0:=Y;
    X1:=-1;
    Y1:=-1;
  end;
end;

procedure TTeeChartExample.ShowMarks1Click(Sender: TObject);
begin
  FastLineSeries1.Marks.Visible := not FastLineSeries1.Marks.Visible;
end;

procedure TTeeChartExample.UpdateMarks;
var i: Integer;
begin
  if ((X1<>-1) and (Y1<>-1)) then
  begin
    TeeChart1.Draw();
    TeeChart1[0].Marks.Arrow.Visible:=true;

    for i:=0 to TeeChart1[0].Count-1 do
    begin
      With TeeChart1[0].Marks.Positions.Position[i] do
      Begin
        Custom:=True;
        LeftTop.X := LeftTop.X + (X1-X0);
        LeftTop.Y := LeftTop.Y + (Y1-Y0);

        ArrowFrom.X:=LeftTop.X + (Width div 2);
        ArrowFrom.Y:=LeftTop.Y + Height;

        ArrowTo.X:=TeeChart1[0].CalcXPos(i);
        ArrowTo.Y:=TeeChart1[0].CalcYPos(i);
      end;
    end;

    TeeChart1.Series[0].Repaint;
  end;
end;

procedure TTeeChartExample.TeeChart1Zoom(Sender: TObject);
begin
  //UpdateMarks;
end;

procedure TTeeChartExample.TeeChart1UndoZoom(Sender: TObject);
begin
  //UpdateMarks;
end;

procedure TTeeChartExample.TeeChart1Scroll(Sender: TObject);
begin
  //UpdateMarks;
end;

procedure TTeeChartExample.TeeChart1MouseUp(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  if (Button = TeeChart1.ScrollMouseButton) then
  begin
    X1:=X;
    Y1:=Y;

    UpdateMarks;
  end;
end;
I'm going to send you modified project too.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

SiA
Newbie
Newbie
Posts: 43
Joined: Wed Mar 10, 2004 5:00 am

Post by SiA » Tue Jul 15, 2008 6:26 am

Thanks Narcis,

After modifying a bit:

Code: Select all

procedure TTeeChartExample.UpdateMarks;
var i: Integer;
begin
  if ((X1<>-1) and (Y1<>-1)) then
  begin
    TeeChart1.Draw();
    TeeChart1[0].Marks.Arrow.Visible:=true;

    for i:=0 to TeeChart1[0].Count-1 do
    begin
      With TeeChart1[0].Marks.Positions.Position[i] do
      If Custom = True then
      Begin
        //Custom:=True;
        LeftTop.X := LeftTop.X + (X1-X0);
        LeftTop.Y := LeftTop.Y + (Y1-Y0);

        ArrowFrom.X:=LeftTop.X + (Width div 2);
        ArrowFrom.Y:=LeftTop.Y + Height;

        ArrowTo.X:=TeeChart1[0].CalcXPos(i);
        ArrowTo.Y:=TeeChart1[0].CalcYPos(i);
      end;
    end;

    TeeChart1.Series[0].Repaint;
  end;
end;
I could set a modified drag mark position to new relative position.

But there are some unexpected behavior:
-the drag cannot follow mouse pointer during panning
-during panning (because panning defect), length of arrow of drag mark is strength longer and longer.

Hope this will be considered as a fix in future release!
[/code]

Post Reply