diff --git a/CHANGELOG.md b/CHANGELOG.md index b74774cd1..059726392 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - next() can be called multiple times from Plugin hooks - Line and circle chats with only dimensions on x, and y axes the markers were off the axis labels. +- Crash on TreeMap only with negative values ### Added diff --git a/src/chart/generator/plot.cpp b/src/chart/generator/plot.cpp index 86219c063..c331759e1 100644 --- a/src/chart/generator/plot.cpp +++ b/src/chart/generator/plot.cpp @@ -159,10 +159,11 @@ void Plot::generateMarkers(const Data::DataTable &table) } clearEmptyBuckets(mainBuckets, true); clearEmptyBuckets(subBuckets, false); - auto conn = linkMarkers(mainBuckets, true); + auto hasMarkerConnection = linkMarkers(mainBuckets, true); linkMarkers(subBuckets, false); - if (conn && options->geometry.get() == ShapeType::line + if (hasMarkerConnection + && options->geometry.get() == ShapeType::line && options->getChannels().at(ChannelId::x).isDimension() && options->getChannels().at(ChannelId::y).isDimension()) { markerConnectionOrientation.emplace( diff --git a/src/chart/speclayout/treemap.cpp b/src/chart/speclayout/treemap.cpp index 060174761..268721372 100644 --- a/src/chart/speclayout/treemap.cpp +++ b/src/chart/speclayout/treemap.cpp @@ -16,11 +16,17 @@ TreeMap::TreeMap(const std::vector &sizes, for (auto j = 0U; j < sizes.size(); ++j) markers.emplace_back(j, sizes[j]); - std::sort(markers.begin(), markers.end(), SpecMarker::sizeOrder); + std::ranges::sort(markers, SpecMarker::sizeOrder); - divide(markers.begin(), markers.end(), p0, p1); + auto it = std::ranges::upper_bound(markers, + SpecMarker{0, 0.0}, + SpecMarker::sizeOrder); - std::sort(markers.begin(), markers.end(), SpecMarker::indexOrder); + divide(markers.begin(), it, p0, p1); + + while (it != markers.end()) it++->emplaceRect({0, 0}, {0, 0}); + + std::ranges::sort(markers, SpecMarker::indexOrder); } void TreeMap::divide(It begin, diff --git a/test/e2e/tests/fixes.json b/test/e2e/tests/fixes.json index 3b65987a9..9862851cc 100644 --- a/test/e2e/tests/fixes.json +++ b/test/e2e/tests/fixes.json @@ -48,6 +48,9 @@ }, "53978116": { "refs": ["d0d0298"] + }, + "55278793": { + "refs": ["6825f33"] } } } diff --git a/test/e2e/tests/fixes/55278793.mjs b/test/e2e/tests/fixes/55278793.mjs new file mode 100644 index 000000000..9aaadce70 --- /dev/null +++ b/test/e2e/tests/fixes/55278793.mjs @@ -0,0 +1,22 @@ +const testSteps = [ + (chart) => + chart.animate({ + data: { + series: [ + { + name: 'D1', + values: ['v1', 'v2'] + }, + { + name: 'M1', + values: [-1, -2] + } + ] + }, + config: { + size: ['D1', 'M1'] + } + }) +] + +export default testSteps diff --git a/tools/ci/run/init-py.sh b/tools/ci/run/init-py.sh index a431f04c4..fc6cdac3a 100755 --- a/tools/ci/run/init-py.sh +++ b/tools/ci/run/init-py.sh @@ -7,6 +7,8 @@ if ! python3 -c 'import sys; assert sys.version_info >= (3,10)' > /dev/null; the exit 1 fi +test -f ~/.netrc && chmod u+rw,u-x,go-rwx ~/.netrc + python3.10 -m venv --copies ".venv" || python3 -m venv --copies ".venv" source .venv/bin/activate pip install pdm==2.10.3