Click here to Skip to main content
15,894,017 members
Articles / Desktop Programming / MFC

Scientific charting control

Rate me:
Please Sign up or sign in to vote.
4.84/5 (122 votes)
17 Jan 20055 min read 1.3M   42.6K   405  
Multi-purpose scientific charting control.
// PropertyView.cpp: Implementierungsdatei
//

#include "stdafx.h"
#include "XGraphTest.h"
#include "XGraphTestDoc.h"
#include "XGraphTestView.h"
#include "PropertyView.h"
#include "MainFrm.h"
#include "math.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPropertyView
 
IMPLEMENT_DYNCREATE(CPropertyView, CFormView)

CPropertyView::CPropertyView()
	: CFormView(CPropertyView::IDD)
{
	//{{AFX_DATA_INIT(CPropertyView)
	m_cInfo = _T("");
	//}}AFX_DATA_INIT
}

CPropertyView::~CPropertyView()
{
}

void CPropertyView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPropertyView)
	DDX_Text(pDX, IDC_INFO, m_cInfo);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPropertyView, CFormView)
	//{{AFX_MSG_MAP(CPropertyView)
	ON_BN_CLICKED(IDC_RADIO1, OnSelect)
	ON_BN_CLICKED(IDC_RADIO2, OnZoom)
	ON_BN_CLICKED(IDC_RADIO3, OnPan)
	ON_BN_CLICKED(IDC_RADIO4, OnCursor)
	ON_BN_CLICKED(IDC_RADIO5, OnEdit)
	ON_BN_CLICKED(IDC_RADIO6, OnMeasure)
	ON_BN_CLICKED(IDC_BUTTON6, OnInsertLabel)
	ON_BN_CLICKED(IDC_BUTTON8, OnResetAll)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// Diagnose CPropertyView

#ifdef _DEBUG
void CPropertyView::AssertValid() const
{
	CFormView::AssertValid();
}

void CPropertyView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// Behandlungsroutinen f�r Nachrichten CPropertyView 



void CPropertyView::OnSelect() 
{
	CXGraphTestView* pView = (CXGraphTestView*)((CMainFrame*)AfxGetMainWnd())->m_wndSplitter.GetPane(0,0);

	pView->m_Graph[0].NoOp();

	m_cInfo = _T("Use the mouse to select objects like axes, curves, ..."); UpdateData(FALSE);

	
}

void CPropertyView::OnZoom() 
{
	CXGraphTestView* pView = (CXGraphTestView*)((CMainFrame*)AfxGetMainWnd())->m_wndSplitter.GetPane(0,0);
	pView->m_Graph[0].Zoom();
	
	m_cInfo = _T("Use the mouse to define an area to zoom in."); UpdateData(FALSE);
	
}

void CPropertyView::OnPan() 
{
	CXGraphTestView* pView = (CXGraphTestView*)((CMainFrame*)AfxGetMainWnd())->m_wndSplitter.GetPane(0,0);
	pView->m_Graph[0].Pan();
	m_cInfo = _T("Use the mouse to pan the curves."); UpdateData(FALSE);
	
}

void CPropertyView::OnCursor() 
{
	CXGraphTestView* pView = (CXGraphTestView*)((CMainFrame*)AfxGetMainWnd())->m_wndSplitter.GetPane(0,0);
	pView->m_Graph[0].Cursor();
	m_cInfo = _T("Use the mouse to move the cursor left and right. The second chart will be synchronised. Use the left mousebutton to insert a data annotation"); UpdateData(FALSE);
	
}

void CPropertyView::OnEdit() 
{
	CXGraphTestView* pView = (CXGraphTestView*)((CMainFrame*)AfxGetMainWnd())->m_wndSplitter.GetPane(0,0);
	pView->m_Graph[0].Edit();
	m_cInfo = _T("Use the mouse to edit the curve-points. Zoom in before"); UpdateData(FALSE);
	
}

void CPropertyView::OnMeasure() 
{
	CXGraphTestView* pView = (CXGraphTestView*)((CMainFrame*)AfxGetMainWnd())->m_wndSplitter.GetPane(0,0);
	pView->m_Graph[0].Measure();
	m_cInfo = _T("Use the mouse to measure the distance between two points."); UpdateData(FALSE);
	
}

void CPropertyView::OnInsertLabel() 
{
	CXGraphTestView* pView = (CXGraphTestView*)((CMainFrame*)AfxGetMainWnd())->m_wndSplitter.GetPane(0,0);
	pView->m_Graph[0].InsertLabel();
	pView->m_Graph[0].Invalidate();
	
}

void CPropertyView::OnResetAll() 
{
	CXGraphTestView* pView = (CXGraphTestView*)((CMainFrame*)AfxGetMainWnd())->m_wndSplitter.GetPane(0,0);
	pView->m_Graph[0].ResetZoom();
	
}

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


Written By
Web Developer
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions