Solved

copy one tchart to another

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now