Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [Unreleased]

## [0.17.1] - 2025-08-24

### Fixed

- Fix Keyframe marker modifications on source chart.

## [0.17.0] - 2025-07-31

### Fixed
Expand Down
14 changes: 10 additions & 4 deletions src/chart/animator/keyframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ void Keyframe::prepareActual()
{
if (Gen::Plot::dimensionMatch(*source, *target)) {
if (Gen::Plot::hasMarkerChange(*source, *target))
copyTarget();
copySourceTarget();
Gen::Plot::mergeMarkersAndCellInfo(*source, *target);
}
else {
copyTarget();
copySourceTarget();
target->prependMarkers(*source);
source->appendMarkers(*targetCopy);
}
Expand All @@ -80,7 +80,7 @@ void Keyframe::prepareActualMarkersInfo()
{
const auto &origTMI = target->getMarkersInfo();
auto &smi = source->getMarkersInfo();
if (!smi.empty()) copyTarget();
if (!smi.empty()) copySourceTarget();

for (auto &tmi = target->getMarkersInfo(); auto &&item : smi)
tmi.insert(std::pair{item.first, Gen::Plot::MarkerInfo{}});
Expand All @@ -89,14 +89,20 @@ void Keyframe::prepareActualMarkersInfo()
smi.insert(std::pair{item.first, Gen::Plot::MarkerInfo{}});
}

void Keyframe::copyTarget()
void Keyframe::copySourceTarget()
{
if (!targetCopy) {
targetCopy = target;
target = std::make_shared<Gen::Plot>(*targetCopy);
target->getStyle().setup();
target->detachOptions();
}
if (!sourceCopy) {
sourceCopy = source;
source = std::make_shared<Gen::Plot>(*sourceCopy);
source->getStyle().setup();
source->detachOptions();
}
}

}
3 changes: 2 additions & 1 deletion src/chart/animator/keyframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ class Keyframe : public Planner
Gen::PlotPtr source;
Gen::PlotPtr target;
Gen::PlotPtr actual;
Gen::PlotPtr sourceCopy;
Gen::PlotPtr targetCopy;

void init(const Gen::PlotPtr &plot,
const Data::DataTable &dataTable);
void prepareActual();
void prepareActualMarkersInfo();
void copyTarget();
void copySourceTarget();
};

}
Expand Down
2 changes: 1 addition & 1 deletion src/chart/main/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

#include "base/app/version.h"

const App::Version Vizzu::Main::version(0, 17, 0);
const App::Version Vizzu::Main::version(0, 17, 1);

const char *const Vizzu::Main::siteUrl = "https://vizzu.io/";
3 changes: 3 additions & 0 deletions test/e2e/tests/fixes.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
},
"55278793": {
"refs": ["3932754"]
},
"keyframes": {
"refs": ["cdb3779"]
}
}
}
87 changes: 87 additions & 0 deletions test/e2e/tests/fixes/keyframes.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import data from '../../test_data/music_data.mjs'

const testSteps = [
(chart) => {
chart.feature('tooltip', true)
return chart.animate({ data })
},
(chart) =>
chart.animate([
{
target: {
data: {
filter: (input) => input.Genres === 'Pop'
},
config: {
channels: {
x: {
set: [{ name: 'Genres' }]
},
y: {
set: [{ name: 'Popularity' }, { name: 'Kinds' }]
},
color: {
set: [{ name: 'Kinds' }]
},
label: {
set: [{ name: 'Popularity' }]
}
}
}
}
},
{
target: {
data: {
filter: (input) => input.Genres === 'Pop'
},
config: {
channels: {
x: {
set: [{ name: 'Genres' }]
},
y: {
set: [{ name: 'Popularity' }]
},
color: {
set: [{ name: 'Kinds' }]
},
label: {
set: [{ name: 'Popularity' }]
}
},
geometry: 'circle'
}
}
},
{
target: {
data: {
filter: null
},
config: {
channels: {
x: {
set: []
},
y: {
set: [{ name: 'Popularity' }, { name: 'Kinds' }, { name: 'Genres' }]
},
color: {
set: [{ name: 'Kinds' }]
},
lightness: {
set: [{ name: 'Genres' }]
},
label: {
set: [{ name: 'Genres' }, { name: 'Popularity' }]
}
},
geometry: 'rectangle'
}
}
}
])
]

export default testSteps