Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

copy one tchart to another

Posted on 2014-10-06
1
Medium Priority
?
596 Views
Last Modified: 2014-10-06
I have a tchart on my form. I draw it by programatically plotting points to a point series. The chart is small on the form and I would like to be able to see it appear as large as the form temporarily. Is there some easy way to make a chart on a form temporarily expand, covering the other objects without moving them ? Otherwise what i am thinking is having a child window open with a tchart on it. Then my question becomes, is there a way to copy the original tchart with the plotted points already on it, to another tchart on a child form ? Or do I need to redraw the points on the second tchart ? Or can I have two charts with the same name that mirror each other so the second tchart is automatically a clone of the first ?
0
Comment
Question by:ChLa
1 Comment
 
LVL 19

Accepted Solution

by:
Thommy earned 2000 total points
ID: 40363572
You may change the parent of the chart and use standard alignment property to make it expand.

Try it somehow like that...

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, VclTee.TeeGDIPlus, Vcl.StdCtrls,
  VCLTee.TeEngine, VCLTee.Series, Vcl.ExtCtrls, VCLTee.TeeProcs, VCLTee.Chart,
  Vcl.ComCtrls;

type
  TForm1 = class(TForm)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    Chart1: TChart;
    Series1: TPointSeries;
    procedure Chart1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

  SaveChartWidth,SaveChartHeight: Integer;
  SaveChartAlign: TAlign;

implementation

{$R *.dfm}

procedure TForm1.Chart1Click(Sender: TObject);
begin
  if Chart1.Parent=TabSheet1 then begin
    SaveChartWidth :=Chart1.Width;
    SaveChartHeight:=Chart1.Height;
    SaveChartAlign :=Chart1.Align;

    Chart1.Parent:=TabSheet2;
    Chart1.Align:=alClient;

    PageControl1.ActivePage:=TabSheet2;
  end
  else begin
    Chart1.Parent:=TabSheet1;
    Chart1.Align :=SaveChartAlign;
    Chart1.Width :=SaveChartWidth;
    Chart1.Height:=SaveChartHeight;
    PageControl1.ActivePage:=TabSheet1;
  end;
end;

end.

Open in new window

0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question