Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

C++ function for plotting a graph

Status
Not open for further replies.

C++

Junior Member level 3
Joined
Oct 12, 2004
Messages
29
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
243
Given a set of X & Y coordinates, is there a function in C++ or a DLL which can plot a graph into an image or something that the program can store externally?
 

graph c++

This board is not the best palace to learn C++ from the beginning. Try with Stroustrup's book and some book related to programming graphic for Windows

Tom
 

how to make a graph in c++

Use the canvas class
 

gnuplot c api

I presume you're working in a Windows enviroment, you could use GDI/GDI+ from the Windows API, GDI/GDI+ can be called from C/C++. Here's an example of a plotter on screen using C# (this can be translated to either C or C++). **broken link removed**
The graph could then be saved to a BMP or a WMF, you'd have to look up how to do that with the Windows API.

Also have a look at this: **broken link removed**

Or if you're only interested in output of a graph

What you could do is bundle GNUPlot with your program and make it silently invoke GNUPlot to create your desired output. To download GNUPlot go to http://www.gnuplot.info.

Have a look here on some discussion on how to do it from C++: **broken link removed**

You can make GNUPlot output a graph to a bitmap like a PNG, BMP or even Postscript.

- Jayson
 

    C++

    Points: 2
    Helpful Answer Positive Rating
create graph c++

Jayson said:
I presume you're working in a Windows enviroment, you could use GDI/GDI+ from the Windows API, GDI/GDI+ can be called from C/C++. Here's an example of a plotter on screen using C# (this can be translated to either C or C++). **broken link removed**
The graph could then be saved to a BMP or a WMF, you'd have to look up how to do that with the Windows API.

Also have a look at this: **broken link removed**

Or if you're only interested in output of a graph

What you could do is bundle GNUPlot with your program and make it silently invoke GNUPlot to create your desired output. To download GNUPlot go to http://www.gnuplot.info.

Have a look here on some discussion on how to do it from C++: **broken link removed**

You can make GNUPlot output a graph to a bitmap like a PNG, BMP or even Postscript.

- Jayson

Thanks for the info

I checked out all the links and the GNUPlot seems the most useful one for what I'm trying to do...

I downloaded GNU plot, but it doesnt run under windows. I made sure it's the windows version I'm downloading, but still, it gives linux related errors
 
Last edited by a moderator:

gnuplot visual c++

The one for windows is ftp://ftp.gnuplot.info/pub/gnuplot/gp400win32.zip, it comes with a Windows based GUI. Version 3.7.3 also had a DOS version which was command line only.

GNUPlot accepts commands, it has its own prompt, or a script of command.

- Jayson
 

visual c gnuplot

tom324 said:
This board is not the best palace to learn C++ from the beginning. Try with Stroustrup's book and some book related to programming graphic for Windows

Tom

Thanks for the suggestion . . .

I'm not trying to learn C++, I know C++ very well, fluent in working with classes, and the other standard stuff, it's the fancy stuff I'm not so familiar with
 

create graph in c++

Hello all.
As always, and ever, C++ is just a pain.
If you want to do something usefull like in your case, to make a simple graph and possibly make an image out of it...you will have to waste a lot of time to do it in C++.
If it was Visual Basic or Delphi, there would be millions of examples and you would get it done much faster.
I believe the best way to do this in C++ (visual C++ in windows, or gcc in Linux) is to use wxwidgets.
Please go to the following link and see what people did to try to reduce this pain, take a look in the very good work of wxwindows people at:

https://www.wxwidgets.org

This is a multiplatform library of classes initially designed for GUIs that can do much more today. And it is completely free....
You will find many examples. Among them, examples on how to make graphics, images of many formats like png, bmp, jpg, etc etc...
And if you take care with your software design, i. e., never use any non standard feature that micro$soft will be offering you like routines and variables starting with underscore and also never never using MFC (micro$soft foundation classes), you will be able to make a multiplatform compatible application.....
Hope it helps.
S.
 

making output look good in c++

I agree, C++ is a pain . . . I know that delphi is easy when it comes to doing these kinda stuff, and I've seen lots of examples of delphi and how simple it makes everything....I'm intrested in learning delphi, so if you know a good book that teaches it, let me know (something that stars from zero - complete noob)

but VB . . . I, as most other programmers don't ever consider it a programming language....not really intrested in it either
 

creating chart c++

Hello C++ and the others.
C++, I think your choice for Delphi would not be bad at all. And now Borland is already providing Delphi for Linux, it is surely something good, but unfortunately it is a comercial pakage. That means, to be able to use it you will have to buy a license, etc.....

About VB, don't neglect VB. In many places you may work in the future you will find this compiler available. It may even save "your life" in some cases. Also the leaning curve and the application development time is probably one of the shortest ever, again you will have to pay.....

Another unbelievable curiosity about visual c++, you will find in the introduction of one of the reference books from micro$oft, probably the book from Kruglinsky (one of the best ones around), that the visual c++ learning curve is about "6 months".
When you finish this "learning curve" you will already be in the unemployment since long time. And somebody using one of those easier languages will have done the job at your place and much better.......

But there is something very important you should never forget, one of the best compilers ever, maybe the best of all, is GCC. And it is free, open source, etc...

S.
 

visual c++ gnuplot

You can do C/C++ for free, and Microsoft will even give you the command line compiler. See the Microsoft Visual C++ Toolkit 2003 (http://msdn.microsoft.com/visualc/vctoolkit2003/), its the same compiler which ships with the commercial Visual Studio product. This compiler comes with all the standard C/C++ libraries, stdio, iostream, etc...

To develop windows programs, i.e., #include <windows.h> you simply have to download the Platform SDK (http://www.microsoft.com/msdownload/platformsdk/sdkupdate/). The Platform SDK also comes with all the documentation on every function of the Window 32-bit API.

And if you know how to code in C or C++, then you're all set. To learn how to use the Windows API have a look at: **broken link removed**, http://www.winprog.org/tutorial/ and **broken link removed**. To compile your programs you use cl.exe and to compile resources you use rc.exe.

- Jayson
 

how to make graphs in c++

You might want to check out this graphics library: https://www.boutell.com/gd/ it can save to GIF. This library is utilized in web sites which create dynamic images, etc. Its an ANSI C library, but you can easily use it within a C++ program.

Alternatively you could look at other free libraries at: **broken link removed**

- Jayson
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top