我的环境:
RadStudio 10.2 Tokyo
我想做的是:
当我从左到右更改轴的侧面时,通过隐藏/显示轴标题和标签来更改图形范围。
例如
//---------------------------------------------------------------------------
#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)
{
addDummyDate();
}
void __fastcall TForm1::addDummyDate()
{
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)
{
if (Button1->Tag == 0) {
Button1->Tag = 1;
Chart1->Series[0]->VertAxis = aRightAxis;
} else {
Button1->Tag = 0;
Chart1->Series[0]->VertAxis = aLeftAxis;
}
}
//---------------------------------------------------------------------------
我搜索了Internet(和Steema文档),但尚未找到解决方案。
我的目标是: 无论配置如何,都可以在同一位置打印图形。