SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

Answered
0
0

Hi,
I want to know how to set FastBandRenderableSeries withSeriesInfoProvider to null?

If i set null like sciChartBuilder.newBandSeries().withSeriesInfoProvider(null) i’m getting error on debug logs:

E/Exception: null
java.lang.NullPointerException: Attempt to invoke interface method ‘com.scichart.charting.visuals.renderableSeries.tooltips.ISeriesTooltip com.scichart.charting.visuals.renderableSeries.hitTest.ISeriesInfoProvider.getSeriesTooltip(java.lang.Class)’ on a null object reference
at com.scichart.charting.modifiers.behaviors.TooltipBehaviorBase.func(SourceFile:120)
at com.scichart.charting.modifiers.behaviors.TooltipBehaviorBase.func(SourceFile:35)
at com.scichart.core.utility.ListUtil.select(SourceFile:249)
at com.scichart.core.observable.ProjectionCollection.onCollectionChanged(SourceFile:186)
at com.scichart.core.observable.ObservableCollection.a(SourceFile:302)
at com.scichart.core.observable.ObservableCollection.a(SourceFile:79)
at com.scichart.core.observable.ObservableCollection.add(SourceFile:93)
at java.util.Collections.addAll(Collections.java:5447)
at com.ikon.prodigy.Fragments.FragmentUI.SciChartFragmentUI$1$3.run(SciChartFragmentUI.java:1057)
at com.scichart.core.framework.UpdateSuspender.using(SourceFile:122)
at com.ikon.prodigy.Fragments.FragmentUI.SciChartFragmentUI$1.run(SciChartFragmentUI.java:1013)
at android.os.Handler.handleCallback(Handler.java:793)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:173)
at android.app.ActivityThread.main(ActivityThread.java:6698)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:782)

Version
2.5
  • You must to post comments
Best Answer
1
0

Hi there,

To disable drawing of rollover marker you need to create custom series info provider with custom tooltip ( please take a look on our example ) and override onDrawTooltipOverlay() to do nothing:

class CustomSeriesInfoProvider extends DefaultXySeriesInfoProvider {
    @Override
    protected ISeriesTooltip getSeriesTooltipInternal(Context context, XySeriesInfo<?> seriesInfo, Class<?> modifierType) {
        if (modifierType == RolloverModifier.class) {
            return new CustomXySeriesTooltip(context, seriesInfo);
        } else {
            return super.getSeriesTooltipInternal(context, seriesInfo, modifierType);
        }
    }

    private static class CustomXySeriesTooltip extends XySeriesTooltip {
        public CustomXySeriesTooltip(Context context, XySeriesInfo seriesInfo) {
            super(context, seriesInfo);
        }

        @Override
        public void onDrawTooltipOverlay(Canvas canvas, PointF xyCoordinate, int color) {
            // do nothing here and marker won't be rendered
        }
    }
}

Is this what you’re trying to achieve? Hope this will help you!

Best regards,
Yura

  • You must to post comments
Great Answer
0
0

Hi Yura;

Thanks for your answer, yes it’s worked.

And i have another question about this…
As you can see on attached images i’m create MACD chart. And I just want to show the rollover marker and label of FastColumnRenderableSeries of histogram data. I do not show the markers and labels of FastBandRenderableSeries with the CustomSeriesInfoProvider you provided. There is no problem during runtime and it works properly as you can see in the attached 2nd picture. But in the debug log I get the following error:

E/Exception: null
java.lang.UnsupportedOperationException: Expected instance of XyRenderableSeriesBase
    at com.scichart.core.utility.Guard.instanceOf(SourceFile:50)
    at com.scichart.core.utility.Guard.instanceOf(SourceFile:39)
    at com.scichart.charting.visuals.renderableSeries.RenderableSeriesProviderBase.attachTo(SourceFile:48)
    at com.scichart.core.utility.AttachableHelper.tryAttachTo(SourceFile:38)
    at com.scichart.charting.visuals.renderableSeries.BaseRenderableSeries.attachTo(SourceFile:473)
    at com.scichart.charting.utility.propertyHelpers.AttachableCollectionPropertyHelper.attachTo(SourceFile:36)
    at com.scichart.charting.utility.propertyHelpers.RenderableSeriesPropertyHelper.attachTo(SourceFile:55)
    at com.scichart.charting.utility.propertyHelpers.RenderableSeriesPropertyHelper.attachTo(SourceFile:31)
    at com.scichart.charting.utility.propertyHelpers.CollectionPropertyHelper.onCollectionChanged(SourceFile:85)
    at com.scichart.core.observable.ObservableCollection.a(SourceFile:300)
    at com.scichart.core.observable.ObservableCollection.a(SourceFile:77)
    at com.scichart.core.observable.ObservableCollection.add(SourceFile:91)
    at java.util.Collections.addAll(Collections.java:5447)
    at com.ikon.prodigy.Fragments.FragmentUI.SciChartFragmentUI$1$3.run(SciChartFragmentUI.java:1054)
    at com.scichart.core.framework.UpdateSuspender.using(SourceFile:122)
    at com.ikon.prodigy.Fragments.FragmentUI.SciChartFragmentUI$1.run(SciChartFragmentUI.java:1009)
    at android.os.Handler.handleCallback(Handler.java:793)
    at android.os.Handler.dispatchMessage(Handler.java:98)
    at android.os.Looper.loop(Looper.java:173)
    at android.app.ActivityThread.main(ActivityThread.java:6698)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:782)
Images
  • Yura Khariton
    For FastBandRenderableSeries you need to extend DefaultBandSeriesInfoProvider and probably BandSeriesTooltip, because it uses XyyDataSeries instead of XyDataSeries. For each data series type tooltip should display different information. That’s why you see exception in debug log. To hide tooltips you can make it invsiible ( tooltip extents TextView so you can set View.GONE or View.INVISIBLE for it to hide)
  • Emre Gökberk
    Yes, you are right. Creating CustomBandSeriesInfoProvider fixed the error. Tnx.
  • You must to post comments
0
0

Hi Emre,

Well by design you can’t set it to null. This SeriesInfoProvider is important part of HitTest API, which is used by almost all modifiers which work with series to get information about series. So to avoid performance overhead of constant null checks we assume that it is always set to some not null value.


May I ask why do you want to set it to null?

Best regards,
Yura

  • You must to post comments
0
0

@Yura,

I don’t want the dots to appear when i rollover the chart. only the dots appear.
If I set withSeriesInfoProvider to null, only the dots are visible, the labels are not, but I get an error.

Images
  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.