Stock Charts in C++ - c++

I am trying to create some charts of data (eg http://www.amibroker.com/). Is there a C++ library that can do this without a lot of extra work? I'm thinking Qt or wxWindows would have something like it, but it wasn't immediately obvious.
Thanks!

FLTK is a light and portable C++ toolkit for GUI. There's a chart class. Sample.

Qwt does at least some of the things you are trying to achieve (basic plots, bar charts and so on), and integrates well with Qt.

I think you need to pick your GUI framework first, then find a charting control for the given framework, since that affects what charting controls you could feasibly use. For example, must this be portable?
For the project I'm working on (a large MFC application) we use Cedric Moonen's ChartCtrl. We've had a pretty good experience with it so far.

I've done some graph plotting with gnuplot lately, which is quite powerful. Although I think it is Linux only, which may or may not be a problem.
Also, believe it or not, some amazing things can be done with LaTeX. I've used the tkz (tikz) library to produce some awesome graphs.
Both solutions plot to a file which you can include in your interface.
They aren't C++ libraries but you can easily create the datafiles and call the necessary programs from within your C++ program (Being creative with system() and possible some shell scripts).

Related

gtkmm for desktop application

Is it a good idea to use gtkmm gui toolkit for some desktop client application ?
Is this toolkit stable and is there enough documentation online ?
I used gtkmm to write professional applications and yes you can use it for real world software development.
But I also used C/GTK+ and C++/Qt and my opinion is that using Gtkmm you have the feeling that the original toolkit was meant to be used in C and the porting to C++ is ok but in many cases you feel that C++ features could have been used better.
For Comparison:
If you have to choose between Gtk and Gtkmm go for Gtkmm even though you might find yourself stuck in some not well documented or supported function. Eventually you always manage to find a solution (you can check the source code) and c++ is way better then c.
If you have to choose between Gtkmm and Qt, go for Qt. There is a HUGE gap between the two. Not only in the toolkit itself but in the documentation and all the other classes that you need when writing an application.
I started two month ago with gtkmm. I actually port a tcl/tk application and it feels very hard for my to get the things run. The only useful documentation I found is the https://developer.gnome.org/gtkmm-tutorial/3.4/
But many things described in the manual are not working! I actually run into trouble while overriding signal handlers which should work but didn't. Maybe you will take a look in gtkmm-list#gnome.org to find out what kind of problems yo will maybe run in :-)
The docs derived from the doxygen input seems useless for me, because the functions are mostly not described and the parameter names or often not very clear to me.
In comparison to tcl/tk the interface looks inconsistent. Sometimes a parameter must be provided by a text, sometimes by a pointer and sometimes by the native value itself. Especially the menus are very "mysterious" with the string based configuration. The need of having parameters as text is very unhandy! You have to convert the parameter with ostrstream into a text and parse the parameters sometimes yourself from text to real values.
I decided to give gtk+ a chance is the existence of the c++ interface. I thought it would be helpful to get the errors in compile time and not while running the app like with tcl/tk. But this is not the always true with gtkmm. With gtkmm you are also able to run into run time errors because all string parameters will be parsed during run time! This makes the things error prone!
Maybe I will start again and give Qt a chance. But a first view on it shows, that this seems not really better :-)
Writing a gui application still is a really annoying job!
gtkmm is a official supported binding of GTK (gtk.org/language-bindings.php).
"inkscape" and "ardour" are notable applications written in gtkmm
The bindings that are official GNOME Bindings follow the GNOME release schedule which guarantees API stability and time-based releases.
If you want to write your Application in C, go with GTK+ (and the GLib).
You can find a link to the documentation at http://www.gtkmm.org/ (https://developer.gnome.org/gtkmm-tutorial/).
With Glade (and ie. PyGTK) you could rapid prototype your application.
Building a GUI with Glade is easy and the resulting UI is a xml file, that is not bound to a programming language.

How to develop nice-looking, visually modern applications in QT?

I'm wondering how to develop visually modern, with attractive GUI applications in QT. When I run QT Creator and start new project, the GUI looks very basic and "pure", just like simple win32 apps. But look for example at Allegorithmic Substance Designer 2, where GUI looks somehow similar to WPF. There are many other applications with nice-looking GUI. So, the question is: how to do this? Is there any extension/library to QT, which provide richer GUI experience? Or it must be developed from scratch? Thanks for replies in advance.
As well as Nano's answer, I think it would be worth your while to search around for any Qt stylesheets others have made.
For example, this one that mimics Microsoft Office.
Unfortunately, there doesn't seem to be very many of them available.
I found these useful links, some of whose links may give some ideas:
Qt Stylesheet Snippet Repository
Another idea might be to search for example qml files in Google Code Search. This search for .qml files has plenty of hits. Before using any of them, you would obviously need to check its license.
Have you tried Nokia's Qt Creator? If you're looking for something "similar" to WPF I assume you're referring to its declarative nature, QML being XAML's counterpart in such regard.

windows programming using template in c++

I am interested in writing simple windows-based programs for scientific calculations in c++. Is there a place I could find source code for a template that I could use? The window I would create would hardly ever vary -- it would be something similar to this (but simpler!):
http://www.lisisoft.com/imglisi/6/Science/73401version4xp.jpg
I am not a c++ programmer -- but I have created similar programs in visual basic (blush!). This is my way of learning c++ by working within a limited range of program design...mainly at first just changing the formulas and a few labels.
Can anyone help or point me in the right direction?
First off, there are a million things you need to know before you can just download some code from somewhere and try to work with it. My best advice would be to pick up an "Introduction to C++" book.
But, putting that aside, I will try to answer the question.
There are 2 main ways to make GUI apps in windows using C++:
Get a C++ GUI library, there is an extensive list here.
Work with the Windows API directly.
Once you have choosen either step 1 or 2, try to search for samples by searching the library name you have chosen followed by the word "samples" or "examples" (i.e, "WxWidgets Samples", "Qt examples" or "Windows API examples")
However, either way you choose, in order to make something like the example in your picture, I would estimate that it would take you at least 6 months (and thats if you program everyday).
For a windows C++ GUI library try reliable software library at www.relisoft.com. If you want to use native windows GUI programming you can also try using QT libraries.

making a gui editor

For my school project, I would like to build a gui that someone else can use to create a gui. Upon some research I saw lot of gui builders but didn't see anything along the lines of what I am looking for.
But then I did find a tutorial using C# on here
I rather create this gui editor for linux environment.
Any suggestions to where I should start? what tools I can use? Any links to any tutorials?
Any help/direction would be greatly appreciated.
P.S. I would like to add that it only needs to be very simple. like few text input fields and some button type fields that user can arrange in the order desired.
I would recommend that you not try to build your own GUI builder. It is a daunting task that you will not be able to accomplish as a school project. C++ is fully-compiled, which means that it lacks almost every feature that enables people to build meta-tools (like GUI editors) for it. This mainly has to do with the fact that C++ does not have runtime reflection (natively, anyway). Beyond that, there is no "one GUI toolkit and/or paradigm to rule them all." This makes your problem incredibly difficult to deal with.
So: I would recommend Qt, because it works on a ton of platforms, is easy to use and is just plain awesome. You could also look at the billions of other GUI toolkits like Gtk+, Tk, FLTK, YAAF, GLUI, dlib, CLX...
I'm aware that this does not actually answer the question. However, I do not think that the author is aware of how incredibly difficult the task he has set in front of himself is.
I would recommend starting by implementing it like an interpreter. Start with a very simple command line tool that takes commands like window(300, 400, "window1") and button(50,100, "button1") etc and output the code (native or whatever other GUI code you want), to a file. The goal should be to output a file that can be run and show the GUI that was designed. Once you have that, build a GUI that uses the command line functions as a back-end.
I don't have any exact links to this, but here's an example of what you could do. Gtk has the option of loading a GUI by using a class called GtkBuilder. Glade (the usual Gtk gui editor) has support for outputting it's result as an XML file that the GtkBuilder class then reads.
It would be possible for your program to output an equivalently formed XML file that GtkBuilder could read.
I have no clue as to how difficult it would be to target that XML though.
You should use GTK+ or Qt if you are targeting the linux environment. I think the first step is to learn how to program gui, which takes some time considering you are writing c/c++ code wich is different from higher level languages. Don't you think learning to code gui programs and writing a gui builder at the same time is a little bit too much.? First you should master the basics about gui and then go on to harder projects.
Here's a link to an excellent book on gtk. (Foundations of gtk+ development - Andrew Krause)
http://books.google.com/books?id=L1BZZYRrqSgC&printsec=frontcover&dq=foundations+krause&hl=es&cd=1#v=onepage&q=&f=false
And here's a great tutorial/cookbook for gtk+.
http://zetcode.com/tutorials/gtktutorial/
The official documentation is on library.gnome.org
My final advice is learn one thing at a time.

C/C++ strip chart

Just a quick question.
I'm looking for a simple strip chart (aka. graphing) control similar to the windows task manager 'Performance' view. And have found a few, but they all rely on MFC or .NET :(
Am hoping that someone here might have or know where to get a simple strip chart Win32 control that is not MFC.
Thanks.
If you have to go the roll-your-own route look at the polyline GDI call. That can draw the entire line for you in one call.
I work on a system that draws charts with custom code (no 3rd party controls, all win32 GDI). It sounds really hard, but it isn't that bad.
A little math to map the points from your coordinate space to the device context, drawing gridlines/backgrounds, and Ployline. Done! ;)
Heck you can use GDI mapping modes to make the math easy (but I wouldn't).
If you have found a good MFC control, maybe your best approach would be to convert the code yourself to pure Win32 - MFC is a thin wrapper around the Win32 API after all. Out of interest, what is the name of the MFC control you found?
Few months ago I have also experienced the same issue: trying to find an existing implementation of a performance monitoring library, which looks similar to windows task manager. However because I couldn't find any existing library that works on multi-platforms (not dependent to MFC or .NET), to I decided to create my own library :-)
Today I just released the beta version of this library, and made it available as an open source project.
Check this out here: http://code.google.com/p/qw-performance-monitoring/
Let me know if this is useful. I am still doing some testing, to make sure that every features in this library work in Mac, Linux, and Windows. Once I am done with the testing, I will release the stable release. For the current time, enjoy using this beta version :-)
I don't think there is a standard one in the Win32 common controls library. You'll either have to use someone else's widget library, or roll your own using GDI to draw the graphs. It probably isn't too difficult to roll your own - just create a bitmap control, and set the image every time your data updates to a graph that you draw in memory.
Look at this amazing open source library: http://mctrl.sourceforge.net