[Xamarin.Forms] Issues on WindowsPhone and Android
-
- Newbie
- Posts: 9
- Joined: Mon Jan 12, 2015 12:00 am
[Xamarin.Forms] Issues on WindowsPhone and Android
Hi There,
We hope you are doing fine.
We tried searching on the forum but couldn't find any similar problems. We had recently purchased TeeCharts for Xamarin.Forms license the charts seem to work well on iOS and mostly on Android too. However, we are facing some glaring issues and would like to find solutions to them ASAP.
ISSUE 1:
On Android, if we put the charts in a ListView and scroll the ListView towards the end of the list, all the charts that scroll through the top navigation bar leave trails of their marks on the bar. We tried to figure out the cause but we couldn't and many tweaks we tried to put in didn't work for us. The behavior is identical on Emulator and Device both, and the issue remains the same across different versions of Xamarin.Forms too. We think this might be a bug in the Xamarin.Forms implementation of TeeCharts for Android. (Please see the attached screenshot)
ISSUE 2:
On Windows Phone, we are simply unable to use charts at all on most screens because if TeeCharts are placed inside a scrollable Xamarin.Forms container (like. scrollview or listview), the TeeChart.WP8.DLL crashes with a NullPointerException. We are think this might also be a bug in TeeChart for WinbPhone.
We've attached a sample project and screenshot to demonstrate the issues on both Windows Phone and Android.
Thanks.
We hope you are doing fine.
We tried searching on the forum but couldn't find any similar problems. We had recently purchased TeeCharts for Xamarin.Forms license the charts seem to work well on iOS and mostly on Android too. However, we are facing some glaring issues and would like to find solutions to them ASAP.
ISSUE 1:
On Android, if we put the charts in a ListView and scroll the ListView towards the end of the list, all the charts that scroll through the top navigation bar leave trails of their marks on the bar. We tried to figure out the cause but we couldn't and many tweaks we tried to put in didn't work for us. The behavior is identical on Emulator and Device both, and the issue remains the same across different versions of Xamarin.Forms too. We think this might be a bug in the Xamarin.Forms implementation of TeeCharts for Android. (Please see the attached screenshot)
ISSUE 2:
On Windows Phone, we are simply unable to use charts at all on most screens because if TeeCharts are placed inside a scrollable Xamarin.Forms container (like. scrollview or listview), the TeeChart.WP8.DLL crashes with a NullPointerException. We are think this might also be a bug in TeeChart for WinbPhone.
We've attached a sample project and screenshot to demonstrate the issues on both Windows Phone and Android.
Thanks.
- Attachments
-
- Android screenshot
- Nexus 4 (KitKat) Screentshot 1.png (74.75 KiB) Viewed 19005 times
-
- TeeChartsSample.zip
- Sample project
- (287.25 KiB) Downloaded 635 times
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: [Xamarin.Forms] Issues on WindowsPhone and Android
Hello,
I can reproduce this in Android 4 and Android 5 emulators but can not reproduce it on several Android 5 devices and one Android 4 device. This somehow reminds me of this Xamarin.Forms bug I reported. In some occasions it produced a similar result. In which kind of device can you reproduce the problem on?ISSUE 1:
On Android, if we put the charts in a ListView and scroll the ListView towards the end of the list, all the charts that scroll through the top navigation bar leave trails of their marks on the bar. We tried to figure out the cause but we couldn't and many tweaks we tried to put in didn't work for us. The behavior is identical on Emulator and Device both, and the issue remains the same across different versions of Xamarin.Forms too. We think this might be a bug in the Xamarin.Forms implementation of TeeCharts for Android. (Please see the attached screenshot)
I could reproduce the problem here and added it (ID1102) to the defect list. My colleague Christopher Ireland will add a workaround and update on the issue status in a following post.ISSUE 2:
On Windows Phone, we are simply unable to use charts at all on most screens because if TeeCharts are placed inside a scrollable Xamarin.Forms container (like. scrollview or listview), the TeeChart.WP8.DLL crashes with a NullPointerException. We are think this might also be a bug in TeeChart for WinbPhone.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: [Xamarin.Forms] Issues on WindowsPhone and Android
This issue is now fixed. It seems that for some reason the code path in WP8 Xamarin Forms has changed a little, either because of your specific code or because of the update to Xamarin Forms 1.3. In any case, there is a workaround you can apply.Narcís wrote:I could reproduce the problem here and added it (ID1102) to the defect list.
The workaround involves adding a new unit, MyTChart.cs, to your project TeeChartsSample.WinPhone with the following content:
Code: Select all
using Steema.TeeChart;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TeeChartsSample.WinPhone
{
public class MyTChart : TChart
{
public MyTChart() : base()
{
}
double oldWidth = 0, oldHeight = 0;
protected override System.Windows.Size MeasureOverride(System.Windows.Size availableSize)
{
Xamarin.Forms.Size result = new Xamarin.Forms.Size();
result.Width = !double.IsInfinity(availableSize.Width) ? availableSize.Width : 0;
result.Height = !double.IsInfinity(availableSize.Height) ? availableSize.Height : 0;
if (oldWidth != result.Width && oldHeight != result.Height && RootElement != null)
{
Draw(new Xamarin.Forms.Rectangle(new Xamarin.Forms.Point(0, 0), result));
}
oldWidth = result.Width;
oldHeight = result.Height;
return new System.Windows.Size(result.Width, result.Height);
}
}
}
Code: Select all
using Xamarin.Forms;
using Xamarin.Forms.Platform.WinPhone;
using Steema.TeeChart;
using TeeChartsSample;
using TeeChartsSample.WinPhone;
[assembly: ExportRenderer(typeof(ChartView), typeof(TeeChartRenderer))]
namespace TeeChartsSample.WinPhone
{
class TeeChartRenderer : ViewRenderer<ChartView, MyTChart>
{
private Chart chartModel;
private MyTChart chart;
protected override void OnElementChanged(ElementChangedEventArgs<ChartView> e)
{
base.OnElementChanged(e);
chartModel = Element.Model;
chart = new MyTChart();
chart.Chart = chartModel;
SetNativeControl(chart);
}
protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
}
}
}
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 9
- Joined: Mon Jan 12, 2015 12:00 am
Re: [Xamarin.Forms] Issues on WindowsPhone and Android
Hi Narcis,
Thanks for your response.
We can successfully reproduce the Android overlap issue on the following devices:
Also, as soon as the scroll clipping reaches middle of the charts the mark overlap disappears. Also, the overlap is only caused by the Chart Marks and nothing else (i.e. the panel, bars or anything else do not overlap).
I hope this information helps. I've attached a screenshot demonstrating the issue when some other components are placed before the ListView.
Thanks for your response.
We can successfully reproduce the Android overlap issue on the following devices:
- Android Emulator with 4.4.4 KitKat
Google Nexus 5 with 5.1 Lollipop
Huawei Ascend G750 with 4.2.2 JellyBean
HTC D816 with 4.2.2 JellyBean
Samsung Note 3
Also, as soon as the scroll clipping reaches middle of the charts the mark overlap disappears. Also, the overlap is only caused by the Chart Marks and nothing else (i.e. the panel, bars or anything else do not overlap).
I hope this information helps. I've attached a screenshot demonstrating the issue when some other components are placed before the ListView.
- Attachments
-
- Android issue
- Nexus 4 (KitKat) Screentshot 7.png (31.38 KiB) Viewed 18879 times
-
- Newbie
- Posts: 9
- Joined: Mon Jan 12, 2015 12:00 am
Re: [Xamarin.Forms] Issues on WindowsPhone and Android
Hi Christopher,
The workaround you suggested seems to resolve the issue for us on Windows Phone. Thank you so much.
One thing you might want to know is that the issue did occur on older versions of Xamarin as well so it wasn't just related to Xamarin.Forms 1.3.x.
Do you know if this fix will be out anytime soon in a newer version of TeeCharts for Xamarin.Forms?
I have another question regarding TeeCharts for Xamarin.Forms.
Can you let us know when the iOS Unified compatible version of TeeCharts for Xamarin.Forms will be out?
Thanks.
The workaround you suggested seems to resolve the issue for us on Windows Phone. Thank you so much.
One thing you might want to know is that the issue did occur on older versions of Xamarin as well so it wasn't just related to Xamarin.Forms 1.3.x.
Do you know if this fix will be out anytime soon in a newer version of TeeCharts for Xamarin.Forms?
I have another question regarding TeeCharts for Xamarin.Forms.
Can you let us know when the iOS Unified compatible version of TeeCharts for Xamarin.Forms will be out?
Thanks.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: [Xamarin.Forms] Issues on WindowsPhone and Android
Hello,
Thanks for the feedback.
I haven't been able to reproduce it consistently here with a device. It's reproduceable with Android API 19 and Android API 21 emulators but not in a device. Actually, I even tested on a Google Nexus 5 with Android 5.0.1 as you said and worked fine there. I also tested with a Google Nexus 7 (2012) with Android 5.0.2 and a Google Nexus 4 with Android 5.01. At the URL below you can download the .apk I used for the test and a video showing how the application works on the Nexus 7. It worked the same way with the other devices. Can you please test the attached apk at your end and let us know how it works?
http://www.steema.com/files/public/TeeC ... Scroll.zip
BTW, some Android resources that might be helpful here:
How do you install an APK file in the Android emulator?
How to Record Your Android Device’s Screen With Android 4.4 KitKat
Thanks for the feedback.
I haven't been able to reproduce it consistently here with a device. It's reproduceable with Android API 19 and Android API 21 emulators but not in a device. Actually, I even tested on a Google Nexus 5 with Android 5.0.1 as you said and worked fine there. I also tested with a Google Nexus 7 (2012) with Android 5.0.2 and a Google Nexus 4 with Android 5.01. At the URL below you can download the .apk I used for the test and a video showing how the application works on the Nexus 7. It worked the same way with the other devices. Can you please test the attached apk at your end and let us know how it works?
http://www.steema.com/files/public/TeeC ... Scroll.zip
BTW, some Android resources that might be helpful here:
How do you install an APK file in the Android emulator?
How to Record Your Android Device’s Screen With Android 4.4 KitKat
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: [Xamarin.Forms] Issues on WindowsPhone and Android
Hello,
the iOS Unified version is almost ready. Just a few details need to be finalised before it can be released.MiracleTek wrote: Can you let us know when the iOS Unified compatible version of TeeCharts for Xamarin.Forms will be out?
Given that Christopher fixed that and a maintenance release might be required to support iOS Unified, yes, that could be the case. Please be aware at this forum or any other Steema Software communication channels for further news.MiracleTek wrote: Do you know if this fix will be out anytime soon in a newer version of TeeCharts for Xamarin.Forms?
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 9
- Joined: Mon Jan 12, 2015 12:00 am
Re: [Xamarin.Forms] Issues on WindowsPhone and Android
Hi Christopher,
I had to do a little tweak to your function you supplied as part of the MyTChart class for the windows phone fix, since the older code was causing the chart to disappear if picker dialog was opened on top of a chart that is inside a list view item. Coming back to chart list from the picker dialog would cause the chart to disappear.
The following implementation seems to work well.
Just thought I should let you should know.
Thanks.
I had to do a little tweak to your function you supplied as part of the MyTChart class for the windows phone fix, since the older code was causing the chart to disappear if picker dialog was opened on top of a chart that is inside a list view item. Coming back to chart list from the picker dialog would cause the chart to disappear.
The following implementation seems to work well.
Code: Select all
namespace TeeChartsSample.WinPhone
{
public class MyTChart : TChart
{
public MyTChart()
: base()
{
}
double oldWidth = 0, oldHeight = 0;
protected override System.Windows.Size MeasureOverride(System.Windows.Size availableSize)
{
if (RootElement != null)
{
double width = !double.IsInfinity(availableSize.Width) ? availableSize.Width : 0;
double height = !double.IsInfinity(availableSize.Height) ? availableSize.Height : 0;
if (oldWidth != width || oldHeight != height)
Draw(new Xamarin.Forms.Rectangle(0, 0, width, height));
oldWidth = width;
oldHeight = height;
return new System.Windows.Size(width, height);
}
return availableSize;
}
}
}
Thanks.
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: [Xamarin.Forms] Issues on WindowsPhone and Android
Hello!
That's great, thank you very much I have added the change to the TeeChart.PCL.WP8 source code.MiracleTek wrote: Just thought I should let you should know.
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 9
- Joined: Mon Jan 12, 2015 12:00 am
Re: [Xamarin.Forms] Issues on WindowsPhone and Android
Hi Narcís,
Any updates on the iOS unified version? Our next release is dependent on itthe iOS Unified version is almost ready. Just a few details need to be finalised before it can be released.
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: [Xamarin.Forms] Issues on WindowsPhone and Android
A new Xamarin Forms version including support for iOS.Unified is available for download from the customer download page here.
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 9
- Joined: Mon Jan 12, 2015 12:00 am
Re: [Xamarin.Forms] Issues on WindowsPhone and Android
Hi Christopher,
Thanks a lot for the swift reply. Apologies for not checking the download section first .
Got the right version now.
Thanks !
Thanks a lot for the swift reply. Apologies for not checking the download section first .
Got the right version now.
Thanks !
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: [Xamarin.Forms] Issues on WindowsPhone and Android
You're very welcomeMiracleTek wrote: Thanks a lot for the swift reply. Apologies for not checking the download section first .
A happy coincidence that I was finishing publishing this version when I saw your message!
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |