package com.gh.gamecenter.common.view

import android.content.Context
import android.widget.TextView
import com.gh.gamecenter.common.R
import com.gh.gamecenter.common.utils.dip2px
import com.github.mikephil.charting.components.MarkerView
import com.github.mikephil.charting.data.Entry
import com.github.mikephil.charting.highlight.Highlight
import com.github.mikephil.charting.utils.MPPointF

class CustomMarkerView(context: Context) : MarkerView(context, R.layout.layout_chart_markerview) {
    var markerView: TextView = findViewById(R.id.markerView)
    override fun refreshContent(e: Entry, highlight: Highlight?) {
        markerView.text = e.y.toInt().toString()
        super.refreshContent(e, highlight)
    }


    override fun getOffset(): MPPointF {
        return MPPointF((-(width / 2)).toFloat(), (-height).toFloat() - 3f.dip2px())
    }
}