Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

GraphFX - A graph framework

0.00/5 (No votes)
9 Nov 2000 1  
A Doc/View framework for displaying graphical data
  • Download demo project - 192 Kb
  • Sample Image - graphfx.gif

    Background

    The following code is based on a application I wrote to monitor Processes and Threads. I visually displayed the CPU percentages against processes/threads running on a Windows system.

    When I released the application to Code Project, many people contacted via email for either the code to do the drawing or the code to enumerate the processes. Well this is step one, the drawing code.

    Implemention

    To implement the CGraphFX frameworks, include GraphFX.h, GraphFX.cpp, Screen.h, Screen.cpp, ItemArray.h, ItemArray.cpp, Item.h and Item.cpp to your project.

    GraphFX.h, GraphFX.cpp, Screen.h, and Screen.cpp implement the View and Drawing code.

    The screen class is responsible for drawing the screen (as the name suggests) the drawing code for the bars text etc, is found in CItem (each item is responsible for drawing itself).

    Next add the view header file to your projects view header file

    #include "GraphViewFX.h"

    Then derive your view from CGraphViewFX.

    class CGraphView : public CGraphViewFX
    

    Nice and easy!

    ItemArray.h, ItemArray.cpp and there names states, is a container for the CItem objects.

    Item.h and Item.cpp contain the numerical information. 

    I've set my own array of items to show as example.

    The OnDraw function in your own view must call the CGraphViewFX::OnDraw base class implentation first - see code.

    The CGraphFX class is responsible for Scrolling, Drawing and Hit-testing the items on the page - see code.

    You can add your own functionality to CItem to expand on what I have created here, ideally CItem would be a base class.

    That's it - I hope you like.

    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here