Cursor tool problem & upgrade question

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
marc_x
Newbie
Newbie
Posts: 23
Joined: Mon Dec 01, 2008 12:00 am

Cursor tool problem & upgrade question

Post by marc_x » Sat Dec 10, 2011 1:25 pm

Hi,

With TeeChart 8.08 & RAD 2007 but I beleive this may happen in all version.

My customer complains that when zooming ans scrolling the cursor tool (in this case a vertival line) may go beyond the RightAxis where is is still visible but cannot be dragged anymore until scrolled back between the axes by scrolling the graph.

It shoul also be noted that when the Series assigned to a cursor becomes invisible the cursor behaves in a way that customers do not understand. if you hade the series then scroll a bit off one side the moving the cursor the other way will stop at where the series was starting before it became invisible. workaround is to assign another visible series but you gotta knows

Steema: I was also tempted to upgrade my version but worder since we are soo close to 2012 if I'd better waiting for the next release. my guess is that FMX will call for more updates than usual and wonder about support for the 2011 release in the future.

Thanks

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

Re: Cursor tool problem & upgrade question

Post by Yeray » Wed Dec 14, 2011 4:31 pm

Hi Marc,
marc_x wrote:My customer complains that when zooming ans scrolling the cursor tool (in this case a vertival line) may go beyond the RightAxis where is is still visible but cannot be dragged anymore until scrolled back between the axes by scrolling the graph.
I've reproduced it so I've added it to the wish list to be revised in future releases. In the meanwhile, you could hide/show the cursor tool manually checking its position at OnScroll and OnZoom events. Or change its style if it is showing both horizontal and vertical lines.
Here it is a simple example:

Code: Select all

uses Series, TeeTools;

var Cursor1: TCursorTool;
    defaultCursorStyle: TCursorToolStyle;

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

  Chart1.AddSeries(TPointSeries).FillSampleValues();

  Cursor1:=Chart1.Tools.Add(TCursorTool) as TCursorTool;
  defaultCursorStyle:=Cursor1.Style;
end;

procedure TForm1.Chart1Scroll(Sender: TObject);
begin
  CheckCursor;
end;

procedure TForm1.Chart1Zoom(Sender: TObject);
begin
  CheckCursor;
end;

procedure TForm1.Chart1UndoZoom(Sender: TObject);
begin
  CheckCursor;
end;

procedure TForm1.CheckCursor;
var showCursor, showHoriz, showVert: Boolean;
begin
  showCursor:=true;
  showVert:=(Cursor1.XValue>=Chart1.Axes.Bottom.Minimum) and (Cursor1.XValue<=Chart1.Axes.Bottom.Maximum);
  showHoriz:=(Cursor1.YValue>=Chart1.Axes.Left.Minimum) and (Cursor1.YValue<=Chart1.Axes.Left.Maximum);

  if showHoriz and showVert then Cursor1.Style:=defaultCursorStyle
  else if showHoriz then Cursor1.Style:=cssHorizontal
  else if showVert then Cursor1.Style:=cssVertical
  else showCursor:=false;

  Cursor1.Active:=showCursor;
end;
marc_x wrote:It shoul also be noted that when the Series assigned to a cursor becomes invisible the cursor behaves in a way that customers do not understand. if you hade the series then scroll a bit off one side the moving the cursor the other way will stop at where the series was starting before it became invisible. workaround is to assign another visible series but you gotta knows
I'm not sure to see this. Find below the code I'm using. With it, I scroll the chart to a side. Then I drag the cursor to the new space without problems.

Code: Select all

uses Series, TeeTools;

var Cursor1: TCursorTool;

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

  Chart1.AddSeries(TPointSeries).FillSampleValues();
  Chart1.AddSeries(TPointSeries).FillSampleValues();

  Cursor1:=Chart1.Tools.Add(TCursorTool) as TCursorTool;
  Cursor1.Series:=Chart1[0];
  Chart1[0].Visible:=false;
end;
Please, try to arrange a simple example project we can run as-is to reproduce the problem here.
marc_x wrote:Steema: I was also tempted to upgrade my version but worder since we are soo close to 2012 if I'd better waiting for the next release. my guess is that FMX will call for more updates than usual and wonder about support for the 2011 release in the future.
As you can read in the subscription agreement:
The subscription period
is initially for 12 months, renewable annually. Steema will send out a reminder near the end of the subscription period offering you the option to renew.

The subscription offers
Technical support and access to all minor and major updates during the subscription period.
This means you'll be able to download any version published in the next 12 months after a renewal (any Standard version if you have a Standard license, any Pro version if you have a Pro license and any SourceCode version if you have a SourceCode version, of course) and get support through this forums during the same period. So the major/minor version number doesn't mean too much here.
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

marc_x
Newbie
Newbie
Posts: 23
Joined: Mon Dec 01, 2008 12:00 am

Re: Cursor tool problem & upgrade question

Post by marc_x » Sat Dec 17, 2011 2:12 pm

Hi,

I have attached a simple app with instruction (on the app form) to show you the 2nd cursor problem.

You will get a warning when opening the project as I added a Units property to the library.

Regards

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

Re: Cursor tool problem & upgrade question

Post by Yeray » Mon Dec 19, 2011 8:15 am

Hi Marc,

Where is the attachment?
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

marc_x
Newbie
Newbie
Posts: 23
Joined: Mon Dec 01, 2008 12:00 am

Re: Cursor tool problem & upgrade question

Post by marc_x » Mon Dec 19, 2011 8:52 pm

Take two
Attachments
TChartTool.zip
(65.22 KiB) Downloaded 483 times

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

Re: Cursor tool problem & upgrade question

Post by Yeray » Wed Dec 21, 2011 11:11 am

Hi Marc,

You are right. The problem is that the CursorTool is limited to be moved between the FirstVisibleIndex and LastVisibleIndex of the series linked to it, and when you hide a series, these indexes aren't updated. So a workaround is to force them to be recalculated at, for example, OnUndoZoom event:

Code: Select all

uses Series, TeeTools;

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

  Chart1.AddSeries(TFastLineSeries).FillSampleValues(100);
  Chart1.AddSeries(TFastLineSeries).FillSampleValues(100);

  with Chart1.Tools.Add(TCursorTool) as TCursorTool do
  begin
    Series:=Chart1[0];
    Style:=cssVertical;
    Snap:=true;
    FollowMouse:=true;
  end;
end;

procedure TForm1.Chart1UndoZoom(Sender: TObject);
begin
  Chart1.Draw;
  Chart1[0].CalcFirstLastVisibleIndex;
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

Post Reply