Customize the marker - MPAndroidChart

Prabs picture Prabs · Jan 4, 2017 · Viewed 9.9k times · Source

I've created a Simple Bar Chart using MPAndroidChart. For the purpose of Marker I'm extending MarkerView. I need a marker as shown in the git hub, like this:

enter image description here

But I'm not getting that arrow. So it is not looking like a comment, it's a rectangular box :/

enter image description here

In order to make it look like a comment box instead of a rectangular box which class I should use. I've checked IMarker, MarkerImage but not sure which I should proceed with.

And even MPPointF isn't working. Can't import the package

import com.github.mikephil.charting.utils.MPPointF;

Code:

@Override
public void refreshContent(Entry e, Highlight highlight) { 
    tv_turnOver.setText("Turn over: " + (int) e.getVal());

    /*
    if (e instanceof CandleEntry) {

        CandleEntry ce = (CandleEntry) e;

        tv_label.setText("" + Utils.formatNumber(ce.getVal(), 0, true));
    } else {

        tv_label.setText("" + Utils.formatNumber(e.getXIndex(), 0, true));
    }*/

    //  super.refreshContent(e, highlight);
}

Answer

Prabs picture Prabs · Jan 5, 2017

https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/main/res/drawable-nodpi/marker2.png

Using an image as a background

That's it...

That's it??!!!

Instead of the background colour 'Red', I've used this image to get that arrow.