Custom MPAndroidChrt Piechart example
Change the color of current selected item with custom highlight color.
Features
- Defalut highlight first value.
- Custom Hightlight color
- Custom Marker view
chart!!.highlightValues(null)
val h = arrayOfNulls<Highlight>(1)
h[0] = Highlight(0f, 0, 0)
chart!!.highlightValue(h[0])
chart!!.invalidate()
Need to custom MPAndroidChrt lib
Because com.github.PhilJay:MPAndroidChart:v3.1.0'
is not(yet) supported this feature 😭😭😭
Reference : https://github.com/PhilJay/MPAndroidChart/pull/3777/files
Custom list:
- MPChartLib/src/main/java/com/github/mikephil/charting/charts/PieChart.java
- MPChartLib/src/main/java/com/github/mikephil/charting/data/PieDataSet.java
- MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/datasets/IPieDataSet.java
- MPChartLib/src/main/java/com/github/mikephil/charting/renderer/PieChartRenderer.java
chart!!.setUseCustomHighLightColor(true)
dataSet.setHighLightColor(Color.parseColor("#CFAF05"))