Simple to Use, Yet Powerful Graphics Classes
Environment: [VC6, NT4 SP5, Windows 95b/98]
In engineering applications it is necessary to have some graphics functions which can draw graphics using dynamic engineering data. The following simple classes provide such functions which have been implemented using SDK rather than MFC.
Features
- Linear and logarithmic Cartesian coordinate system
- 11 types of symbolic markers
- 6 types of bar and pie shapes
- Support Memory Device Context drawing
- Support printing
- Any direction text alignment and output
You are free to use or modify these classes and to use them in any of your applications. But I make no guarantees about these classes suitability for use. If there is any problem with anything I wrote, I will certainly try to help solve it.
Source Code
- Graphics.h and Graphics.cpp: property definition and drawing framework description.
- Scatter.h: template based class to implement the simplest plot under the linear and logarithmic Cartesian coordinate system .
- BarLine.h and Pie.h: template based classes to implement the simplest chart.
Demo Project
The GRDemo, which is an MFC MDI application, demonstrates how to use classes mentioned above. It uses two DocTemplates and two views (one is CScrollView and the other is CView).
The former view shows some features of CLinear, CXLogYLinear, CXLinearYLog, and CXlogYlog classes. From the File menu, you can test open this view, print preview, and print the map. From the Map menu, you can select one map, two maps, or four maps with a view. From the Type menu, you can select linear, or logarithmic coordinate system. The Property menu includes grid, boundary, legend, title, memory drawing, and back color properties. The Zoom menu demonstrates rectangle and random zoom in, fixed scale zoom in or out (+ or -), and drag maps (two scrollbars move at the same time).
The latter view shows some features of CBarLine and CPie classes, It only displays one map in each view and no scroll capability.
CRealTime class uses some complex algorithms and will be demonstrated in RTDemo project.
About the Author
I am a senior software engineer for TechComm Simulation Pty Ltd., Sydney, Australia, where I specialize in Client/Server and TCP/IP programming on Unix and Windows NT. My e-mail address is yuantuh@techsim.com.au.
Downloads
Download demo project - 47 KbDownload source - 16 Kb

Comments