There’s a build error when implementing IPointMarkerPaletteProvider, IFillPaletteProvider, or IStrokePaletteProvider.
MainActivity_P.java:50: error: isAttached() in MainActivity_P cannot override isAttached() in PaletteProviderBase
public boolean isAttached ()
^
overridden method is final
MainActivity_P.java:58: error: attachTo(IServiceContainer) in MainActivity_P cannot override attachTo(IServiceContainer) in PaletteProviderBase
public void attachTo (com.scichart.core.IServiceContainer p0)
^
overridden method is final
MainActivity_P.java:66: error: detach() in MainActivity_P cannot override detach() in PaletteProviderBase
public void detach ()
^
overridden method is fina
What’s wrong with it? See the attached project to reproduce the issue.
- rubs00 asked 6 years ago
- You must login to post comments
Hi there,
It looks like that it’s caused by some kind of limitation in Xamarin.Android which doesn’t allow to implement IPointMarkerPaletteProvider interface in class which extends PaletteProviderBase because it contains final methods. I’m going to log it into our bugtracker for further investigation and for now you can workaround it by implementing IPointMarkerPaletteProvider interface from scratch in class which inherits from Java Object class:
class P : Java.Lang.Object, IPointMarkerPaletteProvider
{
private readonly IRenderableSeries _renderableSeries;
private readonly IntegerValues _pointMarkerColors = new IntegerValues();
public P(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
{
}
public P(IRenderableSeries renderableSeries)
{
_renderableSeries = renderableSeries;
}
public void Update()
{
// update colors
var count = _renderableSeries.CurrentRenderPassData.PointsCount();
_pointMarkerColors.Clear();
for (int i = 0; i < count; i++)
{
_pointMarkerColors.Add((int)(0xFFFFFF00 | (i % 255)));
}
}
public IntegerValues PointMarkerColors
{
get { return _pointMarkerColors; }
}
public void AttachTo(IServiceContainer services)
{
IsAttached = true;
}
public void Detach()
{
IsAttached = false;
}
public bool IsAttached { get; private set; }
}
Is this suitable for your needs? Hope that this will help you!
EDIT:
I’ve added simple Update() method implementation which worked for me. NOTE we can’t use ItemsArray property because Xamarin bindings generator wraps it in a such way that when you get it a new C# array is created and when you try change its elements original Java array remains intact (initialized with 0 values). Maybe that’s why you got an empty chart when use palete provider and in this case you just need to use Add/Set methods which modify original Java array.
Best regards,
Yura
- Yura Khariton answered 6 years ago
- last edited 6 years ago
-
Any updates on this issue? I couldn’t make this work.
-
Implementing this way draws no point at all. The update method is invoked but no point is visible. When I remove my palette provider, points appear.
-
Anyone?
-
Can you post code of your palette provider? Also how do you update your colors?
- You must login to post comments
Please login first to submit.