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

Cannot visualize on IOS #800

Open
canperk opened this issue Dec 4, 2022 · 29 comments · Fixed by #1131
Open

Cannot visualize on IOS #800

canperk opened this issue Dec 4, 2022 · 29 comments · Fixed by #1131
Labels
has workaround requires external features We can not fix this for now, we need a feature that is out of this library.

Comments

@canperk
Copy link

canperk commented Dec 4, 2022

Describe the bug
When I try to use charts as basic usage. Android works fine but on IOS it shows only an empty space

To Reproduce
Steps to reproduce the behavior:

  1. Create MAUI Project.
  2. Add LiveCharts dependency from Nuget
  3. Add sample Line Chart code from LiveCharts sample
  4. Try on IOS

Expected behavior
Chart is shown

Screenshots
image

Smartphone:

  • Device: iPhone 11
  • OS: iOS16
@canperk
Copy link
Author

canperk commented Dec 16, 2022

@beto-rodriguez as you mentioned in the issue here I added <AndroidLinkResources>false</AndroidLinkResources> to project file in Property Groups, stil same problem exists.

@canperk
Copy link
Author

canperk commented Dec 16, 2022

https://github.com/canperk/LiveChartMAUI_IOS_issue is the reproduced version. A Basic line chart is not able to shown on IOS. YOu can use this as a reference. Maybe I am missing a silly detail. I just followed the Getting Started Stuffs

@beto-rodriguez beto-rodriguez added the priority 1 might not be fixed in the next release of the library, but it will soon! label Mar 3, 2023
@ScottyLightnin
Copy link

Hi @beto-rodriguez
Unfortunately we are also seeing this behavior where a basic line chart does not display on iOS, but works as expected on Android and Windows. We're using dotnet 7 (MAUI), but dropping back to dotnet 6 did not correct the issue.
Do you have plans to investigate and resolve this?
Kind regards,
Scott

@frederikspang
Copy link

frederikspang commented Jun 1, 2023

We're seeing the same issue on iOS. Simplest of charts, static ISeries[], copied from Samples. Just a blank view.

@JerryAndersen
Copy link

I experience the same. Windows and Android is working well. iOS is showing blank.
What do you other guys do? Trying to fix, found workaround, alternatives or just waiting.

@beto-rodriguez
Copy link
Owner

This should be fixed soon, will be apriority for the next release.

@ScottyLightnin
Copy link

ScottyLightnin commented Jun 18, 2023 via email

@erdmenchen
Copy link

Same issue here, is there a workaround or an expected time frame for a fix in the near future?
Is the problem known and just needs to be implemented?
Maybe we can help actively to fix as soon as possible, because this is actually a show stopper currently, if you want to build e.g. a MAUI app for Android and iOS...

@erdmenchen
Copy link

I got it working now.
I did a lot of changes, so don´t know what fixed the issue... sorry ;-)

@beto-rodriguez
Copy link
Owner

beto-rodriguez commented Jul 9, 2023

This should be probably fixed if you update your MAUI/dotnet version, I have seen a lot of issues fixed when I upgraded from net 6.0 to net7.0, anyways I keep investigating this.

@ScottyLightnin
Copy link

still broken for us on the latest Maui stable and .net 7.0. Appreciate your investigation.

@roja300
Copy link

roja300 commented Jul 9, 2023

Same issue here. Changed nuget version, changed .NET version etc.

Doesn't work.

@beto-rodriguez beto-rodriguez added priority 0 needs to be fixed asap. and removed priority 1 might not be fixed in the next release of the library, but it will soon! labels Jul 10, 2023
@JerryAndersen
Copy link

I just updated to 2.0.0-beta.810 (from beta 802) and with latest .Net7 I have the same issue. Doesn't work at iOS (16.5.1) but works fine at Android (emulator).
@erdmenchen I'm really curious why it is working for you. Can you please provide some versions of what you use?
LiveChartsCore.SkiaSharpView.Maui
MAUI version
Maybe iOS version?

@beto-rodriguez
Copy link
Owner

beto-rodriguez commented Jul 14, 2023

After checking this out and setting up my Mac environment again I was able to deploy the sample provided in this repository to an iPad.

I was able to run this repo on iOS, this is the sample provided in this repo I just published it to an iPad without issues:

maui-works.mp4

Well, this is the dev branch version (not published to NuGet yet), but is just the MauiSample provided in this repo; In the last days I updated the Maui view of the library to net 7, that fixed some zooming and panning issues for me, I am not sure if this update fixed this issue, I see a couple of options to try to fix this error for your case:

  1. Wait for my next release (this weekend), it will force your dotnet version to be at least net 7.0, I am not sure if something in SkiaSharp or Maui has been improved.

  2. Try to clone this repo (use the dev branch), and deploy the Maui sample to your iOS device, this will give you a clue if the issue is on your development environment, with my current setup it works: dotnet version 7.0.36, visual studio 17.6.5, my iPadOS is on 16.5.1 and my MacOS is Ventura 13.4.1.

@beto-rodriguez
Copy link
Owner

beto-rodriguez commented Jul 14, 2023

Update

You can discard option 1, the library is working with the latest NuGet package (beta.810), the following repo is just a really basic app and is working on iOS also:

https://github.com/beto-rodriguez/MauiApp-LiveCharts

VID_20230713_190257.mp4

Please verify your development environment (dotnet version, visual studio, MacOS) and try to publish https://github.com/beto-rodriguez/MauiApp-LiveCharts to your iOS device again, see the readme file in that repo for more info.

@beto-rodriguez
Copy link
Owner

Your issue could also be caused by #1063, it will be fixed once there is a stable release of SkiaSharp 2.88.4

@beto-rodriguez beto-rodriguez added not verified It is probably an issue, but we have not enough evidence to mark this as a bug. more info required and removed priority 0 needs to be fixed asap. labels Jul 19, 2023
@JerryAndersen
Copy link

I just cloned your repo and tried your sample and it doesn't work at my environment. It deploys fine but at iOS the view is blank.

I have .NET 7.0.306. VS 17..6.5. IOS 16.5.1. I don't use Mac for now but only iTunes 12.12.9.4 but I guess that can't be the cause. Everything else works fine. What do you think?

@beto-rodriguez
Copy link
Owner

I don't discard that the issue exists, it is just that we have not found what triggers it, so any feedback would be useful to find this.

Being honest, I don't think that the issue is in this library, we are not doing anything special for the iOS view, we are only using the SkiaSharp view for MAUI, this issue seems out of the scope of this library.

You could also be affected by dotnet/maui#7350. They now removed the verified tag, which probably means that it is not happening on the latest version. I have not test this again, but in the past, I was able to reproduce the issue and gave them feedback on the issue I found.

beto-rodriguez added a commit that referenced this issue Jul 22, 2023
@beto-rodriguez
Copy link
Owner

I just published beta.860, this version removes the support for the XAML designer (which just noticed is not actually supported on MAUI), please let me know if that fixed the issue.

@JerryAndersen
Copy link

I just published beta.860, this version removes the support for the XAML designer (which just noticed is not actually supported on MAUI), please let me know if that fixed the issue.

I just tried 860 and unfortunately it didn't fix the issue.

@concer22
Copy link

concer22 commented Aug 3, 2023

I had the same problem. The only way i could fix it on iOS (for now) is to add HorizontalOptions = FillAndExpand + VerticalOptions = FillAndExpand on the chart object in xaml. Hope this comment helps someone avoiding hours of debugging!

@ScottyLightnin
Copy link

Thanks for your feedback @concer22.
Sadly we tried that but for us the issue remains. Latest Preview of VS, on .Net 7, using:

Works great in Windows and Android, but just a blank chart on iOS

@concer22
Copy link

concer22 commented Aug 4, 2023

Ok weird, same specs here and it works. Maybe if i post the whole code you can get it to work for you. It seems the chart is very sensitive for properties being there or not that can influence the height/width. The wrong property there means an invisible chart on iOS. (works fine in android)

<lvc:CartesianChart ZIndex="10" HorizontalOptions="FillAndExpand" VerticalOptions="Start" HeightRequest="550" x:Name="lineChart" TooltipPosition="Top" TooltipTextSize="10" LegendTextSize="10" Series="{Binding Series}" XAxes="{Binding XAxes}" YAxes="{Binding YAxes}"> </lvc:CartesianChart>

		`SeriesValue = new ObservableCollection<ISeries>
				{
					new LineSeries<ObservableValue>
					{
						Values = ChartDataValue.Select(x => new ObservableValue((double)x.Value)),
						Stroke = new SolidColorPaint(SKColor.Parse("#95C11F"), 3),
						Fill = new SolidColorPaint(SKColor.Parse("#95C11F").WithAlpha(0x40)),
						DataLabelsSize = 8,
						DataLabelsPaint = new SolidColorPaint(SKColor.Parse("#000")),
						GeometrySize = 6,
						GeometryStroke = new SolidColorPaint(SKColor.Parse("#95C11F")),
						GeometryFill = new SolidColorPaint(SKColor.Parse("#000").WithAlpha(0x80)),
						DataLabelsPosition = LiveChartsCore.Measure.DataLabelsPosition.Top,

					}
				};

				XAxesValue = new ObservableCollection<Axis>
				{
					new Axis
					{
						Labels = ChartDataValue.Select(x => x.Label).ToArray(),
						Labeler = (value) => value.ToString(),
						TextSize=10,
						MinStep = 1,
						ForceStepToMin = true,
						ShowSeparatorLines = true,
						LabelsRotation = 70,
						Padding = new LiveChartsCore.Drawing.Padding(0,10,5,10),
						UnitWidth = SelectedStatisticType == StatisticTypeEnum.DAY ? TimeSpan.FromHours(1).Ticks : TimeSpan.FromDays(1).Ticks,
					}
				};

				YAxesValue = new ObservableCollection<Axis>
				{
					new Axis
					{
						TextSize=12,
						MinLimit = 0
					}
				};`

@ScottyLightnin
Copy link

ok finally an update and some good news. Our charts on iOS started working!
For us, it took building and deploying from a Mac first, rather than from our main Windows dev boxes.
@beto-rodriguez I don't know if this gives you a hint as to what could be wrong, or helps with your reproduction steps.
But for us, this is great news as we're able to go ahead and use LiveCharts2 in our production apps.

@beto-rodriguez
Copy link
Owner

@ScottyLightnin Those are good news! thanks for the feedback, I will try to find the issue, at least now we know a workaround.

@JerryAndersen
Copy link

@ScottyLightnin that is very cool with a workaround. Just to be sure - is it a correct assumption that you use VS for Mac to build and deploy? So no Windows at all in this case.
If that is the case I assume you haven't tried the "hybrid" with Windows VS and bridge remote mac.

@ScottyLightnin
Copy link

@ScottyLightnin that is very cool with a workaround. Just to be sure - is it a correct assumption that you use VS for Mac to build and deploy? So no Windows at all in this case.
If that is the case I assume you haven't tried the "hybrid" with Windows VS and bridge remote mac.

Windows VS with Mac remote bridge also works for us. The only failure was deploying direct to local iOS from windows.

@erdmenchen
Copy link

I saw this issue with SkiaSharp based libraries multiple times recently, e.g. Mapsui/Mapsui#1872 (comment)

Here is an original SkiaSharp issue about the same problem:
mono/SkiaSharp#2410

Limitation of HotReload:

Static iOS libraries and frameworks aren't supported and you may see runtime errors or crashes if your app attempts to load these.

see https://learn.microsoft.com/en-us/dotnet/maui/ios/hot-restart#limitations

Solution: Do not directly connect your iOS devices to your Windows dev machine but use a Mac remote bridge...

@sencagri
Copy link

I saw this issue with SkiaSharp based libraries multiple times recently, e.g. Mapsui/Mapsui#1872 (comment)

Here is an original SkiaSharp issue about the same problem: mono/SkiaSharp#2410

Limitation of HotReload:

Static iOS libraries and frameworks aren't supported and you may see runtime errors or crashes if your app attempts to load these.

see https://learn.microsoft.com/en-us/dotnet/maui/ios/hot-restart#limitations

Solution: Do not directly connect your iOS devices to your Windows dev machine but use a Mac remote bridge...

Is this mean it will work when we publish it?

@beto-rodriguez beto-rodriguez added has workaround requires external features We can not fix this for now, we need a feature that is out of this library. and removed more info required maui not verified It is probably an issue, but we have not enough evidence to mark this as a bug. labels Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has workaround requires external features We can not fix this for now, we need a feature that is out of this library.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants