LoginSignup
0
1

More than 5 years have passed since last update.

C++ Builder XE4 > TeeChart > TChartのコピー > CloneChart(Dest,Origin:TCustomChart; AOwner:TComponent; ForceManualData:Boolean);

Last updated at Posted at 2018-12-21
動作環境
C++ Builder XE4
TeeChart Lite v2013.08.130414 32bit VCL

処理概要

  • TChartが二つある
  • 片方のTChartの内容をもう片方にコピーしたい

実装

CloneChart(Dest,Origin:TCustomChart; AOwner:TComponent; ForceManualData:Boolean);
という関数があるようだ。

Unit1.cpp
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include <DateUtils.hpp>
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormShow(TObject *Sender)
{
    Chart1->Series[0]->XValues->DateTime = true;
    Chart1->BottomAxis->DateTimeFormat = L"nn:ss";

    TDateTime dt;

    dt = Now();

    double yval;
    for (int idx=0; idx < 10; idx++) {
        yval = (1+ idx) % 2;
        Series1->AddXY(dt, yval, "", clRed);
        dt = IncSecond(dt, 1);
    }
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
    TComponent *cmpPtr = (TComponent *)Sender;

           //  Dest,  Origin, AOwner, ForceManualData
    CloneChart(Chart2, Chart1, cmpPtr, false);
}
//---------------------------------------------------------------------------

動作例

ソフト起動直後
2018-12-21_18h23_08.png

Button1押下後
2018-12-21_18h23_17.png

備考

  • コピー先TChartには系列データの定義を追加していない
    • 系列データを定義しなくて良い
  • TeeChartの公式ドキュメントを探したが、signatureの記載のみのページしか見つからず

検索用キーワード

  • Copy
  • Clone

関連

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1