Problem with mpFXYVector and mpInfoLegend

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
dudero
Knows some wx things
Knows some wx things
Posts: 44
Joined: Wed Mar 25, 2009 7:09 pm

Problem with mpFXYVector and mpInfoLegend

Post by dudero » Thu May 07, 2009 8:49 am

Hello,

I have got a problem with mpFXYVector and mpInfoLegend from wxMathPlot library:

my vector insists on 6 points which are used to connect them to a line.

My Problem now is that if I use the mpInfoLegend, it generates for every point a legend-value - which means in my case 6 x the same color/name among each other...

How could a reduce it to only one legend-value?

Greetz dudero

extreme001
I live to help wx-kind
I live to help wx-kind
Posts: 192
Joined: Fri Dec 22, 2006 9:17 am
Location: Germany
Contact:

Post by extreme001 » Fri May 08, 2009 7:51 am

I used the follwing code:

Code: Select all

wxBrush hatch2(wxColour(255,255,255), wxSOLID);
    mpInfoLegend* leg;
    m_GraphContainer->AddLayer( leg = new mpInfoLegend(wxRect(200,20,40,40), &hatch2));
    leg->SetVisible(true);
Could you post a screenshot and some piece of code? That's much easier...

dudero
Knows some wx things
Knows some wx things
Posts: 44
Joined: Wed Mar 25, 2009 7:09 pm

Post by dudero » Fri May 08, 2009 10:55 am

Hello extreme001,

I used almost the same code for my mpInfoLegend as your one - only size/color is differential...

My mpWindow looks like this:

Image

And I want only 1 legend-value: "CAVITY A"

But I think this is impossible, because of it is not a mathematical function only a vector which insists on points, and the legend does`t see it as a line, also when I connect it with the "SetContinuity(true)" to a line function...

But maybe it is possible???

Greetz dudero

dudero
Knows some wx things
Knows some wx things
Posts: 44
Joined: Wed Mar 25, 2009 7:09 pm

Post by dudero » Fri May 08, 2009 11:01 am

And here is the same graph without the "SetContinuity(true)"-function:

Image

extreme001
I live to help wx-kind
I live to help wx-kind
Posts: 192
Joined: Fri Dec 22, 2006 9:17 am
Location: Germany
Contact:

Post by extreme001 » Fri May 08, 2009 11:16 am

Oh...i see...but some code would be much better. Please post some lines...i have no idea until yet. sorry...

extreme001
I live to help wx-kind
I live to help wx-kind
Posts: 192
Joined: Fri Dec 22, 2006 9:17 am
Location: Germany
Contact:

Post by extreme001 » Fri May 08, 2009 11:18 am

Did you add a layer for every value? The infolegend should only show the layer's lable...and maybe that's the problem.

upCASE
Site Admin
Site Admin
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE » Fri May 08, 2009 11:27 am

Hi!
Just a side-note: You can add attachments (images) directly here in the forum when you post. Please do so next time as I personally don't want to see ads about women who's like to meet me :-)
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda

dudero
Knows some wx things
Knows some wx things
Posts: 44
Joined: Wed Mar 25, 2009 7:09 pm

Post by dudero » Fri May 08, 2009 12:24 pm

@extreme001:

Jes I do add a new layer for each value(with the old values) - but I delete the old layer with the DelLayer-function:

Code: Select all

wxString name = _T("Cavity A");
mpLayer* del = myMpWindow->GetLayerByName(name);
myMpWindow->DelLayer(del,true,true);//Deletes also the object of the layer and refreshes the mpWindow
And then I add the new layer with one more point, which comes from an event:

Code: Select all

int value = event.GetInt();//New value
wxPen mypen(wxColour(0, 0, 255), 5, wxSOLID);
wxString cavity = wxString("Cavity A");//Name of my line
mpFXYVector* myGraph = new mpFXYVector(cavity, mpALIGN_SW);
myLayer->SetData(xsz, ysz);//This new data that insists the new point
myLayer->SetPen(mypen);
myMpWindow->AddLayer(myGraph);
myMpWindow->Fit(390, 400, 2500, 8500);//The range of my line
And after the last point is set - then I run the "SetContinuity(true)"-function an add the mpInfoLegend-label:

Code: Select all

myMpWindow->SetContinuity(true);
mpInfoLegend* leg;
myMpWindow->AddLayer( leg = new mpInfoLegend(wxRect(0,0,50,50), wxRED_BRUSH));
leg->SetVisible(true);
Question: Can I edit the layer`s table manually?

@upCASE: Sorry, now I use board-function to upload an image...

Greetz dudero

Post Reply