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