Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple PlotView with large data is very slow (OutOfMemoryException thrown) #1781

Open
julientrflz opened this issue Aug 23, 2021 · 23 comments

Comments

@julientrflz
Copy link

julientrflz commented Aug 23, 2021

photo
Hello,

I am using Oxyplot.WPF 2.1.0-Preview1, and I am ploting in a stackpanel about 10 Plotviews composed of :

  • 1 to 4 LineSeries for each Plot
  • +100K points for each LineSeries
  • Most of the charts have their X axis linked using a function (using zoom and invalideplot)

When I am importing big data like that, the UI is very low, and sometimes gives me OutOfMemoryException thrown.

How can I deal with big data in order to have good performance ? I heard about OxyPlot.SkiaSharp but I don't know what I am supposed to do.

I am in .NET FRAMEWORK 4.7.2 (I was in .NETCORE before and I hadn't this issue before, but I had to change)

Thanks,
J

@VisualMelon
Copy link
Contributor

I don't presently have time to provide a comprehensive reply, but to use skia you need to swap out the PlotView for the one provided by https://www.nuget.org/packages/OxyPlot.SkiaSharp.Wpf/2.1.0-Preview1 (i.e. OxyPlot.SkiaSharp.Wpf.PlotView). Do ask if you need further guidance and I'll try to find time.

@julientrflz
Copy link
Author

So i have to download this package, and remove the Oxyplot.WPF that I already use? Nothing more ?

@VisualMelon
Copy link
Contributor

Make sure the PlotView is from OxyPlot.SkiaSharp.Wpf (check the namespaces as necessary, e.g. per

<oxySkia:PlotView Model="{Binding SkiaModel}" Controller="{Binding SelectedExample.Controller}" Visibility="{Binding SkiaModel, Converter={StaticResource NotNullVisibilityConverter}}" />
)

@julientrflz
Copy link
Author

julientrflz commented Aug 25, 2021

I have to deal with Unable to load library 'libSkiaSharp'. System.DllNotFoundExceptio
problem and I will update you. Do you had the same type of issue when installing ?

@julientrflz
Copy link
Author

ERROR OXY

@VisualMelon
Copy link
Contributor

If you are targeting .NET Framework, you will need to specify the target architecture because skia is a native library (shouldn't be a problem with .NET Core; see #1760), but I can't repro any issue within the design view; can you provide your csproj?

@julientrflz
Copy link
Author

julientrflz commented Aug 25, 2021

DASVIZ.zip
I have sent you the .csproj in zip. How can i access to the file and modify it in VS anyway ?

@VisualMelon
Copy link
Contributor

VisualMelon commented Aug 25, 2021

image

Only works for SDK style projects, I think (which yours is not)

I don't see the Skia nuget package in the listing; may be worth removing all the existing Oxyplot dependencies and just re-install OxyPlot.SkiaSharp.Wpf, which will bring its dependencies with it.

@julientrflz
Copy link
Author

julientrflz commented Aug 25, 2021

TEST OXYSKIA.zip
To do not make a bad move, I have created a new project and install Oxyplot.Wpf Oxyplot.Wpf.SkiaSharp.wpf and his dependencies. Did you see the package now ?

I dont have a SDK project btw so I am not able to edit project file.

@VisualMelon
Copy link
Contributor

Yes, the package reference appears in that one.

@julientrflz
Copy link
Author

So what am I supposed to change in order to fix this issue ?

@VisualMelon
Copy link
Contributor

VisualMelon commented Aug 25, 2021

I'm not sure; the second one looks fine; it's virtually identical to when I get when I create a new WPF/.NET Framework and add OxyPlot.Skia.Wpf, though with a couple more references (you don't need a reference to OxyPlot.Wpf). Does it also have the problem?

The first project is clearly missing the references to the skia stuff, so you could try copying those into the csproj directly if the nuget manager in VS isn't doing its job properly. Check packages.config contains, since that's what contains the actual nuget package reference (csproj just references the dlls) and force a restore (slapping build/debug a few times in VS usually does this anyway)

Modified version of your second csproj, and a packages.config created by my computer for blank project: https://gist.github.com/VisualMelon/5f4a00d204d603c545923915bd009994

@julientrflz
Copy link
Author

Still on my example "TEST OXYSKIA" i have removed Oxyplot.Wpf in order to have the same packages.config than you and I have replace my .csproj by the one you provided and I still have the same issue. :(

@VisualMelon
Copy link
Contributor

If it's just a test project, can you upload the whole solution?

@julientrflz
Copy link
Author

TEST OXYSKIA.zip
sln.zip

Sorry I wasn't able to sent you one zip because of an importation bug. Moreover, I wasn't able to provide you the packages but I used exactly the same as yours.

@VisualMelon
Copy link
Contributor

Builds and runs fine for me, and the designer view is happy as well. (VS 2019, Win10, x64). There were a couple of broken references (E.g. to OxyPlot.WPF) but they shouldn't matter.

I'm not sure what to suggest; can you try cleaning the solution (manually delete the packages, bin, and obj directories to make sure) and re-build? May be worth checking there isn't a conflicting nuget config on your machine which might be messing with pre-release downloads or something.

Apart from that, if you were using .NET Core before, you should be able to just add net471 as a target in the SDK-style csproj, and it should 'just work'. E.g. change <TargetFramework>netcoreapp3.1</TargetFramework> to <TargetFrameworks>net471;netcoreapp3.1</TargetFrameworks> or similar and specify a target platform e.g. <PlatformTarget>x64</PlatformTarget>.

@julientrflz
Copy link
Author

I had VS2019, Win10 x64 as well. I tried what you told me but it's not working...

@julientrflz
Copy link
Author

EDIT: I have update some packages and it worked (not the design view but i dont care). However I had an issue regarding the publish. Worked on VS but once I click to my application for the update, it's fail (picture below).

If you sent me the folder with your packages, dont you think it's gonna work ?
4KP12DO4.log

@VisualMelon
Copy link
Contributor

He's a basic dual-target project: WpfApp4.zip

I don't know a whole lot about strong naming and publishing under framework; I can't really suggest why your program is failing at runtime, but I suspect it won't change with my project (seems to be related to things like conflicts in the GAC, etc.)

@seba30
Copy link

seba30 commented Nov 8, 2021

I ran into the same issue ("System.DllNotFoundException: Unable to load library 'libSkiaSharp'.").

I created a new project and added the dependencies through Nuget. You can find the repo here. The designer only shows an error, but the binary is runnable and shows a chart.

image

image

Could anybody lead me into the right direction, because it's a pain to develop an UI with this error.

Thank you!

@seba30
Copy link

seba30 commented Nov 8, 2021

Short update: no problems with the latest Visual Studio 2022.

image

@VisualMelon
Copy link
Contributor

@seba30 thanks for checking that

@mikezw
Copy link

mikezw commented Feb 7, 2022

I ran into the same issue ("System.DllNotFoundException: Unable to load library 'libSkiaSharp'.").

I created a new project and added the dependencies through Nuget. You can find the repo here. The designer only shows an error, but the binary is runnable and shows a chart.

image

image

Could anybody lead me into the right direction, because it's a pain to develop an UI with this error.

Thank you!

Hey, i solve this issue in vs2019 by copy x86'libSkiaSharp' dlls into system folder(syswow64).I think the issue is because the native library loading path of designer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants