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

Fix PieChart values overlap #109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MPChartLib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
id 'maven-publish'
id 'kotlin-android'
id "com.vanniktech.maven.publish" version "0.29.0"
id 'org.jetbrains.kotlin.android'
}

ext {
Expand Down Expand Up @@ -47,6 +48,7 @@ android {

dependencies {
implementation 'androidx.annotation:annotation:1.8.1'
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,20 +2,23 @@
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.text.TextUtils;
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.data.PieEntry;
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 @@ -29,6 +32,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 @@ -113,13 +118,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
Loading