Skip to content

Commit 364093d

Browse files
committed
Axis label padding fixed.
1 parent ea36a19 commit 364093d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/chart/rendering/drawaxes.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,16 @@ void drawAxes::drawDiscreteLabels(bool horizontal)
182182
auto availLength = (max-min).abs();
183183
auto neededLength = (rotatedIdent * neededSize).abs();
184184

185+
auto plotPaddingLeft = style.plot.paddingLeft
186+
->get(boundingRect.size.x);
187+
185188
Geom::Rect rect;
186189
if (!(*labelStyle.overflow == Styles::Overflow::hidden)
187190
|| availLength >= neededLength)
188191
{
189192
auto minWidth =
190193
(rotatedIdent * Geom::Point((max - min).abs(),
191-
margin.left)).abs();
194+
plotPaddingLeft)).abs();
192195

193196
auto actWidth = std::min(minWidth, neededSize.x);
194197
auto halfSize = Geom::Point(actWidth/2, neededSize.y/2);

src/chart/rendering/drawingcontext.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ class DrawingContext
3030
painter(dynamic_cast<IPainter &>(canvas)),
3131
options(*diagram.getOptions()),
3232
style(style),
33-
events(events)
33+
events(events),
34+
boundingRect(rect)
3435
{
3536
coordSys = CoordinateSystem(style.plot.contentRect(rect),
3637
options.angle.get(),
@@ -48,6 +49,7 @@ class DrawingContext
4849
const Diag::Options &options;
4950
const Styles::Chart &style;
5051
const Events::Draw &events;
52+
Geom::Rect boundingRect;
5153
};
5254

5355
}

0 commit comments

Comments
 (0)