📄 hgraph.h
字号:
#if !defined(AFX_GRAPH_H__5595CBC4_2ADD_4E0D_BC04_9DA3E57870A6__INCLUDED_)
#define AFX_GRAPH_H__5595CBC4_2ADD_4E0D_BC04_9DA3E57870A6__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// HGraph.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CHGraph window
#include "HGraphSeries.h"
#include "HGraphLegend.h"
class AFX_EXT_CLASS CHGraph : public CStatic
{
// Construction
public:
CHGraph();
// Attributes
public:
private:
int m_tickSpace; //number of pixels between "y" axis ticks
int m_tickRange;
int m_graphType; //0 - bar graph, 1 - line graph, 2 - pie
int m_graphAlignment; //0 - horizontal, 1 - vertical
int m_maxHeight;
int m_maxWidth;
int m_yApexPoint;
int m_xApexPoint;
int m_yAxisHeight;
int m_xAxisWidth;
int m_seriesSize; //number of data elements to map per series
int m_legendWidth;
int m_xAxisAlign; //0 - horizontal, # - degree rotation
int m_xAxisLabelLength;
int m_nxMark;
int m_nyMark;
int m_nySign;
double m_dMinOfData;
double m_dMaxOfData;
double m_dMinOfYAxis;
double m_dMaxOfYAxis;
BOOL m_graphHasLegend;
CStringArray m_saXMark;
CStringArray m_saYMark;
double *m_ySignArray;
CString m_axisYLabel;
CString m_axisXLabel;
CString m_graphTitle;
DWORD m_dwaColor[2048];
CObList *m_graphSeries;
CHGraphLegend m_graphLegend;
// Operations
public:
void SetTickSpace(int yDist);
void SetTickRange(int maxTick);
void DrawGraph(CDC* pDC);
void AddSeries(CHGraphSeries* dataSet);
void SetXAxisLabel(CString label);
void SetYAxisLabel(CString label);
void SetLegend(int datagroup, CString label);
void SetColor(int group, DWORD dwColor);
BOOL SetColor(DWORD *dwaColor,int nSize);
void SetXAxisAlignment(int alignValue);
void SetGraphTitle(CString title);
private:
void DrawAxis(CDC* pDC);
void DrawSeries(CDC* pDC);
void DrawLegend(CDC* pDC);
DWORD GetColor(int group);
int GetXAxisAlignment();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CHGraph)
//}}AFX_VIRTUAL
// Implementation
public:
void SetRect(CRect Rect);
int GetSeriesSize();
void SetYSign(int n,double dValue);
void SetYSignNum(int nSize);
void RemoveAllSeries();
void AddXMark(CString strValue);
void AddYMark(CString strValue);
void SetXMarkNum(int nSize);
void SetYMarkNum(int nSize);
void SetSeriesSize(int nSeriesSize);
virtual ~CHGraph();
// Generated message map functions
protected:
BOOL m_bUseRect;
CRect m_Rect;
double MaxOfArray(double *Array,int nSize);
double MinOfArray(double* Array,int nSize);
//{{AFX_MSG(CHGraph)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_GRAPH_H__5595CBC4_2ADD_4E0D_BC04_9DA3E57870A6__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -