Author Topic: MathPlot  (Read 24657 times)

Offline rcoll

  • Almost regular
  • **
  • Posts: 150
MathPlot
« on: February 26, 2010, 09:20:46 am »
A year or so ago I needed to plot some data; the data was fairly simple (something like the ratio of "expanding waist size" to  "thinning hair count" over time).

So, I went to the wxCode site and downloaded wxMathPlot; this is a light-weight plotting canvas that was perfect for my purposes, especially since it handled all the annoying little details like scaling the axis and providing a built-in zoom control.  After I made my plot (and got depressed about my hair), I thought I was done.

But, as it turned out, I've used wxMathPlot at least 5 or 6 times in the past year.  Enough times, in fact, that I finally decided to write a plugin for it, so I could just select it in wxSmith and drop it on a form and pre-load some data.

This is it.  Note that I did not write wxMathPlot, I only created a plugin for it to make it easier to use with Code::Blocks. 

The plugin can be download from Rapidshare at

http://rapidshare.com/files/356046463/MathPlot_Compiled_MSW.zip

http://rapidshare.com/files/356044316/MathPlot_Source_Only.zip

or Berlios at

http://prdownload.berlios.de/ringowidgets/MathPlot_Compiled_MSW.zip

http://prdownload.berlios.de/ringowidgets/MathPlot_Source_Only.zip


From the wxMathPlot documentation:

wxMathPlot is a framework for mathematical graph plotting in wxWindows.

The framework is designed for convenience and ease of use.

The heart of wxMathPlot is mpWindow, which is a 2D canvas for plot layers.
mpWindow can be embedded as subwindow in a wxPane, a wxFrame, or any other
wxWindow.  mpWindow provides a zoomable and moveable view of the layers. The
current view can be controlled with the mouse, the scrollbars, and a context
menu.

Plot layers are implementations of the abstract base class mpLayer. Those can
be function plots, scale rulers, or any other vector data visualisation.
wxMathPlot provides two mpLayer implementations for plotting horizontal and
vertical rulers: mpScaleX and mpScaleY.  For convenient function plotting three
more abstract base classes derived from mpLayer are provided: mpFX, mpFY and
mpFXY. These base classes already come with plot code, own functions can be
implemented by overiding just one member for retrieving a function value.
Another class, mpFXYVector, is provided since version 0.03. This non-virtual
class renders 2D graphs from a pair of std::vector's. One of the utility of this
class is that you can use it directly in GUI designers such as wxSmith within
Code::Blocks.

From version 0.03, the mpWindow has built-in support for mouse-based pan and
zoom through intuitive combinations of buttons and the mouse wheel. It also
incorporate an optional double buffering mechanism to avoid flicker.

wxMathPlot sticks to wxWindow's coding conventions. All entities defined by
wxMathPlot have the prefix "mp".

wxMathPlot is published under the terms of the wxWindow license.
The original author is David Schalig <mrhill@users.sourceforge.net>.
From June 2007 the project is maintained by Davide Rondini.
<cdron@users.sourceforge.net>.
Authors can be contacted via the wxMathPlot's homepage at
http://sourceforge.net/projects/wxmathplot.
Contributors:
Jose Luis Blanco <jlblanco@ctima.uma.es>, Val Greene.


Ringo


Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: MathPlot
« Reply #1 on: February 26, 2010, 09:36:51 am »
what should I say? you are a really  cool man. :D
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline alexanderlegend

  • Single posting newcomer
  • *
  • Posts: 4
Re: MathPlot
« Reply #2 on: June 16, 2011, 05:05:02 pm »
Hey,
I just stumbled upon this awesome plugin and require it urgently.
I have Windows XP and I read the README.txt which said that I could just manually install the compiled .dll and the zip in the required folder. I did that, however CodeBlocks gives a warning:

"One or more plugins were not loaded. This usually happens when the plugin is built for a different version of the Code::Blocks SDK."

I tried building the plugin from source code. But that too returned errors. After cutting down on most errors, I am stuck with 14 of them. All of them saying, "undefined reference to wxString..."
I am sure that all libraries are properly linked and yet this problem persists.

Please tell me how I can fix this problem and have the plugin properly installed with wxSmith/win7 or win XP.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: MathPlot
« Reply #3 on: June 16, 2011, 05:20:15 pm »
You need exactly the same version of wxWidgets and gcc used to compile your version of C::B.
You need to compile wxWidgets exactly the same as the one who has built your version of C::B.

The easier option is to compile wxWidgets and then compile C::B from inside C::B, then compile and install the plugin.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline alexanderlegend

  • Single posting newcomer
  • *
  • Posts: 4
Re: MathPlot
« Reply #4 on: June 16, 2011, 05:48:48 pm »
Thank you for your quick reply. :)
Sorry, but I'm a little confused.
I used binaries to install both C::B and wxWidgets: C::B+MingW and wxPack.

why do I need to compile wxWidgets and C::B again?




Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: MathPlot
« Reply #5 on: June 16, 2011, 06:43:20 pm »
why do I need to compile wxWidgets and C::B again?
The easiest thing is as following:
- install a nightly of C::B
- checkout the "wxsmith_addons" branch of C::B from SVN
- compile C::B using C::B (assuming you have compiled the prerequisite wxWidgets, too already)
- run it.

This plugin is already included in this distribution and working fine there.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: MathPlot
« Reply #6 on: June 16, 2011, 06:53:59 pm »
why do I need to compile wxWidgets and C::B again?
Because for a successful build you need all libraries (wxWidgets, libcodeblocks, all the plugins, etc) and all applications (codeblocks.exe) to be compiled with the same compiler.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline alexanderlegend

  • Single posting newcomer
  • *
  • Posts: 4
Re: MathPlot
« Reply #7 on: June 17, 2011, 05:17:32 pm »
Okay so I have done the first 3 steps without any hassle.
I have also compiled C::B from the src in SVN(wxsmith_addons) using the nightly without any error.

But, when I run the newly built C::B I am greeted with a message saying:

"Cannot find resources...
Code::Blocks was configured to be installed in 'C:\Users\Abhipray\wxsmith_addons\src\output/share/codeblocks'.
Please use the command-line switch '--prefix' or set the CODEBLOCKS_DATA_DIR environment variable to point where Code::Blocks is installed,
or try re-installing the application..."

I was not sure how to fix this so I located the resources.zip file from the nightly build and copied it to the src\output\share\codeblocks directory .
Now, when I run C::B, it opens up with a default page missing and when trying to open a project, a dialog that says "Deactivating the compiler plugin is most unwise...." .

How do I fix this?


Offline ouch

  • Almost regular
  • **
  • Posts: 223
Re: MathPlot
« Reply #8 on: June 17, 2011, 05:43:24 pm »
you have to run update.bat if your on windows, or the update shell script if your on linux.

these copy and extract everything to the right places.

Offline alexanderlegend

  • Single posting newcomer
  • *
  • Posts: 4
Re: MathPlot
« Reply #9 on: June 17, 2011, 05:50:24 pm »
Yes, I have used the update.bat.. as you can see, it has created the output folder.
However it complains that it cannot find *.zip and also initially, it says 'zip is not recognized as internal or external command.'

Offline ouch

  • Almost regular
  • **
  • Posts: 223
Re: MathPlot
« Reply #10 on: June 17, 2011, 05:54:12 pm »
well you need that program for it to extract stuff, otherwise it skips that step screwing up everything.

you can get it here:
http://gnuwin32.sourceforge.net/packages/zip.htm

just stuff it in your compilers, "bin" directory.
« Last Edit: June 17, 2011, 05:55:46 pm by ouch »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: MathPlot
« Reply #11 on: June 17, 2011, 06:20:02 pm »
To be precise: the zip utility is needed, for archiving, not extracting
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]