Click here to Skip to main content
13,398,451 members (35,062 online)
Click here to Skip to main content
Add your own
alternative version

Stats

27K views
1K downloads
37 bookmarked
Posted 24 Nov 2007

Windows Task Manager Style History Plot

, 24 Nov 2007
Rate this:
Please Sign up or sign in to vote.
Realtime plotting using Windows Task Manager style.

Screenshot - WinTaskManagerHistoryPlotLike.png

Introduction

While working with a Process Control System, I needed to plot various output variables in real time. As Windows Task Manager History is very elegant to me, it has been my inspiration, and I added zooming capability and tooltips message to make it fancier.

Background

I want to give credits to article authors for their articles I used to accomplish this work.

Using the Code

The main class GraphWnd is derived from CWnd so that it can have a standard MFC control signature.

class GraphWnd : public CWnd

You have to plan ahead how many parameters you want to plot and choose their colors on the plots by adding different colors from a predefined enum into a vector while being passed to a GraphWnd class construction.

enum eColor     {
         SOLID_RED,
         LIGHT_RED,
         SOLID_YELLOW,
         LIGHT_YELLOW,
         SOLID_GREEN,
         LIGHT_GREEN,
         SOLID_BLUE,
         LIGHT_BLUE,
         SOLID_BLACK,
         LIGHT_BLACK,
         SOLID_MAGENTA,
         LIGHT_MAGENTA,
         SOLID_CYAN,
         LIGHT_CYAN,
         SOLID_WHITE};

...

GraphWnd(CRect rect,          //Plotting Control location

         CWnd* parent,        //parent control

         vector<ecolor> color)//color and number of parameters to be plotted

The parameters plotting is done through the UpdateGraphe method.

void UpdateGraphe(GraphData<double> data,
        double timeUnit, //the grid width in pixel on X axis

        double valueUnit,//the grid height in pixel on Y axis

        double minValue, //the minimum value expected on Y axis

        double maxValue, //the maximum value expected on Y axis

        string message)  //the tooltip message
  • The structure GraphData<t> data is used to handle the display of as many as parameters you wish.
  • template<T> struct GraphData
    {
        std::vector<T> d;
    };
    

    The plot axis are time axes as X axis and values axis as Y axis.

  • double timeUnit is the grid width in pixel on the X axis.
  • double valueUnit is the grid height in pixel on the Y axis.
  • double minValue is the minimum value expected on the Y axis.
  • double maxValue is the maximum value expected on the Y axis.
  • string message is a tooltip message.

That's all, folks. Please vote after using my article.

History

  • 25-11-2007
    • Original article.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Frederic Ntawiniga
Engineer
Canada Canada
Just programming

You may also be interested in...

Pro
Pro

Comments and Discussions

 
GeneralMy vote of 1 Pin
jackbowman18-May-09 16:19
memberjackbowman18-May-09 16:19 
GeneralRight Margin Runoff Pin
Jeffrey Walton25-Nov-07 0:27
memberJeffrey Walton25-Nov-07 0:27 
GeneralRe: Right Margin Runoff Pin
Frederic Ntawiniga25-Nov-07 6:32
memberFrederic Ntawiniga25-Nov-07 6:32 

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.180216.1 | Last Updated 25 Nov 2007
Article Copyright 2007 by Frederic Ntawiniga
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid