Creating a Graph

hi all,

i want to create a grapg dynamically getting the values from a file..
take for example the first row is the x axis and the second row is the
y axis. i am planning to do this in mfc. what needs to be done for
this.. if somebody has an example relating this please send me the
link or the code.. thanks
0
manadiar (4)
3/7/2008 2:38:38 AM
vc.mfc 33608 articles. 0 followers. Follow

5 Replies
532 Views

Similar Articles

[PageSpeed] 6

Read the data. Plot it.

First, you have to read the data.  You read the data and build an array of <x,y> pairs in
whatever way you want to save them, e.g., int, float, double.  This is pretty elementary
programming.

To do a graph in a very fancy way, you should use an existing graphing package; if it is a
serious product, buy something like GigaSoft's graph package.  You cannot reproduce a
fraction of its capability for the purchase price.

If it is a quick knock-off project for which you need a simple graph, just convert the
data to an array of CPoint/POINT values and call PolyLine on the array.  The rest is
figuring out how to draw the various lines of the graph, and that isn't too hard.  To do
this, you can simply subclass CStatic and do all your drawing in the OnPaint handler.
There are examples of doing this in my Asynch Explorer project (which does X-Y scatter
plots and a logarithmic graph), and if you've never done something like this, you might
want to download that code and study it.
					joe

On Thu, 6 Mar 2008 18:38:38 -0800 (PST), chandru080 <manadiar@gmail.com> wrote:

>hi all,
>
>i want to create a grapg dynamically getting the values from a file..
>take for example the first row is the x axis and the second row is the
>y axis. i am planning to do this in mfc. what needs to be done for
>this.. if somebody has an example relating this please send me the
>link or the code.. thanks
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)
3/7/2008 8:23:51 AM
On Mar 7, 1:23 pm, Joseph M. Newcomer <newco...@flounder.com> wrote:
> Read the data. Plot it.
>
> First, you have to read the data.  You read the data and build an array of <x,y> pairs in
> whatever way you want to save them, e.g., int, float, double.  This is pretty elementary
> programming.
>
> To do a graph in a very fancy way, you should use an existing graphing package; if it is a
> serious product, buy something like GigaSoft's graph package.  You cannot reproduce a
> fraction of its capability for the purchase price.
>
> If it is a quick knock-off project for which you need a simple graph, just convert the
> data to an array of CPoint/POINT values and call PolyLine on the array.  The rest is
> figuring out how to draw the various lines of the graph, and that isn't too hard.  To do
> this, you can simply subclass CStatic and do all your drawing in the OnPaint handler.
> There are examples of doing this in my Asynch Explorer project (which does X-Y scatter
> plots and a logarithmic graph), and if you've never done something like this, you might
> want to download that code and study it.
>                                         joe
>
> On Thu, 6 Mar 2008 18:38:38 -0800 (PST), chandru080 <manad...@gmail.com> wrote:
> >hi all,
>
> >i want to create a grapg dynamically getting the values from a file..
> >take for example the first row is the x axis and the second row is the
> >y axis. i am planning to do this in mfc. what needs to be done for
> >this.. if somebody has an example relating this please send me the
> >link or the code.. thanks
>
> Joseph M. Newcomer [MVP]
> email: newco...@flounder.com
> Web:http://www.flounder.com
> MVP Tips:http://www.flounder.com/mvp_tips.htm

hi.. thanks for the valuable information.. now i would want to
download some of the code so that i can go thru it.. now can u provide
some sites where there are programs relating to graphs..
0
manadiar (4)
3/9/2008 10:04:13 AM
Hi,

Take a look at www.gigasoft.com

Downloading the evaluation will contain a large VC/ MFC example project. 
Containing PeView.CPP which holds all the code.

You can also see simple hello-app example code at...
http://www.gigasoft.com/chartinglibrary.html

When looking at the online or local documentation, see the Reference, 
Alphabetic Listing, Functions to find the DLL function calls.

best regards,

Robert Dede
Gigasoft, Inc.



"chandru080" <manadiar@gmail.com> wrote in message 
news:5b95f722-6a30-4905-916f-18ed97ae0d46@e25g2000prg.googlegroups.com...
> hi all,
>
> i want to create a grapg dynamically getting the values from a file..
> take for example the first row is the x axis and the second row is the
> y axis. i am planning to do this in mfc. what needs to be done for
> this.. if somebody has an example relating this please send me the
> link or the code.. thanks 


0
robert8450 (10)
3/9/2008 6:24:38 PM
I already pointed you to my code, which is on my MVP Tips site.  Really simplistic
graphing.  Better code can be found in places like www.codeproject.com.
					joe

On Sun, 9 Mar 2008 03:04:13 -0700 (PDT), chandru080 <manadiar@gmail.com> wrote:

>On Mar 7, 1:23 pm, Joseph M. Newcomer <newco...@flounder.com> wrote:
>> Read the data. Plot it.
>>
>> First, you have to read the data.  You read the data and build an array of <x,y> pairs in
>> whatever way you want to save them, e.g., int, float, double.  This is pretty elementary
>> programming.
>>
>> To do a graph in a very fancy way, you should use an existing graphing package; if it is a
>> serious product, buy something like GigaSoft's graph package.  You cannot reproduce a
>> fraction of its capability for the purchase price.
>>
>> If it is a quick knock-off project for which you need a simple graph, just convert the
>> data to an array of CPoint/POINT values and call PolyLine on the array.  The rest is
>> figuring out how to draw the various lines of the graph, and that isn't too hard.  To do
>> this, you can simply subclass CStatic and do all your drawing in the OnPaint handler.
>> There are examples of doing this in my Asynch Explorer project (which does X-Y scatter
>> plots and a logarithmic graph), and if you've never done something like this, you might
>> want to download that code and study it.
>>                                         joe
>>
>> On Thu, 6 Mar 2008 18:38:38 -0800 (PST), chandru080 <manad...@gmail.com> wrote:
>> >hi all,
>>
>> >i want to create a grapg dynamically getting the values from a file..
>> >take for example the first row is the x axis and the second row is the
>> >y axis. i am planning to do this in mfc. what needs to be done for
>> >this.. if somebody has an example relating this please send me the
>> >link or the code.. thanks
>>
>> Joseph M. Newcomer [MVP]
>> email: newco...@flounder.com
>> Web:http://www.flounder.com
>> MVP Tips:http://www.flounder.com/mvp_tips.htm
>
>hi.. thanks for the valuable information.. now i would want to
>download some of the code so that i can go thru it.. now can u provide
>some sites where there are programs relating to graphs..
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)
3/9/2008 6:25:33 PM
We have used the gigasoft package in products.  It is sometimes a bit hard to figure out
all the features and exactly how to use them, because it is very feature-rich, but it is
one of the most thoroughly "designed" pieces of software I've used in a long time.  We
have not found a feature we needed that wasn't there!  In one app, we are doing real-time
graphical displays of data, with "rewriting" (sort of like medical monitors, although the
application is not medical-related) and it didn't take all that long to figure out how to
make something this sophisticated work.  We have linear and logarithmic display modes,
etc.  We are very happy with the package.
					joe

On Sun, 9 Mar 2008 13:24:38 -0500, "Gigasoft" <robert@gigasoft.com> wrote:

>Hi,
>
>Take a look at www.gigasoft.com
>
>Downloading the evaluation will contain a large VC/ MFC example project. 
>Containing PeView.CPP which holds all the code.
>
>You can also see simple hello-app example code at...
>http://www.gigasoft.com/chartinglibrary.html
>
>When looking at the online or local documentation, see the Reference, 
>Alphabetic Listing, Functions to find the DLL function calls.
>
>best regards,
>
>Robert Dede
>Gigasoft, Inc.
>
>
>
>"chandru080" <manadiar@gmail.com> wrote in message 
>news:5b95f722-6a30-4905-916f-18ed97ae0d46@e25g2000prg.googlegroups.com...
>> hi all,
>>
>> i want to create a grapg dynamically getting the values from a file..
>> take for example the first row is the x axis and the second row is the
>> y axis. i am planning to do this in mfc. what needs to be done for
>> this.. if somebody has an example relating this please send me the
>> link or the code.. thanks 
>
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)
3/10/2008 1:26:44 PM
Reply:

Similar Artilces:

Permissions when creating new users in AD
When we had out Exchange 2003 setup, when you added a new user it would automatically make permissions for: Administrator ANONYMOUS LOGIN - (read only) Domain Admins Domain Users Enterprise Admins Everyone - (read only) Exchange Domain Servers MYSERVERNAMEHERE$ SBS Mail Operators Self But now when I add a new user it only creates: Self Not sure what happened, where do I go to set this at? Thanks -Matt You don't (and shouldn't) have to do anything. This is the default. Give it some time, once the mailbox is accessed, the correct permissions will be set. "Custom GT" w...

In creating a spreadsheet how can I lock a formula cell only?
I am trying to create a spreadsheet in Excell and want to lock the formula cells to they cannot be typed over accidently destroying the function?? Bob By default all cells are locked when the sheet is protected. Hit CRTL + A(twice if xl2003) then Format>Cells>Protection. Uncheck "locked" and OK. Select the cells you wish to lock and Format>Cells>Protection. Check "locked" and OK. Now Tools>Protection>Protect Sheet. This is mandatory!! You can set a password to unprotect. These can easily be broken in Excel but will keep your formulas from being ...

Creating new form instance in Access 2003 SP3
I have had a database working for 3 years that creates multiple instances of a main data form. It uses the idea of: Dim frm as Form set frm = new Form_frmCall and then add the form reference to a collection to keep it active. It worked until SP3. Now the Set statement fails with error 2950, Reserved Error. Is this functionality going away? Thanks, Kevin, I'm not seeing that problem. The sample database in this page still works in A2003 SP3: http://allenbrowne.com/ser-35.html -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrown...

How to create an email in a client's default mail client
Hi I need to create and send an email using MAPI that works when the client is using outlook express, or a variety of versions of outlook. I think this code will work with a variety of outlook versions, but it doesn't work with outlook express What do I need to do differently to work with Outlook Express and Outlook? -------------- Code Snippet Set oApp = CreateObject("Outlook.Application") Set oOutbox = oApp.GetNamespace("MAPI").GetDefaultFolder(4) '4 = olFolderOutbox enum value Set oEmail = oApp.CreateItem(0) '0 - olMailItem enum va...

CDialog::Create() changes foreground window
Hi In my dialog based application I must create a modeless, invisible window: class CDummyDlg : public CDialog { // (...) }; BOOL CApp::InitInstance() { // (...) InitCommonControls(); this->TBase::InitInstance(); CDummyDlg * m_dummy_dlg; this->m_dummy_dlg = new CDummyDlg(); this->m_dummy_dlg->Create(IDD); this->m_pMainWnd = this->m_dummy_dlg; // (...) } Unfortunately the CDialog::Create() method somehow changes the foreground window from, for example: Total Commander or MS Visual Studio, or any other program, starting...

Can't create a new user with a mail box automatically with Active Dir
I have 2003 server with Active Directory and Exchange installed. When i click Create -> "User" and reach the dialog to create an Exchange mail box, the "Mailbox Store" drop down list is empty. Which has the effect that the "Next" button is disabled and I can't create a mailbox attached to that account. Where can I find that setting or what should I do? Thanks in advance /Mac Does the account you are logged in with have the rights on the Exchange server, if you have Administrative Groups the account will need at least View Only rights on the Admini...

creating pushable buttons
I wish to create a simple table where for ten different fields of information the user will have 5 choices of answer that can be selected by pushing a button labeled with the correct answer. I have seen many forms that use this type of button but have no clue what the process is. If someone can tell me some basics of how this is done or knows of a good reference it will be much appreciated. After putting a button on to a worksheet you assign a macro to run when it is clicked. REgards BrianB ============================================== "CK" <dodge54@shaw.ca> wrote in me...

Creating Chapters for Book (Word 2007)
I want to create a book using Word 2007 that mets the following criteria: 1. Each new hard page creates a caption, preformed and ready to be included in a table of contents. 2. I want to have subchapters which I can insert wherever I want them. 3. All of this has to be preformatted for a table of contents. How is this done? Use the Heading 1 style for your captions. Add "Page break before" to the Heading 1 style (and modify the font and paragraph formatting as desired). Instead of inserting a manual page break, apply the Heading 1 style to the next parag...

Creating some sort of control by MFC. Problems
Hi there. I need to implement following: In my main project I have a tab control which has few tabs. On that tab there are some windows where different modules of my application are implemented. Now I need to make some sort of license program where depending of some conditions users will be able to use different modules. Also I would like to implement module's window design and logic in separated DLL so I will be able to modify modules without recompiling main program. I'm using MFC for my main project. Currently the best solutions which I see is to create a MFC DLL and make a d...

How to create a new Administrative Group to archive mailboxes
I read recently that a user created a second Administrative group to store his archived mailboxes. I think this is a great idea, however as a newbie I'm not sure of the best way to go about doing this. I've been able to create the group, but I'm sure there are best practices on what servers to put there and why. Has anyone done this before? -- Sandy Wood Orange County District Attorney you don't store anything in an administrative group...AGs contain mailbox stores...I don't know why anyone would want to move unused/disabled mailboxes to another mailbox store...is tha...

Problem with creating user-only Start menu shortcuts in Vista
I have a problem which shows only on Windows Vista (Business Edition). I try to create programmatically (by using a well described method involving IShellLink and IPersistFile interfaces, and the appropriate interface methods) a sub-folder and several shortcuts for an individual user in the <Start menu/Programs> folder , but the shortcuts 'mysteriously' end up in the all users <Start menu/Programs> folder. To be more precise, the shortcuts should be created in: C:\Users\username\AppData\Roaming\Microsoft\Windows\Start Menu \Programs \ProductName\ but instead they end up i...

How to do a work graph in MS Excel?
How do give single letters numerical equivalent? (MS Excel) im trying to do a work graph. I have filled some cols and rows like that Example: | Date | | Date | | Date | | Date | {etc} |Working hours Name 1.th june 2.th june 3.th june 4.th june {etc} | Peter J J G - | as in example J means 8 working hours, G means 6 working hours and - means a day off. At the end should be some formula which sums all the working days to exact hours...

Probability Graph
Hello, I am trying to create a probability graph. On the x-axis, I would like to have days (365 days). The Y-axis would represent a volume of liquid (from 0.4 to 32.0L). This water is shipped to a location every 6 days. The water comes either in 0.4 L, 23.5 L or 32.0 L per shipment. How would you construct a graph that would visually show this knowing also that you can only have two consecutive shipments of the same quantity (ie. Shipment 1=0.4, shipment 2=0.4 but shipment 3 could not equal 0.4). Thanks so much for your help Have you tried using the data analysis component of Exc...

Create a Virtual Directroy in IIS through .net Remoting
Hi All, I am new in Remoting & Windows ,actual till now i had only work in Web,recentelly i change my job so i have to work on Windows.Now i have one query... I have to make a application in that Create a Virtual Directroy in IIS Through Remoting or WCF..and after that we will able to update this virtual directory Properties..So can you tell me or guide how can i'll prepare for that..Please i'll heartly thankfull to you.... Regards: Gourav Vishnoi 91-9871157845 (M) ...

Categories: Creating and managing (Outlook 2007)
Where is the Master Category List in Outlook 2007? How do I add a category to the Master Category List? Once added, I presume that I can assign items using the Categorize button, right? click the category button - it's the icon with 4 different color squares. Choose all categories at the very bottom. -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com Outlook Tips by email: dailytips-subscribe-request@lists.outlooktips.net EMO - a weekly newsletter about Outlook and Exchange: EMO-NEWSLETTER-...

Create an input form
I'd like to create a form (input screen) where Year and Month (Fiscal Year & Fiscal Period) represent Column headers, and various codes would represent rows. The user would input data in the intersection of the row and column. The input data would then pull other data and calculate. For example a user would enter hours on the row for a particular labor rate and the form would self populate the matematical result for hours multiplied by the labor rate to come up with an amount for the Fiscal Year and Fiscal period) Later I'd like to generate reports by different criteri...

Access 2007... create Form and Form design
Hi, Though apperant.. just curious to ask... In Access 2007 ... in create there is form which creates form based on .. Table on spot... and you design form with form design .. by adding fileds.... form desing by form ... making it in design mode.. and trying to rearrange fileds... I am not able to do is it.. normal.. or do i have something not right in my access.. ( i mean any corruption ) Office 2007 Prof.. edition thanks in advance appreciate response ...

Create a mask from transparent PNG
Hi, I would like to know how I can create a mask image from a transparent PNG. So I have a source image in PNG format and I would like to create a 1 bpp image with the transparent color set to white and the rest is in black. Thanks Read the PNG file into a bitmap Identify the transparent color Create a monochrome bitmap of the right dimensions Iterate over the bitmap, setting the pixels in the monochrome bitmap I don't know PNG format so I don't know how to find the transparent color, but the format is well-documented. joe On Fri, 07 Dec 2007 14:18:34 +0100, mosfet <john....

How do I create a dropcap?
I would like to create a dropcap in MS-Publisher, How do I go about that? I'm not sure what you mean by "dropcap" but give this a look ans see if it is what you want. Select you text box, select Format, Font, under the Effects area, select "Small cap". -- Don Vancouver, USA "Bheka" <Bheka@discussions.microsoft.com> wrote in message news:304F62A7-FE43-49C2-9F50-26710D798DFC@microsoft.com... >I would like to create a dropcap in MS-Publisher, How do I go about that? Help works good. Type Drop Cap in Help and get this: Add a dropped capita...

Creating a Rule in Outlook to Automatically Pair replys
Hi guys, Not sure if this is the right place but im trying to create a rule for outlook at work so that it automatically pairs sent emails with replys and moves them to a specific folder in outlook. Now all emails get sent to a shared email address and then we each take turns (a week each) replying to the ones we get so im thinking the best way to do this is if its possible to have a macro that automatically can do this? instead of pairing up my emails with replys all the time, even though i could just click subject and then select the ones i want this is very time consuming as ...

Sliding dates on a graph?
I have created stacked column graphs using the OFFSET function to automatically update when each week's information is added to the worksheet. However, now my boss want's only the last 4-6 weeks of information to be displayed on the graph. Is there a way to do this without manually changing each data point (there are 6 for each week for each chart--YIKES) every week? Thank you for your time, Dee I found it! http://www.peltiertech.com/Excel/Charts/DynamicLast12.html "Dee Sperling" <sperling@infimed.com> wrote in message news:uE$hZxiLFHA.3064@TK2MSFTNGP12.phx.gbl....

How do I join graphs together in Excel?
I have two graphs drawn in excel, the x-axises are slightly different, is there a way i can join these two graphs together Depends on what chart type they are. If they're both XY: select one chart, copy, select the other chart, Edit menu > Paste Special > Formulas. This puts the data from the copied chart into the pasted chart. If they are column/line/area types, the X axes are connected with the first series in the chart, so there may be more complicated steps you need to take. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Sol...

Create a report from different files
I need to create a report from several files with different names but from the same cells in each file and paste them into a new file with the information in specific locations and then calculate for totals etc... How do I direct Excel to get the information? There may be a changing umber of files but they will always be in the same folder. Tom Tom, What version of Excel do you work with? "Tom Velnosky" wrote: > I need to create a report from several files with different names but from > the same cells in each file and paste them into a new file with the > informa...

creating browse info
I'm curious to know why my who machine locks up during a "creating browse info" step of the compilation. It can take three seconds during which time the mouse won't move, and other applications are frozen. I'm happy enough to have the browse info generated, but it's like it's thunking down to some primitive ancient Windows 2 piece of code that disables interrupts. Is it just me who observes this, can't see anything mentioned on dejanews. This is vis C 6 by the way. Geoff. Geoff Phillips wrote: > I'm curious to know why my who machine locks up ...

Creating .NET UML Classes
Hello, I've just started using Visio For Enterprise Architects (SP2) - I believe it's Visio 2003 version, because whilst it doesn't say it anywhere clearly, that's when the copyright message runs up to. My problem is that I've been development classes/interfaces, etc for a new (2005) DotNet project and I'm stuck as to how I can include the .NET system classes. The UML stencil that comes with Visio has the basic data type defined for C#, but I can't see how to reference system namespace classes. If I want to pass a StringBuilder object my only options so far...