Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove align min #586

Merged
merged 4 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Fixed

- Removed 'min' align property from the API which equivalent with the 'none'.
- Markers are the same even if new record added.

### Changed
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, stretch]
enum: [none, center, stretch]
split:
description: |
If set to true, markers will be split by the dimension(s) along the axis.
Expand Down
5 changes: 1 addition & 4 deletions src/chart/generator/plotbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,7 @@ void PlotBuilder::addSeparation(const Buckets &subBuckets,
const std::size_t &mainBucketSize) const
{
if (plot->getOptions()->split) {
auto align =
plot->getOptions()->align == Base::Align::Type::none
? Base::Align::Type::min
: plot->getOptions()->align;
auto align = plot->getOptions()->align;

std::vector ranges{mainBucketSize,
Math::Range<double>::Raw({}, {})};
Expand Down
5 changes: 2 additions & 3 deletions src/chart/options/align.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ namespace Vizzu::Base

struct Align : private Math::Range<double>
{
enum class Type : std::uint8_t { none, min, center, stretch };
enum class Type : std::uint8_t { none, center, stretch };

Align(Type type, const Range &range) : Range(range), type(type) {}

[[nodiscard]] Range getAligned(const Range &range) const
{
switch (type) {
case Type::none: return range;
case Type::min: return range + min - range.getMin();
case Type::none: return range - range.getMin() + min;
schaumb marked this conversation as resolved.
Show resolved Hide resolved
case Type::center: return range - range.middle() + middle();
case Type::stretch: return static_cast<const Range &>(*this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const testSteps = [
},
title: 'Split Area Chart',
split: true,
align: 'min'
align: 'none'
}
}),

Expand All @@ -53,7 +53,7 @@ const testSteps = [
title: 'Bar Chart',
geometry: 'rectangle',
split: false,
align: 'min'
align: 'none'
},
style: {
plot: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const testSteps = [
title: 'Operations: Circle - Splitted.',
orientation: 'horizontal',
split: true,
align: 'min'
align: 'none'
}
}),
(chart) =>
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/test_cases/shorthands/column_shorthands.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const testSteps = [
}),
(chart) =>
chart.animate({
align: 'min'
align: 'none'
}),
(chart) =>
chart.animate({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const testSteps = [
},

geometry: 'line',
align: 'min'
align: 'none'
}
}),
(chart) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const testSteps = [
y: 'Value 2 (+)'
},

align: 'min'
align: 'none'
}
}),
(chart) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const testSteps = [
(chart) =>
chart.animate({
config: {
align: 'min',
align: 'none',
split: true
}
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const testSteps = [
label: 'Value 2 (+)'
},

align: 'min',
align: 'none',
split: true
},
style: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const testSteps = [
(chart) =>
chart.animate({
config: {
align: 'min'
align: 'none'
}
}),
(chart) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const testSteps = [
(chart) =>
chart.animate({
config: {
align: 'min'
align: 'none'
}
}),
(chart) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const testSteps = [
},

geometry: 'rectangle',
align: 'min',
align: 'none',
split: false,
sort: 'byValue',
reverse: true
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/test_cases/web_content/infinite.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ const testSteps = [
},
title: '28',
geometry: 'circle',
align: 'min',
align: 'none',
split: false
},
style: {
Expand Down Expand Up @@ -676,7 +676,7 @@ const testSteps = [
},
title: '29',
geometry: 'circle',
align: 'min',
align: 'none',
split: false
},
style: {
Expand Down Expand Up @@ -706,7 +706,7 @@ const testSteps = [
},
title: '30',
geometry: 'circle',
align: 'min',
align: 'none',
split: false
},
style: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const testSteps = [
}
},
title: 'Split Area Chart',
align: 'min',
align: 'none',
split: true
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const testSteps = [
}
},
title: 'Split Column Chart',
align: 'min',
align: 'none',
split: true
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const testSteps = [
},
title: 'Split Area Chart',
split: true,
align: 'min'
align: 'none'
}
})
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const testSteps = [
},
title: 'Bar Chart',
geometry: 'rectangle',
align: 'min',
align: 'none',
split: false
}
},
Expand Down Expand Up @@ -132,7 +132,7 @@ const testSteps = [
title: 'Stacked Area Chart',
geometry: 'area',
legend: null,
align: 'min',
align: 'none',
split: false
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const testSteps = [
},
title: 'Bar Chart',
geometry: 'rectangle',
// align: 'min',
// align: 'none',
split: false
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const testSteps = [
},
title: 'Bar Chart',
geometry: 'rectangle',
align: 'min',
align: 'none',
split: false
}
}),
Expand Down Expand Up @@ -82,7 +82,7 @@ const testSteps = [
title: 'Stacked Area Chart',
geometry: 'area',
legend: null,
align: 'min',
align: 'none',
split: false
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const testSteps = [
},
title: 'Bar Chart',
geometry: 'rectangle',
// align: 'min',
// align: 'none',
split: false
}
})
Expand Down
14 changes: 7 additions & 7 deletions test/e2e/test_cases/ww_next_steps/next_steps/03_C_R.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ const testSteps = [
color: { set: 'Country' }
},
title: 'Groupped Column / Comparison(?), Group(?)',
align: 'min'
align: 'none'
}
}),

Expand All @@ -217,7 +217,7 @@ const testSteps = [
color: { set: 'Country' }
},
title: 'Column / Aggregate(?), - Discrete(?)',
align: 'min'
align: 'none'
}
}),

Expand All @@ -231,7 +231,7 @@ const testSteps = [
label: { set: 'Value 2 (+)' }
},
title: 'Column / Total(?) Aggregate(?) - Discrete(?)',
align: 'min',
align: 'none',
legend: null
}
}),
Expand All @@ -250,7 +250,7 @@ const testSteps = [
label: { set: null }
},
title: 'Column / Drill down(?), + Discrete(?)',
align: 'min',
align: 'none',
legend: null
}
},
Expand All @@ -270,7 +270,7 @@ const testSteps = [
color: { set: 'Country' }
},
title: 'Groupped Column / Comparison(?), Group(?)',
align: 'min',
align: 'none',
legend: 'color'
}
},
Expand All @@ -290,7 +290,7 @@ const testSteps = [
color: { set: 'Country' }
},
title: 'Stacked Bar / Sum(?)',
align: 'min'
align: 'none'
}
},
{
Expand Down Expand Up @@ -327,7 +327,7 @@ const testSteps = [
label: { set: 'Value 2 (+)' }
},
title: 'Stacked Bar / Sum(?)',
align: 'min'
align: 'none'
},
style: {
plot: {
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/test_cases/ww_next_steps/next_steps/04_C_R.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ const testSteps = [
geometry: 'rectangle',
split: false,
legend: 'color',
align: 'min'
align: 'none'
}
},
{
Expand All @@ -519,7 +519,7 @@ const testSteps = [
geometry: 'circle',
split: false,
legend: 'color',
align: 'min'
align: 'none'
}
},
{
Expand Down Expand Up @@ -560,7 +560,7 @@ const testSteps = [
geometry: 'rectangle',
split: false,
legend: 'color',
align: 'min'
align: 'none'
}
},
{
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/test_cases/ww_next_steps/next_steps/05_C_R.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ const testSteps = [
title: 'Splitted Column / Components(?), Part-to-whole(?), Split(?)',
geometry: 'rectangle',
orientation: 'horizontal',
align: 'min',
align: 'none',
split: true
}
},
Expand All @@ -189,7 +189,7 @@ const testSteps = [
title: 'Scatter plot / + Continuous(?)',
geometry: 'circle',
orientation: 'horizontal',
align: 'min',
align: 'none',
split: false
}
},
Expand Down Expand Up @@ -230,7 +230,7 @@ const testSteps = [
title: 'Splitted Column / - Continuous(?), Components(?), Part-to-whole(?), Split(?)',
geometry: 'rectangle',
orientation: 'horizontal',
align: 'min',
align: 'none',
split: true
},
style: {
Expand Down
Loading