Skip to content

Commit 6c27ac4

Browse files
authored
Merge pull request #585 from vizzuhq/remove-align_max
Remove 'align: max'
2 parents a91de27 + 4500980 commit 6c27ac4

File tree

3 files changed

+13
-20
lines changed

3 files changed

+13
-20
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
- Remove unwanted line connections from line-circle + orientation changed anim.
1515
- Move axis to the center on align: center charts.
1616

17+
### Changed
18+
19+
- Removed the 'align: max' property from the API. That function can be achieved
20+
by setting the axis range to: {min: '100%', max: '0%'}.
21+
22+
1723
## [0.13.0] - 2024-09-13
1824

1925
### Fixed

src/apps/weblib/typeschema-api/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ definitions:
223223
on where the measure is. In case both axes have measures on them, this is determined
224224
by the `orientation` of the chart.
225225
type: string
226-
enum: [none, min, center, max, stretch]
226+
enum: [none, min, center, stretch]
227227
split:
228228
description: |
229229
If set to true, markers will be split by the dimension(s) along the axis.

src/chart/options/align.h

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,17 @@ namespace Vizzu::Base
1010

1111
struct Align : private Math::Range<double>
1212
{
13-
public:
14-
enum class Type : std::uint8_t {
15-
none,
16-
min,
17-
center,
18-
max,
19-
stretch
20-
};
21-
22-
Align(Type type, const Range<double> &range) :
23-
Range<double>(range),
24-
type(type)
25-
{}
26-
27-
[[nodiscard]] Range<double> getAligned(
28-
const Range<double> &range) const
13+
enum class Type : std::uint8_t { none, min, center, stretch };
14+
15+
Align(Type type, const Range &range) : Range(range), type(type) {}
16+
17+
[[nodiscard]] Range getAligned(const Range &range) const
2918
{
3019
switch (type) {
3120
case Type::none: return range;
3221
case Type::min: return range + min - range.getMin();
3322
case Type::center: return range - range.middle() + middle();
34-
case Type::max: return range + max - range.getMax();
35-
case Type::stretch:
36-
return static_cast<const Range<double> &>(*this);
23+
case Type::stretch: return static_cast<const Range &>(*this);
3724
}
3825
throw std::logic_error("invalid align type");
3926
}

0 commit comments

Comments
 (0)