Click here to Skip to main content
15,896,557 members
Articles / Desktop Programming / MFC

An MFC Chart Control with Enhanced User Interface

Rate me:
Please Sign up or sign in to vote.
4.92/5 (102 votes)
17 Jun 2013CPOL112 min read 442.5K   98.8K   390  
An MFC linear chart control with enhanced appearance.
// ChartCtrlDemoDlg.h : header file
//

#include "ChartDef.h"
#include "ChartContainer.h"

#pragma once

class CDlgGenProp;
class CDlgAddChart;
class CDlgChange;
class CDlgAppendCharts;
class CDlgTruncate;
class CDlgRemoveChart;
class CDlgMisc;

typedef struct
{
  int funcID;
  double lastX;
  double deltaX;
  double alpha;
  double multY;
  size_t pntsNmb;
  size_t period;
} STRUCT_FUNCDATA;

typedef std::map<int, STRUCT_FUNCDATA > MAP_FUNCTIONS;

int GetRangePrecision(double minX, double maxX, int stepsNmb);

///////////////////////////////////////////////////////////////////////////////
// CChartCtrlDemoDlg dialog

class CChartCtrlDemoDlg : public CDialogEx
{
// Construction
public:
	CChartCtrlDemoDlg(CWnd* pParent = NULL);	// standard constructor
  virtual ~CChartCtrlDemoDlg();

// Dialog Data
	enum { IDD = IDD_CHARTDEMO };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support


// Implementation

public:
  void UpdateFuncMap(void);

protected:
	HICON m_hIcon;

	DECLARE_MESSAGE_MAP()

// Generated message map functions
	virtual BOOL OnInitDialog();
  virtual void OnCancel();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
//public:
  afx_msg LRESULT OnTabChanged(WPARAM tabID , LPARAM);
  afx_msg void OnChartVisibilityChanged(NMHDR*, LRESULT*); 


public:
  CChartContainer m_chartContainer;
  MAP_FUNCTIONS m_mapFunctions;

  CStatic m_tabLoc;
  CMFCTabCtrl m_tabCtrl;

  CDlgGenProp* m_pDlgGenProp;
  CDlgAddChart* m_pDlgAddChart;
  CDlgChange* m_pDlgChange;
  CDlgAppendCharts* m_pDlgAppendChart;
  CDlgTruncate* m_pDlgTruncate;
  CDlgRemoveChart* m_pDlgRemoveChart;
  CDlgMisc* m_pDlgMisc;

};

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Verizon Internet Services
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions