CChartSerie* CChartCtrl::AddSerie(int Type) { size_t Count = m_pSeriesList.size(); size_t ColIndex = Count%10; CChartSerie* pNewLine = NULL; switch (Type) { case CChartSerie::stLineSerie: pNewLine = new CChartLineSerie(this); break; case CChartSerie::stPointsSerie: pNewLine = new CChartPointsSerie(this); break; case CChartSerie::stSurfaceSerie: pNewLine = new CChartSurfaceSerie(this); break; default: pNewLine = NULL; break; } if (pNewLine) { pNewLine->SetRect(m_PlottingRect); pNewLine->SetColor(pSeriesColorTable[ColIndex]); m_pSeriesList.push_back(pNewLine); } return pNewLine; }
void CBase_SampleChart::SetColor(DWORD dwFlag, COLORREF color) { EnableRefresh(false); if(dwFlag & FLAG_DATA_SOURCE) { CChartSerie* pSerie = GetMainSerie(); if(pSerie) pSerie->SetColor(color); } // if(dwFlag & FLAG_POINTS_BEGIN) // { // if(m_pBeginPoints) m_pBeginPoints->SetColor(color); // } // if(dwFlag & FLAG_POINTS_PEAK) // { // if(m_pPeakPoints) m_pPeakPoints->SetColor(color); // } // if(dwFlag & FLAG_POINTS_END) // { // if(m_pEndPoints) m_pEndPoints->SetColor(color); // } if(dwFlag & FLAG_LINES_BASE) { m_crBaseLines = color; CChartLineSerie* pLine = NULL; for(int i=0; i<=m_arrBaseLines.GetUpperBound(); i++) { pLine = m_arrBaseLines.GetAt(i); if(pLine) pLine->SetColor(color); } } if(dwFlag & FLAG_LINES_DIVIDEBASE) { m_crDivideBaseLines = color; CChartLineSerie* pLine = NULL; for(int i=0; i<=m_arrDivideBaseLines.GetUpperBound(); i++) { pLine = m_arrDivideBaseLines.GetAt(i); if(pLine) pLine->SetColor(color); } } if(dwFlag & FLAG_LINES_DIVIDEBASE) { m_crDivideBaseLines = color; CChartLineSerie* pLine = NULL; for(int i=0; i<=m_arrDivideBaseLines.GetUpperBound(); i++) { pLine = m_arrDivideBaseLines.GetAt(i); if(pLine) pLine->SetColor(color); } } DWORD dwFMask = dwFlag & FLAGMASK_STRINGS_ASSISTANT; if(dwFMask == FLAGMASK_STRINGS_ASSISTANT) { //同时都更改,才更改 m_crAssistants = color; CSuperChartString* pSerie = NULL; for(int i=0; i<=m_arrAssistants.GetUpperBound(); i++) { pSerie = m_arrAssistants.GetAt(i); if(pSerie) pSerie->Font.Color = m_crAssistants; } }//否则,无效 EnableRefresh(true); RefreshCtrl(); }