I'm not able to fix the position of the view

Help
2011-07-07
2013-05-02
  • Blue_Stream
    Blue_Stream
    2011-07-07

    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.

        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();
    
     
  • Blue_Stream
    Blue_Stream
    2011-07-07

    Yes I've tried to set it to 0 but it didn't help :/

     
  • Blue_Stream
    Blue_Stream
    2011-07-08

    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…

     
  • cdron77
    cdron77
    2011-07-08

    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.

     
  • Blue_Stream
    Blue_Stream
    2011-07-10

    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.. ?