##// END OF EJS Templates
Fix animation artifact with boxplots....
Miikka Heikkinen -
r2564:b874ab753024
parent child
Show More
@@ -42,7 +42,11 void BoxPlotAnimation::addBox(BoxWhiskers *box)
42 42 animation = new BoxWhiskersAnimation(box, this);
43 43 m_animations.insert(box, animation);
44 44 BoxWhiskersData start;
45 start.m_lowerExtreme = box->m_data.m_median;
46 start.m_lowerQuartile = box->m_data.m_median;
45 47 start.m_median = box->m_data.m_median;
48 start.m_upperQuartile = box->m_data.m_median;
49 start.m_upperExtreme = box->m_data.m_median;
46 50 animation->setup(start, box->m_data);
47 51 } else {
48 52 animation->stop();
@@ -54,7 +58,7 ChartAnimation *BoxPlotAnimation::boxAnimation(BoxWhiskers *box)
54 58 {
55 59 BoxWhiskersAnimation *animation = m_animations.value(box);
56 60 if (animation)
57 animation->m_moveMedianLine = false;
61 animation->m_changeAnimation = false;
58 62
59 63 return animation;
60 64 }
@@ -62,7 +66,7 ChartAnimation *BoxPlotAnimation::boxAnimation(BoxWhiskers *box)
62 66 ChartAnimation *BoxPlotAnimation::boxChangeAnimation(BoxWhiskers *box)
63 67 {
64 68 BoxWhiskersAnimation *animation = m_animations.value(box);
65 animation->m_moveMedianLine = true;
69 animation->m_changeAnimation = true;
66 70 animation->setEndData(box->m_data);
67 71
68 72 return animation;
@@ -50,7 +50,7 QVariant BoxWhiskersAnimation::interpolated(const QVariant &from, const QVariant
50 50 BoxWhiskersData endData = qvariant_cast<BoxWhiskersData>(to);
51 51 BoxWhiskersData result;
52 52
53 if (m_moveMedianLine) {
53 if (m_changeAnimation) {
54 54 result.m_lowerExtreme = startData.m_lowerExtreme + progress * (endData.m_lowerExtreme - startData.m_lowerExtreme);
55 55 result.m_lowerQuartile = startData.m_lowerQuartile + progress * (endData.m_lowerQuartile - startData.m_lowerQuartile);
56 56 result.m_median = startData.m_median + progress * (endData.m_median - startData.m_median);
@@ -60,7 +60,7 public: // from QVariantAnimation
60 60 protected:
61 61 friend class BoxPlotAnimation;
62 62 BoxWhiskers *m_box;
63 bool m_moveMedianLine;
63 bool m_changeAnimation;
64 64 BoxPlotAnimation *m_boxPlotAnimation;
65 65 };
66 66
General Comments 0
You need to be logged in to leave comments. Login now