Skip to content

Commit 033bb07

Browse files
authored
Merge pull request #526 from vizzuhq/dim_dim_on_x_y
Dim--dim on x y
2 parents a3bca64 + c7197ad commit 033bb07

File tree

6 files changed

+38
-21
lines changed

6 files changed

+38
-21
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- Tooltip with 'seriesName' does not rewrite first series data.
1818
- Handle as different category the empty string and the missing value.
1919
- On chart resize, the font size is recalculated.
20+
- Dim-Dim on x-y shows separated rectangles.
2021

2122
### Added
2223

src/chart/generator/marker.cpp

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,18 @@ Marker::Marker(const Options &options,
7575
index,
7676
horizontal ? &mainId->value : subAxisId);
7777

78-
spacing.x = (horizontal || (lineOrCircle && !polar))
79-
&& options.getChannels().anyAxisSet()
80-
&& channels.at(ChannelId::x).isDimension()
81-
? 1
82-
: 0;
78+
auto yChannelRectDim =
79+
channels.at(ChannelId::y).isDimension()
80+
&& channels.at(ChannelId::y).hasDimension()
81+
&& options.geometry == ShapeType::rectangle
82+
&& options.align != Base::Align::Type::stretch;
83+
84+
spacing.x =
85+
(horizontal || (lineOrCircle && !polar) || yChannelRectDim)
86+
&& options.getChannels().anyAxisSet()
87+
&& channels.at(ChannelId::x).isDimension()
88+
? 1
89+
: 0;
8390

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

91-
spacing.y = (!horizontal || lineOrCircle)
98+
auto xChannelRectDim =
99+
channels.at(ChannelId::x).isDimension()
100+
&& channels.at(ChannelId::x).hasDimension()
101+
&& options.geometry == ShapeType::rectangle
102+
&& options.align != Base::Align::Type::stretch;
103+
104+
spacing.y = (!horizontal || lineOrCircle || xChannelRectDim)
92105
&& options.getChannels().anyAxisSet()
93106
&& channels.at(ChannelId::y).isDimension()
94107
? 1
@@ -223,4 +236,4 @@ bool Marker::Label::operator==(const Label &other) const
223236
{
224237
return value == other.value && indexStr == other.indexStr;
225238
}
226-
}
239+
}

src/chart/options/options.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ void Options::drilldownTo(const Options &other)
115115
for (auto &&dim : other.getChannels().getDimensions())
116116
if (!getChannels().isSeriesUsed(dim))
117117
stackChannel.addSeries(dim);
118+
if (stackChannel.isDimension()
119+
&& geometry == ShapeType::rectangle)
120+
this->align = Base::Align::Type::stretch;
118121
}
119122

120123
void Options::intersection(const Options &other)

test/e2e/test_cases/test_cases.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,7 +1775,7 @@
17751775
"refs": ["2352b28"]
17761776
},
17771777
"ww_next_steps/next_steps/38_C_L_line": {
1778-
"refs": ["b8ffd23"]
1778+
"refs": ["d03e139"]
17791779
},
17801780
"ww_next_steps/next_steps_Tests/02_C_R": {
17811781
"refs": ["c550e7b"]
@@ -1802,7 +1802,7 @@
18021802
"refs": ["feed828"]
18031803
},
18041804
"ww_next_steps/next_steps_Tests/38_C_L_line": {
1805-
"refs": ["a19aa52"]
1805+
"refs": ["3b273c7"]
18061806
},
18071807
"ww_next_steps/next_steps_Tests/axisLabel_problem": {
18081808
"refs": ["d33f180"]
@@ -2624,7 +2624,7 @@
26242624
"refs": ["9f2a6ba"]
26252625
},
26262626
"ww_noFade/wNoFade_cases/1_des_pol/rectangle_Ve1/04a_rec_Ve1_1c": {
2627-
"refs": ["aa58cd6"]
2627+
"refs": ["cbc5606"]
26282628
},
26292629
"ww_noFade/wNoFade_cases/1_des_pol/rectangle_Ve1/04a_rec_Ve1_2c": {
26302630
"refs": ["40b7f79"]
@@ -2633,7 +2633,7 @@
26332633
"refs": ["819fdce"]
26342634
},
26352635
"ww_noFade/wNoFade_cases/1_des_pol/rectangle_Ve1/06a_rec_Ve1_1c": {
2636-
"refs": ["21ba8df"]
2636+
"refs": ["5586c4d"]
26372637
},
26382638
"ww_noFade/wNoFade_cases/1_des_pol/rectangle_Ve1/07a_rec_Ve1_2c": {
26392639
"refs": ["0d9d4eb"]
@@ -2888,7 +2888,7 @@
28882888
"refs": ["0e97ae5"]
28892889
},
28902890
"ww_noFade/wNoFade_cases/2_des_pol-without/rectangle_V1/04a_d-w_rec_Ve1_1c_V1": {
2891-
"refs": ["7164b5b"]
2891+
"refs": ["537c8d4"]
28922892
},
28932893
"ww_noFade/wNoFade_cases/2_des_pol-without/rectangle_V1/04a_d-w_rec_Ve1_2c_V1": {
28942894
"refs": ["fe2656a"]
@@ -2909,7 +2909,7 @@
29092909
"refs": ["7008537"]
29102910
},
29112911
"ww_noFade/wNoFade_cases/2_des_pol-without/rectangle_Ve1/04a_d-w_rec_Ve1_1c": {
2912-
"refs": ["f9144aa"]
2912+
"refs": ["a1d4c96"]
29132913
},
29142914
"ww_noFade/wNoFade_cases/2_des_pol-without/rectangle_Ve1/04a_d-w_rec_Ve1_2c": {
29152915
"refs": ["3e15bfc"]
@@ -2918,7 +2918,7 @@
29182918
"refs": ["990dc60"]
29192919
},
29202920
"ww_noFade/wNoFade_cases/2_des_pol-without/rectangle_Ve1/06a_d-w_rec_Ve1_1c": {
2921-
"refs": ["a685430"]
2921+
"refs": ["c6fbce3"]
29222922
},
29232923
"ww_noFade/wNoFade_cases/2_des_pol-without/rectangle_Ve1/06a_d-w_rec_Ve1_2c": {
29242924
"refs": ["ac1ed71"]
@@ -2930,7 +2930,7 @@
29302930
"refs": ["27d694a"]
29312931
},
29322932
"ww_noFade/wNoFade_cases/2_des_pol-without/rectangle_Ve1/07a_d-w_rec_Ve2_1c": {
2933-
"refs": ["bcc4e6f"]
2933+
"refs": ["0b50210"]
29342934
},
29352935
"ww_noFade/wNoFade_cases/2_des_pol-without/rectangle_Ve1/07a_d-w_rec_Ve2_2c": {
29362936
"refs": ["fe75086"]
@@ -3146,10 +3146,10 @@
31463146
"refs": ["dfa1f88"]
31473147
},
31483148
"ww_samples_for_presets/without_coo_sys/602_W_R_heatmap3": {
3149-
"refs": ["4905e0d"]
3149+
"refs": ["049e495"]
31503150
},
31513151
"ww_samples_for_presets/without_coo_sys/60_W_R_heatmap": {
3152-
"refs": ["4d4090e"]
3152+
"refs": ["6276534"]
31533153
},
31543154
"www_new_analytical_operations/operations/01_drilldown/Bar_Bar": {
31553155
"refs": ["6396b85"]
@@ -3236,7 +3236,7 @@
32363236
"refs": ["bd104b0"]
32373237
},
32383238
"web_content/cookbook/style/dark_theme": {
3239-
"refs": ["5c4e3c1"]
3239+
"refs": ["f828b32"]
32403240
},
32413241
"web_content/cookbook/style/highligh_markers": {
32423242
"refs": ["48d6207"]

test/e2e/tests/config_tests.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"refs": ["5949df4"]
4242
},
4343
"dimension_axis_title": {
44-
"refs": ["d9bab94"]
44+
"refs": ["6b8167a"]
4545
},
4646
"dimension_axis_density": {
4747
"refs": ["9b330fb"]

test/e2e/tests/fixes.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
"refs": ["2ad1738"]
3636
},
3737
"41932946": {
38-
"refs": ["bf6b3a9"]
38+
"refs": ["3ca57ce"]
3939
},
4040
"42836788": {
41-
"refs": ["b0eeac3"]
41+
"refs": ["4d761f7"]
4242
},
4343
"47977099": {
4444
"refs": ["5f58727"]

0 commit comments

Comments
 (0)