Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into Fix-channel-step
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
schaumb committed Oct 1, 2024
2 parents a686e2d + b98eb87 commit 47469f9
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixed

- Fix again measure axis labels when the axis range and step set too.
- Fix drilldown regroup strategy on fake-split charts.

## [0.13.0] - 2024-09-13

Expand Down
18 changes: 12 additions & 6 deletions src/chart/options/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ std::optional<ChannelId> 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();
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions src/chart/options/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/test_cases/test_cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -3236,7 +3236,7 @@
"refs": ["bd104b0"]
},
"web_content/cookbook/style/dark_theme": {
"refs": ["f7c42b8"]
"refs": ["b23128f"]
},
"web_content/cookbook/style/highligh_markers": {
"refs": ["54fc3d3"]
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/tests/fixes.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"91": {
"refs": ["1732a49"]
},
"143": {
"refs": ["4396a67"]
},
"144": {
"refs": ["fde02e4"]
},
Expand Down
42 changes: 42 additions & 0 deletions test/e2e/tests/fixes/143.mjs
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 47469f9

Please sign in to comment.