Click here to Skip to main content
12,700,201 members (35,135 online)
Click here to Skip to main content
Add your own
alternative version


102 bookmarked

GraphFX - A graph framework

, 9 Nov 2000
Rate this:
Please Sign up or sign in to vote.
A Doc/View framework for displaying graphical data
<!-- Download Links -->
  • Download demo project - 192 Kb
  • <!-- Article image -->

    Sample Image - graphfx.gif


    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.


    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.


    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


    About the Author

    Software Developer (Senior) Software Kinetics
    United Kingdom United Kingdom

    Software Kinetics
    are experts in developing customised and bespoke applications and have expertise in the development of desktop, mobile and internet applications on Windows.

    We specialise in:

    • User Interface Design

    • Desktop Development

    • Windows Phone Development

    • Windows Presentation Framework

    • Windows Forms

    • Windows Communication Framework

    • Windows Services

    • Network Applications

    • Database Applications

    • Web Development

    • Web Services

    • Silverlight


    Visit Software Kinetics

    You may also be interested in...

    Comments and Discussions

    GeneralMy vote of 1 Pin
    Sheetal_Joshi8-Dec-09 7:03
    memberSheetal_Joshi8-Dec-09 7:03 
    GeneralMy vote of 1 Pin
    Ryleigh27-Mar-09 8:38
    memberRyleigh27-Mar-09 8:38 
    GeneralRe: My vote of 1 Pin
    Norm .net20-May-09 5:46
    groupNorm .net20-May-09 5:46 
    QuestionGreat work it is freeware? Pin
    asfur19-Sep-06 11:17
    memberasfur19-Sep-06 11:17 
    QuestionHow to Use CItem? Pin
    zy76056-Apr-06 1:16
    memberzy76056-Apr-06 1:16 
    GeneralI want a professonal Graph Dispaly wit Pin
    vikas4117911-Aug-05 0:34
    membervikas4117911-Aug-05 0:34 
    QuestionHow myItem input to pItem?? Pin
    Byung_Hun13-Jul-05 22:21
    sussByung_Hun13-Jul-05 22:21 
    AnswerRe: How myItem input to pItem?? Pin
    AremSn27-Jan-12 6:19
    memberAremSn27-Jan-12 6:19 
    GeneralToolTip problem in &quot;New&quot; or &quot;Open&quot; Pin
    kiukeluke21-Feb-05 6:31
    memberkiukeluke21-Feb-05 6:31 
    GeneralRe: ToolTip problem in &quot;New&quot; or &quot;Open&quot; Pin
    DayDayDayu19-Apr-05 15:38
    memberDayDayDayu19-Apr-05 15:38 
    QuestionHow to click row data Seperately? Pin
    pubududilena3-Nov-04 18:01
    memberpubududilena3-Nov-04 18:01 
    Questionthe green line? Pin
    Mike200221-May-04 7:03
    memberMike200221-May-04 7:03 
    AnswerRe: the green line? Pin
    DayDayDayu19-Apr-05 3:58
    memberDayDayDayu19-Apr-05 3:58 
    GeneralRe: the green line? Pin
    DayDayDayu19-Apr-05 17:40
    memberDayDayDayu19-Apr-05 17:40 
    AnswerRe: the green line? Pin
    Transaxle23-Feb-07 8:07
    memberTransaxle23-Feb-07 8:07 
    GeneralExcellent job! Pin
    Allenwei26-Dec-02 21:43
    memberAllenwei26-Dec-02 21:43 
    GeneralOk, Cool ! Pin
    Behzad Ebrahimi3-Dec-02 1:53
    memberBehzad Ebrahimi3-Dec-02 1:53 
    GeneralIs this only for SDI projects Pin
    Jose Cruz14-Oct-02 11:38
    memberJose Cruz14-Oct-02 11:38 
    GeneralRe: Is this only for SDI projects Pin
    Anonymous16-Oct-02 4:29
    sussAnonymous16-Oct-02 4:29 
    GeneralDear Norm Pin
    mohammadsh5-Oct-02 19:46
    membermohammadsh5-Oct-02 19:46 
    GeneralNice Pin
    Jon Sagara26-Sep-01 22:49
    memberJon Sagara26-Sep-01 22:49 
    QuestionHow to implement a line graph using MFC Pin
    Keegan13-Aug-01 6:28
    memberKeegan13-Aug-01 6:28 
    AnswerRe: How to implement a line graph using MFC Pin
    Norm Almond18-Sep-01 23:18
    memberNorm Almond18-Sep-01 23:18 
    AnswerRe: How to implement a line graph using MFC Pin
    shani_pk6-Sep-04 12:06
    membershani_pk6-Sep-04 12:06 
    AnswerRe: How to implement a line graph using MFC Pin
    vikas4117911-Aug-05 2:31
    membervikas4117911-Aug-05 2:31 
    AnswerHow to implement a graph(Gaussian Curve) using MFC Pin
    Ritesh Karkele24-Aug-05 20:03
    memberRitesh Karkele24-Aug-05 20:03 
    GeneralDoesnt work on docking window tab ctrl ! Pin
    vincent leong10-Jul-01 18:08
    membervincent leong10-Jul-01 18:08 
    GeneralProblem first time I use it. Pin
    Erich J. Ruth23-Feb-01 15:30
    memberErich J. Ruth23-Feb-01 15:30 
    GeneralUpdate Item Pin
    Darren Schroeder11-Nov-00 5:22
    memberDarren Schroeder11-Nov-00 5:22 
    GeneralRe: Update Item Pin
    Daniel Madden13-Nov-00 19:21
    memberDaniel Madden13-Nov-00 19:21 
    GeneralProblem... Pin
    Joseph Dempsey9-Nov-00 16:32
    memberJoseph Dempsey9-Nov-00 16:32 
    GeneralRe: Problem... Pin
    Norm Almond9-Nov-00 22:28
    memberNorm Almond9-Nov-00 22:28 
    GeneralAsk, and you shall receive! Pin
    Daniel Madden8-Nov-00 7:45
    memberDaniel Madden8-Nov-00 7:45 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    | Advertise | Privacy | Terms of Use | Mobile
    Web01 | 2.8.170118.1 | Last Updated 10 Nov 2000
    Article Copyright 2000 by NormDroid
    Everything else Copyright © CodeProject, 1999-2017
    Layout: fixed | fluid