Dashboard Functionality

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
OSNick
Newbie
Newbie
Posts: 23
Joined: Thu Apr 21, 2016 12:00 am

Dashboard Functionality

Post by OSNick » Thu Jun 02, 2016 4:27 pm

I'm looking to use the dashboard component but can't find much in the way of documentation.

Specifically I would like to:

Print the entire dashboard and all its charts.
Load and Save editor settings.
Add charts at runtime to the dashboard.

Any clues where to look please?

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

Re: Dashboard Functionality

Post by Yeray » Fri Jun 03, 2016 10:55 am

Hello,
OSNick wrote:Print the entire dashboard and all its charts.
I've seen the positions and the size of the charts seems to be lost when printing. I'll be back to you asap.
OSNick wrote:Load and Save editor settings.
Note the TDashBoard is basically a TChart with a TSubChartTool. It is designed so you can easily add SubCharts to the DashBoard.
There are a couple of tickets reporting issues about the Dashboard not saving some properties into the .dfm. In case this is what you are finding problems with:
http://bugs.teechart.net/show_bug.cgi?id=1314
http://bugs.teechart.net/show_bug.cgi?id=1315
OSNick wrote:Add charts at runtime to the dashboard.
Ie:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  DashBoard1.AddChart('Chart1').AddSeries(TBarSeries).FillSampleValues;
  DashBoard1.AddChart('Chart2').AddSeries(TLineSeries).FillSampleValues;
  DashBoard1.AddChart('Chart2').AddSeries(TPieSeries).FillSampleValues;
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

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

Re: Dashboard Functionality

Post by Yeray » Mon Jun 06, 2016 2:59 pm

Hello,
Yeray wrote:I've seen the positions and the size of the charts seems to be lost when printing. I'll be back to you asap.
I've added this to the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=1554

We have a fix in the works.
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

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

Re: Dashboard Functionality

Post by Yeray » Tue Jun 07, 2016 1:15 pm

Hello,
Yeray wrote:I've added this to the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=1554
We've just closed the ticket.

The fix consists on:

Code: Select all

--- a/TeeSubChart.pas
+++ b/TeeSubChart.pas
@@ -17,6 +17,11 @@ uses
 
   {$IFDEF FMX}
   FMX.Types, System.UITypes,
+
+  {$IFDEF D19}
+  FMX.Graphics,
+  {$ENDIF}
+
   {$IFDEF D17}
   System.UIConsts,
   {$ENDIF}
@@ -382,20 +387,57 @@ begin
 end;
 
+type
+  TCustomTeePanelAccess=class(TCustomTeePanel);
+
 procedure TSubChartTool.ChartEvent(AEvent: TChartToolEvent);
+
+  {$IFNDEF FMX}
+  procedure ApplyMetaScale(var R:TRect);
+  var tmp : TRect;
+      tmpR : TRect;
+      tmpW,
+      tmpH,
+      tmpX,
+      tmpY : Single;
+  begin
+    tmp:=ParentChart.ChartPrintRect;
+    tmpR:=ParentChart.GetRectangle;
+
+    tmpW:=(tmpR.Right-tmpR.Left);
+    tmpX:=(tmp.Right-tmp.Left)/tmpW;
+
+    R.Left:=Round(R.Left*tmpX);
+    R.Right:=Round(R.Right*tmpX);
+
+    tmpH:=(tmpR.Bottom-tmpR.Top);
+    tmpY:=(tmp.Bottom-tmp.Top)/tmpH;
+
+    R.Top:=Round(R.Top*tmpY);
+    R.Bottom:=Round(R.Bottom*tmpY);
+  end;
+  {$ENDIF}
+
 var t : Integer;
+    tmp : TCanvas;
+    tmpR : TRect;
+
+    {$IFNDEF FMX}
+    tmpScale : Boolean;
+    {$ENDIF}
 begin
   inherited;
 
   if Active and (AEvent=cteAfterDraw) and Assigned(ParentChart) then
-     for t:=0 to Charts.Count-1 do
-     with Charts[t] do
-     if Chart.Visible then
-     begin
-       // NOT A GOOD IDEA: Chart.View3D:=Self.ParentChart.View3D;
+  begin
+    tmp:=ParentChart.Canvas.ReferenceCanvas;
+
+    {$IFNDEF FMX}
+    tmpScale:=ParentChart.Printing and
+              ParentChart.Canvas.Metafiling and
+              TCustomTeePanelAccess(ParentChart).IsPrinterCanvas;
+    {$ENDIF}
+
-       Chart.BufferedDisplay:=False;
-       Chart.Draw(Self.ParentChart.Canvas.ReferenceCanvas,Bounds);
-     end;
+    for t:=0 to Charts.Count-1 do
+    with Charts[t] do
+    if Chart.Visible then
+    begin
+      Chart.BufferedDisplay:=False;
+
+      tmpR:=Bounds;
+      OffsetRect(tmpR,ParentChart.ChartBounds.Left,
+                      ParentChart.ChartBounds.Top);
+
+      {$IFNDEF FMX}
+      if tmpScale then
+         ApplyMetaScale(tmpR);
+      {$ENDIF}
+
+      Chart.Draw(tmp,tmpR);
+    end;
+  end;
 end;
 
 procedure TSubChartTool.ChartMouseEvent(AEvent: TChartMouseEvent;
@@ -1168,9 +1171,6 @@ end;
 
 { TChartCollection }
 
-type
-  TCustomTeePanelAccess=class(TCustomTeePanel);
-
 function TChartCollection.AddChart(const AName: String=''): TChart;
 var tmp : TCustomTeePanel;
 begin
-- 
-- 

Code: Select all

--- a/TeeProcs.pas
+++ b/TeeProcs.pas
@@ -439,6 +439,7 @@ type
     FCustomChartRect : Boolean;
     IsEmbedded       : Boolean;
     InternalCanvas   : TCanvas3D;
+    IsPrinterCanvas  : Boolean;
 
     Procedure ApplyMargins;
 
@@ -3591,7 +3592,9 @@ begin
   // FMX TODO: Change Scale.X and Y
 
   SetAnisotropic;
+
   FPrinting:=True;
+  IsPrinterCanvas:=True;
   try
     if CanClip then ClipCanvas(PrintCanvas,tmpR);
 
@@ -3601,6 +3604,7 @@ begin
     DrawToMetaCanvas(PrintCanvas,tmpR);
     UnClipCanvas(PrintCanvas);
   finally
+    IsPrinterCanvas:=False;
     FPrinting:=False;
   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

OSNick
Newbie
Newbie
Posts: 23
Joined: Thu Apr 21, 2016 12:00 am

Re: Dashboard Functionality

Post by OSNick » Tue Jun 21, 2016 3:49 pm

Thanks for the update (just got back onto this). Is it possible to have an updated .pas please? I'm always nervous about editing your source files.

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

Re: Dashboard Functionality

Post by Yeray » Wed Jun 22, 2016 9:50 am

Hello,

I've just sent you a mail with the modified units.
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

OSNick
Newbie
Newbie
Posts: 23
Joined: Thu Apr 21, 2016 12:00 am

Re: Dashboard Functionality

Post by OSNick » Thu Jun 23, 2016 9:03 am

Thank you for sending the units. Unfortunately I am using version 'Teechart Pro 2014 Components' (as I couldn't install the latest version). The units you send give compilation errors

Could I have the 2014 versions please?

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

Re: Dashboard Functionality

Post by Yeray » Thu Jun 23, 2016 10:28 am

Hello,
OSNick wrote:Could I have the 2014 versions please?
I'm not sure if it will be possible. v2014.11 or v2014.12?
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

OSNick
Newbie
Newbie
Posts: 23
Joined: Thu Apr 21, 2016 12:00 am

Re: Dashboard Functionality

Post by OSNick » Thu Jun 23, 2016 2:43 pm

v2014.12 is my version.

I tried re-installing the latest version into D2007, but I get errors loading Delphi - cannot load bpl files.

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

Re: Dashboard Functionality

Post by Narcís » Mon Jun 27, 2016 9:27 am

HI OSNick,

Which exact error message(s) do you get?

BTW, this thread may help setting up your environment.
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

Post Reply