VC6中调用 ProEssentials v5图表组件实现科学图表绘制
PEszset(m_hPE, PEP_szMAINTITLE, "Example Data");
PEszset(m_hPE, PEP_szSUBTITLE, ""); // no subtitle
PEszset(m_hPE, PEP_szYAXISLABEL, "Units Sold");
PEszset(m_hPE, PEP_szXAXISLABEL, "Month");
PEnset(m_hPE, PEP_bFOCALRECT, FALSE);
PEnset(m_hPE, PEP_bPREPAREIMAGES, TRUE);
PEnset(m_hPE, PEP_bCACHEBMP, TRUE);
PEnset(m_hPE, PEP_nPLOTTINGMETHOD, PEGPM_POINTSPLUSSPLINE);
PEnset(m_hPE, PEP_nGRIDLINECONTROL, PEGLC_NONE);
PEnset(m_hPE, PEP_nALLOWZOOMING, PEAZ_HORZANDVERT);
PEnset(m_hPE, PEP_nZOOMSTYLE, PEZS_RO2_NOT);
// 子集的标识
PEvsetcell( m_hPE, PEP_szaSUBSETLABELS, 0, "Texas" );
PEvsetcell( m_hPE, PEP_szaSUBSETLABELS, 1, "Florida" );
PEvsetcell( m_hPE, PEP_szaSUBSETLABELS, 2, "Washington" );
PEvsetcell( m_hPE, PEP_szaSUBSETLABELS, 3, "California" );
// 子集点的颜色s
DWORD dwArray[4] = { RGB(198,0,0), RGB( 0, 198, 198 ), RGB( 198,198,0 ), RGB( 0,198,0 ) };
PEvsetEx( m_hPE, PEP_dwaSUBSETCOLORS, 0, 4, dwArray, 0 );
// 子集点的线型
int nLineTypes[] = { PELT_MEDIUMSOLID, PELT_MEDIUMSOLID, PELT_MEDIUMSOLID, PELT_MEDIUMSOLID };
PEvset(m_hPE, PEP_naSUBSETLINETYPES, nLineTypes, 4);
// 子集点的类型
int nPointTypes[] = { PEPT_DOTSOLID, PEPT_UPTRIANGLESOLID, PEPT_SQUARESOLID, PEPT_DOWNTRIANGLESOLID };
PEvset(m_hPE, PEP_naSUBSETPOINTTYPES, nPointTypes, 4)
// Version 4.0 功能 //
PEnset(m_hPE, PEP_bFIXEDFONTS, TRUE);
PEnset(m_hPE, PEP_bSIMPLEPOINTLEGEND, TRUE);
PEnset(m_hPE, PEP_bSIMPLELINELEGEND, TRUE);
PEnset(m_hPE, PEP_nLEGENDSTYLE, PELS_1_LINE);
PEnset(m_hPE, PEP_nMULTIAXISSTYLE, PEMAS_SEPARATE_AXES);
// 设置其他属性 //
PEnset(m_hPE, PEP_bBITMAPGRADIENTMODE, TRUE);
PEnset(m_hPE, PEP_nQUICKSTYLE, PEQS_MEDIUM_NO_BORDER);
PEnset(m_hPE, PEP_nGRADIENTBARS, 8);
PEnset(m_hPE, PEP_nTEXTSHADOWS, PETS_BOLD_TEXT);
PEnset(m_hPE, PEP_bMAINTITLEBOLD, TRUE);
PEnset(m_hPE, PEP_bSUBTITLEBOLD, TRUE);
PEnset(m_hPE, PEP_bLABELBOLD, TRUE);
PEnset(m_hPE, PEP_bLINESHADOWS, TRUE);
PEnset(m_hPE, PEP_nFONTSIZE, PEFS_LARGE);
PEnset(m_hPE, PEP_bSCROLLINGHORZZOOM, TRUE);
}
}
void CPEView::CreateDataCursor()
{
CreateSimpleSGraph();
// 创建游标 //
PEnset(m_hPE, PEP_nCURSORMODE, PECM_DATACROSS);
// 可以方便的查看数据点//
PEnset(m_hPE, PEP_bMARKDATAPOINTS, TRUE);
// 可以点击数据点来移动游标 //
PEnset(m_hPE, PEP_bMOUSECURSORCONTROL, TRUE);
PEnset(m_hPE, PEP_bALLOWDATAHOTSPOTS, TRUE);
// Cursor prompting in top left corner //
PEnset(m_hPE, PEP_bCURSORPROMPTTRACKING, TRUE);
PEnset(m_hPE, PEP_nCURSORPROMPTSTYLE, PECPS_XYVALUES);
PEnset(m_hPE, PEP_nCURSORPROMPTLOCATION, PECPL_TOP_RIGHT);
// 取消放大功能
PEnset(m_hPE, PEP_nALLOWZOOMING, PEAZ_NONE);
// 其他可能的游标模式如下:
// PECM_NOCURSOR = 0
// PECM_POINT = 1
// PECM_DATACROSS = 2
// PECM_DATASQUARE = 3
// PECM_FLOATINGY = 4
// PECM_FLOATINGXY = 5
// 注意:必须重新初始化
else if ((m_nLastSelection == 105) && (HIWORD(wp) == PEWN_CURSORMOVE))
{ int nSubset, nPoint;
float xvalue, yvalue;
char buffer[64];
nSubset = PEnget(m_hPE, PEP_nCURSORSUBSET);
nPoint = PEnget(m_hPE, PEP_nCURSORPOINT);
PEvgetcellEx(m_hPE, PEP_faXDATA, nSubset, nPoint, &xvalue);
PEvgetcellEx(m_hPE, PEP_faYDATA, nSubset, nPoint, &yvalue);
sprintf(buffer, "Cursor at %d,%d=(%.2f, %.2f)", nSubset, nPoint, xvalue, yvalue);
CWnd* pParent = GetParent()->GetParent();
if (pParent) {pParent->SetWindowText(buffer);}
pParent = AfxGetMainWnd();
if (pParent) {pParent->SetWindowText("PEWN_CURSORMOVE");
return TRUE;
}
}
以上代码在Win2000,VC6环境下调试通过。
Tags:
作者:佚名评论内容只代表网友观点,与本站立场无关!
评论摘要(共 0 条,得分 0 分,平均 0 分)
查看完整评论