How to set the colour of a curve (wxPlotCtrl)?

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
Grieko
Earned a small fee
Earned a small fee
Posts: 16
Joined: Wed Sep 09, 2009 8:55 am

How to set the colour of a curve (wxPlotCtrl)?

Post by Grieko » Thu Sep 24, 2009 9:59 pm

Hi,
i want to change the colour of a curve in a wxPlotCtrl.
I'm using this code:

wxPlotData* pdata = new wxPlotData(20);
wxPen mPen(*wxRED,1,wxSOLID);
pdata->SetPen(wxPLOTPEN_NORMAL, mPen);
for(int i=0;i!=20;++i)
{
pdata->SetXValue(i,(6.28/20)*i);
pdata->SetYValue(i,sin((6.28/20)*i));
}
m_plotCtrl1->AddCurve(pdata);

The curve is drawn, but alyways in blue ...
What´s wrong on my code ?

BR
Grieko

timg
Earned some good credits
Earned some good credits
Posts: 148
Joined: Mon Jan 23, 2006 6:52 pm

Post by timg » Fri Sep 25, 2009 4:57 pm

Not sure if it's the case, but is your curve selected? The last curve added stays selected, and selected curves are blue.

Grieko
Earned a small fee
Earned a small fee
Posts: 16
Joined: Wed Sep 09, 2009 8:55 am

Ok,

Post by Grieko » Fri Sep 25, 2009 5:09 pm

so i'm sure that´s my problem,'cause i added only 1 curve.
But i have only one curve to show, how can i deselct this one ?
I don´t know that, 'cause i don´t found ANY documentation of the wxPlotCtrl

Grieko
Earned a small fee
Earned a small fee
Posts: 16
Joined: Wed Sep 09, 2009 8:55 am

Yap,

Post by Grieko » Fri Sep 25, 2009 5:19 pm

that´s it.
I just added a second curve, an so the first one is shown in red :-)

Agucho
Earned a small fee
Earned a small fee
Posts: 14
Joined: Sat Jul 09, 2011 8:20 pm

Re: How to set the colour of a curve (wxPlotCtrl)?

Post by Agucho » Thu Nov 24, 2011 5:23 pm

Hello! When you add the curve you can deselect it. Yo should write:

Code: Select all

m_plotctrl1->AddCurve(pdata,false,false);
and the curve will be RED.

Post Reply