Someone can suggest me a good, free, easy to use library for c++ that allow to draw a mathematical function in a window for microsoft windows? (e.g. the parabola x^2+5x+3=0)
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- ceil conterpart for Math.floorDiv in Java?
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
Since you need a ready-made plotting widget, use Qwt.
It uses Qt.
You could use Qt directly as in contero's answer, without Qwt, as the task is simple enough. However, Qwt has lots of graph features built in, and the usage is straightforward.
Another option is wxMathPlot which is wxWidgets based.
From it's website:
wxMathPlot main features:
You mention your language (C++) and platform (Windows), but there are frameworks available for writing a Windows C++ application: Qt, MFC, C++Builder... Additionally, C and C++ can interface with just about anything. So your decision for which plotting library to use will depend on what framework you're using for your UI and on what kind of external interfaces or dependencies you're willing to introduce:
Definitely gnuplot, and the library gnuplot++
I wrote a program similar to this using Qt. Qt is wonderful once you get it set up, but it may take a bit of effort if you've never used it (as will OpenGL, DirectX, etc..).
You can create a QImage and set it to whatever background color you want, then run your program through the width of the image pixel by pixel calling your function to get the y value. Roughly:
Once you've created your QImage, you can attach it to a QLabel using setPixmap(). Once you've attached it you can then display the image in a layout.
You can use GDI/+, OpenGL, Direct3D, Direct2D as well if you're using Vista/7. There's plenty out there.