D> We are developing with wxWidgets/C++ on Windows and Linux and need to
D> add x/y plots to our GUI.
D>
D> I am aware that there are a number of plotting components/libraries
D> available, e.g. wxPlotCtrl, wxChart, wxMathPlot, PlPlot.
D>
D> Would anyone like to compare the status/functionality of these and
D> recommend one for me to try first please?
All I can say is that I had to do something related to what you did (as
you, I needed both x/y graphs and a special kind of bar charts, namely OHLC
(http://en.wikipedia.org/wiki/OHLC) charts) and I chose PlPlot with its wx
bindings to do it. It did work but if I had to choose again I'd probably
use something else because PlPlot turned out to be very/too low-level and I
wasn't even sure if I really saved time by using it in the first place
instead of just doing everything myself. PlPlot is definitely flexible
enough to do everything you need but I'd prefer something more useful out
of the box. E.g. unlike wxMathPlot it doesn't have any support for panning/
zooming/scrolling and I had to implement the subset of these that I needed
myself on top of it.
Unfortunately I didn't really try wxMathPlot so I can't say much about it
but from its description and what I know about PlPlot now I think I'd
rather choose it. BTW, there is another plotting library missing from your
list: wxFreeChart (http://wxcode.sourceforge.net/components/freechart/). It
is very new and didn't even exist when I started my project, otherwise I'd
have almost certainly used it because it was the only one which supported
OHLC plots. But again, I didn't [try to] use it so I can't say much about
it neither.
If you're going to do some testing of all these libraries it would be nice
if you could summarize your results in a post here or on a Wiki page (or
both, by posting here a link to the wiki) as I'm sure this would be useful
for others as well.
Thanks and good luck,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
WS> PLplot can be configured and compiled on Mac OS X, Linux and Windows
WS> (and it's also supported there). The mailing list is in general very
WS> helpful and PLplot is actively developed by a number of developers
Yes, indeed, I got a lot of help and useful advice on the PLplot list and
from Werner himself and I'm grateful for this. This is important and I
should have mentioned this in my original message.
WS> Further, PLplot's strong area is scientific plots.
I guess it would have worked better if I wanted to do something closer to
this. Unfortunately what I needed was really quite different which is why
it left me with a feeling that it might not have been the best choice.
Regards,
> We are developing with wxWidgets/C++ on Windows and Linux and need to
> add x/y plots to our GUI.
I haven't tried to use it (yet), but Visualization Toolkit (VTK) looks
interesting:
It's available wrapped in an application as ParaView:
I'm considering using it for displaying exaggerated contour maps in a
surface analysis application.
http://wiki.wxwidgets.org/Eclipse,_CDT_&_MingW_&_MSYS_Setup_Guide#Building_a
nd_Configuring_wxWidgets
The guide contains the warning:
Caution: If you plan to use other libraries which depend on wxWidgets (e.g.
PLplot), be aware that although this method which uses ./configure to create
the makefiles will result in Windows libraries, it will not place them in
the same paths as if you were to use mingw32-make directly with the
pre-existing makefiles. The location of build.cfg may also be a significant
factor. CMake, for example, can search for wxWidgets via two independent
methods labeled 'unix' and 'win32'. This ./configure method is not
compatible with the 'win32' search method.
Now I want to use PLplot and sure enough, the standard CMake build of PLplot
doesn't work!
Can anyone advise me how to get PLplot integrated with the aforementioned
set of tools?
Thanks
Jack Dodds
Geo Equipment Manufacturing Ltd.
Geotech Ltd.
245 Industrial Parkway North
Aurora, Ontario, Canada
L4G 4C4
Phone: 905-841-5004
Fax: 905-841-0611
Email: ja...@geotech.ca
I'm trying to display numbers, left aligned, in a wxGrid using
wxGridCellNumberRenderer() and wxGridCellFloatRenderer().
The contents of the cells are always right aligned, even though I set left
alignment with wxGrid::SetCellAlignment() and/or wxGrid::SetColAttr().
In other cells where I specify wxGridCellStringRenderer(), I have
successfully set both left and right alignment with
wxGrid::SetCellAlignment() and wxGrid::SetColAttr().
Is this the way the Number and Float renderers work - or am I doing
something wrong?
Jack Dodds
JD> I'm trying to display numbers, left aligned, in a wxGrid using
JD> wxGridCellNumberRenderer() and wxGridCellFloatRenderer().
JD>
JD> The contents of the cells are always right aligned, even though I set left
JD> alignment with wxGrid::SetCellAlignment() and/or wxGrid::SetColAttr().
Looking at the code of wxGridCellFloatRenderer::Draw() this isn't really
surprising as it does the following:
// draw the text right aligned by default
int hAlign, vAlign;
attr.GetAlignment(&hAlign, &vAlign);
hAlign = wxALIGN_RIGHT;
wxRect rect = rectCell;
rect.Inflate(-1);
grid.DrawTextRectangle(dc, GetString(grid, row, col), rect, hAlign, vAlign);
Obviously overwriting hAlign with wxALIGN_RIGHT is not a great idea, I
don't know why was this done even though apparently I did it myself in an
almost 10 year old r6210.
It looks like just initializing hAlign to wxALIGN_RIGHT before calling the
function should work as intended, i.e. use right alignment by default but
allow overriding it if another alignment is explicitly set. Could you
please test if this is really the case?
Thanks,
Thanks for steering me to that code.
Could it be that the alignment is forced to wxALIGN_RIGHT because other
problems crop up when other alignments are used?
I'll try a mod to the code. To test it I'll have to remember how to build
wxWidgets, which I haven't done for a few months!
Jack
JD> Could it be that the alignment is forced to wxALIGN_RIGHT because other
JD> problems crop up when other alignments are used?
I really don't know/remember but it seems just like a bug to me.
JD> I'll try a mod to the code. To test it I'll have to remember how to build
JD> wxWidgets, which I haven't done for a few months!
It hasn't changed since then :-)
Good luck,
JD> Looking at the code of GetAlignment(), it seems that presetting hAlign to
JD> wxALIGN_RIGHT before the call to GetAlignment() only has an effect if there
JD> is no alignment set for the cell, and no default alignment set (and the
JD> latter seems to be an error condition). I'm not sure if this case is
JD> important.
JD>
JD> Looks like the original intent was to make wxALIGN_RIGHT the default
JD> alignment for numeric fields (since wxALIGN_LEFT is the overall default).
Yes, it definitely was. So if the fix results in these fields not being
right aligned by default any more then it actually doesn't work... And
looking at the code more carefully it does seem like it's impossible to
have a NULL m_defGridAttr in wxGridCellAttr and so some alignment will
always be returned. Which is definitely not what we want...
The simplest solution I can see right now is to replace all
int hAlign, vAlign;
attr.GetAlignment(&hAlign, &vAlign);
hAlign = wxRIGHT;
blocks with something like this:
int hAlign, vAlign;
if ( attr.HasAlignment() )
attr.GetAlignment(&hAlign, &vAlign);
else // no non-default alignment
{
hAlign = wxRIGHT;
vAlign = wxTOP;
}
but this is still far from ideal...
I think I solved the problem in the svn trunk with r62728 (you will also
need r62727 it depends on) and in principle this could be backported to
2.8, although more work would be needed.
Regards,