Pre loader

Chart in ViewPager disappears on page changing.

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

Hi,

Let me explain the structure of attached views. Default view state is https://imgur.com/a/zqAqpXp .

<VerticalViewPager>
    <FirstPagedFragment>
         <TradingViewFragment>
             <WebView />
         </TradingViewFragment>
         <SciChartFragment>
             <com.scichart.charting.visuals.SciChartSurface />
         </SciChartFragment>
    </FirstPagedFragment>
    <SecondPagedFragment> 
           ... 
    </ SecondPagedFragment>
</VerticalViewPager>

When FirstPagedFragment is dragged, SecondPagedFragment becomes displayed. You can see it on https://imgur.com/a/2VqZ1HY

The problem is the chart becomes disappeared when ViewPager is on changing state. Here is another link : https://imgur.com/a/xDO6Xtx

It is happened on [Samsung Galaxy S9, API 26] and [Xiaomi Mi A1, API 25] and I did not update displayMetric of chart.
Is there any configuration to fix this issue? Thanks.

All images are attached.

Version
2.2.1.2391
Images
  • You must to post comments
0
0

Hi Changhee,

It looks like that this issue is caused by our default RenderSurface implementation which is based on GLSurfaceView which draws its content outside View hierarchy. It looks like that ViewPager uses some kind of drawing cache to animate transition and it doesn’t record content of GLSurfaceView. As result when transition starts ViewPager doesn’t include content of GLSurfaceView. To workaround this issue you can use alternative RenderSurface implementations such as RenderSurface and GLTextureView:

    UpdateSuspender.using(surface) {
  surface.renderSurface = RenderSurface(activity)

  Collections.addAll<IAxis>(surface.getXAxes(), xAxis)
  Collections.addAll<IAxis>(surface.getYAxes(), yAxis)
  Collections.addAll<FastCandlestickRenderableSeries>(surface.getRenderableSeries(), rSeries)
}

Also you can extend SciChartSurface class and override its default render surface ( please take a look on suggestion #3 from my reply in this question ) so you won’t need to set it for every chart instance.

Hope this will help you!

Best regards,
Yura

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies