Solved

copy one tchart to another

Posted on 2014-10-06
1
540 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 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

680 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