0

I am using the library MPAndroidChart.

I am struggling with getting the View object that represents the TextView inside the PieChart ("Blabla" in the following example image):

Example PieChart

I need the View object because I need to pass it to a Showcase library in order to make a showcase around that TextView. The library needs to get the position and size of the object it has to draw a showcase around.

The only thing I have is the PieChart object. And from that I need to get the TextView object that represents the center text.

Do you have any guess on how I can do this?

Mosius
  • 1,602
  • 23
  • 32
Charly Lafon
  • 562
  • 1
  • 3
  • 18
  • You can easily clear the `PieChart` center text, and put the `PieChart` in a `FrameLayout` containing a `TextView` with `android:layout_gravity="center"` – Mosius Oct 09 '18 at 19:24
  • :/ I don't like this solution very much because I'll have to manage the size of the TextView so it doesn't go outside the center of the chart etc. It looks like a bug source to me, whereas I get the center TextView out of the box with the PieChart directly. – Charly Lafon Oct 09 '18 at 19:33
  • 1
    here is the source code for `PieChartRenderer`: https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/PieChartRenderer.java it seems it doesn't use any `TextView` at all as it draw the text itself – Mosius Oct 09 '18 at 19:46

0 Answers0