问题
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 MPAndroidCharts. But MPCharts only supports angular RadarCharts by default.
I found the following Link in the Issues, but there is no Code given https://github.com/PhilJay/MPAndroidChart/issues/1446
Another Stack Overflow Entry I found is this, but I can't combine it with MPAndroid Charts Radar Chart for Android
At the Android Charts Library: https://github.com/limccn/Android-Charts rounded Charts are mentioned, but I can't find the according Class in Code
Is there already a solution to make MPAndroidCharts RadarCharts round, or any other Library that supports rounded RadarCharts. Thanks for Help
回答1:
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,
- write your
RoundRadarChart
class to extend theRadarChart
- write your
RoundRadarChartRenderer
,YAxisRendererRoundRadarChart
andXAxisRendererRoundRadarChart
to extend the RadarChart ones, mainly you should to override thedrawXXX
functions - 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.
回答2:
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:
来源:https://stackoverflow.com/questions/57698749/how-to-make-mpandroidchart-radarchart-round