Plotting area showing content of other fragment (1)


#1

Dear Sir or Madam,

I’m using two charts in a view pager with three tabs. The charts are both on the “middle-tab”, the “graph tab”. On the right tab is a Google Map and two smaller fragments showing speed and distance. My problem is the following: Now and then when I pan or zoom in one of the two charts, the map appears in the plotting area of the chart.

For better understanding please see the pictures:

https://www.dropbox.com/s/p1r0aq5q6kewa0n/device-2014-08-28-144500.png?dl=0

The tabs are realised by fragments. The XML-file for the “graph-tab” contains a LinearLayout that holds the both charts. The map in the other tab-fragments is added programmatically.

Do have an idea where this behaviour comes from?


#2

Hi BjoernSteinmetz,

I’m sorry to hear you’re having problems with the charts in a ViewPager.

Would you be able to try your app with the trial version of ShinobiCharts, rather than the Standard or Premium one, and see if you still experience the same issue please?

The trial version can be downloaded from http://www.shinobicontrols.com/android/shinobicharts/price-plans/shinobicharts-standard/shinobicharts-free-trial-form.

Kind regards,

Patrick


#3

Hi Patrick,

when using the trial version everything works fine. The new standard version (1.6) causes this problem too.

Please tell me if you need additional information about my programm code.

Thank you verry much,

Bjoern


#4

Hi Bjoern,

This is a strange bug which we’ve seen once before but it’s very hard to pin down as it only happens with certain devices (for example, we found it happen with a Nexus 10 but not a HTC One).

It seems by placing a view on top of the chart you can prevent it from happening - which explains why it doesn’t happen with the trial version; the watermark is a view on top of the chart.

A workaround you can employ is as follows:

  • Create an ImageView with an image resource that is a 1x1 pixel transparent image
  • Add a custom view annotation to the chart using the above ImageView:

AnnotationsManager annotationsManager = chart.getAnnotationsManager();
Annotation annotation = annotationsManager.addViewAnnotation(imageView, null, null, chart.getXAxis(), chart.getYAxis());

- The X and Y values can be set to null as we’re going to make the annotation span the width and height of the plot area (see below)

  • For this workaround to work the ImageView needs to be constantly on top of the chart so the layout params of the ImageView have to be set accordingly to make the annotation span the width and height of the plot area:

imageView.getLayoutParams().width = LayoutParams.MATCH_PARENT;
imageView.getLayoutParams().height = LayoutParams.MATCH_PARENT;

Hopefully that will help in the meantime while we look for a permanent fix.

Kind regards,

Patrick


#5

Hello Patrick,

thank you for this workaround. It works :slight_smile:

I saw this strange behaviour on a Nexus 7 (2013, K008) and on a Samsung Galaxy Tab Pro (Samsung SM-T320).

Thanks again.

Bjoern


#6

Hi Bjoern,

Glad to hear it worked. And thanks for letting us know which devices you saw this on!

Kind regards,

Patrick