void CBase_SampleChart::ResetAxis()
{
	GetBottomAxis()->SetCoordinate(0, 5, COORDINATE_SET);
	GetLeftAxis()->SetCoordinate(-10, 500, COORDINATE_SET);

	GetBottomAxis()->GetGrid()->SetVisible(false);
	GetLeftAxis()->GetGrid()->SetVisible(false);

	if((g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC_PX) == 0) || (g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC1120) == 0) || (g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC2400) == 0) || (g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC1100W) == 0) || (g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC1100P) == 0)) 
		 GetLeftAxis()->SetZoomLimit(0.01);
	else if((g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_LC1620A) == 0) || (g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_IC1800) == 0)) 
		 GetLeftAxis()->SetZoomLimit(0.1);
	else GetLeftAxis()->SetZoomLimit(0.1);
	GetTopAxis()->SetZoomLimit(0.1);
	GetRightAxis()->SetZoomLimit(0.1);
	GetBottomAxis()->SetZoomLimit(0.1);
}
Beispiel #2
0
void CChartCtrl::OnMouseMove(UINT nFlags, CPoint point) 
{
	if (m_bRMouseDown && m_bPanEnabled)
	{
		if (point != m_PanAnchor)
		{
			GetLeftAxis()->PanAxis(m_PanAnchor.y,point.y);
			GetRightAxis()->PanAxis(m_PanAnchor.y,point.y);
			GetBottomAxis()->PanAxis(m_PanAnchor.x,point.x);
			GetTopAxis()->PanAxis(m_PanAnchor.x,point.x);

			RefreshCtrl();
			m_PanAnchor = point;
		}
	}

	if (m_bLMouseDown && m_bZoomEnabled)
	{
		m_rectZoomArea.BottomRight() = point;
		Invalidate();
	}

	CWnd::OnMouseMove(nFlags, point);
}
Beispiel #3
0
void CChartCtrl::OnLButtonUp(UINT nFlags, CPoint point) 
{
	m_bLMouseDown = false;
	if (m_bZoomEnabled)
	{
		if ( (m_rectZoomArea.left > m_rectZoomArea.right) ||
			 (m_rectZoomArea.top > m_rectZoomArea.bottom))
		{
			GetBottomAxis()->UndoZoom();
			GetTopAxis()->UndoZoom();
			GetLeftAxis()->UndoZoom();
			GetRightAxis()->UndoZoom();
		}
		else
		{
			CChartAxis* pBottom = GetBottomAxis();
			double MinVal = 0;			
			double MaxVal = 0;
			
			if (pBottom->IsInverted())
			{
				MaxVal = pBottom->ScreenToValue(m_rectZoomArea.left);
				MinVal = pBottom->ScreenToValue(m_rectZoomArea.right);
			}
			else
			{
				MinVal = pBottom->ScreenToValue(m_rectZoomArea.left);
				MaxVal = pBottom->ScreenToValue(m_rectZoomArea.right);
			}
			pBottom->SetZoomMinMax(MinVal,MaxVal);

			CChartAxis* pLeft = GetLeftAxis();
			if (pLeft->IsInverted())
			{
				MaxVal = pLeft->ScreenToValue(m_rectZoomArea.bottom);
				MinVal = pLeft->ScreenToValue(m_rectZoomArea.top);
			}
			else
			{
				MinVal = pLeft->ScreenToValue(m_rectZoomArea.bottom);
				MaxVal = pLeft->ScreenToValue(m_rectZoomArea.top);
			}
			pLeft->SetZoomMinMax(MinVal,MaxVal);

			CChartAxis* pTop = GetTopAxis();
			if (pTop->IsInverted())
			{
				MaxVal = pTop->ScreenToValue(m_rectZoomArea.left);
				MinVal = pTop->ScreenToValue(m_rectZoomArea.right);
			}
			else
			{
				MinVal = pTop->ScreenToValue(m_rectZoomArea.left);
				MaxVal = pTop->ScreenToValue(m_rectZoomArea.right);
			}
			pTop->SetZoomMinMax(MinVal,MaxVal);

			CChartAxis* pRight = GetRightAxis();
			if (pRight->IsInverted())
			{
				MaxVal = pRight->ScreenToValue(m_rectZoomArea.bottom);
				MinVal = pRight->ScreenToValue(m_rectZoomArea.top);
			}
			else
			{
				MinVal = pRight->ScreenToValue(m_rectZoomArea.bottom);
				MaxVal = pRight->ScreenToValue(m_rectZoomArea.top);
			}
			pRight->SetZoomMinMax(MinVal,MaxVal);
		}

		RefreshCtrl();
	}

	CWnd::OnLButtonUp(nFlags, point);
}
void CBase_SampleChart::RedrawPeakOnRealTime(const CBase_AnalysisSample* pSample, DWORD dwFlag, CBase_SampleChart::enumMode eMode, bool bRefresh)
{
	if(!pSample) return;
	EnableRefresh(false);

	if(dwFlag & FLAG_DATA_SOURCE)
	{
		CChartSerie* pSerie = GetMainSerie();
		if(pSerie)
		{
			pSerie->ClearSerie();
			const CArray<CCurveDataSingle>& m_srcData = pSample->m_dataMainCurve.m_arrayData;
			if(m_srcData.GetUpperBound() > -1)
			{
				pSerie->m_vPoints.InitPoints(m_srcData.GetUpperBound()+1);
				structMinMaxInfo mmi;
				GetBottomAxis()->GetMinMax(mmi.minx, mmi.maxx);
				GetLeftAxis()->GetMinMax(mmi.miny, mmi.maxy);
				bool bNeed = mmi.minx==0 && mmi.miny == 0 && mmi.maxx == 0 && mmi.maxy == 0;
				for (int i=0; i<=m_srcData.GetUpperBound(); ++i)
				{
					double x = m_srcData[i].dX;
					double y = m_srcData[i].dY;
					pSerie->m_vPoints.AddPoint(x, y);					
					if(mmi.minx > x) mmi.minx = x;
					if(mmi.maxx < x) mmi.maxx = x;
					if(mmi.miny > y) mmi.miny = y;
					if(mmi.maxy < y) mmi.maxy = y;
				}
				if(bNeed)
				{
					GetBottomAxis()->SetCoordinate(mmi.minx, mmi.maxx, COORDINATE_SET);
					GetLeftAxis()->SetCoordinate(mmi.miny, mmi.maxy, COORDINATE_SET);
				}
			}
		}
	}
	//const CPeakList* pPS = &pSample->m_cResultList;
	const CPeakList* pPS = &pSample->m_cPeakList;
	const CPeakList* pRT = &pSample->m_cAllRealTimePeakList; 
	
	if(dwFlag & FLAG_LINES_BASE)
	{
		//首先删除全部,再重新绘画
		if(eMode == MODE_SETALL) ClearPeak(pSample, FLAG_LINES_BASE);

		CChartLineSerie* pLine = NULL;
		for (int i=0; i<=pRT->m_cArrayData.GetUpperBound(); ++i)
		{
			pLine = CreateLineSerie();
			pLine->SetColor(m_crBaseLines);
			pLine->m_vPoints.AddPoint(pRT->m_cArrayData[i].m_dataBegin.dX, pRT->m_cArrayData[i].m_dataBegin.dY);
			pLine->m_vPoints.AddPoint(pRT->m_cArrayData[i].m_dataEnd.dX, pRT->m_cArrayData[i].m_dataEnd.dY);
			pLine->m_dwDPFlag = NULL;//不能在数据处理的曲线选择列表框中出现
			m_arrBaseLines.Add(pLine);
		}
	}
	if(dwFlag & FLAG_LINES_DIVIDEBASE)
	{
		CChartLineSerie* pLine = NULL;
		//首先删除全部,再重新绘画
		if(eMode == MODE_SETALL) ClearPeak(pSample, FLAG_LINES_DIVIDEBASE);

		for (int i=0; i<=pSample->m_arrayVLines.GetUpperBound(); ++i)
		{
			const CBase_AnalysisSample::structLine& line = pSample->m_arrayVLines.GetAt(i);
			pLine = CreateLineSerie();
			pLine->SetColor(m_crBaseLines);
			pLine->m_vPoints.AddPoint(line.begin.x, line.begin.y);
			pLine->m_vPoints.AddPoint(line.end.x, line.end.y);
			pLine->m_dwDPFlag = NULL;//不能在数据处理的曲线选择列表框中出现
			m_arrDivideBaseLines.Add(pLine);
		}
	}


	if((dwFlag & FLAG_STRINGS_RESERVEDTIME) || (dwFlag & FLAG_STRINGS_CONCENTRATION) || (dwFlag & FLAG_STRINGS_COMPONENTNAME) || (dwFlag & FLAG_STRINGS_FMJ) || (dwFlag & FLAG_STRINGS_FG))
	{
		
		//不管。首先删除全部,再重新绘画
		if(eMode == MODE_SETALL) ClearPeak(pSample, FLAGMASK_STRINGS_ASSISTANT);

		CString t;
		int i_upper_bound = pRT->m_cArrayData.GetUpperBound();
		for (int i=0; i<=i_upper_bound; ++i)
		{
			CString ass;
			const CPeakStandard& ps = pRT->m_cArrayData[i];
			if(dwFlag & FLAG_STRINGS_RESERVEDTIME) ass += CParamCommon::TimeString(ps.m_dReserveTime) + _T("/");
			if(dwFlag & FLAG_STRINGS_FMJ)
			{
				t.Format(_T("%.3f/"), ps.m_dArea);
				ass += t;
			}
			if(dwFlag & FLAG_STRINGS_FG)
			{
				t.Format(_T("%.3f/"), ps.m_dHeight);
				ass += t;
			}

			const CPeakStandard* pPSResult = GetPSByTime(pSample->m_cResultList, ps.m_dReserveTime);
			if(pPSResult)
			{
				if(dwFlag & FLAG_STRINGS_CONCENTRATION)
				{
					t.Format(_T("%.1f/"), pPSResult->m_dResultConcentration);
					ass += t;
				}
				if(dwFlag & FLAG_STRINGS_COMPONENTNAME)
				{
					ass += pPSResult->m_cStrComponentName;
					ass += _T('/');
				}
			}

			while(ass.Right(1) == _T("/")) ass.Delete(ass.GetLength()-1);
			//ass = _T("-->") + ass;
			CSuperChartString* pSerie = AddChartString(ps.m_dataTop.dX, ps.m_dataTop.dY, ass);
			pSerie->SetMustInPlottingRect(true);
			pSerie->Font.Color = m_crAssistants;
			pSerie->Font.SetSize(100);
			pSerie->Font.SetBold(550);
			pSerie->Font.SetAngle(600);
			pSerie->SetScreenOffset(-6, -8);
			pSerie->m_dwChartObjectFlag = CTWenChartObject::CHARTOBJECT_NOTINBZMANAGE;
			m_arrAssistants.Add(pSerie);
		}
	}
	EnableRefresh(true);
	if(bRefresh) RefreshCtrl();
}
void CBase_SampleChart::RefreshSample_Curve2DSeries(CBase_AnalysisSample* pSample ,const CString& dataFolder, bool bRefreshAxisRange)
{
	if(pSample)
	{
		CIADataCurve2D c2d;
		if(!PASUCCESS(pSample->GetIADataCurve2D(c2d))) return;
		structMinMaxInfo mmi;
		mmi.minx=0,mmi.miny=0,mmi.maxx=0,mmi.maxy=0;
		CString type;
		CIADataCurve2DSingle single;
		CString strMainGroup,strMainSerie;
		pSample->GetIADataCurve2D_MainInfo(&strMainGroup, &strMainSerie);
		long pos;
		c2d.BeginEnum(pos);
		while(c2d.GetNext(pos, type, single))
		{
			CString name,filename;
			single.BeginEnum();
			while(single.GetNext(name, filename))
			{
				void* pv = NULL;
				m_mapCurve2DVisibilites.Lookup(name, pv);
				void* pLine = NULL;
				bool bIsMain = strMainGroup == type && strMainSerie == name;
				if(bIsMain) continue;//主曲线由积分结果负责
				if(bIsMain) pLine = m_pcCurveMain;
				else m_mapCurve2DSeries.Lookup(name, pLine);
				if(pv)//需要绘画
				{
					if(bIsMain)
					{
						if(m_pcCurveMain)
						{
							m_pcCurveMain->ClearSerie();
							LoadSerieFromFile(mmi, m_pcCurveMain, dataFolder + filename);
							m_pcCurveMain->SetVisible(true);
						}
					}
					else
					{
						if(pLine == NULL)
						{
							CChartSerie* line = CreateCurve2DSerie(type, name);
							line->ClearSerie();
							LoadSerieFromFile(mmi, line, dataFolder + filename);
						}
						else ((CChartSerie*)pLine)->SetVisible(true);
					}
				}
				else
				{
					if(pLine) ((CChartSerie*)pLine)->SetVisible(false);
				}
			}
		}
		if(bRefreshAxisRange)
		{
			GetBottomAxis()->SetCoordinate(mmi.minx, mmi.maxx, COORDINATE_SET);
			GetLeftAxis()->SetCoordinate(mmi.miny, mmi.maxy, COORDINATE_SET);
		}
	}
}