// DlgResultGraph.cpp : ±¸Çö ÆÄÀÏÀÔ´Ï´Ù.
|
//
|
|
#include "stdafx.h"
|
#include "DlgResultGraph.h"
|
#include "afxdialogex.h"
|
#include "CHReviewResult/ReviewResult.h"
|
#include "CHEdgeTriangle/RecipeFormula.h"
|
|
|
// CDlgResultGraph ´ëÈ »óÀÚÀÔ´Ï´Ù.
|
|
IMPLEMENT_DYNAMIC(CDlgResultGraph, CDialog)
|
|
CDlgResultGraph::CDlgResultGraph(CWnd* pParent /*=NULL*/)
|
: CDialog(CDlgResultGraph::IDD, pParent)
|
{
|
m_nGraphMode = 1;
|
nGlassIndex = 0;
|
nGlassID = 0;
|
temp = 0;
|
nMode = 1;
|
|
}
|
|
CDlgResultGraph::~CDlgResultGraph()
|
{
|
|
}
|
|
void CDlgResultGraph::DoDataExchange(CDataExchange* pDX)
|
{
|
CDialog::DoDataExchange(pDX);
|
DDX_Control(pDX, IDC_STATIC_GRAPH_VIEW, m_ctrlGraphView);
|
}
|
|
|
BEGIN_MESSAGE_MAP(CDlgResultGraph, CDialog)
|
ON_WM_SIZE()
|
END_MESSAGE_MAP()
|
|
void CDlgResultGraph::DrawMeasureGraph(int nType, CGlassResult* pGlassResult)
|
{
|
|
//
|
// SReviewResult b;
|
// CReviewResult c;
|
//
|
// b.vecMeasure_ResultData[0].m_dResultValue = rand() % 10;
|
// b.vecMeasure_ResultData[1].m_dResultValue = rand() % 10;
|
// c.AddSReviewResult(b);
|
// c.SetModuleIndex(0);
|
//
|
// CGlassResult pGlassResult2;
|
// pGlassResult2.AddMeasureResult(c);
|
|
a.SetChartGlassData(1,nGlassIndex,pGlassResult);
|
if(nType)
|
UpdateGraphView(nType);
|
else
|
UpdateGraphView(nType);
|
nGlassIndex++;
|
a.MoveChartData(nGlassIndex);
|
}
|
|
BOOL CDlgResultGraph::OnInitDialog()
|
{
|
CDialog::OnInitDialog();
|
|
InitGlassGraph();
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
}
|
|
void CDlgResultGraph::InitGlassGraph()
|
{
|
CChartGlassData::Reset();
|
|
CRect rect;
|
m_ctrlGraphView.GetClientRect(rect);
|
|
XYChart* pChart = new XYChart(rect.Width(), rect.Height(), 0xf8daa9, 0x000000, 1);
|
if (pChart != NULL)
|
{
|
// CRect rtGraphGab(50,30,20,30); // gab
|
// CRect areaRect(rtGraphGab.left, rtGraphGab.top, rect.Width()-rtGraphGab.right, rect.Height()-rtGraphGab.bottom);
|
// pChart->setPlotArea(areaRect.left, areaRect.top, areaRect.Width(), areaRect.Height(), 0xffffff, -1, -1, 0xcccccc, 0xcccccc);
|
// pChart->addLegend(areaRect.left, 2, false, "arialbd.ttf", 9)->setBackground(Chart::Transparent);
|
|
int nLineWidthX = 2;
|
int nLineWidthY = 2;
|
|
char strValue[MAX_STR_LEN];
|
switch(m_nGraphMode)
|
{
|
case 0:
|
sprintf_s(strValue, MAX_STR_LEN, "Defect Count(ea)");
|
break;
|
case 1:
|
sprintf_s(strValue, MAX_STR_LEN, "Measure Result(um)");
|
break;
|
}
|
|
pChart->yAxis()->setAutoScale();
|
pChart->yAxis()->setLabelFormat("{value}");
|
pChart->yAxis()->setTitle(strValue, "arialbd.ttf", 9);
|
pChart->yAxis()->setWidth(nLineWidthY);
|
|
pChart->xAxis()->setAutoScale();
|
pChart->xAxis()->setTitle("Glass ID", "arialbd.ttf", 9);
|
pChart->xAxis()->setDateScale(0, double(m_nGlassCount));
|
pChart->xAxis()->setLabelStep(5);
|
pChart->xAxis()->setWidth(nLineWidthX);
|
|
m_ctrlGraphView.setChart(pChart);
|
|
delete pChart;
|
}
|
}
|
|
void CDlgResultGraph::UpdateGraphView(int nType)
|
{
|
// graph update
|
CRect rect;
|
m_ctrlGraphView.GetClientRect(rect);
|
const char *imageMap = 0;
|
int nListCnt = nGlassIndex;
|
BaseChart *chart = NULL;
|
if(nType)
|
chart = a.CreateChart(m_nGraphMode, nListCnt, &imageMap, rect, nType);
|
else
|
chart = a.CreateChart(m_nGraphMode, nListCnt, &imageMap, rect, nType);
|
|
if (chart!=NULL)
|
{
|
m_ctrlGraphView.setChart(chart);
|
m_ctrlGraphView.setImageMap(imageMap);
|
}
|
//nGlassIndex++;
|
delete chart;
|
}
|
|
void CDlgResultGraph::OnSize(UINT nType, int cx, int cy)
|
{
|
CDialog::OnSize(nType, cx, cy);
|
|
if (m_ctrlGraphView.GetSafeHwnd())
|
{
|
m_ctrlGraphView.SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOZORDER);
|
if(nMode)
|
UpdateGraphView(Graph_Dy);
|
else
|
UpdateGraphView(Graph_Dx);
|
}
|
}
|