Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into markerId-to-string
Browse files Browse the repository at this point in the history
# Conflicts:
#	test/e2e/test_cases/test_cases.json
#	test/e2e/tests/fixes.json
  • Loading branch information
schaumb committed Oct 14, 2024
2 parents 05d820c + 1c32ef6 commit 4ed9be7
Show file tree
Hide file tree
Showing 48 changed files with 686 additions and 352 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-vizzu-dev-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jobs:
- name: Build and Publish
run: |
IMAGE="vizzu-dev-desktop"
IMAGE_NAME="vizzu/$IMAGE:0.12"
IMAGE_NAME="vizzu/$IMAGE:0.14"
docker build -t $IMAGE_NAME -f tools/ci/docker/$IMAGE .
docker push $IMAGE_NAME
2 changes: 1 addition & 1 deletion .github/workflows/docker-vizzu-dev-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jobs:
- name: Build and Publish
run: |
IMAGE="vizzu-dev-wasm"
IMAGE_NAME="vizzu/$IMAGE:0.12"
IMAGE_NAME="vizzu/$IMAGE:0.14"
docker build -t $IMAGE_NAME -f tools/ci/docker/$IMAGE .
docker push $IMAGE_NAME
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@

## [Unreleased]

## [0.14.0] - 2024-10-03

### Fixed

- Fix again measure axis labels when the axis range and step set too.
- Fix drilldown regroup strategy on fake-split charts.
- From now vertical line connections are curved lines.
- Remove duplicated circles on line-circle transition.
- Fix area-circle polar connection transition.
- Fix line-rectangle polar connection linearity.
- Fix all polar connection interpolation (except fading).
- Remove unwanted line connections from line-circle + orientation changed anim.
- Move axis to the center on align: center charts.

### Changed

- Removed the 'align: max' property from the API. That function can be achieved
by setting the axis range to: {min: '100%', max: '0%'}.


## [0.13.0] - 2024-09-13

### Fixed

- Legend title bottomPadding extended.
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ docker run -i -t -v .:/workspace vizzu/vizzu-dev-desktop bash
or you can use a specific version of the prebuilt image:

```sh
docker run -i -t -v .:/workspace vizzu/vizzu-dev-desktop:0.12 bash
docker run -i -t -v .:/workspace vizzu/vizzu-dev-desktop:0.14 bash
```

Run the following commands to build and run the `WASM` version's development
Expand All @@ -84,7 +84,7 @@ docker run -i -t -v .:/workspace vizzu/vizzu-dev-wasm bash
or you can use a specific version of the prebuilt image:

```sh
docker run -i -t -v .:/workspace vizzu/vizzu-dev-wasm:0.12 bash
docker run -i -t -v .:/workspace vizzu/vizzu-dev-wasm:0.14 bash
```

### Building the project
Expand Down
4 changes: 1 addition & 3 deletions docs/tutorial/chart_layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ are aligned.
```javascript
chart.animate({
style: {
title: {
backgroundColor: '#A0A0A0'
},
backgroundColor: '#A0A0A0',
plot: {
backgroundColor: '#D2D2D2'
},
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/shorthands_store.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Promise.all([dataLoaded, mdChartLoaded]).then((results) => {
return chart.animate({
style: {
'plot.xAxis.label.fontSize': '150%',
'title.backgroundColor': '#A0A0A0'
'plot.backgroundColor': '#A0A0A0'
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/shorthands_store.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ chart.animate({
style: {
// plot: { xAxis: { label: { fontSize: '150%' } } }
'plot.xAxis.label.fontSize': '150%',
'title.backgroundColor': '#A0A0A0'
'plot.backgroundColor': '#A0A0A0'
}
})
```
Expand Down
2 changes: 1 addition & 1 deletion src/apps/weblib/typeschema-api/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ definitions:
on where the measure is. In case both axes have measures on them, this is determined
by the `orientation` of the chart.
type: string
enum: [none, min, center, max, stretch]
enum: [none, min, center, stretch]
split:
description: |
If set to true, markers will be split by the dimension(s) along the axis.
Expand Down
8 changes: 8 additions & 0 deletions src/base/anim/interpolated.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ template <typename Type> class Interpolated
return values[has_second && static_cast<bool>(index)];
}

[[nodiscard]] std::optional<InterpolateIndex> get_index(
const Type &type) const
{
if (values[0].value == type) return first;
if (has_second && values[1].value == type) return second;
return {};
}

template <class T>
// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward)
[[nodiscard]] auto get(T &&) const = delete;
Expand Down
64 changes: 43 additions & 21 deletions src/base/refl/auto_enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,29 @@ namespace Detail
{
template <class T> using real_t = std::underlying_type_t<T>;

template <class E, real_t<E> From, real_t<E> To>
requires(!std::same_as<bool, real_t<E>>)
template <class E>
concept UniqueNames = requires {
static_cast<std::string_view>(unique_enum_names(E{}));
};

template <class E>
concept UniqueRange = requires {
static_cast<std::pair<real_t<E>, real_t<E>>>(unique_from_to(E{}));
};

template <class E>
requires(UniqueRange<E>)
consteval std::pair<real_t<E>, real_t<E>> from_to()
{
constexpr auto res = unique_from_to(E{});
static_assert(res.first <= res.second, "Invalid range");
return res;
}

template <class E,
real_t<E> From = real_t<E>{},
real_t<E> To = real_t<E>{}>
requires(!UniqueRange<E> && !std::same_as<bool, real_t<E>>)
consteval std::pair<real_t<E>, real_t<E>> from_to()
{
if constexpr (std::is_signed_v<real_t<E>>
Expand All @@ -44,39 +65,40 @@ consteval std::pair<real_t<E>, real_t<E>> from_to()
return from_to<E, From - 1, To>();
else if constexpr (!Name::name<E, static_cast<E>(To)>().empty())
return from_to<E, From, To + 1>();
else
return {From, To};
else {
static_assert(From != To, "Not found any enum string");
return {From, To - 1};
}
}

template <class E, int, int>
requires(std::same_as<bool, real_t<E>>)
requires(!UniqueRange<E> && std::same_as<bool, real_t<E>>)
consteval std::pair<real_t<E>, real_t<E>> from_to()
{
return {false, false};
constexpr auto has_false =
!Name::name<E, static_cast<E>(false)>().empty();
constexpr auto has_true =
!Name::name<E, static_cast<E>(true)>().empty();
static_assert(has_false || has_true, "Not found any enum string");
return {!has_false, has_true};
}

template <class E>
requires(!std::same_as<bool, real_t<E>>)
consteval real_t<E> count()
{
auto [from, to] = from_to<E, 0, 0>();
return static_cast<real_t<E>>(to - from);
auto [from, to] = from_to<E>();
return static_cast<real_t<E>>(to - from + 1);
}

template <class E>
requires(std::same_as<bool, real_t<E>>)
consteval int count()
{
return Name::name<E, static_cast<E>(false)>().empty()
? 0
: 1 + !Name::name<E, static_cast<E>(true)>().empty();
auto [from, to] = from_to<E>();
return to - from + 1;
}

template <class E>
concept UniqueNames = requires {
static_cast<std::string_view>(unique_enum_names(E{}));
};

template <class E, class F = real_t<E>, F... Ix>
consteval auto whole_array(std::integer_sequence<F, Ix...> = {})
{
Expand All @@ -87,7 +109,7 @@ consteval auto whole_array(std::integer_sequence<F, Ix...> = {})
return res;
}
else {
constexpr auto first = Detail::from_to<E, 0, 0>().first;
constexpr auto first = Detail::from_to<E>().first;
std::array<char,
(Name::name<E, static_cast<E>(Ix + first)>().size() + ...
+ (sizeof...(Ix) - 1))>
Expand All @@ -109,7 +131,7 @@ constexpr std::array enum_name_holder = Detail::whole_array<E>(
Detail::count<E>()>{});

template <class E>
constexpr std::array enum_name_holder<E, true> =
constinit const std::array enum_name_holder<E, true> =
Detail::whole_array<E, int>(
std::make_integer_sequence<int, Detail::count<E>()>{});

Expand Down Expand Up @@ -143,7 +165,7 @@ template <class E> constexpr std::array enum_names = get_names<E>();
template <class Type = std::string_view, class E>
Type enum_name(E name)
{
constexpr auto first = Detail::from_to<E, 0, 0>().first;
constexpr auto first = Detail::from_to<E>().first;
constexpr auto n = std::size(enum_names<E>);
if (static_cast<std::size_t>(
static_cast<Detail::real_t<E>>(name) - first)
Expand All @@ -159,7 +181,7 @@ Type enum_name(E name)

template <class E> constexpr E get_enum(const std::string_view &data)
{
constexpr auto first = Detail::from_to<E, 0, 0>().first;
constexpr auto first = Detail::from_to<E>().first;
Detail::real_t<E> ix{};
for (auto v : enum_names<E>) {
if (v == data) break;
Expand Down Expand Up @@ -204,7 +226,7 @@ struct EnumArray : std::array<V, std::size(enum_names<E>)>
template <class E, class... Args>
requires(std::is_enum_v<E>
&& sizeof...(Args) == Detail::count<E>()
&& Detail::from_to<E, 0, 0>().first == 0)
&& Detail::from_to<E>().first == 0)
struct EnumVariant : std::variant<Args...>
{
using base_variant = std::variant<Args...>;
Expand Down
22 changes: 11 additions & 11 deletions src/chart/animator/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ bool Planner::needColor() const
}

size_t Planner::dimensionCount(const Gen::Plot *plot,
Gen::ChannelId type)
Gen::AxisId type)
{
return plot->getOptions()
->getChannels()
Expand All @@ -401,15 +401,15 @@ bool Planner::verticalBeforeHorizontal() const
|| !srcOpt->getChannels().anyAxisSet()
|| !trgOpt->getChannels().anyAxisSet()) {
if (srcOpt->getChannels().anyAxisSet())
return srcOpt->subAxisType() == Gen::ChannelId::y;
return srcOpt->subAxisType() == Gen::AxisId::y;
if (trgOpt->getChannels().anyAxisSet())
return trgOpt->mainAxisType() == Gen::ChannelId::y;
return trgOpt->mainAxisType() == Gen::AxisId::y;
}

auto srcXcnt = dimensionCount(source, Gen::ChannelId::x);
auto srcYcnt = dimensionCount(source, Gen::ChannelId::y);
auto trgXcnt = dimensionCount(target, Gen::ChannelId::x);
auto trgYcnt = dimensionCount(target, Gen::ChannelId::y);
auto srcXcnt = dimensionCount(source, Gen::AxisId::x);
auto srcYcnt = dimensionCount(source, Gen::AxisId::y);
auto trgXcnt = dimensionCount(target, Gen::AxisId::x);
auto trgYcnt = dimensionCount(target, Gen::AxisId::y);

if ((trgYcnt != srcYcnt) || (trgXcnt != srcXcnt)) {
return (trgYcnt > srcYcnt) || (trgXcnt < srcXcnt);
Expand All @@ -425,8 +425,8 @@ bool Planner::needVertical() const
!= target->axises.at(Gen::ChannelId::y).measure
|| source->axises.at(Gen::ChannelId::y).dimension
!= target->axises.at(Gen::ChannelId::y).dimension
|| source->guides.at(Gen::ChannelId::y)
!= target->guides.at(Gen::ChannelId::y)
|| source->guides.at(Gen::AxisId::y)
!= target->guides.at(Gen::AxisId::y)
|| (isAnyLegend(Gen::ChannelId::size)
&& (source->axises.at(Gen::ChannelId::size).common
!= target->axises.at(Gen::ChannelId::size).common
Expand Down Expand Up @@ -472,8 +472,8 @@ bool Planner::needHorizontal() const
!= target->axises.at(Gen::ChannelId::x).measure
|| source->axises.at(Gen::ChannelId::x).dimension
!= target->axises.at(Gen::ChannelId::x).dimension
|| source->guides.at(Gen::ChannelId::x)
!= target->guides.at(Gen::ChannelId::x)
|| source->guides.at(Gen::AxisId::x)
!= target->guides.at(Gen::AxisId::x)
|| source->anyAxisSet != target->anyAxisSet
|| source->keepAspectRatio != target->keepAspectRatio
|| (source->markerConnectionOrientation
Expand Down
2 changes: 1 addition & 1 deletion src/chart/animator/planner.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Planner : public ::Anim::Group
[[nodiscard]] bool positionMorphNeeded() const;
[[nodiscard]] bool verticalBeforeHorizontal() const;
static size_t dimensionCount(const Gen::Plot *plot,
Gen::ChannelId type);
Gen::AxisId type);

[[nodiscard]] bool isAnyLegend(Gen::ChannelId type) const;

Expand Down
20 changes: 15 additions & 5 deletions src/chart/generator/axis.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,22 @@ struct Axises
return axises.at(channelType);
}

[[nodiscard]] const Axis &other(ChannelId channelType) const
[[nodiscard]] const Axis &at(AxisId axisType) const
{
switch (channelType) {
case ChannelId::x: return axises.at(ChannelId::y);
case ChannelId::y: return axises.at(ChannelId::x);
default: throw std::logic_error("not an axis channel");
return axises.at(asChannel(axisType));
}

[[nodiscard]] Axis &at(AxisId axisType)
{
return axises.at(asChannel(axisType));
}

[[nodiscard]] const Axis &other(AxisId axisType) const
{
switch (axisType) {
default:
case AxisId::x: return at(AxisId::y);
case AxisId::y: return at(AxisId::x);
}
}

Expand Down
22 changes: 12 additions & 10 deletions src/chart/generator/guides.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "guides.h"

#include <stdexcept>

#include "base/math/interpolation.h"
#include "chart/options/align.h"
#include "chart/options/channel.h"
Expand Down Expand Up @@ -92,18 +90,22 @@ Guides::Guides(const Options &options)
|| (!yIsMeasure && !yOpt.isEmpty())));
}

GuidesByAxis &Guides::at(ChannelId channel)
GuidesByAxis &Guides::at(AxisId channel)
{
if (channel == ChannelId::x) return x;
if (channel == ChannelId::y) return y;
throw std::out_of_range("guides index out of range");
switch (channel) {
default:
case AxisId::x: return x;
case AxisId::y: return y;
}
}

const GuidesByAxis &Guides::at(ChannelId channel) const
const GuidesByAxis &Guides::at(AxisId channel) const
{
if (channel == ChannelId::x) return x;
if (channel == ChannelId::y) return y;
throw std::out_of_range("guides index out of range");
switch (channel) {
default:
case AxisId::x: return x;
case AxisId::y: return y;
}
}

bool Guides::hasAnyGuides() const
Expand Down
4 changes: 2 additions & 2 deletions src/chart/generator/guides.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ struct Guides
GuidesByAxis y;

explicit Guides(const Options &options);
[[nodiscard]] const GuidesByAxis &at(ChannelId channel) const;
GuidesByAxis &at(ChannelId channel);
[[nodiscard]] const GuidesByAxis &at(AxisId channel) const;
GuidesByAxis &at(AxisId channel);
[[nodiscard]] bool hasAnyGuides() const;
};

Expand Down
Loading

0 comments on commit 4ed9be7

Please sign in to comment.