Page 1 of 1
Win10 (File copy) progress like chart graphics
Posted: Sat Oct 14, 2017 3:34 pm
by 16579927
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 (6.53 KiB) Viewed 8734 times
What kind of series to use for this, or is there maybe some example code for that ?
Thanks and best regards
Re: Win10 (File copy) progress like chart graphics
Posted: Mon Oct 16, 2017 6:39 am
by yeray
Hello,
Have you tried with just an Area series? You can find examples in the Features Demo included with the binary installation.
Re: Win10 (File copy) progress like chart graphics
Posted: Tue Oct 17, 2017 7:10 am
by 16579927
Hello Yeray,
Thank you, using an Area series got me already a long way:
- AreaSeriesProgressCapture.PNG (9.86 KiB) Viewed 8688 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
Re: Win10 (File copy) progress like chart graphics
Posted: Tue Oct 17, 2017 9:00 am
by yeray
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;
Re: Win10 (File copy) progress like chart graphics
Posted: Tue Oct 17, 2017 9:25 am
by 16579927
Hello Yeray,
Thank You, that was exactly what I was looking for, this gives a very nice and generic progress display.
best regards,
Thomas