Skip to content

Commit 631c756

Browse files
committed
Fix incorrect Y-axis label resizing in Interactive Plot
1 parent 50cabb2 commit 631c756

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

Source/Processors/Visualization/InteractivePlot.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,19 @@ InteractivePlot::InteractivePlot() :
4646
addAndMakeVisible(drawComponent.get());
4747

4848
titleLabel = std::make_unique<Label>("Title Label", "Title");
49-
titleLabel->setFont(Font("Default", 15, Font::plain));
49+
titleLabel->setFont(Font("Fira Code", "Bold", 15.0f));
5050
titleLabel->setColour(Label::textColourId, axisColour);
5151
titleLabel->setJustificationType(Justification::centred);
5252
addAndMakeVisible(titleLabel.get());
5353

5454
xLabel = std::make_unique<Label>("X-Axis Label", "X Label");
55-
xLabel->setFont(Font("Default", 15, Font::plain));
55+
xLabel->setFont(Font("Fira Code", "Regular", 15.0f));
5656
xLabel->setColour(Label::textColourId, axisColour);
5757
xLabel->setJustificationType(Justification::centred);
5858
addAndMakeVisible(xLabel.get());
5959

6060
yLabel = std::make_unique<Label>("Y-Axis Label", "Y Label");
61-
yLabel->setFont(Font("Default", 15, Font::plain));
61+
yLabel->setFont(Font("Fira Code", "Regular", 15.0f));
6262
yLabel->setColour(Label::textColourId, axisColour);
6363
yLabel->setJustificationType(Justification::centred);
6464
addAndMakeVisible(yLabel.get());
@@ -137,15 +137,15 @@ void InteractivePlot::resized()
137137
if (h == 0 || w == 0)
138138
return;
139139

140-
int heightOffset = 20; // (controlButtonsVisible) ? 50 : 20;
141-
int axesWidth = 50; // Fixed
140+
int heightOffset = 20;
141+
int labelWidth = yLabel->getFont().getStringWidth(yLabel->getText());
142+
int axesWidth = labelWidth + 30;
142143
int axesHeight = 50;
143144
int padding = 10;
144145

145146
titleLabel->setBounds(axesWidth + padding + 2, 0, w - axesWidth - padding*2, 20);
146147
xLabel->setBounds(axesWidth + padding + 2, getHeight() - 20, w - axesWidth - padding*2, 20);
147-
yLabel->setBounds(0, 0, 20, getHeight());
148-
//yLabel->setTransform(AffineTransform::rotation(-MathConstants<float>::halfPi,
148+
yLabel->setBounds(0, 0, labelWidth, h);
149149

150150
if (MIN(w,h) > 250)
151151
{

0 commit comments

Comments
 (0)