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

Update to Avalonia 11 #49

Open
HendrikMennen opened this issue Oct 14, 2022 · 57 comments
Open

Update to Avalonia 11 #49

HendrikMennen opened this issue Oct 14, 2022 · 57 comments

Comments

@HendrikMennen
Copy link
Contributor

Seems like this module is not as easy to port...

@VisualMelon
Copy link
Contributor

VisualMelon commented Oct 14, 2022

hurried notes:

I took a jab at it in https://github.com/VisualMelon/oxyplot-avalonia/tree/av11

But the plots didn't render. I hard-coded something to do with invalidation to true and then they started flickering.

Something is wrong with the render invalidation, I believe, but the boring bits are done.

@HendrikMennen
Copy link
Contributor Author

Thats where I got stuck too. Managed to make it "run" but never render. Don't really know the code so hard to know where to look

@VisualMelon
Copy link
Contributor

Changing PlotBase.IsUserVisible to return element.IsEffectivelyVisible seems to make the simple demo work, but it disappears when you pan the plot (so a good back if you just need static plots).

@VisualMelon
Copy link
Contributor

It's almost as if the old plot is being removed (by Canvas.Clear()) before the redraw, but the new plot isn't being added before the redraw (if you remove the clear, then not only do you get fun patterns, but there is no flickering).

@HendrikMennen
Copy link
Contributor Author

Changing PlotBase.IsUserVisible to return element.IsEffectivelyVisible seems to make the simple demo work, but it disappears when you pan the plot (so a good back if you just need static plots).

Interesting. For me even panning works with a dynamic plot using this hack

@VisualMelon
Copy link
Contributor

Are you able to share your repo? Might be that you've fixed something else that I've missed.

@HendrikMennen
Copy link
Contributor Author

HendrikMennen commented Oct 14, 2022

I discarded my repo and used yours. Directly with my project, let me try the demos
https://github.com/HendrikMennen/oxyplot-avalonia/tree/avalonia11

@HendrikMennen
Copy link
Contributor Author

Are you able to share your repo? Might be that you've fixed something else that I've missed.

I think the flickering is solved by using Avalonia preview2

@VisualMelon
Copy link
Contributor

VisualMelon commented Oct 17, 2022

Cool, will try it out now. I fixed the ExampleBrowser so it works in 11 in my repo.

@VisualMelon
Copy link
Contributor

Yep, everything seems to be OK now. Still had to remove the bounds check in PlotBase.IsUserVisible, so may be other issues with that down the line.

@jp2masa
Copy link
Contributor

jp2masa commented Oct 27, 2022

This check is also broken:

https://github.com/VisualMelon/oxyplot-avalonia/blob/d4b0b66411f41b11384bb50aaf035b1e86ecefe3/Source/OxyPlot.Avalonia/PlotBase.cs#L104

I think TransformedBounds now returns null when there's no transform, so a possible solution is to do this (while still keeping the one for transformed bounds I think):

            this.GetObservable(BoundsProperty).Subscribe(bounds => OnSizeChanged(this, bounds.Size));

Even after that fix it doesn't always update: isUpdateRequired is stuck with value 2, not sure what's supposed to happen in order to reset it. This loop never runs again:

https://github.com/VisualMelon/oxyplot-avalonia/blob/d4b0b66411f41b11384bb50aaf035b1e86ecefe3/Source/OxyPlot.Avalonia/PlotBase.cs#L238

Also, may I ask what are the plans for the update, i.e. will there be a version for Avalonia 11 preview or only for the stable release? I have some time available to contribute if needed!

@VisualMelon
Copy link
Contributor

VisualMelon commented Oct 27, 2022

Also, may I ask what are the plans for the update, i.e. will there be a version for Avalonia 11 preview or only for the stable release? I have some time available to contribute if needed!

There are no plans at the moment; I can't remember if I have rights to public releases, but if I do then I probably should sooner rather than later. Regarding 11, I'm not sure. Would need to look into it more to find out if we should be switching to 11, or if we need to keep it in parallel. (May be that we do 2.1 release with 10, then switch to 11 for the pre-release, in expectation that the next version is 11 only)

@K-Luth
Copy link

K-Luth commented Dec 7, 2022

Is there an update on avalonia 11 support? I'm looking into upgrading my projects to avalonia and I'd like to use oxyplot.

@VisualMelon
Copy link
Contributor

VisualMelon commented Jan 14, 2023

@K-Luth sorry for the slow reply; still no specific plan (will depend on when 11 is release), but I think we have a working branch targeting 11-preview4 (though still not sure what's up with IsUserVisible): https://github.com/VisualMelon/oxyplot-avalonia/tree/av11 - pre-release package at https://www.myget.org/feed/melonoxyplottesting/package/nuget/OxyPlot.Avalonia/2.1.0-av11 (but you shouldn't consider that feed reliable)

(2.1.0 was released a while back targeting Avalonia 10)


Update
Looks like there is an issue with updating when resized.

@jp2masa
Copy link
Contributor

jp2masa commented Feb 4, 2023

Sorry for not replying earlier.

Preview 5 was released yesterday and will likely be the last preview (AvaloniaUI/Avalonia#10193 (reply in thread)).

Looks like there is an issue with updating when resized.

This is the issue I was trying to describe in my previous comment. TransformedBounds will probably be replaced soon because it's broken (AvaloniaUI/Avalonia#9308 (comment)). Anyway, I believe PlotBase doesn't need it, and Bounds can be used for now, although using ArrangeOverride would probably work too, not sure because I honestly couldn't understand the isUpdateRequired logic.

@VisualMelon
Copy link
Contributor

VisualMelon commented Feb 4, 2023

@jp2masa howdy, I've already updated my branch to preview 5: https://github.com/VisualMelon/oxyplot-avalonia/tree/av11

Indeed, one of the changes was to listen to Bounds rather than TransformedBounds. I made that change without putting any real thought into it, but the resize issue did go away. VisualMelon@567f076#diff-0da552064490156cd714c002a2c4790ca84a2b140ba733b71001fc58600db80fL104

I can push that to myget if useful.

@jp2masa
Copy link
Contributor

jp2masa commented Feb 5, 2023

I tested it and I still have the 2nd issue I tried to describe in the other comment:

Even after that fix it doesn't always update: isUpdateRequired is stuck with value 2, not sure what's supposed to happen in order to reset it. This loop never runs again:

VisualMelon/oxyplot-avalonia@d4b0b66/Source/OxyPlot.Avalonia/PlotBase.cs#L238

I'm pretty sure it's related to InvalidatePlot(true), I'll try to create a repro.

@VisualMelon
Copy link
Contributor

I'll try to create a repro.

Cool, if you can do that I'll be happy to have a look. It's perfectly possible I broke everything when I re-fitted the update logic so that it could be called off-thread.

@jp2masa
Copy link
Contributor

jp2masa commented Feb 5, 2023

Here is the repro: https://github.com/jp2masa/oxyplot-avalonia/tree/repro

Repro Steps

  • Run AvaloniaExamples
  • Open TabDemo (it was adapted from the user control demo, but uses PlotView/PlotModel instead)
  • On Plot1, click the Update button: the plot updates correctly, and the tracker works normally
  • Switch to the Plot2 tab, and click the Update button: the plot updates correctly, and the tracker works normally
  • Switch back to the Plot1 tab, and click the Update button: the points list updates but the plot stays the same, and the tracker doesn't work anymore
  • Plot2 is broken as well

I believe tabs are important here because of attached to/detached from visual tree events.

@VisualMelon
Copy link
Contributor

VisualMelon commented Feb 5, 2023

Thanks, I'll take a look now.

I've also noticed an issue with the ExampleBrowser: when you open, close, and re-open a category, it doesn't measure properly. Not been able to repro this outside of the ExampleBrowser yet, but feels like a bug in Avalonia. Oddy the bug doesn't occur if you set a non-small value for MinHeight (e.g. 10).

@VisualMelon
Copy link
Contributor

VisualMelon commented Feb 5, 2023

@jp2masa pushed a fix in VisualMelon@1970da2

The issue seems to be - as you said - that the invalidation state wasn't being reset when UpdateModel detected there was nothing to draw.

@jp2masa
Copy link
Contributor

jp2masa commented Feb 5, 2023

I've also noticed an issue with the ExampleBrowser: when you open, close, and re-open a category, it doesn't measure properly. Not been able to repro this outside of the ExampleBrowser yet, but feels like a bug in Avalonia.

Yes, it seems to be a bug in Avalonia, I just tried switching to fluent theme and it works correctly, so maybe it's a bug in simple theme, I will investigate it.

@jp2masa
Copy link
Contributor

jp2masa commented Feb 5, 2023

pushed a fix in VisualMelon@1970da2

Thanks! I will try it and give feedback.

@VisualMelon
Copy link
Contributor

VisualMelon commented Feb 5, 2023

We should probably bump the .NET versions of the examples to .NET 6; shout if you'd rather I didn't do that just yet in my Av11 branch.

@jp2masa
Copy link
Contributor

jp2masa commented Feb 5, 2023

The fix worked like a charm, thanks again!

We should probably bump the .NET versions of the examples to .NET 6; shout if you'd rather I didn't do that just yet in my Av11 branch.

I totally agree with it, I'm currently using .NET 6/7 on my projects.

@VisualMelon
Copy link
Contributor

@jp2masa
Copy link
Contributor

jp2masa commented Feb 5, 2023

Noticed that the expander bug doesn't occur in preview 4 either.

It is probably related to either AvaloniaUI/Avalonia#9677 or AvaloniaUI/Avalonia#9979.

@VisualMelon
Copy link
Contributor

Linking AvaloniaUI/Avalonia#10226 (thanks for reporting that)

@jp2masa
Copy link
Contributor

jp2masa commented Feb 9, 2023

I was completely wrong, it was broken by control themes.

PR AvaloniaUI/Avalonia#10273 should fix it, I tried the ExampleBrowser with the CI nuget and it seems to work fine.

@VisualMelon
Copy link
Contributor

@jp2masa thank you indeed

I'm not aware at this minute of any other bugs, then. There are some things I changed in the plot view that I didn't really understand, but not noticed any issues with them.

I should probably do some tests with a flyout/tooltip/dock (indeed, should add one of those to the AvaloniaExample) because they always seem to cause issues with the WPF and Avalonia provisions.

@VisualMelon
Copy link
Contributor

VisualMelon commented Feb 12, 2023

Added a simple flyout/tooltip/changing parent example to the Av11 branch to check that the plots respond to layout changes etc.: everything seems to work OK. Interested to know if there are other scenarios in the category of "I'm not sitting pretty in a rigid UI" that we need to consider.

@jp2masa
Copy link
Contributor

jp2masa commented Feb 12, 2023

I tried it and there's a small bug with the tooltip for me: when the cursor enters the "ToolTip" text from above, the tooltip appears correctly the first time but then it always shows at top left of the screen.

Video:

tooltip-bug.mp4

I tried to create a simple repro in Avalonia Sandbox, but the tooltip was only showing on the first hover, it seems to be broken...

@VisualMelon
Copy link
Contributor

VisualMelon commented Feb 12, 2023

Seems only to occur if you enter it from outside the window: if you move the TextBlock down a bit it's possible to repro with some violent mouse movement, but doesn't occur if you enter from above slowly.

@VisualMelon
Copy link
Contributor

VisualMelon commented Feb 12, 2023

Might be related to this ;)

image

Avalonia.Controls\Primitives\PopupPositioning\IPopupPositioner.cs line 461

Better default would be the bottom-right corner of the control if we can't get the current pointer location.

@jp2masa
Copy link
Contributor

jp2masa commented Feb 13, 2023

That must be the problem, yes. Still a bit weird since it is a pointer over that triggers the popup, so LastPointerPosition should be valid, but it seems to be updated only after pointer over is triggered:

https://github.com/AvaloniaUI/Avalonia/blob/ca26912ddeaa8fdbe0820cb66a64f536e7562e12/src/Avalonia.Base/Input/PointerOverPreProcessor.cs#L150-L168

@VisualMelon
Copy link
Contributor

Pushed nuget targetting avalonia 11-preview6 to my testing feed: https://www.myget.org/feed/melonoxyplottesting/package/nuget/OxyPlot.Avalonia/2.1.0-av11-preview6

Again, shouldn't be considered a reliable source

@VisualMelon
Copy link
Contributor

@jp2masa not seeing the tooltip bug with preview6

@jp2masa
Copy link
Contributor

jp2masa commented Mar 27, 2023

Yes, I reported the issue on a PR related to popup and flyout (referenced above), and maxkatz6 fixed it!

@VisualMelon
Copy link
Contributor

Done a hurried port to preview7 in my av11 branch; will look it over properly and push to myget when I have more time and stable internet.

@XueDee123
Copy link

Hi,avalonia version 11.0.0 has been released. Will oxyplot be updated

@VisualMelon
Copy link
Contributor

There is an open PR: #55

Blockers from merging/shipping a nuget package are:

  • I need to retest it
  • We need to decide whether we are going to support Avalonia 0.10 at all going forward and if so how

@XueDee123
Copy link

There is an open PR: #55

Blockers from merging/shipping a nuget package are:

  • I need to retest it
  • We need to decide whether we are going to support Avalonia 0.10 at all going forward and if so how

Ok

@VisualMelon
Copy link
Contributor

Avalonia 11 port merged into master

@XueDee123
Copy link

Avalonia 11 port merged into master

There is no update on the new version of nuget

@VisualMelon
Copy link
Contributor

@XueDee123 I've not had any feedback about 0.10 support, so I'm intending to release a version 2.1.2, targeting Avalonia 11 and OxyPlot 2.1.2 soon (hopefully in the next week or so)

@XueDee123
Copy link

Thank you very much and look forward to the new release

@giacarrea
Copy link

Hello, any news on this front?

@VisualMelon
Copy link
Contributor

VisualMelon commented Sep 29, 2023

There is an OxyPlot Avalonia 2.1.0-Avalonia11 on NuGet; I've still not made a decision about naming.

It should be compatible with OxyPlot.Core 2.1.2.

@giacarrea
Copy link

Cool, will check it out, thanks.

@giacarrea
Copy link

Hello, I'm noticing that the clickable tickers don't work anymore with the avalonia 11 pre-release version. Is there a specific thing to do to re-enable them?

@VisualMelon
Copy link
Contributor

Sorry, not sure what you mean by tickers

@giacarrea
Copy link

Sorry my bad, I meant these things:
image

@VisualMelon
Copy link
Contributor

That's the Tracker: that said, I'm still not sure what you mean by clickable: the built-in trackers do not accept user input, but should just appear (using the default plot controller) when you hold the mouse down near a series.

I've not seen any examples of them not working, but I could easily be missing the point entirely: can you provide example code (or is there an existing example in the example library) that will reproduce the issue?

@giacarrea
Copy link

giacarrea commented Dec 5, 2023

Nevermind, I just didn't realize I had to include avares://OxyPlot.Avalonia/Themes/Default.axaml sorry for the bother :/.

@ilmandorlone
Copy link

Does anyone have a working demo using Avalonia version 11 that they could share? I'm beginning a new project and a basic example would suffice. I'm currently using the newly released Avalonia 2.1.0-Avalonia11 and am stuck with the StyleInclude issue

@giacarrea
Copy link

Here's one I made from the avalonia samples; there are two charts, one set by view only, the other fed by viewmodel.

Avalonia.Samples-main - main proj only.zip

@nicolasr75
Copy link

@giacarrea Have you successfully compiled your samples with the newest Avalonia (11.0.7)? It doesn't work for me and seems to be related to the StyleInclude, see also here #65

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

No branches or pull requests

8 participants