Microsoft KB Archive/161183

= How To Use the Pinnacle Graph Control to Graph Data =

Article ID: 161183

Article Last Modified on 7/13/2004

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition

-



This article was previously published under Q161183



SUMMARY
This article explains how to use the Pinnacle Publishing Graph ActiveX control that ships with Visual Basic. The Pinnacle Graph control is available in a 16- or 32-bit version.



MORE INFORMATION
This example uses the Pinnacle Graph Control that ships with Visual Basic 4.0. In order to use the Pinnacle Graph Control, it must first be properly registered. For more information about registering controls, please see the Microsoft Knowledge Base article referenced below.

In Visual FoxPro, perform the following steps:

 Add the Pinnacle Graph ActiveX control. On the Tools menu, click Options, and click the Controls tab. Click ActiveX controls and select Pinnacle-BPS Graph Control. Create a new local view using the TestData!Employee table. Add the field Count(*) to the Available fields Expression text box. Click the Group By tab and add Employee.City Save the local view as "Group by City." Create a new form and add the Pinnacle Graph Control from the ActiveX controls. Size the Graph to accordingly. The default name of the control is OleControl1. Set the Visible property of the OleControl1 to .F.</li> Add the local view "Group by City" in the DataEnvironment of the form.</li> Add a command button. Set the name property to cmdGraph with the caption set to Graph.</li>  In the Click event of cmdGraph add the following code: WITH thisform.Olecontrol1 .NumPoints = reccount .NumSets = 1 .Autoinc = 1 .GraphTitle = "Employees by City" .Labels = 1 .FontUse = 2 .FontSize = 200 ENDWITH

GO TOP * Add the Data for each bar DO WHILE !EOF ThisForm.OleControl1.GraphData = cnt SKIP ENDDO

GO TOP * Add the label for each bar DO WHILE !EOF ThisForm.OleControl1.LabelText = City SKIP ENDDO

WITH ThisForm.OleControl1 .ThisSet = 1 .GraphType = 4 .DrawMode = 2 .Visible = .T.      ENDWITH </li> Run the form and click the command button.</li></ol>

<div class="references_section">