📄 dataseries.cpp
字号:
return;
}
/************************************************************************************************/
/* */
/* Function: CDataSeriesArray::SetElevation() */
/* */
/* Purpose : the amount of height or thickness for the 3D pie chart */
/* */
/* Inputs : double dHeight -> amount of height to set [0,100] */
/* */
/* Outputs : NONE */
/* */
/* Author : Scott Pelger Date Created: 11JUN02 */
/* */
/* Revisions */
/* */
/* Engineer Date Description */
/* */
/* Scott Pelger 11JUN02 initial version */
/* */
/************************************************************************************************/
void CDataSeriesArray::SetHeight(double dHeight) {
//restrict this between 0 and 100
m_dHeight = dHeight+DBL_EPSILON>100?100:dHeight+DBL_EPSILON<0?0:dHeight;
return;
}
/************************************************************************************************/
/* */
/* Function: CDataSeriesArray::SetElevation() */
/* */
/* Purpose : the elevation of ones perspective above the 3D pie chart */
/* */
/* Inputs : double dElevation -> amount of elevation to set [5.0,49.5] */
/* */
/* Outputs : NONE */
/* */
/* Author : Scott Pelger Date Created: 11JUN02 */
/* */
/* Revisions */
/* */
/* Engineer Date Description */
/* */
/* Scott Pelger 11JUN02 initial version */
/* */
/************************************************************************************************/
void CDataSeriesArray::SetElevation(double dElevation) {
//restrict this between 5.0 and 49.5
m_dElevation = dElevation+DBL_EPSILON>49.5?49.5:dElevation+DBL_EPSILON<5.0?5.0:dElevation;
return;
}
/************************************************************************************************/
/* */
/* Function: CDataSeriesArray::AddDataSeries() */
/* */
/* Purpose : adds a new data series to the data series array */
/* */
/* Inputs : CString Caption -> caption for this new data series */
/* COLORREF Color -> color for this new data series */
/* */
/* Outputs : int <- location of this new data series */
/* */
/* Author : Scott Pelger Date Created: 11JUN02 */
/* */
/* Revisions */
/* */
/* Engineer Date Description */
/* */
/* Scott Pelger 11JUN02 initial version */
/* */
/************************************************************************************************/
int CDataSeriesArray::AddDataSeries(CString Caption/*=""*/, COLORREF Color/*=RGB(255, 0, 0)*/) {
CDataSeries* pDataSeries = new CDataSeries;
pDataSeries->m_sCaption = Caption;
pDataSeries->m_crColor = Color;
if (TYPE_STRIP_CHART ==m_eChartType||
TYPE_STRIP_CHART_FILLED ==m_eChartType)
pDataSeries->SetMaxNumDataPoints(m_wMaxInList);
return m_DataSeriesArray.Add(pDataSeries);
}
/************************************************************************************************/
/* */
/* Function: CDataSeriesArray::GetDataSeries() */
/* */
/* Purpose : returns the data series at the specified location */
/* */
/* Inputs : int nDataSeries -> location of the data series to retrieve */
/* */
/* Outputs : CDataSeries* <- the retrieved data series */
/* */
/* Author : Scott Pelger Date Created: 11JUN02 */
/* */
/* Revisions */
/* */
/* Engineer Date Description */
/* */
/* Scott Pelger 11JUN02 initial version */
/* */
/************************************************************************************************/
CDataSeries* CDataSeriesArray::GetDataSeries(int nDataSeries) {
return (CDataSeries*)m_DataSeriesArray.GetAt(nDataSeries);
}
/************************************************************************************************/
/* */
/* Function: AddDataPoint() */
/* */
/* Purpose : adds a data point to a specified data series */
/* */
/* Inputs : CDataPoint* pDataPoint -> data point to add */
/* int nDataSeries -> the series to add the data point to */
/* */
/* Outputs : BOOL <- TRUE if a data point has been removed from the series */
/* */
/* Author : Scott Pelger Date Created: 12MAR02 */
/* */
/* Revisions */
/* */
/* Engineer Date Description */
/* */
/* Scott Pelger 12MAR02 initial version */
/* */
/************************************************************************************************/
BOOL CDataSeriesArray::AddDataPoint(CDataPoint* pDataPoint, int nDataSeries/*=0*/) {
ASSERT(nDataSeries>=0);
if (nDataSeries<0)
return FALSE;
pDataPoint->m_dwDataSeries = nDataSeries;
m_bRemoved = _GetDataSeries(nDataSeries)->AddDataPoint(pDataPoint);
_CalculateStats();
return m_bRemoved;
}
/************************************************************************************************/
/* */
/* Function: RemoveDataPoint() */
/* */
/* Purpose : removes a data point at the specified location from a specified data series */
/* */
/* Inputs : int nIndex -> location to remove the data point from */
/* int nDataSeries -> the series to remove the data point from */
/* */
/* Outputs : BOOL <- TRUE if a data point at the specified location does not exist */
/* */
/* Author : Scott Pelger Date Created: 12MAR02 */
/* */
/* Revisions */
/* */
/* Engineer Date Description */
/* */
/* Scott Pelger 12MAR02 initial version */
/* */
/************************************************************************************************/
BOOL CDataSeriesArray::RemoveDataPoint(int nIndex, int nDataSeries/*=0*/) {
ASSERT(nDataSeries>=0);
if (nDataSeries<0)
return TRUE;
BOOL bResult(_GetDataSeries(nDataSeries)->RemoveDataPoint(nIndex));
_CalculateStats();
return bResult;
}
/************************************************************************************************/
/* */
/* Function: CDataSeriesArray::GetRangeInDataSeries() */
/* */
/* Purpose : returns the min and max from the specified series and axis */
/* */
/* Inputs : int nDataSeries -> location of data series */
/* double& dMin -> storage location for min */
/* double& dMax -> storage location for max */
/* enum AXIS eAxis -> axis to retrive from */
/* */
/* Outputs : NONE */
/* */
/* Author : Scott Pelger Date Created: 11JUN02 */
/* */
/* Revisions */
/* */
/* Engineer Date Description */
/* */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -