Skip to content

Commit 365b1f0

Browse files
committed
Fix lint
1 parent a84c801 commit 365b1f0

File tree

3 files changed

+28
-17
lines changed

3 files changed

+28
-17
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- axis labels multiplication.
1515
- axis range interpretation differently for all split part.
1616
- align center / stretch fix.
17+
- Less restrictive 'plot.marker.label.unit'
1718

1819
### Added
1920

src/chart/generator/plotbuilder.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -473,15 +473,21 @@ void PlotBuilder::calcLegendAndLabel(const Data::DataTable &dataTable)
473473
.axisPropsAt(mainAxisType)
474474
.align
475475
== Base::Align::Type::stretch
476-
&& plot->getOptions()->labelSeries(mainAxisType)
476+
&& plot->getOptions()
477+
->getChannels()
478+
.at(mainAxisType)
479+
.measure()
477480
== *meas
478481
&& !plot->getOptions()->isSplit(mainAxisType))
479482
|| (plot->getOptions()
480483
->getChannels()
481484
.axisPropsAt(subAxisType)
482485
.align
483486
== Base::Align::Type::stretch
484-
&& plot->getOptions()->labelSeries(subAxisType)
487+
&& plot->getOptions()
488+
->getChannels()
489+
.at(subAxisType)
490+
.measure()
485491
== *meas
486492
&& !plot->getOptions()->isSplit(subAxisType)));
487493

@@ -578,13 +584,14 @@ void PlotBuilder::addAlignment(const Buckets &buckets,
578584
axisRange.max - halfSize};
579585
}
580586

581-
auto &&axisLabel = plot->getOptions()->labelSeries(axisIndex);
587+
auto &&axisMeasure =
588+
plot->getOptions()->getChannels().at(axisIndex).measure();
582589
auto markerLabelsUnitPercent =
583590
plot->getStyle().plot.marker.label.unit
584591
== Styles::MarkerLabel::Unit::percent
585592
&& axisProps.align == Base::Align::Type::stretch
586-
&& axisLabel.has_value()
587-
&& axisLabel
593+
&& axisMeasure.has_value()
594+
&& axisMeasure
588595
== plot->getOptions()
589596
->getChannels()
590597
.at(ChannelId::label)

test/e2e/tests/style_tests/plot/markerLabelUnit.mjs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,20 @@ const testSteps = [
8686
return chart.animate({ data })
8787
},
8888
(chart) =>
89-
chart.animate({
90-
config: {
91-
x: ['Foo2'],
92-
y: {
93-
set: ['Bar2', 'Foo3'],
94-
align: 'stretch'
95-
},
96-
color: ['Foo3'],
97-
label: ['Bar2']
98-
}
99-
}, 0),
89+
chart.animate(
90+
{
91+
config: {
92+
x: ['Foo2'],
93+
y: {
94+
set: ['Bar2', 'Foo3'],
95+
align: 'stretch'
96+
},
97+
color: ['Foo3'],
98+
label: ['Bar2']
99+
}
100+
},
101+
0
102+
),
100103
(chart) =>
101104
chart.animate({
102105
style: {
@@ -106,7 +109,7 @@ const testSteps = [
106109
(chart) =>
107110
chart.animate({
108111
config: {
109-
y: { labelLevel: 0 },
112+
y: { labelLevel: 0 },
110113
orientation: 'vertical'
111114
}
112115
})

0 commit comments

Comments
 (0)