question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disabling padding does not work for empty plots (WinForms)

See original GitHub issue

Describe the Issue: I use it as the initial Form. I can’t achieve my goal without data. Like this: Without data: image The LightBlue is the padding that I want to eliminate. But I can eliminate it by adding the data. Like this: With data: image This is my code and it is the demo about Customize: Figure - No Padding.

var plt = this.scottPlot.plt;
plt.PlotHLine(2);
plt.Style(figBg: Color.LightBlue);
plt.Style(dataBg: Color.LightYellow);
plt.Ticks(false, false);
plt.Frame(false);
plt.TightenLayout(padding: 0);
scottPlot.Configure(recalculateLayoutOnMouseUp: false);
scottPlot.Render();

How can I eliminate the padding except by Adding data?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
YUXI07commented, Feb 4, 2021

Further debugging,I find an amazing phenomenon. I remove the part of your code. So I can’t get my goal.

Before modification

		private ScottPlot.FormsPlot formsPlot1 = new ScottPlot.FormsPlot(new ScottPlot.Plot(200, 200));
		private ScottPlot.FormsPlot formsPlot2 = new ScottPlot.FormsPlot(new ScottPlot.Plot(200, 200));

After modification

		private ScottPlot.FormsPlot formsPlot1 = new ScottPlot.FormsPlot();
		private ScottPlot.FormsPlot formsPlot2 = new ScottPlot.FormsPlot(new ScottPlot.Plot(200, 200));

The result

image

Automatic generated by Visio studio

		this.formsPlot1 = new ScottPlot.FormsPlot();

I think it is my Heart of the matter. I add the code and get goals successfully.

0reactions
swhardencommented, Feb 5, 2021

Hi @YUXI07, thanks for the question and @bclehmann for your help along the way!

To summarize the problem, plots weren’t rendering framelessly in the FormsPlot control if they were empty, and that this is an an issue that only applies to version 4.0.

The fix is to instantiate the FormsPlot control by passing-in a new Plot with a defined size, rather than letting it create one.

I too am puzzled by this solution, but am happy to hear @YUXI07 ended-up with something that gets the job done! 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

WinForm Bottom Margin Property Doesn't Do Anything
1 Answer. The Margin property is used by the automatic layout feature built into Winforms. But it does require that you allow the...
Read more >
Padding.Empty Field (System.Windows.Forms)
Provides a Padding object with no padding. ... An empty padding object is defined as having the Right, Left, Bottom and Top padding...
Read more >
Removing extra whitespace under x-axis of reporting graph
The default Graph padding is '10px'. You may set it to a negative value, for example '-10px', to reduce the empty space below...
Read more >
ScottPlot 4.0.47 Cookbook
This example demonstrates how to plot OHLC data continuously even though there are gaps on the horizontal axis (for days the market is...
Read more >
PySimpleGUI
One simple call, write_event_value , solves threading issues. Not ready for the threading module but need to run a thread? Use window.perform_long_operation ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found