wxPlotCtrl and events in wxPlotMarker. How To?

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
avico
In need of some credit
In need of some credit
Posts: 7
Joined: Mon Aug 10, 2009 8:58 am

wxPlotCtrl and events in wxPlotMarker. How To?

Post by avico »

Hi Forum!

I use wxplotctrl sample and add marks like this:

wxPlotMarker *marca = new wxPlotMarker(wxPLOTMARKER_ELLIPSE, wxPoint2DDouble(428500.000,4594000.000), wxSize(2,2), wxGenericPen( wxGenericColour( 255, 0, 0), 1, wxSOLID ), wxNullGenericBrush);

m_plotCtrl->AddMarker(*marca);

and show in plot without problem.

At the same file i add an event like this (for test doble clik in plot) :

else if (eventType == wxEVT_PLOTCTRL_POINT_DOUBLECLICKED)
{
wxMessageDialog mensaje (this, _("Funciona"), _("Mensaje de error"), wxOK);
mensaje.ShowModal();
}

Load a sample data for test and run without problem and double clik in point data of curve show message, but double clik in mark added not.

I read files *.cpp and *.h from source of wxplotctrl but not have valid conclusion.

How to add events to a Mark added ?


And more questions:
If test add mark whit wxPLOTMARKER_RECT, mark not show a rectangular shape. Include file plotmark.h has two functions void CreateRectMarker. The fist has Create(wxPLOTMARKER_RECT, rect, wxSize(-1, -1), pen, brush); and the second has { Create(wxPLOTMARKER_RECT, wxRect2DDouble(pt.m_x, pt.m_y, 0, 0), size, pen, brush); }
(the same as wx_PLOTMARKER_ELLIPSE).

How to use the second function for display rectangular mark ?. In my test (previos definition of plotMarker whit wx_PLOTMARKER_RECT definition) not show.

Thanks!

PD: libraries used for samples are distribution of wxDev-C++ and wxplotctrl code from sourceforge.
avico
In need of some credit
In need of some credit
Posts: 7
Joined: Mon Aug 10, 2009 8:58 am

More about this question

Post by avico »

Continue my research abut this question in wxplotMarker.

I have tested one aproximation to assign event to Marker simulate marker whit one unic point curve. This work is number of marker (curves) are small. More points -> more curves and time for drawing is large.

Plot markers are full speed. If test this loop:

[code]
wxPlotMarker marca1;
for (int i=0; i<15000; i++)
{
marca1.Create(wxPLOTMARKER_ELLIPSE, wxRect2DDouble(428600.000+0.5*i,4594000.000+0.5*i,428600.000+0.5*i,4594000.000+0.5*i), wxSize(2,2), wxGenericPen( wxGenericColour( 255, 0, 0), 1, wxSOLID ), wxNullGenericBrush, wxNullBitmap);
m_plotCtrl->AddMarker(marca1);
}
[/code]

Yes!, 15000 points!!. Draw is inmediate!!!.

If draw the same whit curve, aplication crash, and a reduction on number of point to 1000 or 2000 show curves but speed for creation are low.

Test this:

[code]

wxPlotData midato1;
for (int i=0; i<1000; i++)
{
midato1.Create(1,true);
midato1.SetXValue(0,428650.000+0.5*i);
midato1.SetYValue(0,4594100.000+.5*i);
m_plotCtrl->AddCurve(midato1);
}
[/code]

Speed for markers are fantastic, but events questions are not solved.

I need assign a event for simple/double click to a marker for show information (launch a dialog or a wxpropertygrid).

Number of markes are variable (result for a query). In exceptional case is around 8000 (all information stored).

Research continue :-)
DavidA
Knows some wx things
Knows some wx things
Posts: 33
Joined: Wed Jul 22, 2009 1:05 pm

Post by DavidA »

Hi Avico

I am experimenting with plotting using wxWidgets. Please will you tell me whether you are building wxPlotCtrl on Windows or Linux?

If you are building on Windows, did you use the pre-compiled library libplot.a or build your own?

Best regards

David
avico
In need of some credit
In need of some credit
Posts: 7
Joined: Mon Aug 10, 2009 8:58 am

wx-devc++

Post by avico »

Hi DavidA

I use a precompiled version obtained from version wx-devc++ v 7.0 release candidate (in windows). Has a version for wxwidgets 2.8.10.

This package has a mount of examples for wxwidgets, included wxplotctrl in "project format", a file ".dev" for open wiht wxdevc++ and compile easily. (in certains projects, modify incorrect name of libraries linked and run without problems)

If you has interest for wxplotctrl, is a good first point. The sample project of wxplotctrl in included. Modify and compile for test options.

http://wxdsgn.sourceforge.net

alternate version has in wxPack (wxwidgets 2.8.9)

http://wxpack.sourceforge.net

I am not compilate librarie but as project for this. Require wxthigs.
netoperek
In need of some credit
In need of some credit
Posts: 3
Joined: Sun Sep 27, 2009 11:11 am

Post by netoperek »

avico, You are using the curves wrong way. You don't have to / shouldn't create 1000 curves. create just one, before the loop.
Post Reply