Page 1 of 1

New version of Oxyplot with problems

Posted: Sun Mar 10, 2024 4:34 pm
by Jean-Francois
Hello Robin,

I remark that fast all my scripts that use the Oxyplot functions are no more working properly.
Hmm ... SharpCap crashes after an error message.

I found that the Oxyplot.dll are now different.
The old version was from 19.10.2019 and the new version installed with SharpCap 4.1.11939 is from 03.12.2022.

The problem is located to the functions for the legend.

I can comment all the "legend" function in my scripts, but it is not nice.
I search how to use the "new" legend functions. But I did not find how to do.

It is really very annoying when a library changes something without having back compatibility.

Some other people are using my scripts. It would be nice to correct this problem very soon.
One simple dirty solution is to copy the Oxyplot.dll of the 2019 version in the SharpCap directory (but only if somebody secure the 2019 version before installing the last version of SharpCap).

Regards,
Jean-Francois

Re: New version of Oxyplot with problems

Posted: Mon Mar 11, 2024 9:01 am
by admin
Hi,

yes, I ended up updating the Oxyplot DLL for another reason and had to change my code because they changed the API :(

I think the reason for the change is that the new version can support multiple legends, so having a single LegendPlacement/Position was no longer sufficient. I had to change my code like this...

old version

Code: Select all

            var model = new PlotModel()
            {
                LegendPlacement = LegendPlacement.Inside,
                LegendPosition = LegendPosition.TopLeft,
            };
new version

Code: Select all

            using OxyPlot.Legends;
            var model = new PlotModel();
            model.Legends.Add(new Legend() { LegendPlacement = LegendPlacement.Inside, LegendPosition = LegendPosition.TopLeft });
That's obviously the C# vresion, but hopefully it should point you in the right direction.

cheers,

Robin