Kanval Kalra
Kanval Kalra

Reputation: 67

MPAndroidChart: Getting Pixel values from Entry values

I have multiple DataSet in line chart and i want to highlight all the Y points with custom overlay image. do we have any function for it ?

If not then

is there any function which can return corresponding pixel values for an entry object ?

Any direction would be appreciated.

Thanks you for reading.

Upvotes: 1

Views: 383

Answers (1)

The method is given by getPixelForValues(x,y) in Transform class

    val viewPortHandler = ViewPortHandler()
    viewPortHandler.setChartDimens(canvas.width.toFloat(),canvas.height.toFloat())
    val transformer = Transformer(viewPortHandler)
    var mpPointD = transformer.getPixelForValues(x, y)

But the transformation is not working for me with the points I pass but I know that the lib uses it with similar data that I set

Upvotes: 2

Related Questions