Click here to Skip to main content
12,632,062 members (29,030 online)
Click here to Skip to main content

Stats

682.8K views
35K downloads
379 bookmarked
Posted

Scientific charting control

, 17 Jan 2005
Multi-purpose scientific charting control.
XGRAPH10.dll
XGraphTest.exe
Include
Release
res
bitmap1.bmp
bs1.bmp
bs2.bmp
bs3.bmp
bs4.bmp
bs5.bmp
Toolbar.bmp
XGraphTest.ico
XGraphTestDoc.ico
XGRAPH10.lib
XGRAPH10d.lib
XGraphTest.clw
XGraphTest.dsp
XGraphTest.dsw
XGRAPH10.dll
bitmap2.bmp
default1.bin
Logo.bmp
Screen1.bmp
xgraphtest
XGraph.clw
xgraph.def
XGRAPH.dsw
XGRAPH.dsp
bitmap1.bmp
bs1.bmp
bs2.bmp
bs3.bmp
bs4.bmp
bs5.bmp
lib
XGRAPH10.dll
XGRAPH10.exp
XGRAPH10.lib
// ChartPage.cpp: Implementierungsdatei
//

#include "stdafx.h"
#include "xgraph.h"
#include "ChartPage.h"
#include "ChartDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// Dialogfeld CChartPage 


CChartPage::CChartPage(CWnd* pParent /*=NULL*/)
	: CDialog(CChartPage::IDD, pParent)
{
	//{{AFX_DATA_INIT(CChartPage)
		
	//}}AFX_DATA_INIT

	m_pGraph = NULL;
	m_pGraphAxis = NULL;
	m_pGraphDataSerie = NULL;

	m_pChart = new CChartDlg;
	m_pCurve = new CCurveDlg;
	m_pAxis  = new CAxisDlg;

}

CChartPage::~CChartPage()
{
	delete m_pChart;
	delete m_pCurve;
	delete m_pAxis;
}


void CChartPage::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CChartPage)
	DDX_Control(pDX, IDC_TAB, m_Tab);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CChartPage, CDialog)
	//{{AFX_MSG_MAP(CChartPage)
	ON_NOTIFY(TCN_SELCHANGE, IDC_TAB, OnSelchangeTab)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// Behandlungsroutinen f�r Nachrichten CChartPage 

BOOL CChartPage::OnInitDialog() 
{
	CDialog::OnInitDialog();

	TCITEM tabItem;

	
	int nPageSelect = 0;

	if (m_pGraphAxis == NULL)
		m_pGraphAxis = &m_pGraph->GetYAxis (0);
	else
		nPageSelect = 1;

	if (m_pGraphDataSerie == NULL)
		m_pGraphDataSerie = &m_pGraph->GetCurve (0);
	else
		nPageSelect = 2;

	m_pChart->m_pGraph = m_pGraph;
	m_pCurve->m_pSerie = m_pGraphDataSerie; 
	m_pAxis->m_pAxis  = m_pGraphAxis; 
	
	tabItem.mask = TCIF_PARAM | TCIF_TEXT;
    tabItem.lParam = (LPARAM)m_pChart;
    VERIFY(m_pChart->Create(CChartDlg::IDD, &m_Tab));
    tabItem.pszText = "Chart";
    m_Tab.InsertItem(0,&tabItem);
	
	tabItem.lParam = (LPARAM)m_pAxis;
    VERIFY(m_pAxis->Create(CAxisDlg::IDD, &m_Tab));
    tabItem.pszText = "Axis";
    m_Tab.InsertItem(1,&tabItem);
	
	tabItem.lParam = (LPARAM)m_pCurve;
    VERIFY(m_pCurve->Create(CCurveDlg::IDD, &m_Tab));
    tabItem.pszText = "Curve";
    m_Tab.InsertItem(2,&tabItem);
		
	if (nPageSelect == 0)
	{
		m_pChart->SetWindowPos(NULL, 8, 25, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
		m_pChart->ShowWindow(SW_SHOW);
		m_pChart->EnableWindow(TRUE);
		m_pChart->ModifyStyle(WS_CAPTION,0);
	}

	
	if (nPageSelect == 1)
	{
		m_pAxis->SetWindowPos(NULL, 8, 25, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
		m_pAxis->ShowWindow(SW_SHOW);
		m_pAxis->EnableWindow(TRUE);
		m_pAxis->ModifyStyle(WS_CAPTION,0);
	}

	if (nPageSelect == 2)
	{
		m_pCurve->SetWindowPos(NULL, 8, 25, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
		m_pCurve->ShowWindow(SW_SHOW);
		m_pCurve->EnableWindow(TRUE);
		m_pCurve->ModifyStyle(WS_CAPTION,0);
	}

	m_Tab.SetCurSel(nPageSelect);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zur�ckgeben
}

void CChartPage::OnSelchangeTab(NMHDR* pNMHDR, LRESULT* pResult) 
{
	m_pChart->ShowWindow(SW_HIDE);
	m_pChart->EnableWindow(FALSE);
	m_pAxis->ShowWindow(SW_HIDE);
	m_pAxis->EnableWindow(FALSE);
	m_pCurve->ShowWindow(SW_HIDE);
	m_pCurve->EnableWindow(FALSE);
	
    switch (m_Tab.GetCurSel()) 
	{
	case 0:
		{
			m_pChart->SetWindowPos(&wndTop, 8, 25, 0, 0, SWP_NOSIZE );
		    m_pChart->ShowWindow(SW_SHOW);
			m_pChart->EnableWindow(TRUE);
			m_pChart->ModifyStyle(WS_CAPTION,0);
			break;
		}
	case 1:
		{
			m_pAxis->SetWindowPos(&wndTop, 8, 25, 0, 0, SWP_NOSIZE );
		    m_pAxis->ShowWindow(SW_SHOW);
			m_pAxis->EnableWindow(TRUE);
			m_pAxis->ModifyStyle(WS_CAPTION,0);
			break;
		}

	case 2:
		{
			m_pCurve->SetWindowPos(&wndTop, 8, 25, 0, 0, SWP_NOSIZE );
		    m_pCurve->ShowWindow(SW_SHOW);
			m_pCurve->EnableWindow(TRUE);
			m_pCurve->ModifyStyle(WS_CAPTION,0);
			break;
		}

	}
	
	*pResult = 0;
}

void CChartPage::SelectXAxis(int nItem)
{
	m_pAxis->m_pAxis = &m_pGraph->GetXAxis(nItem);
	m_pAxis->PresetValues ();
}

void CChartPage::SelectYAxis(int nItem)
{
	m_pAxis->m_pAxis = &m_pGraph->GetYAxis(nItem);
	m_pAxis->PresetValues ();
}

void CChartPage::SelectCurve(int nItem)
{
	m_pCurve->m_pSerie = &m_pGraph->GetCurve(nItem);
	m_pCurve->PresetValues ();
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Gunnar Bolle
Web Developer
Germany Germany
No Biography provided

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161208.2 | Last Updated 17 Jan 2005
Article Copyright 2002 by Gunnar Bolle
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid