##// END OF EJS Templates
Fixes line uder grid issue
Fixes line uder grid issue

File last commit:

r139:167329998526
r190:3ea3ba4a3395
Show More
domain.cpp
45 lines | 767 B | text/x-c | CppLexer
#include "domain_p.h"
QTCOMMERCIALCHART_BEGIN_NAMESPACE
Domain::Domain():
m_minX(0),
m_maxX(0),
m_minY(0),
m_maxY(0)
{
}
Domain::~Domain()
{
// TODO Auto-generated destructor stub
}
qreal Domain::spanX() const
{
Q_ASSERT(m_maxX >= m_minX);
return m_maxX - m_minX;
}
qreal Domain::spanY() const
{
Q_ASSERT(m_maxY >= m_minY);
return m_maxY - m_minY;
}
Domain Domain::subDomain(const QRectF& rect, qreal maxWidth,qreal maxHeight) const
{
Domain domain;
qreal dx = spanX() / maxWidth;
qreal dy = spanY() / maxHeight;
domain.m_minX = m_minX + dx * rect.left();
domain.m_maxX = m_minX + dx * rect.right();
domain.m_minY = m_maxY - dy * rect.bottom();
domain.m_maxY = m_maxY - dy * rect.top();
return domain;
}
QTCOMMERCIALCHART_END_NAMESPACE