Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clicked view/coordinate information on pie chart #5454

Open
HaticeBolatSofttech opened this issue Apr 26, 2024 · 0 comments
Open

Clicked view/coordinate information on pie chart #5454

HaticeBolatSofttech opened this issue Apr 26, 2024 · 0 comments

Comments

@HaticeBolatSofttech
Copy link

  val params = halfChart.layoutParams as ConstraintLayout.LayoutParams
    params.setMargins(0, 0, 0, -offset)
    halfChart.layoutParams = params
    halfChart.setOnChartValueSelectedListener(object : OnChartValueSelectedListener {
        override fun onValueSelected(e: Entry?, h: Highlight?) {
            halfChart.highlightValues(null) 
            val label = e?.data.toString()
            val percent = (e?.y ?: 0f) / halfChart.data.yValueSum * 100
            val formattedPercent =
                String.format("%.2f", percent) // Yüzdeyi iki ondalıklı hale getir
            val balloon = createBalloon(this@AboutAppActivity) {
                setWidthRatio(0.25f)
                setHeight(BalloonSizeSpec.WRAP)
                setText("$label: $formattedPercent%")
                setTextColorResource(R.color.white)
                setTextSize(5f)
                setIconDrawableResource(R.drawable.ic_about_app)
                setArrowSize(10)
                setArrowPosition(0.5f)
                setPadding(12)
                setCornerRadius(8f)
                setBackgroundColorResource(R.color.primary)
                setLifecycleOwner(this@AboutAppActivity)
            }
            **balloon.showAlignTop(halfChart,0,0)**. 
        }

        override fun onNothingSelected() {
            TODO("Not yet implemented")
        }

})}

Hi,
How can I get the X,Y coordinates of the area I clicked on in the pie chart? Or how can I get the clicked area view in the in the pie chart? I want to show a balloon at these coordinates/views that I click on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant