Skip to content Skip to sidebar Skip to footer

How To Make Mpandroidchart Radarchart Round

I would like to present some Values inside a Radar Chart. Long-time I was working with AndroidPlot which works great but it doesn't support Radar charts. So I swapped to MPAndroidC

Solution 1:

go to RadarChartRenderer class. and edit the method inside class like below:

protected void drawDataSet(Canvas c, IRadarDataSet dataSet, int mostEntries) {

  ..........................
  ..........................

        mRenderPaint.setStrokeWidth(dataSet.getLineWidth());
        mRenderPaint.setStyle(Paint.Style.STROKE);
        mRenderPaint.setDither(true);                   
        mRenderPaint.setStrokeJoin(Paint.Join.ROUND);  
        mRenderPaint.setStrokeCap(Paint.Cap.ROUND); 
        mRenderPaint.setPathEffect(new CornerPathEffect(30) );  
        mRenderPaint.setAntiAlias(true); 

  ............................
  ............................
}

my results like: enter image description here

Solution 2:

As mention in the issue link, you can implement it by yourself, just see https://github.com/PhilJay/MPAndroidChart/blob/c1f6fcebf0c3516e067b34312b283189f909bde5/MPChartLib/src/main/java/com/github/mikephil/charting/charts/RadarChart.java as a reference,

  1. write your RoundRadarChart class to extend the RadarChart
  2. write your RoundRadarChartRenderer, YAxisRendererRoundRadarChart and XAxisRendererRoundRadarChart to extend the RadarChart ones, mainly you should to override the drawXXX functions
  3. use your new renderer classes in your chart class to replace the RadarChart renderers

You need to re-caculate the factory of drawing lines, points and labels

And about the Android-Charts project, you may have a look at https://github.com/limccn/Android-Charts/tree/master/src/src/cn/limc/androidcharts/view. Not sure if the RoundChart is what you want.

Post a Comment for "How To Make Mpandroidchart Radarchart Round"