I attached sample executable file.
The yellow chart window appear when you double click "LabelMissing.exe".
And the red chart window appear when you click "Create Another Window" button.
And the red chart window destroy when you click "Terminate Another Window" button.
Bingo!! You can see that yellow chart's title and label is disappear.
I'll explain the inner code routine below
------------------------------------------------------------------------------------------------------------------------------------------
Window Initialize -> Timer(trigger every seconds) turn on -> Chart will add data at timer event routine
These steps(Window initialize, Timer Set, Timer event process) are same routine adapted both MainWindow(LabelMissing) and Sub Window(NewLabelMissing).
1. Window Initialize ( Window create routine is execute 1 time)
Code: Select all
if (m_tctMain.GetSeriesCount() == 0)
{
long index = m_tctMain.AddSeries(scTower);
CSeries cSeries = m_tctMain.Series(index);
cSeries.GetAsTower().SetTowerStyle(tsCube);
cSeries.GetAsTower().SetUseOrigin(TRUE);
m_tctMain.SetTheme(ctBlackIsBack, cpOpera);
m_tctMain.GetPanel().GetGradient().SetVisible(FALSE);
m_tctMain.GetPanel().SetColor(RGB(0,0,0));
m_tctMain.GetPanel().SetMarginTop(0);
m_tctMain.GetZoom().SetEnable(FALSE);
m_tctMain.GetScroll().SetEnable(FALSE);
m_tctMain.GetHeader().Show();
m_tctMain.GetHeader().SetCaption(_T("Main Chart"));
m_tctMain.GetHeader().SetCustomPosition(TRUE);
m_tctMain.GetHeader().SetLeft(10);
m_tctMain.GetHeader().SetTop(10);
m_tctMain.GetHeader().GetFont().SetBold(TRUE);
m_tctMain.GetLegend().SetVisible(FALSE);
m_tctMain.GetAspect().SetView3D(TRUE);
m_tctMain.GetAspect().SetOrthogonal(FALSE);
m_tctMain.GetAspect().SetChart3DPercent(100);
m_tctMain.GetAspect().SetZoom(90);
m_tctMain.GetAspect().SetRotation(325);
m_tctMain.GetAspect().SetElevation(345);
m_tctMain.GetAspect().SetPerspective(0);
m_tctMain.GetAspect().GetOpenGL().SetActive(TRUE);
//x axis setting
m_tctMain.GetAxis().GetBottom().SetAutomatic(FALSE);
m_tctMain.GetAxis().GetBottom().SetMaximum(10);
m_tctMain.GetAxis().GetBottom().SetMinimum(0);
//y axis setting
m_tctMain.GetAxis().GetLeft().SetAutomatic(FALSE);
m_tctMain.GetAxis().GetLeft().SetMinimum(0);
m_tctMain.GetAxis().GetLeft().SetMaximum(10);
//z axis setting
m_tctMain.GetAxis().GetDepth().SetVisible(TRUE);
m_tctMain.GetAxis().GetDepth().SetAutomatic(FALSE);
m_tctMain.GetAxis().GetDepth().SetMaximum(10);
m_tctMain.GetAxis().GetDepth().SetMinimum(0);
m_tctMain.GetWalls().GetBack().SetVisible(TRUE);
m_tctMain.GetWalls().GetBack().GetGradient().SetVisible(FALSE);
m_tctMain.GetWalls().GetBack().SetColor(RGB(90,90,90));
m_tctMain.GetWalls().GetLeft().SetVisible(TRUE);
m_tctMain.GetWalls().GetLeft().SetColor(RGB(65,65,65));
m_tctMain.GetWalls().GetLeft().GetPen().SetVisible(FALSE);
m_tctMain.GetWalls().GetBottom().SetVisible(TRUE);
m_tctMain.GetWalls().GetBottom().SetSize(1);
}
2.Timer Routine
After Window initialize, SetTimer(timer id, 1 second)
3. Timer event Routine (Execute every 1 second)
Code: Select all
m_tctMain.RemoveAllSeries(); //For memory release
if (m_tctMain.GetSeriesCount() == 0)
{
long index = m_tctMain.AddSeries(scTower);
CSeries cSeries = m_tctMain.Series(index);
cSeries.GetAsTower().SetTowerStyle(tsCube);
cSeries.GetAsTower().SetUseOrigin(TRUE);
}
CSeries cSeries = m_tctMain.Series(0);
for (int nPeriod=0; nPeriod<10; nPeriod++)
{
for (int nPhase=0; nPhase<10; nPhase++)
{
int nData = rand() % 10;
cSeries.GetAsTower().AddXYZ(nPeriod, nData , nPhase, _T(""), RGB(255,255,0));
}
}
------------------------------------------------------------------------------------------------------------------------------------------
Push "Create Another Window" button
Code: Select all
CRedChartDlg* pNew = new CRedChartDlg;
if(pNew)
{
pNew->Create(IDD_NEWDLG, this);
pNew->ShowWindow(SW_SHOW);
}
------------------------------------------------------------------------------------------------------------------------------------------
Push "Terminate Another Window" button
Code: Select all
if(pNew)
{
pNew->DestroyWindow();
delete pNew;
pNew = NULL;
}