44
55#include " chart/animator/keyframe.h"
66#include " chart/generator/plot.h"
7+ #include " chart/generator/plotbuilder.h"
78
89namespace Vizzu ::Anim
910{
@@ -36,6 +37,7 @@ Animation::Animation(const Gen::PlotPtr &plot) :
3637}
3738
3839void Animation::addKeyframe (const Gen::PlotPtr &next,
40+ const Data::DataTable &dataTable,
3941 const Options::Keyframe &options)
4042{
4143 if (isRunning ())
@@ -61,9 +63,11 @@ void Animation::addKeyframe(const Gen::PlotPtr &next,
6163 {
6264 base.drilldownTo (other);
6365 };
64- intermediate0 = getIntermediate (target, next, drilldown);
66+ intermediate0 =
67+ getIntermediate (target, next, dataTable, drilldown);
6568
66- intermediate1 = getIntermediate (next, target, drilldown);
69+ intermediate1 =
70+ getIntermediate (next, target, dataTable, drilldown);
6771 }
6872 else if (strategy == RegroupStrategy::aggregate) {
6973 auto &&targetAxisSet =
@@ -98,10 +102,14 @@ void Animation::addKeyframe(const Gen::PlotPtr &next,
98102
99103 const auto &base = basedOnSource ? target : next;
100104 const auto &other = basedOnSource ? next : target;
101- intermediate0 =
102- getIntermediate (base, other, getModifier (basedOnSource));
103- intermediate1 =
104- getIntermediate (base, other, getModifier (!basedOnSource));
105+ intermediate0 = getIntermediate (base,
106+ other,
107+ dataTable,
108+ getModifier (basedOnSource));
109+ intermediate1 = getIntermediate (base,
110+ other,
111+ dataTable,
112+ getModifier (!basedOnSource));
105113 }
106114
107115 auto &&intermediate0Instant = intermediate0
@@ -137,6 +145,7 @@ void Animation::addKeyframe(const Gen::PlotPtr &next,
137145 if (intermediate0) {
138146 addKeyframe (begin,
139147 intermediate0,
148+ dataTable,
140149 real_options,
141150 intermediate0Instant);
142151 begin = intermediate0;
@@ -147,21 +156,23 @@ void Animation::addKeyframe(const Gen::PlotPtr &next,
147156 if (intermediate1) {
148157 addKeyframe (begin,
149158 intermediate1,
159+ dataTable,
150160 real_options,
151161 intermediate1Instant);
152162 begin = intermediate1;
153163
154164 if (!intermediate1Instant)
155165 real_options.all .delay = ::Anim::Duration (0 );
156166 }
157- addKeyframe (begin, next, real_options, nextInstant);
167+ addKeyframe (begin, next, dataTable, real_options, nextInstant);
158168
159169 target = next;
160170}
161171
162172template <class Modifier >
163173Gen::PlotPtr Animation::getIntermediate (const Gen::PlotPtr &base,
164174 const Gen::PlotPtr &other,
175+ const Data::DataTable &dataTable,
165176 Modifier &&modifier)
166177{
167178 Gen::PlotPtr res;
@@ -173,9 +184,9 @@ Gen::PlotPtr Animation::getIntermediate(const Gen::PlotPtr &base,
173184
174185 if (*extOptions != *other->getOptions ()
175186 && *extOptions != *base->getOptions ()) {
176- res = std::make_shared<Gen::Plot>(base-> getTable (),
177- extOptions,
178- base-> getStyle () );
187+ res =
188+ Gen::PlotBuilder{dataTable, extOptions, base-> getStyle ()}
189+ . build ( );
179190
180191 res->keepAspectRatio = base->keepAspectRatio ;
181192 }
@@ -184,11 +195,13 @@ Gen::PlotPtr Animation::getIntermediate(const Gen::PlotPtr &base,
184195
185196void Animation::addKeyframe (const Gen::PlotPtr &source,
186197 const Gen::PlotPtr &target,
198+ const Data::DataTable &dataTable,
187199 const Options::Keyframe &options,
188200 bool isInstant)
189201{
190- ::Anim:: Sequence::addKeyframe (std::make_shared<Keyframe>(source,
202+ Sequence::addKeyframe (std::make_shared<Keyframe>(source,
191203 target,
204+ dataTable,
192205 &options,
193206 isInstant));
194207}
0 commit comments