diff --git a/CHANGELOG.md b/CHANGELOG.md index 71fceeaae..ffdff93e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,9 @@ ## [Unreleased] -### Fixed +### Fixed +- Fix drilldown regroup strategy on fake-split charts. - From now vertical line connections are curved lines. - Remove duplicated circles on line-circle transition. - Fix area-circle polar connection transition. diff --git a/src/chart/options/options.cpp b/src/chart/options/options.cpp index f5827371a..af48464e3 100644 --- a/src/chart/options/options.cpp +++ b/src/chart/options/options.cpp @@ -98,6 +98,13 @@ std::optional Options::secondaryStackType() const return std::nullopt; } +bool Options::isStacked() const +{ + auto dims = stackChannel().dimensions(); + dims.split_by(mainAxis().dimensions()); + return !dims.empty(); +} + Channels Options::shadowChannels() const { auto shadow = channels.shadow(); @@ -122,12 +129,11 @@ void Options::drilldownTo(const Options &other) { auto &stackChannel = this->stackChannel(); + if (this->split && !isSplit()) this->split = false; + for (auto &&dim : other.getChannels().getDimensions()) if (!getChannels().isSeriesUsed(dim)) stackChannel.addSeries(dim); - if (stackChannel.isDimension() - && geometry == ShapeType::rectangle) - this->align = Base::Align::Type::stretch; } void Options::intersection(const Options &other) @@ -192,9 +198,9 @@ bool Options::sameShadowAttribs(const Options &other) const return shape == shapeOther && coordSystem == other.coordSystem && angle == other.angle && orientation == other.orientation - && split == other.split && dataFilter == other.dataFilter - && align == other.align && sort == other.sort - && reverse == other.reverse; + && isSplit() == other.isSplit() + && dataFilter == other.dataFilter && align == other.align + && sort == other.sort && reverse == other.reverse; } bool Options::sameAttributes(const Options &other) const diff --git a/src/chart/options/options.h b/src/chart/options/options.h index 8a4bc42b8..ebade4a01 100644 --- a/src/chart/options/options.h +++ b/src/chart/options/options.h @@ -109,6 +109,18 @@ class Options return channels.at(stackChannelType()); } + [[nodiscard]] const Channel &stackChannel() const + { + return channels.at(stackChannelType()); + } + + [[nodiscard]] bool isStacked() const; + [[nodiscard]] bool isSplit() const + { + return split + && (stackChannelType() != subAxisType() || isStacked()); + } + Heading title{std::nullopt}; Heading subtitle{std::nullopt}; Heading caption{std::nullopt}; diff --git a/test/e2e/test_cases/test_cases.json b/test/e2e/test_cases/test_cases.json index b7aad2257..6a6c9b478 100644 --- a/test/e2e/test_cases/test_cases.json +++ b/test/e2e/test_cases/test_cases.json @@ -3236,7 +3236,7 @@ "refs": ["bd104b0"] }, "web_content/cookbook/style/dark_theme": { - "refs": ["f7c42b8"] + "refs": ["b23128f"] }, "web_content/cookbook/style/highligh_markers": { "refs": ["54fc3d3"] diff --git a/test/e2e/tests/fixes.json b/test/e2e/tests/fixes.json index ad51ba411..fac053f6a 100644 --- a/test/e2e/tests/fixes.json +++ b/test/e2e/tests/fixes.json @@ -7,6 +7,9 @@ "91": { "refs": ["1732a49"] }, + "143": { + "refs": ["4396a67"] + }, "144": { "refs": ["fde02e4"] }, diff --git a/test/e2e/tests/fixes/143.mjs b/test/e2e/tests/fixes/143.mjs new file mode 100644 index 000000000..db662e8ba --- /dev/null +++ b/test/e2e/tests/fixes/143.mjs @@ -0,0 +1,42 @@ +const testSteps = [ + (chart) => { + const data = { + series: [ + { + name: 'Colors', + type: 'dimension', + values: ['red', 'green', 'blue', 'red', 'green', 'blue', 'red', 'green', 'blue'] + }, + { + name: 'Letters', + type: 'dimension', + values: ['a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c'] + }, + { + name: 'Val', + type: 'measure', + values: [3, 5, 4, 3 + 1, 5 + 1, 4 + 1, 3 + 2, 5 + 2, 4 + 2] + } + ] + } + + return chart.animate({ + data, + config: { + y: 'Colors', + x: 'Val' + } + }) + }, + (chart) => + chart.animate( + { + y: 'Val', + x: 'Letters', + split: true + }, + { regroupStrategy: 'drilldown' } + ) +] + +export default testSteps