Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dim--dim on x y #526

Merged
merged 6 commits into from
May 22, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- Tooltip with 'seriesName' does not rewrite first series data.
- Handle as different category the empty string and the missing value.
- On chart resize, the font size is recalculated.
- Dim-Dim on x-y shows separated rectangles.

### Added

Expand Down
27 changes: 20 additions & 7 deletions src/chart/generator/marker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,18 @@ Marker::Marker(const Options &options,
index,
horizontal ? &mainId->value : subAxisId);

spacing.x = (horizontal || (lineOrCircle && !polar))
&& options.getChannels().anyAxisSet()
&& channels.at(ChannelId::x).isDimension()
? 1
: 0;
auto yChannelRectDim =
channels.at(ChannelId::y).isDimension()
&& channels.at(ChannelId::y).hasDimension()
&& options.geometry == ShapeType::rectangle
&& options.align != Base::Align::Type::stretch;

spacing.x =
(horizontal || (lineOrCircle && !polar) || yChannelRectDim)
&& options.getChannels().anyAxisSet()
&& channels.at(ChannelId::x).isDimension()
? 1
: 0;

position.y = size.y = getValueForChannel(channels,
ChannelId::y,
Expand All @@ -88,7 +95,13 @@ Marker::Marker(const Options &options,
index,
!horizontal ? &mainId->value : subAxisId);

spacing.y = (!horizontal || lineOrCircle)
auto xChannelRectDim =
channels.at(ChannelId::x).isDimension()
&& channels.at(ChannelId::x).hasDimension()
&& options.geometry == ShapeType::rectangle
&& options.align != Base::Align::Type::stretch;

spacing.y = (!horizontal || lineOrCircle || xChannelRectDim)
&& options.getChannels().anyAxisSet()
&& channels.at(ChannelId::y).isDimension()
? 1
Expand Down Expand Up @@ -223,4 +236,4 @@ bool Marker::Label::operator==(const Label &other) const
{
return value == other.value && indexStr == other.indexStr;
}
}
}
3 changes: 3 additions & 0 deletions src/chart/options/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ void Options::drilldownTo(const Options &other)
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It smells a bit "workaroundy". Stretch does the work, but it's purpose is complety different.
I feel like that instead, we would need an bool spacing member in Channel which gives controls to manually swich on/off the spacing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noted. I'll not rewrite it in this PR but handle it at the axis refactor.

}

void Options::intersection(const Options &other)
Expand Down
22 changes: 11 additions & 11 deletions test/e2e/test_cases/test_cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -1775,7 +1775,7 @@
"refs": ["2352b28"]
},
"ww_next_steps/next_steps/38_C_L_line": {
"refs": ["b8ffd23"]
"refs": ["d03e139"]
},
"ww_next_steps/next_steps_Tests/02_C_R": {
"refs": ["c550e7b"]
Expand All @@ -1802,7 +1802,7 @@
"refs": ["feed828"]
},
"ww_next_steps/next_steps_Tests/38_C_L_line": {
"refs": ["a19aa52"]
"refs": ["3b273c7"]
},
"ww_next_steps/next_steps_Tests/axisLabel_problem": {
"refs": ["d33f180"]
Expand Down Expand Up @@ -2624,7 +2624,7 @@
"refs": ["9f2a6ba"]
},
"ww_noFade/wNoFade_cases/1_des_pol/rectangle_Ve1/04a_rec_Ve1_1c": {
"refs": ["aa58cd6"]
"refs": ["cbc5606"]
},
"ww_noFade/wNoFade_cases/1_des_pol/rectangle_Ve1/04a_rec_Ve1_2c": {
"refs": ["40b7f79"]
Expand All @@ -2633,7 +2633,7 @@
"refs": ["819fdce"]
},
"ww_noFade/wNoFade_cases/1_des_pol/rectangle_Ve1/06a_rec_Ve1_1c": {
"refs": ["21ba8df"]
"refs": ["5586c4d"]
},
"ww_noFade/wNoFade_cases/1_des_pol/rectangle_Ve1/07a_rec_Ve1_2c": {
"refs": ["0d9d4eb"]
Expand Down Expand Up @@ -2888,7 +2888,7 @@
"refs": ["0e97ae5"]
},
"ww_noFade/wNoFade_cases/2_des_pol-without/rectangle_V1/04a_d-w_rec_Ve1_1c_V1": {
"refs": ["7164b5b"]
"refs": ["537c8d4"]
},
"ww_noFade/wNoFade_cases/2_des_pol-without/rectangle_V1/04a_d-w_rec_Ve1_2c_V1": {
"refs": ["fe2656a"]
Expand All @@ -2909,7 +2909,7 @@
"refs": ["7008537"]
},
"ww_noFade/wNoFade_cases/2_des_pol-without/rectangle_Ve1/04a_d-w_rec_Ve1_1c": {
"refs": ["f9144aa"]
"refs": ["a1d4c96"]
},
"ww_noFade/wNoFade_cases/2_des_pol-without/rectangle_Ve1/04a_d-w_rec_Ve1_2c": {
"refs": ["3e15bfc"]
Expand All @@ -2918,7 +2918,7 @@
"refs": ["990dc60"]
},
"ww_noFade/wNoFade_cases/2_des_pol-without/rectangle_Ve1/06a_d-w_rec_Ve1_1c": {
"refs": ["a685430"]
"refs": ["c6fbce3"]
},
"ww_noFade/wNoFade_cases/2_des_pol-without/rectangle_Ve1/06a_d-w_rec_Ve1_2c": {
"refs": ["ac1ed71"]
Expand All @@ -2930,7 +2930,7 @@
"refs": ["27d694a"]
},
"ww_noFade/wNoFade_cases/2_des_pol-without/rectangle_Ve1/07a_d-w_rec_Ve2_1c": {
"refs": ["bcc4e6f"]
"refs": ["0b50210"]
},
"ww_noFade/wNoFade_cases/2_des_pol-without/rectangle_Ve1/07a_d-w_rec_Ve2_2c": {
"refs": ["fe75086"]
Expand Down Expand Up @@ -3146,10 +3146,10 @@
"refs": ["dfa1f88"]
},
"ww_samples_for_presets/without_coo_sys/602_W_R_heatmap3": {
"refs": ["4905e0d"]
"refs": ["049e495"]
},
"ww_samples_for_presets/without_coo_sys/60_W_R_heatmap": {
"refs": ["4d4090e"]
"refs": ["6276534"]
},
"www_new_analytical_operations/operations/01_drilldown/Bar_Bar": {
"refs": ["6396b85"]
Expand Down Expand Up @@ -3236,7 +3236,7 @@
"refs": ["bd104b0"]
},
"web_content/cookbook/style/dark_theme": {
"refs": ["5c4e3c1"]
"refs": ["f828b32"]
},
"web_content/cookbook/style/highligh_markers": {
"refs": ["48d6207"]
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/config_tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"refs": ["5949df4"]
},
"dimension_axis_title": {
"refs": ["d9bab94"]
"refs": ["6b8167a"]
},
"dimension_axis_density": {
"refs": ["9b330fb"]
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/tests/fixes.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
"refs": ["2ad1738"]
},
"41932946": {
"refs": ["bf6b3a9"]
"refs": ["3ca57ce"]
},
"42836788": {
"refs": ["b0eeac3"]
"refs": ["4d761f7"]
},
"47977099": {
"refs": ["5f58727"]
Expand Down