ProEssentials v7常用代码二:极坐标图
ProEssentials v7(下载)创建极坐标图表源代码:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
void CPEView::CreateSimplePolar() { //! Right button click to show popup menu. // //! Double Click to show customization dialog. // //! Left-Click and drag to draw zoom box. Use popup memu or 'z' to undo zoom. // // Simple example show the basics of a polar object. // // Polar Graph's contain both YData and XData. // RECT rect; GetClientRect( &rect ); // Construct Object // m_hPE = PEcreate(PECONTROL_PGRAPH, WS_VISIBLE, &rect, m_hWnd, 1001); PEnset(m_hPE, PEP_nSUBSETS, 2); PEnset(m_hPE, PEP_nPOINTS, 360); int p; float f1, f2; for (p=0; p<360; p++) { f1 = ( float ) p; f2 = ( float ) 150 * sin (( double ) p * 0.054F); PEvsetcellEx(m_hPE, PEP_faXDATA, 0, p, &f1); PEvsetcellEx(m_hPE, PEP_faYDATA, 0, p, &f2); } for (p=0; p<360; p++) { f1 = ( float ) p; f2 = ( float ) 150 * sin ((( double ) p * 0.044F)) * 2; PEvsetcellEx(m_hPE, PEP_faXDATA, 1, p, &f1); PEvsetcellEx(m_hPE, PEP_faYDATA, 1, p, &f2); } PEnset(m_hPE, PEP_nPLOTTINGMETHOD, PEGPM_LINE); PEnset(m_hPE, PEP_nALLOWZOOMING, 1); PEszset(m_hPE, PEP_szMAINTITLE, TEXT( "Polar Chart" )); PEszset(m_hPE, PEP_szSUBTITLE, TEXT( "" )); // no subtitle float ftmp = .9F; PEvset(m_hPE, PEP_fFONTSIZELEGENDCNTL, &ftmp, 1 ); PEnset(m_hPE, PEP_bPREPAREIMAGES, TRUE); PEnset(m_hPE, PEP_bCACHEBMP, TRUE); PEnset(m_hPE, PEP_bFOCALRECT, FALSE); // Set line types int nTypes[] = { PELT_MEDIUMSOLID, PELT_MEDIUMSOLID }; PEvset(m_hPE, PEP_naSUBSETLINETYPES, nTypes, 2); // Set point types int nPTypes[] = { PEPT_DOTSOLID, PEPT_PLUS }; PEvset(m_hPE, PEP_naSUBSETPOINTTYPES, nTypes, 2); // subset colors DWORD dwArray[2] = { PERGB(128, 198,0,0), PERGB(128, 0, 198, 0) }; PEvset( m_hPE, PEP_dwaSUBSETCOLORS, dwArray, 2); // subset labels PEvsetcell( m_hPE, PEP_szaSUBSETLABELS, 0, TEXT( "Signal #1" )); PEvsetcell( m_hPE, PEP_szaSUBSETLABELS, 1, TEXT( "Signal #2" )); double dnull = -99999.0F; PEvset(m_hPE, PEP_fNULLDATAVALUEX, &dnull, 1); PEvset(m_hPE, PEP_fNULLDATAVALUE, &dnull, 1); // Set Various other features // PEnset(m_hPE, PEP_bFIXEDFONTS, TRUE); PEnset(m_hPE, PEP_bBITMAPGRADIENTMODE, TRUE); PEnset(m_hPE, PEP_nQUICKSTYLE, PEQS_MEDIUM_NO_BORDER); PEnset(m_hPE, PEP_bSIMPLEPOINTLEGEND, TRUE); PEnset(m_hPE, PEP_bSIMPLELINELEGEND, TRUE); PEnset(m_hPE, PEP_nLEGENDSTYLE, PELS_1_LINE); PEnset(m_hPE, PEP_nZOOMSTYLE, PEZS_RO2_NOT); PEnset(m_hPE, PEP_nPOINTSIZE, PEPS_SMALL); 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_MEDIUM); PEnset(m_hPE, PEP_nGRADIENTBARS, 8); PEnset(m_hPE, PEP_nDATASHADOWS, PEDS_SHADOWS); float f = 1.2F; PEvset(m_hPE, PEP_fFONTSIZEGNCNTL, &f, 1); PEnset(m_hPE, PEP_nIMAGEADJUSTBOTTOM, 100); // Improves metafile export // PEnset(m_hPE, PEP_nDPIX, 600); PEnset(m_hPE, PEP_nDPIY, 600); // Set Demo's RenderEngine to Gdi Plus // CMDIFrameWnd* pWnd = (CMDIFrameWnd*) AfxGetApp()->GetMainWnd(); pWnd->SendMessage(WM_CHANGE_METAFILE, PEPLAYMETAFILEGDIPLUS ); } //******************************** |
极坐标图是一种圆形极线图,上面的数据点使用角度和到中心点的距离来表示。 X轴位于圆圈的边界上,Y 轴连接圆心与 X 轴,图表上的每一个数据点对应一对X,Y值。以上是用工控图表控件ProEssentials创建的一个简单的极坐标图表。
欢迎加群交流控件经验:301644590