Last active
August 29, 2015 14:08
-
-
Save Satark/dedd2c8970aa10b48f7b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QRectF QwtArrayPlotItem::boundingRect() const | |
{ | |
//if we have valid rect, return it | |
if( m_boundingRect.isValid()) | |
return m_boundingRect; | |
//need to calculate | |
else if(m_data != 0 && m_size>1) | |
{ | |
double min =0.0; | |
double max =0.0; | |
if(m_data[0]<m_data[1]) | |
{ | |
min = m_data[0]; | |
max = m_data[1]; | |
} | |
else | |
{ | |
min = m_data[1]; | |
max = m_data[0]; | |
} | |
//compare pairs | |
for(int k=2;k<m_size-2;k+=2) | |
{ | |
if(m_data[k]>m_data[k+1]) | |
{ | |
if(m_data[k]>max) | |
{ | |
max = m_data[k]; | |
} | |
if(m_data[k+1]<min) | |
{ | |
min = m_data[k+1]; | |
} | |
} | |
else | |
{ | |
if(m_data[k+1]>max) | |
{ | |
max = m_data[k+1]; | |
} | |
if(m_data[k]<min) | |
{ | |
min = m_data[k]; | |
} | |
} | |
} | |
m_boundingRect = QRectF(0.0,(double)min, m_size*m_dt, (double)(max-min)); | |
return m_boundingRect; | |
} | |
return QRectF( 1.0, 1.0, -2.0, -2.0 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment