Drawing realtime line graphs

I'm creating an application that will consist of a main view of a 
CMFCListCtrl with multiple CMFCDockablePanes displaying the listed data in a 
line graph format.  I know there isn't a control that does graphs, so I'm 
assuming i will be creating my own.  I have some experience with computer 
graphics using openGL, but thought openGL might have too much of an overhead 
for simple 2D drawings.  

What do you recommend as the base technology of creating my own 2D line graph?

I'm also thinking of placing these graphs within their own views so when the 
list gets updated, the individual views can update their graphs.

Thanks,

Nick


0
4/18/2008 11:05:02 PM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies
694 Views

Similar Articles

[PageSpeed] 32

Nick Schultz wrote:
> I'm creating an application that will consist of a main view of a 
> CMFCListCtrl with multiple CMFCDockablePanes displaying the listed data in a 
> line graph format.  I know there isn't a control that does graphs, so I'm 
> assuming i will be creating my own.  I have some experience with computer 
> graphics using openGL, but thought openGL might have too much of an overhead 
> for simple 2D drawings.  
> 
> What do you recommend as the base technology of creating my own 2D line graph?
> 
> I'm also thinking of placing these graphs within their own views so when the 
> list gets updated, the individual views can update their graphs.
> 
> Thanks,
> 
> Nick

I worked on several 2D GIS projects which relied on OpenGL for rendering 
massive amounts of contouring and realtime elevation data.  It always 
worked great.  I'm wondering what you mean by "too much of an overhead."

-JJ
0
menelaus1 (17)
4/18/2008 11:15:30 PM
I just thought using a 3D graphics library on a simple 2D graph would be 
overkill.  I also would have to redistribute the dll correct?  

"King Menelaus" wrote:

> Nick Schultz wrote:
> > I'm creating an application that will consist of a main view of a 
> > CMFCListCtrl with multiple CMFCDockablePanes displaying the listed data in a 
> > line graph format.  I know there isn't a control that does graphs, so I'm 
> > assuming i will be creating my own.  I have some experience with computer 
> > graphics using openGL, but thought openGL might have too much of an overhead 
> > for simple 2D drawings.  
> > 
> > What do you recommend as the base technology of creating my own 2D line graph?
> > 
> > I'm also thinking of placing these graphs within their own views so when the 
> > list gets updated, the individual views can update their graphs.
> > 
> > Thanks,
> > 
> > Nick
> 
> I worked on several 2D GIS projects which relied on OpenGL for rendering 
> massive amounts of contouring and realtime elevation data.  It always 
> worked great.  I'm wondering what you mean by "too much of an overhead."
> 
> -JJ
> 
0
4/18/2008 11:31:01 PM
It's great for fast 2D, data-heavy work with minimal code.  Windows 
ships with OpenGL and chances are video drivers on most machines 
supersede it.  We never shipped any "extra" DLLs with our apps.

I wouldn't use anything else for high-performance 2D.  But, I'm old. :)

-JJ

Nick Schultz wrote:
> I just thought using a 3D graphics library on a simple 2D graph would be 
> overkill.  I also would have to redistribute the dll correct?  
> 
> "King Menelaus" wrote:
> 
>> Nick Schultz wrote:
>>> I'm creating an application that will consist of a main view of a 
>>> CMFCListCtrl with multiple CMFCDockablePanes displaying the listed data in a 
>>> line graph format.  I know there isn't a control that does graphs, so I'm 
>>> assuming i will be creating my own.  I have some experience with computer 
>>> graphics using openGL, but thought openGL might have too much of an overhead 
>>> for simple 2D drawings.  
>>>
>>> What do you recommend as the base technology of creating my own 2D line graph?
>>>
>>> I'm also thinking of placing these graphs within their own views so when the 
>>> list gets updated, the individual views can update their graphs.
>>>
>>> Thanks,
>>>
>>> Nick
>> I worked on several 2D GIS projects which relied on OpenGL for rendering 
>> massive amounts of contouring and realtime elevation data.  It always 
>> worked great.  I'm wondering what you mean by "too much of an overhead."
>>
>> -JJ
>>
0
menelaus1 (17)
4/19/2008 12:03:33 AM
"Nick Schultz" <NickSchultz@discussions.microsoft.com> wrote in message 
news:9EED6DA7-CBC7-4F9E-9EBD-AC8D8E9FB2B6@microsoft.com...
> I'm creating an application that will consist of a main view of a
> CMFCListCtrl with multiple CMFCDockablePanes displaying the listed data in 
> a
> line graph format.  I know there isn't a control that does graphs, so I'm
> assuming i will be creating my own.  I have some experience with computer
> graphics using openGL, but thought openGL might have too much of an 
> overhead
> for simple 2D drawings.
>
> What do you recommend as the base technology of creating my own 2D line 
> graph?
>
> I'm also thinking of placing these graphs within their own views so when 
> the
> list gets updated, the individual views can update their graphs.


2D line graphs are easy.  You scale the data into an array of points in 
pixel coordinates and then call CDC::Polyline to draw it. If your needs are 
simple there's not much point in using a library.

-- 
Scott McPhillips [VC++ MVP] 

0
Scott
4/19/2008 12:13:07 AM
"Nick Schultz" <NickSchultz@discussions.microsoft.com> ha scritto nel 
messaggio news:E4F4BD53-D74C-4870-B39D-5274AD1A34F2@microsoft.com...
>
> I just thought using a 3D graphics library on a simple 2D graph would be
> overkill.  I also would have to redistribute the dll correct?

Well, it depends on projects, but I would disagree with you for the general 
case.

I mean: you could use the power of 3D hardware accelerated cards also for 
2D, to achieve good-looking effects, like alpha-blending, or antialiasing, 
etc. for your graphs.

For example, I think that modern WPF technology (a modern technology for 
developing GUIs in Windows using managed code) uses 3D hardware acceleration 
(via DirectX/DirectGraphics) also for 2D stuff like 2D plots...

However, for this kind of problems, I think that the best thing for you 
would be to just write some code and test...

But my opinion is that using 3D also for 2D stuff may lead to better 
visualization results, and may be considered as a more long-term quality 
investement.

Just my 2 cents.

BTW: About distributing the DLLs, I think that with Windows XP SP2 and 
Windows Vista you have both DirectX 9 and OpenGL DLLs already available in 
the machine, so I think you don't need special extra efforts for 3D graphics 
DLLs deployment...

Giovanni


0
4/19/2008 12:14:24 AM
There are plenty of examples of graphing software available; check out places like
www.codeproject.com.  A couple of my projects, such as the Thread Affinity Explorer and
the Asynch Explorer, have trivial line-graphing code.

For serious work, products like ProEssentials from www.gigasoft.com work very well.  Saves
re-inventing the wheel.
				joe

On Fri, 18 Apr 2008 20:13:07 -0400, "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp>
wrote:

>"Nick Schultz" <NickSchultz@discussions.microsoft.com> wrote in message 
>news:9EED6DA7-CBC7-4F9E-9EBD-AC8D8E9FB2B6@microsoft.com...
>> I'm creating an application that will consist of a main view of a
>> CMFCListCtrl with multiple CMFCDockablePanes displaying the listed data in 
>> a
>> line graph format.  I know there isn't a control that does graphs, so I'm
>> assuming i will be creating my own.  I have some experience with computer
>> graphics using openGL, but thought openGL might have too much of an 
>> overhead
>> for simple 2D drawings.
>>
>> What do you recommend as the base technology of creating my own 2D line 
>> graph?
>>
>> I'm also thinking of placing these graphs within their own views so when 
>> the
>> list gets updated, the individual views can update their graphs.
>
>
>2D line graphs are easy.  You scale the data into an array of points in 
>pixel coordinates and then call CDC::Polyline to draw it. If your needs are 
>simple there's not much point in using a library.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
4/20/2008 5:41:14 PM
Reply:

Similar Artilces:

auto-fill in address line
How do I get Outlook to auto-fill my addresses Thanks Gail, Go to: Tools, Option, Preferences Tab, E-Mail Options, Advanced E-Mail Aptions and check the box next to "Suggest names when completing To:, Cc:, and Bcc: fields. The autocomplete information isn't stored in a contact folder. It is stored in a separate system file called an NK2 or autocomplete file. That file can be opened using a commercially available editor called Owtlook found at www.dcs-imaging.com/products.htm if you're interested. If the above options are turned on and it still isn't working for you, tr...

command line to open a new windows live desktop note
Hello , I have read many posts including the command line flags notes but cant find a command line option just to open a new note without having to click on new note in the gui ? is there a flag for "C:\Program Files\Windows Live\Mail\wlmail.exe" that will do it ? Thank You What do you mean by opening a new note? Do you mean a new email message? --=20 Gary VanderMolen, Microsoft MVP (Mail) http://mvp.support.microsoft.com/default.aspx/profile/vandermolen "bdfox" <bdfox@discussions.microsoft.com> wrote in message = news:62112F27-83C4-42...

Draw lines not bright enough
Drawing lines on top of a well saturated color photo in OneNote does not produce bright lines. To my eye they should be Neon. See the results of Skitch overlays. Maybe with a slight shadow to get them to stand out. ...

how did I get an indent on the first line of each even numbered p.
I am using a template to format a document. When I apply the template, I get a small indent in the first line of text on every even numbered page. When this coincides with a paragraph break the indent is bigger. It does not happen on the odd numbered pages. I did not intend this and I want to make it go away. The page set up has mirror margins, text is left justified, no tabs spaces or other symbols appear before the word that follows the indent when hidden text is shown. Try selecting Format, Indents and see if this is the control you want. -- Don Vancouver, USA "zi" ...

Problem at drawing 256 color Icons in CListCtrl
Hi, i modify my existing code to draw 256 color icons instead of 16 color. I find here in NG some example, but it does not working correctly: The background color is always white. Can anyone give me a hint? Here is the code (i add more than one bitmap in a loop into the imagelist because more than one column contains icons, it works with 16 color icons perfectly), it is compiled under VC6: for (i = m_iImageColumnCount = 0;i < m_iColumnCount;++i) { int iStartindex = -1; if (m_viImageID[i]) { HBITMAP hBitmap = (HBITMAP)::LoadImage(::AfxGetInstanceHandle(), MAKEINTRESOURCE(m_viIma...

Outlook command line switches?
Hi, does anyone know any *extra* command line switches for outlook? I know all the normal ones about changing directories, and views etc. Im more interested in actually creating a new email with all the fields pre-filled in. for example, i know i can do: outlook /c ipm.note /m me@me.com Which will create a new email message already addressed to me@me.com. But are there switches available for the subject and body? and / or setting it to HTML / plain? Cheers Here is the latest list of switches documented in the Outlook 2003 help file : Switch Description /a Creates an i...

Programatically or command line
Hi, Is there a way programatically or command line to modify relay/connection restrictions on SMTP VS? Matthew Did you try ExIPSec? Programmatic modification of SMTP virtual server access and relay control http://support.microsoft.com/kb/810913 -- Bharat Suneja MVP - Exchange www.zenprise.com NEW blog location: exchangepedia.com/blog ---------------------------------------------- "Matthew M (UK)" <mattee76@newsgroup.nospam> wrote in message news:764618AA-B421-4C4E-B327-F65C4530C841@microsoft.com... > Hi, > > Is there a way programatically or command line t...

autoreply with subject line of incoming email
With Exchange 5.5 and Outlook 2000, if possible, how can I set up a rule so that all messages coming into a public folder get an autoreply, but the autoreply has the subject line of the incoming email? Or does this require programming? ...

How do I update graphs automatically with periodic data updates
I am trying to use a data source of 52 weeks of information that I update on a weekly basis. I can't figure out how to have the graph display blank cells on the graph as blank instead of "0." My graph looks great right up to the first blank cell and then the graph plumets to "0". I would like the graph to just end where the data in the cells ends, and automatically pickup the new information as I enter each week. Infinitejest You seem to be asking two questions: 1) how to have blank cells not plot as 0. 2) how to get chart to automatically "pickup the ne...

Measuring Slope of peak on Excel graph
I have a graph with many peaks which are decreasing and increasing and i need to get the slope of these peaks ignoring the rest which is below these peaks. My graph has many peaks e.g. 50 peaks, each one. What i am trying to do is draw a line through the top of two peaks and then get the slope of this line. Any suggestions? If your chosen 2 peaks are X1,Y1 and X2,Y2, then the slope is =(Y2-Y1)/(X2-X1) -- David Biddulph "Lionel Lin" <Lionel Lin@discussions.microsoft.com> wrote in message news:857749AB-207E-40A9-A883-941E97B4284C@microsoft.com... >I have a graph wi...

How do u set the PLOT AREA to nearest mm in Excel Scatter Graph .
I wish to plot x-y scatter graphs to scale e.g. on a landscape A4 size page. I need the y (vertical) axis to be exactly 99mm long and the x (horizontal) axis to be exactly 240mm long. As I cannot find rulers in Excel I insert the graph in Word and turn on the rulers. I then stretch the “chart area” until the axes are the correct length. This usually works. However, sometimes it does not work e.g. the y axis might be around 20mm too long for no apparent reason but the x axis will be correct. I also notice that if a text box overlaps an axis the length of the axis changes. Is there anot...

Line up cells based on content
Need to know if there is a way to line up cells based on data. e.g in column A I have numbers 1200 through 1300 and the numbers can repeat themselves many of times, this is why sorting will not work. In column B I have the same numbers but in my case I could be missing some number(s), so in column A I may have 1250 listed 20 times and column B may have it listed only 10 times. I need to know if I can line them up to see of I am missing any numbers. See below This is what I have now 1256 1252 1256 1252 1257 1252 1257 1252 1257 1252 1257 1252 1257 1252...

Modify behavior of bi-directional line
I am creating an Active Directory site drawing showing site links. There a many of them and some links go through (visually) other sites. Is it possible to change the behavior of the line so that the site object is on top, i.e., the line passes behind the site object? you might try page setup, routing and layout to see if something works for you. al "Byron Boudreaux" <byronb@frontiernet.net> wrote in message news:%23QBHpRPmFHA.4000@TK2MSFTNGP12.phx.gbl... >I am creating an Active Directory site drawing showing site links. There a >many of them and some links...

blank vs. 0 when plotting a dated timescale graph
Greetings! I have a plot with dates on the x-axis and numbers on the y-axis. I am importing database data into excel in the first tab, and referencing that data in the second tab. The problem I run into is that when the imported cell is blank, the reference in tab 2 displays a 0 value. This presents a problem for my plot, which is auto-scaled on the x-axis. Example case (3x3 table): x values: 03/01/07, 05/01/07, blank cell y values: 50, 30, 20 The blank cell is for a future date that has not transpired. The y- value is known, but the actual date realized is not, until it happens. (1) M...

Can you make a "split" or broken y-axis on a graph in Excel?
Can you make a "split" or broken y-axis on a graph in Excel? Have a look in http://peltiertech.com/ best wishes -- Bernard V Liengme Microsoft Excel MVP www.stfx.ca/people/bliengme remove caps from email "question" <question@discussions.microsoft.com> wrote in message news:5B9F468F-70BF-4698-B285-8129D6B11112@microsoft.com... > Can you make a "split" or broken y-axis on a graph in Excel? Specifically, http://peltiertech.com/Excel/Charts/BrokenYAxis.html - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technica...

Word between lines
Hi, I´m working in Publisher 2003. Can you guys help me out ? I need to changes words between lines, can I do it automatic? So if changes the text I don´t have to go and take all the - (meaning-ful) out. Asa Edit, find... -- Mary Sauer MS MVP http://office.microsoft.com/ http://www.msauer.mvps.org/ news://msnews.microsoft.com "ASA" <ASA@discussions.microsoft.com> wrote in message news:B42A5C3B-822C-4E59-855A-C542697E6B39@microsoft.com... > Hi, I�m working in Publisher 2003. > Can you guys help me out ? I need to changes words between lines, can I do &...

Leave no space if line is blank in mail merge address.
I have some recipients that have 2 lines of address but most have only 1 line. How do I get rid of the line of blank data instead of printing a blank line? Look on the print dialog screen for the option to skip blank lines. -- Ron "KarenABS" <KarenABS@discussions.microsoft.com> wrote in message news:446378C6-9359-4BDA-8AFA-597A0A1B08D4@microsoft.com... >I have some recipients that have 2 lines of address but most have only 1 > line. How do I get rid of the line of blank data instead of printing a > blank > line? Thanks so much. "Ron Cohen" wr...

problem printing dashed lines in graph
Hi, I am having problem in printing charts which has dashed lines. Whenever I make a graph which has dashed line instead of solid line, on the computer screen those lines appears to be dashed but when I print the graph those lines come to be solid. I believe it's bug in excel. I was reading and microsoft suggest installing service pack 3 for the office to get the problem rectified. I installed the service pack but the problem still persists. Can somebody help me if he know the work around with this problem. Prashant [This followup was posted to microsoft.public.excel.charting wi...

Line breaks in email template
We setup an email template and sent a bulk email. It looks fine it most email readers. Hotmail and Windows Live Mail seem to disregard the line breaks we have. Anyone else ever see this problem? Thanks, Jeff Sent a test email as an Activity and went into the activity history and was able to see the html source of the email. It doesn't insert <br> tags when you hit enter in the body of the email template, it uses <p> tags instead. Also, it doesn't envelope the body of the message with <html> and <body> tags. I suspect that Hotmail doesn't properly ren...

Creating a distribution Graph.
How do I build a graph to denote the distribution of the Excel data? Believe it or not, this was our boys 4th grade homework. Tools|Data Analysis|Histogram Requires the Analysis ToolPak Add-in to be loaded. Jerry Steve wrote: > How do I build a graph to denote the distribution of the Excel data? > > Believe it or not, this was our boys 4th grade homework. Thanks for the help. "Jerry W. Lewis" wrote: > Tools|Data Analysis|Histogram > > Requires the Analysis ToolPak Add-in to be loaded. > > Jerry > > Steve wrote: > > > How do I ...

drawing box plots with excel
I have different sets of data and would like to draw box plots (Minimum lower quartile, medium, upper quartile, maximum) to present them. I there any way to do this with excel or do you know another program that might help? Many thanks -- Message posted from http://www.ExcelForum.com do you want to actually plot the box or do u want excel to work out the results for the upper quartile ect? MVP Jon Peltier has some instruction on his site for creating box and whisker charts: http://www.peltiertech.com/Excel/Charts/ComboCharts.html#B oxWhisker HTH Jason Atlanta, GA >-----Original ...

I cannot send a fax from excel, I always get a line busy message.
I am using win xp and I am trying to send a fax with excel. I go to file chose print, pick fax driver and then fax wizard comes up, I enter phone number in wizard and click finish but I always get a line busy message in the fax monitior, can anybody help me. Thanks , Dan ...

Need a special bar graph
Hello, I want to represent the birth and death of several historical figures in a horizontal line graph, given the birth and death dates. For example, consider the following. Pericles, -495 to -429 Socrates – 469 to -439 The graph I have in mind is somewhat like a Gantt chart. The graph techniques that I see in Excel only allow for one point, and always reference zero. What would you suggest for a graph of these? Thank you, Keith Here is my data (I do wish we had a better way of showing data!) born died Pericles -495 -429 Socrates...

line graph drops when zeros
Hello, I have a set of data, basically this years data and last years data broken out by 52 weeks. Of course I have all of last years 52 weeks of data however this year I only have up to 26 weeks. I made a 2 line graph over 52 weeks this year vs. last year. Each cell either has a number or a zero (zero due to no data past this years week 26). Since there are zero's, it drops the line chart to the zero marker on the graph. How do you make it so that the line "just" stops where it see's the zeros. Please note that the cells that are referenced have "SUMIF" fo...

Area under the graph
Dear all, I have a small query but am not able to figure it out, how to go about it. Suppose I have created an XY scatter graph or line graph in excel, (for that matter any graph in excel). The graph can be linear or logarithmic or anything. Is there a way by which I can come to know the area bounded by the curve and the axis. And the area bounded between the two curves. Any help would be highly appreciated. Regards Raj The area under the curve is the integral of the curve. If you know calculus and the formula of the curve then manually integrating the curve will be most accurat...