4
4
5
5
#include " chart/animator/keyframe.h"
6
6
#include " chart/generator/plot.h"
7
+ #include " chart/generator/plotbuilder.h"
7
8
8
9
namespace Vizzu ::Anim
9
10
{
@@ -36,6 +37,7 @@ Animation::Animation(const Gen::PlotPtr &plot) :
36
37
}
37
38
38
39
void Animation::addKeyframe (const Gen::PlotPtr &next,
40
+ const Data::DataTable &dataTable,
39
41
const Options::Keyframe &options)
40
42
{
41
43
if (isRunning ())
@@ -61,9 +63,11 @@ void Animation::addKeyframe(const Gen::PlotPtr &next,
61
63
{
62
64
base.drilldownTo (other);
63
65
};
64
- intermediate0 = getIntermediate (target, next, drilldown);
66
+ intermediate0 =
67
+ getIntermediate (target, next, dataTable, drilldown);
65
68
66
- intermediate1 = getIntermediate (next, target, drilldown);
69
+ intermediate1 =
70
+ getIntermediate (next, target, dataTable, drilldown);
67
71
}
68
72
else if (strategy == RegroupStrategy::aggregate) {
69
73
auto &&targetAxisSet =
@@ -98,10 +102,14 @@ void Animation::addKeyframe(const Gen::PlotPtr &next,
98
102
99
103
const auto &base = basedOnSource ? target : next;
100
104
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));
105
113
}
106
114
107
115
auto &&intermediate0Instant = intermediate0
@@ -137,6 +145,7 @@ void Animation::addKeyframe(const Gen::PlotPtr &next,
137
145
if (intermediate0) {
138
146
addKeyframe (begin,
139
147
intermediate0,
148
+ dataTable,
140
149
real_options,
141
150
intermediate0Instant);
142
151
begin = intermediate0;
@@ -147,21 +156,23 @@ void Animation::addKeyframe(const Gen::PlotPtr &next,
147
156
if (intermediate1) {
148
157
addKeyframe (begin,
149
158
intermediate1,
159
+ dataTable,
150
160
real_options,
151
161
intermediate1Instant);
152
162
begin = intermediate1;
153
163
154
164
if (!intermediate1Instant)
155
165
real_options.all .delay = ::Anim::Duration (0 );
156
166
}
157
- addKeyframe (begin, next, real_options, nextInstant);
167
+ addKeyframe (begin, next, dataTable, real_options, nextInstant);
158
168
159
169
target = next;
160
170
}
161
171
162
172
template <class Modifier >
163
173
Gen::PlotPtr Animation::getIntermediate (const Gen::PlotPtr &base,
164
174
const Gen::PlotPtr &other,
175
+ const Data::DataTable &dataTable,
165
176
Modifier &&modifier)
166
177
{
167
178
Gen::PlotPtr res;
@@ -173,9 +184,9 @@ Gen::PlotPtr Animation::getIntermediate(const Gen::PlotPtr &base,
173
184
174
185
if (*extOptions != *other->getOptions ()
175
186
&& *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 ( );
179
190
180
191
res->keepAspectRatio = base->keepAspectRatio ;
181
192
}
@@ -184,11 +195,13 @@ Gen::PlotPtr Animation::getIntermediate(const Gen::PlotPtr &base,
184
195
185
196
void Animation::addKeyframe (const Gen::PlotPtr &source,
186
197
const Gen::PlotPtr &target,
198
+ const Data::DataTable &dataTable,
187
199
const Options::Keyframe &options,
188
200
bool isInstant)
189
201
{
190
- ::Anim:: Sequence::addKeyframe (std::make_shared<Keyframe>(source,
202
+ Sequence::addKeyframe (std::make_shared<Keyframe>(source,
191
203
target,
204
+ dataTable,
192
205
&options,
193
206
isInstant));
194
207
}
0 commit comments