This is maybe a noob question, but i'm really exasperated after spending more than 5 hours on that problem.
I use the moFXYVector to draw three lines.
My Y axis should be between 0 to 100 and X 0 to 1800. My vector array contain 1800 entries.
The data is well drawn, but the screen - or view - position is totally wring. It start from -200 to 900 for x and 110 to 60 for Y.
I've tried all the possible control such as SetPosX, SetScr, SetScaleX, i'm definitely not able to adjust this.
An other point is that the X axis is always on the top, even if I choose mpALIGN_TOP or mpALIGN_BOTTOM.
If i select mpALIGN_BORDER_BOTTOM, the axis disappear.
This happend with or without the fit function.
I'm really getting mad, I don't understand why that happend.
The graph is located on a wxPanel.
for (i = 0; i<1800; i++) {
vectorx.push_back(i);
ValGraphTavg.push_back((double) i * 0.055);
ValGraphTset.push_back((double) 30.0);
ValGraphTair.push_back((double) 1.0);
}
GraphTavg = new mpFXYVector(_("Panel"));
GraphTset = new mpFXYVector(_("Set"));
GraphTair = new mpFXYVector(_("Air"));
GraphTavg->SetData(vectorx, ValGraphTavg);
GraphTset->SetData(vectorx, ValGraphTset);
GraphTair->SetData(vectorx, ValGraphTair);
wxPen vectorpen(*wxBLUE, 1, wxSOLID);
GraphTavg->SetContinuity(false);
GraphTavg->SetPen(vectorpen);
GraphTavg->SetDrawOutsideMargins(true);
wxPen vectorpen2(*wxBLACK, 1, wxSOLID);
GraphTset->SetContinuity(false);
GraphTset->SetPen(vectorpen2);
GraphTset->SetDrawOutsideMargins(true);
wxPen vectorpen3(*wxGREEN, 1, wxSOLID);
GraphTair->SetContinuity(false);
GraphTair->SetPen(vectorpen3);
GraphTair->SetDrawOutsideMargins(false);
wxFont graphFont(11, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
m_plot = new mpWindow( WxPanelGraph, -1, wxPoint(0,0), wxSize(900,900), wxSUNKEN_BORDER );
m_plot->SetMargins(130, 10, 10, 130);
mpScaleX* X = new mpScaleX( wxT("Time"), mpALIGN_TOP, true, mpX_NORMAL);
mpScaleY* Y = new mpScaleY( wxT("°C"), mpALIGN_LEFT);
X->SetDrawOutsideMargins(true);
Y->SetDrawOutsideMargins(true);
m_plot->AddLayer( X );
m_plot->AddLayer( Y );
m_plot->AddLayer(GraphTavg );
m_plot->AddLayer(GraphTset );
m_plot->AddLayer(GraphTair );
m_plot->SetScaleY((double) 1);
m_plot->SetScaleX((double) 1);
m_plot->SetScr(120, 250);
// m_plot->SetPosY((double) 10);
// m_plot->SetPosX((double) 300);
/*18
m_plot->SetMPScrollbars(true);
m_plot->SetPosY((double) 100);
m_plot->SetPosX((double) 100);
m_plot->SetScr(6000, 5000);
//
// fin graph
m_plot->EnableDoubleBuffer(true);
*/
m_plot->EnableDoubleBuffer(true);
m_plot->Fit();
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Please be more clear: saying "there is a problem" is not a good bug report. If you have implemented a code fix, please post it, so I'll be able to evaluate it and eventually introduce it in a future release.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I would be happy to help, unfortunately I've not been able to find the problem. I just have been able to set the position of the axis and their values by bypassing some of the code. I don't have the code there, I will try to put it later.
The problem I encounter seems that the window size is not defined correctly, so when i use the fit function for example, the position is totally out. Same if I use the function to "zoom the mouse selection", actually it doesn't zoom the selection but goes totally out.
Maybe I did some mistakes somewhere but I really cannot find it. Maybe because of the OS (win7) or the frame the graph is located on.. ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello All,
This is maybe a noob question, but i'm really exasperated after spending more than 5 hours on that problem.
I use the moFXYVector to draw three lines.
My Y axis should be between 0 to 100 and X 0 to 1800. My vector array contain 1800 entries.
The data is well drawn, but the screen - or view - position is totally wring. It start from -200 to 900 for x and 110 to 60 for Y.
I've tried all the possible control such as SetPosX, SetScr, SetScaleX, i'm definitely not able to adjust this.
An other point is that the X axis is always on the top, even if I choose mpALIGN_TOP or mpALIGN_BOTTOM.
If i select mpALIGN_BORDER_BOTTOM, the axis disappear.
This happend with or without the fit function.
I'm really getting mad, I don't understand why that happend.
The graph is located on a wxPanel.
Did yout tried to set the margins? Their devault value is not zero.
http://wxmathplot.sourceforge.net/docs/a00018.html#a31f302c5a5d89e16b135a4bc5919d61c
Good luck.
CD-RON77
Yes I've tried to set it to 0 but it didn't help :/
I look a bit further and have been able to set the position by changing the code of the mathplot.cpp.
It seems that there is a problem on the lib to know the size of the window…
Please be more clear: saying "there is a problem" is not a good bug report. If you have implemented a code fix, please post it, so I'll be able to evaluate it and eventually introduce it in a future release.
Hi cdron77,
I would be happy to help, unfortunately I've not been able to find the problem. I just have been able to set the position of the axis and their values by bypassing some of the code. I don't have the code there, I will try to put it later.
The problem I encounter seems that the window size is not defined correctly, so when i use the fit function for example, the position is totally out. Same if I use the function to "zoom the mouse selection", actually it doesn't zoom the selection but goes totally out.
Maybe I did some mistakes somewhere but I really cannot find it. Maybe because of the OS (win7) or the frame the graph is located on.. ?