CGraph - Graph Class for Plotting Groups of Data
Have you ever tried to find a usable graph and chart class for plotting groups of data? I have. And when trying to find some cheap or free classes for plotting graph data, I found very few.
So, here's my version of graph plotting : CGraph
Here's what it looks like during implementation :
I created a test application (testdraw) and used a menu option to show the 3 types of graphs created by my CGraph class and its helper classes (CGraphLegend, CGraphSeries).
A bar chart (I used bowling-type scores for the values).
A pie graph , allowing multiple pies for simultaneous comparisons.
Since some people like to put graphs in a dialog , I did that too.
New in version 2 is the ability to print. Here's a print preview:
It also allows printing for line and pie graphs as well.
In the sample program, I have attempted to use every command in the CGraph and other classes. To use the classes, include them in your project and at the top of the file using them. To build a simple graph, follow these guidelines :
1. Create a graph object. You can pass a parameter for graph type if desired. 2. Set your graph type, if not done in step 1. 0 - bar graph(default) 1 - line graph 2 - pie graph 3. Create a legend object. Use the SetLegend function in the CGraph to add it to the graph. 4. Create a set of series / data groups. Use the AddSeries function in the CGraph to add them to the graph. 5. Perform an Invalidate ... this will force your OnDraw function to execute. 6. In the OnDraw function, do a graph->DrawGraph(pDC); to draw the graph.
I have attempted to provide a fairly detailed help file for use with these classes. If not sufficient, mail me and let me know what I can do to improve it.
DownloadsDownload demo application - 151 Kb
Download CGraph, CGraphLegend, and CGraphSeries classes - 118 Kb (includes help file)
HTML Help - Required to use the help files (and IE 3.0 is also required)
If using Visual Studio 6, you probably have this installed already, though you may want this newer version.
HistoryDate Posted: February 11. 2000
Date Last Updated: August 20, 2000