⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dataseries.cpp

📁 The application wizard has created this SoccerDoctor application for you. This application not onl
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    if (nDataSeries<0)
        return;

    CDataSeries* pDataSeries = (CDataSeries*)m_DataSeriesArray.GetAt(nDataSeries);
    pDataSeries->m_sCaption = Caption;

    return;
    }

/************************************************************************************************/
/*                                                                                              */
/* Function: CDataSeriesArray::GetCaption()                                                     */
/*                                                                                              */
/* Purpose : returns the caption from the specified data series                                 */
/*                                                                                              */
/* Inputs  : int nDataSeries -> location of data series                                         */
/*                                                                                              */
/* Outputs : CString <- caption retrieved                                                       */
/*                                                                                              */
/* Author  : Scott Pelger                                             Date Created: 11JUN02     */
/*                                                                                              */
/* Revisions                                                                                    */
/*                                                                                              */
/* Engineer              Date        Description                                                */
/*                                                                                              */
/* Scott Pelger          11JUN02     initial version                                            */
/*                                                                                              */
/************************************************************************************************/
CString CDataSeriesArray::GetCaption(int nDataSeries/*=0*/) {

    ASSERT(nDataSeries>=0);

    if (nDataSeries<0)
        return "";

    CDataSeries* pDataSeries = (CDataSeries*)m_DataSeriesArray.GetAt(nDataSeries);
    
    return pDataSeries->m_sCaption;
    }

/************************************************************************************************/
/*                                                                                              */
/* Function: _CalculateStats()                                                                  */
/*                                                                                              */
/* Purpose : calculates statistics for all data series on a collective level                    */
/*                                                                                              */
/* Inputs  : NONE                                                                               */
/*                                                                                              */
/* Outputs : NONE                                                                               */
/*                                                                                              */
/* Author  : Scott Pelger                                             Date Created: 12MAR02     */
/*                                                                                              */
/* Revisions                                                                                    */
/*                                                                                              */
/* Engineer              Date        Description                                                */
/*                                                                                              */
/* Scott Pelger          12MAR02     initial version                                            */
/*                                                                                              */
/************************************************************************************************/
void CDataSeriesArray::_CalculateStats() {
    
    m_dXMin = DBL_MAX;
    m_dXMax = DBL_MIN;
    m_dYMin = DBL_MAX;
    m_dYMax = DBL_MIN;

    for (int i(0);i<m_DataSeriesArray.GetSize();i++) {
        CDataSeries* pDataSeries = (CDataSeries*)m_DataSeriesArray.GetAt(i);

        m_dXMin = m_dXMin+DBL_EPSILON>pDataSeries->m_dXMin?pDataSeries->m_dXMin:m_dXMin;
        m_dXMax = m_dXMax-DBL_EPSILON<pDataSeries->m_dXMax?pDataSeries->m_dXMax:m_dXMax;
        m_dYMin = m_dYMin+DBL_EPSILON>pDataSeries->m_dYMin?pDataSeries->m_dYMin:m_dYMin;
        m_dYMax = m_dYMax-DBL_EPSILON<pDataSeries->m_dYMax?pDataSeries->m_dYMax:m_dYMax;
    }
}

/************************************************************************************************/
/*                                                                                              */
/* Function: GetMaxInAllSeries()                                                                */
/*                                                                                              */
/* Purpose : returns the maximum number of data points of all series'                           */
/*                                                                                              */
/* Inputs  : NONE                                                                               */
/*                                                                                              */
/* Outputs : int <- max number of data points                                                   */
/*                                                                                              */
/* Author  : Scott Pelger                                             Date Created: 12MAR02     */
/*                                                                                              */
/* Revisions                                                                                    */
/*                                                                                              */
/* Engineer              Date        Description                                                */
/*                                                                                              */
/* Scott Pelger          12MAR02     initial version                                            */
/*                                                                                              */
/************************************************************************************************/
int CDataSeriesArray::GetMaxInAllSeries() {

    int nNumberOfSeries(m_DataSeriesArray.GetSize());
    int nNumberInSeries(0);
    
    for (int i(0);i<nNumberOfSeries;i++) {
        CDataSeries* pDataSeries = (CDataSeries*)m_DataSeriesArray.GetAt(i);
        nNumberInSeries = nNumberInSeries>pDataSeries->GetCount()?nNumberInSeries:pDataSeries->GetCount();
        }
    
    return nNumberInSeries;
    }

/************************************************************************************************/
/*                                                                                              */
/* Function: SetChartType()                                                                     */
/*                                                                                              */
/* Purpose : sets the chart type. if the type is a strip chart then the number of data points   */
/*           is set also                                                                        */
/*                                                                                              */
/* Inputs  : enum CHART_TYPE eChartType -> the chart type                                       */
/*                                                                                              */
/* Outputs : enum CHART_TYPE <- the chart type passed in. in the case of a strip chart the type */
/*           returned is the base chart type                                                    */
/*                                                                                              */
/* Author  : Scott Pelger                                             Date Created: 12MAR02     */
/*                                                                                              */
/* Revisions                                                                                    */
/*                                                                                              */
/* Engineer              Date        Description                                                */
/*                                                                                              */
/* Scott Pelger          12MAR02     initial version                                            */
/*                                                                                              */
/************************************************************************************************/
enum CHART_TYPE CDataSeriesArray::SetChartType(enum CHART_TYPE eChartType) {
    
    switch (eChartType) {
        case TYPE_STRIP_CHART_15:
        case TYPE_STRIP_CHART_30:
        case TYPE_STRIP_CHART_60:
        case TYPE_STRIP_CHART_120:
        case TYPE_STRIP_CHART_300:
        case TYPE_STRIP_CHART_600: {
            m_eChartType = TYPE_STRIP_CHART;
            int nNumberOfSeries(m_DataSeriesArray.GetSize());
            m_wMaxInList = eChartType;
            for (int i(0);i<nNumberOfSeries;i++) {
                CDataSeries* pDataSeries = (CDataSeries*)m_DataSeriesArray.GetAt(i);
                pDataSeries->SetMaxNumDataPoints(eChartType);
                }
            }
            break;
        case TYPE_STRIP_CHART_15_FILLED:
        case TYPE_STRIP_CHART_30_FILLED:
        case TYPE_STRIP_CHART_60_FILLED:
        case TYPE_STRIP_CHART_120_FILLED:
        case TYPE_STRIP_CHART_300_FILLED:
        case TYPE_STRIP_CHART_600_FILLED: {
            m_eChartType = TYPE_STRIP_CHART_FILLED;
            int nNumberOfSeries(m_DataSeriesArray.GetSize());
            m_wMaxInList = eChartType-1;
            for (int i(0);i<nNumberOfSeries;i++) {
                CDataSeries* pDataSeries = (CDataSeries*)m_DataSeriesArray.GetAt(i);
                pDataSeries->SetMaxNumDataPoints(eChartType);
                }
            }
            break;
        default:
            m_eChartType = eChartType;
            m_wMaxInList = 0;
        }

    return m_eChartType;
    }

/*BOOL Intersect(double dX11, double dY11, double dX12, double dY12, double dX21, double dY21, double dX22, double dY22, double& dXIntersect, double& dYIntersect) {

    double dM1((dY11-dY12)/(dX11-dX12));
    double dB1(dY11-dM1*dX11);
    double dM2((dY21-dY22)/(dX21-dX22));
    double dB2(dY21-dM2*dX21);

    dXIntersect = (dB2-dB1)/(dM1-dM2);
    dYIntersect = dM1*dXIntersect+dB1;

    if (dXIntersect+DBL_EPSILON>=dX11&&dXIntersect+DBL_EPSILON<=dX12)
        return TRUE;

    return FALSE;
    }*/

/************************************************************************************************/
/*                                                                                              */
/* Function: DrawData()                                                                         */
/*                                                                                              */
/* Purpose : draws a chart                                                                      */
/*                                                                                              */
/* Inputs  : CDC* pDC -> the device context to draw with                                        */
/*           C2DScale* pScale -> pointer to the scale class for access to the private methods   */
/*           and members of which this class has been granted friendship                        */
/*                                                                                              */
/* Outputs : NONE                                                                               */
/*                                                                                              */
/* Author  : Scott Pelger                                             Date Created: 12MAR02     */
/*                                                                                              */
/* Revisions                                                                                    */
/*                                                                                              */
/* Engineer              Date        Description                                                */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -