Cosmetic changes

* fix invalid graph painting - for some reasons graphs are not normed as
  expected.
* fix cppcheck warnings related to no default values
This commit is contained in:
2016-03-18 16:23:53 +03:00
parent 453d4d5149
commit 3a6033e676
2 changed files with 7 additions and 7 deletions

View File

@ -90,14 +90,14 @@ void GraphicalItemHelper::paintGraph(const float &value)
// default norms
float normX
= static_cast<float>(m_width) / static_cast<float>(m_values.count());
float normY = static_cast<float>(m_height) / 1.5f;
float normY = static_cast<float>(m_height - 1);
// paint graph
for (int i = 0; i < m_values.count() - 1; i++) {
// some magic here
float x1 = i * normX;
float y1 = -fabs(m_values.at(i)) * normY + 5.0f;
float y1 = -fabs(m_values.at(i)) * normY + 0.5f;
float x2 = (i + 1) * normX;
float y2 = -fabs(m_values.at(i + 1)) * normY + 5.0f;
float y2 = -fabs(m_values.at(i + 1)) * normY + 0.5f;
m_scene->addLine(x1, y1, x2, y2, pen);
}
}
@ -183,7 +183,7 @@ void GraphicalItemHelper::storeValue(const float &value)
qCDebug(LOG_LIB) << "Save value to array" << value;
if (m_values.count() == 0)
m_values.append(0.0);
m_values.append(1.0);
else if (m_values.count() > m_count)
m_values.removeFirst();