Click here to Skip to main content
Click here to Skip to main content

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

    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

    Share

    About the Author

    NormDroid
    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
    • ASP.net
     
    Visit Software Kinetics
    Follow on   Twitter

    Comments and Discussions

     
    GeneralMy vote of 1 PinmemberSheetal_Joshi8-Dec-09 6:03 
    GeneralMy vote of 1 PinmemberRyleigh27-Mar-09 7:38 
    GeneralRe: My vote of 1 PingroupNorm .net20-May-09 4:46 
    QuestionGreat work it is freeware? Pinmemberasfur19-Sep-06 10:17 
    QuestionHow to Use CItem? Pinmemberzy76056-Apr-06 0:16 
    GeneralI want a professonal Graph Dispaly wit Pinmembervikas4117910-Aug-05 23:34 
    QuestionHow myItem input to pItem?? PinsussByung_Hun13-Jul-05 21:21 
    AnswerRe: How myItem input to pItem?? PinmemberAremSn27-Jan-12 5:19 
    GeneralToolTip problem in &quot;New&quot; or &quot;Open&quot; Pinmemberkiukeluke21-Feb-05 5:31 
    GeneralRe: ToolTip problem in &quot;New&quot; or &quot;Open&quot; PinmemberDayDayDayu19-Apr-05 14:38 
    QuestionHow to click row data Seperately? Pinmemberpubududilena3-Nov-04 17:01 
    Questionthe green line? PinmemberMike200221-May-04 6:03 
    AnswerRe: the green line? PinmemberDayDayDayu19-Apr-05 2:58 
    GeneralRe: the green line? PinmemberDayDayDayu19-Apr-05 16:40 
    AnswerRe: the green line? PinmemberTransaxle23-Feb-07 7:07 
    GeneralExcellent job! PinmemberAllenwei26-Dec-02 20:43 
    GeneralOk, Cool ! PinmemberBehzad Ebrahimi3-Dec-02 0:53 
    GeneralIs this only for SDI projects PinmemberJose Cruz14-Oct-02 10:38 
    GeneralRe: Is this only for SDI projects PinsussAnonymous16-Oct-02 3:29 
    GeneralDear Norm Pinmembermohammadsh5-Oct-02 18:46 
    GeneralNice PinmemberJon Sagara26-Sep-01 21:49 
    QuestionHow to implement a line graph using MFC PinmemberKeegan13-Aug-01 5:28 
    AnswerRe: How to implement a line graph using MFC PinmemberNorm Almond18-Sep-01 22:18 
    AnswerRe: How to implement a line graph using MFC Pinmembershani_pk6-Sep-04 11:06 
    AnswerRe: How to implement a line graph using MFC Pinmembervikas4117911-Aug-05 1:31 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
    Web04 | 2.8.141022.1 | Last Updated 10 Nov 2000
    Article Copyright 2000 by NormDroid
    Everything else Copyright © CodeProject, 1999-2014
    Terms of Service
    Layout: fixed | fluid