Skip to content

Commit

Permalink
Fix PieChart values overlap
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesa2 committed Feb 28, 2023
1 parent c0ee877 commit 7e986b2
Show file tree
Hide file tree
Showing 4 changed files with 822 additions and 1 deletion.
2 changes: 2 additions & 0 deletions MPChartLib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'com.android.library'
id 'maven-publish'
id "com.vanniktech.maven.publish" version "0.24.0"
id 'org.jetbrains.kotlin.android'
}

ext {
Expand Down Expand Up @@ -39,6 +40,7 @@ android {

dependencies {
implementation 'androidx.annotation:annotation:1.6.0'
implementation 'androidx.core:core-ktx:1.9.0'
testImplementation 'junit:junit:4.13.2'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
package com.github.mikephil.charting.charts;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.util.AttributeSet;

import com.github.mikephil.charting.R;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.data.PieData;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.highlight.PieHighlighter;
import com.github.mikephil.charting.interfaces.datasets.IPieDataSet;
import com.github.mikephil.charting.renderer.PieChartRenderer;
import com.github.mikephil.charting.renderer.PieChartRendererFixCover;
import com.github.mikephil.charting.utils.MPPointF;
import com.github.mikephil.charting.utils.Utils;

Expand All @@ -26,6 +29,8 @@
*/
public class PieChart extends PieRadarChartBase<PieData> {

private String mode;

/**
* rect object that represents the bounds of the piechart, needed for
* drawing the circle
Expand Down Expand Up @@ -110,13 +115,24 @@ public PieChart(Context context, AttributeSet attrs) {

public PieChart(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
getAttrs(attrs);
}

private void getAttrs(AttributeSet attrs) {
if (attrs != null) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.PieChart);
mode = a.getString(R.styleable.PieChart_mp_chart_out_value_place_mode);
a.recycle();
}
((PieChartRendererFixCover) mRenderer).setMode(mode);
}


@Override
protected void init() {
super.init();

mRenderer = new PieChartRenderer(this, mAnimator, mViewPortHandler);
mRenderer = new PieChartRendererFixCover(this, mAnimator, mViewPortHandler);
mXAxis = null;

mHighlighter = new PieHighlighter(this);
Expand Down
Loading

0 comments on commit 7e986b2

Please sign in to comment.