Skip to content

Commit 85a53ea

Browse files
committed
dim-dim on x-y
1 parent 86857fd commit 85a53ea

File tree

8 files changed

+35
-13
lines changed

8 files changed

+35
-13
lines changed

CHANGELOG.md

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

2021
### Added
2122

src/chart/generator/marker.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Marker::Marker(const Options &options,
1212
ChannelsStats &stats,
1313
const Data::MultiIndex &index,
1414
MarkerIndex idx,
15-
bool needMarkerInfo) :
15+
bool needMarkerInfo,
16+
bool rectangleSpacing) :
1617
enabled(data.empty() || !index.isEmpty()),
1718
cellInfo(enabled || needMarkerInfo
1819
? data.cellInfo(index, idx, needMarkerInfo)
@@ -75,7 +76,12 @@ Marker::Marker(const Options &options,
7576
index,
7677
horizontal ? &mainId->value : subAxisId);
7778

78-
spacing.x = (horizontal || (lineOrCircle && !polar))
79+
spacing.x = (horizontal || (lineOrCircle && !polar)
80+
|| (channels.at(ChannelId::y).isDimension()
81+
&& channels.at(ChannelId::y).hasDimension()
82+
&& options.geometry == ShapeType::rectangle
83+
&& options.align != Base::Align::Type::stretch
84+
&& rectangleSpacing))
7985
&& options.getChannels().anyAxisSet()
8086
&& channels.at(ChannelId::x).isDimension()
8187
? 1
@@ -88,7 +94,12 @@ Marker::Marker(const Options &options,
8894
index,
8995
!horizontal ? &mainId->value : subAxisId);
9096

91-
spacing.y = (!horizontal || lineOrCircle)
97+
spacing.y = (!horizontal || lineOrCircle
98+
|| (channels.at(ChannelId::x).isDimension()
99+
&& channels.at(ChannelId::y).hasDimension()
100+
&& options.geometry == ShapeType::rectangle
101+
&& options.align != Base::Align::Type::stretch
102+
&& rectangleSpacing))
92103
&& options.getChannels().anyAxisSet()
93104
&& channels.at(ChannelId::y).isDimension()
94105
? 1

src/chart/generator/marker.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ class Marker
2929
ChannelsStats &stats,
3030
const Data::MultiIndex &index,
3131
MarkerIndex idx,
32-
bool needMarkerInfo);
32+
bool needMarkerInfo,
33+
bool rectangleSpacing);
3334

3435
::Anim::Interpolated<ColorBase> colorBase;
3536
Geom::Point position;

src/chart/generator/plot.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ Buckets Plot::generateMarkers()
129129
for (auto &&[ix, mid] : options->markersInfo)
130130
map.emplace(mid, ix);
131131

132+
bool rectangleSpacing{true};
133+
if (auto &&sp = style.plot.marker.rectangleSpacing;
134+
sp && sp->get().has_value())
135+
rectangleSpacing = *sp->get() > 0.0;
136+
132137
for (auto first = map.begin(), last = map.end();
133138
auto &&index : getDataCube()) {
134139
auto &&markerId = markers.size();
@@ -139,7 +144,8 @@ Buckets Plot::generateMarkers()
139144
getStats(),
140145
index,
141146
markerId,
142-
needInfo);
147+
needInfo,
148+
rectangleSpacing);
143149

144150
mainBuckets[marker.mainId.get().seriesId]
145151
[marker.mainId.get().itemId] = &marker;

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: 5 additions & 5 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"]
@@ -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": ["b38086a"]
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)