How to draw a diagram like this...(inside) Topic is solved

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
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:

How to draw a diagram like this...(inside)

Post by extreme001 » Wed Feb 25, 2009 7:53 pm

Hi!

I want to draw a diagram/graph. I tried wxMathPlot, wxPlotCtrl but can't get the result i wanted.

would be nice if someone could help.

Look a the attachment or look here: http://www.pokertracker.com/screenshots ... _thumb.png

Thank you!
Attachments
pt3_cash_graph_thumb.jpg
graph
pt3_cash_graph_thumb.jpg (29.53 KiB) Viewed 1130 times

computerquip
Experienced Solver
Experienced Solver
Posts: 72
Joined: Fri Feb 20, 2009 7:13 pm
Location: $(#wx)\src

Post by computerquip » Wed Feb 25, 2009 9:37 pm

wxMathPlot should work. Could you show us the resulting code when you attempted to use it?

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 » Wed Feb 25, 2009 11:32 pm

Heres a piece of code i used for testing:

Code: Select all

m_graph = new mpWindow( this, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE );
	itemBoxSizer2->Add(m_graph, 1, wxGROW|wxALL, 0);

	// @ home

	// Car shape:
    std::vector<float> car_xs(20), car_ys(20);
    car_xs[0]=100;  car_ys[0]=300;
    car_xs[1]=500;  car_ys[1]=800;
    car_xs[2]=1000;  car_ys[2]=400;
    car_xs[3]= 800;     car_ys[3]=300;
    /*car_xs[i]= 0;     car_ys[i++]=-0.5;
    car_xs[i]= 0.6;  car_ys[i++]=-0.5;
    car_xs[i]= 0.6;  car_ys[i++]=-0.6;
    car_xs[i]= 0.8;  car_ys[i++]=-0.6;
    car_xs[i]= 0.8;  car_ys[i++]=-0.5;
    car_xs[i]= 1.0;  car_ys[i++]=-0.5;
    car_xs[i]= 1.0;  car_ys[i++]= 0.5;
    car_xs[i]= 0.8;  car_ys[i++]= 0.5;
    car_xs[i]= 0.8;  car_ys[i++]= 0.6;
    car_xs[i]= 0.6;  car_ys[i++]= 0.6;
    car_xs[i]= 0.6;  car_ys[i++]= 0.5;
    car_xs[i]= 0;     car_ys[i++]= 0.5;
    car_xs[i]= 0;     car_ys[i++]= 0.6;
    car_xs[i]=-0.2;  car_ys[i++]= 0.6;
    car_xs[i]=-0.2;  car_ys[i++]= 0.5;
    car_xs[i]=-0.5;  car_ys[i++]= 0.5;*/

	mpFXYVector* vecs = new mpFXYVector(_("one"), mpALIGN_NE );
	vecs->SetPen(wxPen(*wxGREEN, 5, wxSOLID));
	vecs->SetData(car_xs, car_ys);
	vecs->SetContinuity(false);

	SetLabelX(_T("moin"));
	SetLabelY(_T("zack"));
	mpScaleX* xaxis = new mpScaleX(GetLabelX(), mpALIGN_BOTTOM, true);
    mpScaleY* yaxis = new mpScaleY(GetLabelY(), mpALIGN_LEFT, true);
    xaxis->SetDrawOutsideMargins(true);
    yaxis->SetDrawOutsideMargins(true);
    m_graph->AddLayer(xaxis);
    m_graph->AddLayer(yaxis);
	
	
	wxBrush hatch2(wxColour(163,208,212), wxSOLID);
    mpInfoLegend* leg;
    m_graph->AddLayer( leg = new mpInfoLegend(wxRect(200,20,40,40), &hatch2));
    leg->SetVisible(true);
	
	m_graph->AddLayer(vecs);
	m_graph->Fit();

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 » Thu Feb 26, 2009 2:13 pm

problem solved! I used the vector data in a worng way, so the graph drawed back to my first x-coord.

Thanks!

Post Reply