Win10 (File copy) progress like chart graphics

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
X-ray
Newbie
Newbie
Posts: 6
Joined: Thu Jan 12, 2017 12:00 am

Win10 (File copy) progress like chart graphics

Post by X-ray » Sat Oct 14, 2017 3:34 pm

Hello,

for some long running conversion we want to add a progress display with a graphical representation like Win 10 shows when copying a large amount of files:
ProgressCapture.PNG
ProgressCapture.PNG (6.53 KiB) Viewed 8735 times
What kind of series to use for this, or is there maybe some example code for that ?

Thanks and best regards

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

Re: Win10 (File copy) progress like chart graphics

Post by Yeray » Mon Oct 16, 2017 6:39 am

Hello,

Have you tried with just an Area series? You can find examples in the Features Demo included with the binary installation.
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

X-ray
Newbie
Newbie
Posts: 6
Joined: Thu Jan 12, 2017 12:00 am

Re: Win10 (File copy) progress like chart graphics

Post by X-ray » Tue Oct 17, 2017 7:10 am

Hello Yeray,

Thank you, using an Area series got me already a long way:
AreaSeriesProgressCapture.PNG
AreaSeriesProgressCapture.PNG (9.86 KiB) Viewed 8689 times
I have only one question left, I am using a TCursorTool to show the horizontal line with the current progress value.
Is there a way to show a custom text/string instead of the number, and then above the (TCursorLine) line on the right side in the frame ?
Just like in the Win10 dialog the string "Speed: 222KB/2". How to best solve that ?

Thanks and best regards,

Thomas

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

Re: Win10 (File copy) progress like chart graphics

Post by Yeray » Tue Oct 17, 2017 9:00 am

Hello Thomas,

Instead of modifying the TAnnotationTool embedded into the TCursorTool, I'd use a separated TAnnotationTool and I'd modify its position at the TCursorTool's OnChange event.
Here a simple example showing how to do this:

Code: Select all

uses Series;

var annot1: TAnnotationTool;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=False;
  Chart1.Legend.Visible:=False;
  Chart1.Hover.Visible:=False;

  with Chart1.AddSeries(TAreaSeries) as TAreaSeries do
  begin
    AreaLinesPen.Visible:=False;
    FillSampleValues;
  end;

  with Chart1.Tools.Add(TCursorTool) as TCursorTool do
  begin
    Style:=cssHorizontal;
    FollowMouse:=True;
    OnChange:=CursorOnChange;
  end;

  annot1:=Chart1.Tools.Add(TAnnotationTool) as TAnnotationTool;
  annot1.Shape.Transparent:=True;
end;

procedure TForm1.CursorOnChange(Sender:TCursorTool; x,y:Integer; Const XValue,YValue:Double;
                             Series:TChartSeries; ValueIndex:Integer);
begin
  annot1.Text:=FormatFloat('#,##0.##', YValue);
  annot1.Left:=Chart1.ChartRect.Right-annot1.Width-5;
  annot1.Top:=y-20;
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

X-ray
Newbie
Newbie
Posts: 6
Joined: Thu Jan 12, 2017 12:00 am

Re: Win10 (File copy) progress like chart graphics

Post by X-ray » Tue Oct 17, 2017 9:25 am

Hello Yeray,

Thank You, that was exactly what I was looking for, this gives a very nice and generic progress display.

best regards,

Thomas

Post Reply