Refactor all controls to use a common back-end
See original GitHub issueWhat can we do to make ScottPlot better?
This was originally the intention, however, when the Avalonia module was created for 4.0.39 it was decided that it would be annoying to bump the package version of the rest of ScottPlot. This change would make a move to supporting another platform easier (or indeed updating the WPF and WinForms controls to use ControlBackend
which would help in maintainability). I think I said I would backport ControlBackend
to WPF and WinForms when I first created the Avalonia control, 4 months ago…
The ScottPlot Roadmap may provide additional context regarding current goals and future directions.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
7 Code Refactoring Techniques in Software Engineering
We will discuss some popular and common techniques to refactor the code but before that let's discuss some quick tips…
Read more >Refactoring Tricks to Use for a Clean Architecture
1. Run tests before and after refactoring. 2. Make small incremental changes, not big bang rewrites. 3. Commit to version control frequently.
Read more >What is Code Refactoring? How Refactoring Resolves ...
The main benefit of refactoring is to clean up dirty code to reduce technical debt. Cleaner code is easier to read, for the...
Read more >Refactoring Is Not Bad, Until It Is
A less common and more selfish reason that developers refactor is that they believe the code will always be bad unless they wrote...
Read more >Refactoring with Loops and Collection Pipelines - Martin Fowler
This works here, but for any substantial project, I'd use a common library. Now I can move the clause from the loop into...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m out of town and brought a laptop but I didn’t have any spare Windows licenses - so I quickly installed Ubuntu 20.10, normally I use Windows for desktop things.
I was thinking the same, that Linux might be sending more mouse move events, but I don’t have a Windows machine ATM to confirm this (next week I will).
The call to
bmp.Save()
insideBmpImageFromBmp
was taking ~32ms per call, I’m not sure if that’s the same as Windows or not. If it is the same, then the suspicion that Linux is sending more mouse move events than Linux seems likely.Thank you for the comments, I will definitely go through and try the changes as soon as I’m back to my actual machine mid-next-week.
Control Backend Next Moves
I suspect you wrote this before I posted https://github.com/swharden/ScottPlot/issues/637#issuecomment-735963270, but I agree! I plan to do this tonight.
Perhaps we could keep the
ControlBackend
that works, and we can keep theWpfPlot
andFormsPlot
controls as they are because they all work too. Experimentation could be done inControlBackendExperimental
,FormsPlotExperimental
, etc. This way everything that currently works would keep working while we experiment with these ideas. When ScottPlot 4.1 gets out of pre-release we can delete the old ones and rename the new ones.It may be unexpectedly easy to create new experimental controls to use the experimental backend, as those controls would be very thin and wouldn’t be much effort to maintain along the way as the backend is experimented on.
Displaying cropped giant plots
This is an interesting idea! It does take a lot of memory though (I’m recalling someone wanted to show 100s of plots #257). Right now (as of ScottPlot 4.1) a new Bitmap is created every time
Render()
is called. How long this actually takes may be worth benchmarking. My thought is that limiting creation of new bitmaps toResize()
events would be a big win because that’s a rare event. Your suggestion (display a portion of a huge bitmap) would eliminate even that step, but my lean is to consider resizes a rare event so probably not worth optimizing for at this time. Plus if we optimized for 5000px then someone with an 8K monitor will complain shortly after 😆EDIT: Let’s benchmark how long it takes to create a large bitmap vs. how long it takes to draw a typical plot on it. The controls currently create a new bitmap on every render, so maybe this isn’t even a slow enough step to warrant optimization right now…