Skip to content

Commit 0263d8b

Browse files
committed
Merge branch 'axis_refactor_v12' into axis_refactor_v12b
2 parents ed974b8 + d3ce44d commit 0263d8b

File tree

25 files changed

+148
-121
lines changed

25 files changed

+148
-121
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
### Added
3535

36-
- Add split property for plot axis style structure. Only supported the percentage value.
36+
- Add spacing property for plot axis style structure.
3737

3838
### Changed
3939

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,9 @@ definitions:
452452
interlacing:
453453
$ref: Interlacing
454454
nullable: true
455-
split:
456-
$ref: Length
455+
spacing:
456+
type: string
457+
mask: /:number:%/
457458
nullable: true
458459

459460
Plot:

src/base/refl/auto_enum.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ template <class E> consteval auto enum_values()
202202
constexpr auto n = std::size(enum_names<E>);
203203
std::array<E, n> res{};
204204
for (std::size_t i = 0; i < n; ++i)
205+
// NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange)
205206
res[i] = static_cast<E>(i + first);
206207
return res;
207208
}

src/base/type/uniquelist.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ template <class T> class UniqueList
237237
struct CommonIterateVal
238238
{
239239
const T &value;
240-
const std::size_t *othIx;
240+
const std::size_t *otherIx;
241241
};
242242

243243
struct common_iterator

src/chart/generator/axis.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include <iterator>
88
#include <limits>
99
#include <optional>
10-
#include <set>
1110
#include <string>
1211
#include <string_view>
1312
#include <tuple>

src/chart/generator/buckets.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ struct Buckets
4444
});
4545
}
4646

47-
[[nodiscard]] bool operator!=(const const_iterator &oth) const
47+
[[nodiscard]] bool operator!=(
48+
const const_iterator &other) const
4849
{
49-
return data.data() != oth.data.data();
50+
return data.data() != other.data.data();
5051
}
5152

5253
const_iterator &operator++();

src/chart/generator/marker.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "marker.h"
22

3+
#include <cmath>
34
#include <cstdint>
45
#include <optional>
56
#include <utility>
@@ -225,14 +226,14 @@ void Marker::fromRectangle(const Geom::Rect &rect)
225226

226227
Math::Range<> Marker::getSizeBy(AxisId axisId) const
227228
{
228-
return isHorizontal(++axisId) ? toRectangle().hSize()
229-
: toRectangle().vSize();
229+
return isHorizontal(orientation(axisId)) ? toRectangle().hSize()
230+
: toRectangle().vSize();
230231
}
231232

232233
void Marker::setSizeBy(AxisId axisId, const Math::Range<> range)
233234
{
234235
auto rect = toRectangle();
235-
if (isHorizontal(++axisId))
236+
if (isHorizontal(orientation(axisId)))
236237
rect.setHSize(range);
237238
else
238239
rect.setVSize(range);

src/chart/generator/plotbuilder.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "base/anim/interpolated.h"
1818
#include "base/math/floating.h"
1919
#include "base/math/range.h"
20+
#include "base/refl/auto_enum.h"
2021
#include "chart/main/style.h"
2122
#include "chart/options/align.h"
2223
#include "chart/options/channel.h"
@@ -233,7 +234,7 @@ bool PlotBuilder::linkMarkers(const Buckets &buckets,
233234
auto &marker = **it.base().base().base();
234235
if (!marker.enabled) continue;
235236
o = std::max(o,
236-
marker.size.getCoord(++axisIndex),
237+
marker.size.getCoord(orientation(axisIndex)),
237238
Math::Floating::less);
238239
}
239240
if (o == std::numeric_limits<double>::lowest()) o = 0.0;
@@ -279,7 +280,8 @@ bool PlotBuilder::linkMarkers(const Buckets &buckets,
279280
: *it.base().base().base();
280281

281282
if (act)
282-
prevPos = act->position.getCoord(++axisIndex) +=
283+
prevPos =
284+
act->position.getCoord(orientation(axisIndex)) +=
283285
isAggregatable ? dimOffset[i] : prevPos;
284286

285287
hasConnection |=
@@ -542,7 +544,7 @@ void PlotBuilder::addSeparation(const Buckets &subBuckets,
542544
auto splitSpace =
543545
plot->getStyle()
544546
.plot.getAxis(plot->getOptions()->subAxisType())
545-
.split->get(max.getMax(),
547+
.spacing->get(max.getMax(),
546548
plot->getStyle().calculatedSize());
547549

548550
for (auto i = 1U; i < ranges.size(); ++i)

src/chart/main/style.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ Chart Chart::def()
280280
.interlacing = {
281281
.color = Gfx::Color::Gray(0.97)
282282
},
283-
.split = Gfx::Length::Relative(1 / 15.)
283+
.spacing = Gfx::Length::Relative(1 / 15.)
284284
},
285285
.yAxis = {
286286
.color = Gfx::Color::Gray(0.8),
@@ -372,7 +372,7 @@ Chart Chart::def()
372372
.interlacing = {
373373
.color = Gfx::Color::Gray(0.97)
374374
},
375-
.split = Gfx::Length::Relative(1 / 15.)
375+
.spacing = Gfx::Length::Relative(1 / 15.)
376376
},
377377
.areaColor = Gfx::Color::Transparent(),
378378
.overflow = ::Anim::Interpolated<Overflow>(Overflow::hidden)

src/chart/main/style.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ struct Axis
245245
Tick ticks;
246246
Guide guides;
247247
Interlacing interlacing;
248-
Param<Gfx::Length> split;
248+
Param<Gfx::Length> spacing;
249249
};
250250

251251
struct MarkerLabelParams

0 commit comments

Comments
 (0)