You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.4 KiB
C++
52 lines
1.4 KiB
C++
//////////////////////////////////////////////////////////////////////////////
|
|
//文件 HistogramStat.h
|
|
//主要功能:
|
|
// 统计一系列数据,然后显示其统计柱状图
|
|
//程序编写: 2011-12-01
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
#include "ColorBase.h"
|
|
|
|
class AFX_EXT_CLASS CHistogramStat
|
|
{
|
|
public:
|
|
CHistogramStat(void);
|
|
~CHistogramStat(void);
|
|
|
|
//根据指定参数申请内存,初始化统计参数
|
|
bool CreateStat(double vmin, double vmax, int num);
|
|
|
|
//绑定指定统计的结果,但必须设置最大最小值
|
|
bool AttachStat(double *pz, int* pn, int num);
|
|
void SetValueRange(double vmin, double vmax);
|
|
|
|
int PositionValueIndex(double val);//定位一个值在统计列表中的索引值
|
|
void StatAdd(double& val); //统计一个值
|
|
void Stat(double *v, int num); //统计指定的值
|
|
void ClearStatState();
|
|
|
|
int GetSize() { return m_num; }
|
|
void EnableAutoDelete(bool bEnable) { m_bAutoDelete = bEnable; }
|
|
void Clear(void);
|
|
|
|
//将统计图显示到指定的DC、指定的范围中
|
|
void Draw(CDC* pDC, CColorBase* pColorBar, CRect rect);
|
|
void SetPenWidth(int width) { m_penWidth = width; }
|
|
|
|
//获得统计个数中的最大值
|
|
int GetMaxStatCount();
|
|
|
|
//以下参数一般不要直接调用修改
|
|
public:
|
|
double* m_pz; //保存统计范围值
|
|
int * m_pn; //保存统计的个数
|
|
int m_num; //指针个数
|
|
int m_penWidth; //显示的笔的线宽
|
|
double m_delt; //步长
|
|
double zmin;
|
|
double zmax;
|
|
bool m_bAutoDelete; //是否自动删除指针内存
|
|
};
|
|
|