Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Conflicts:
	MPChartLib/src/com/github/mikephil/charting/renderer/LineChartRenderer.java
	MPChartLib/src/com/github/mikephil/charting/renderer/PieChartRenderer.java
  • Loading branch information
dexterbg committed Apr 12, 2015
2 parents 1b35193 + aa7cbce commit 9531ba6
Show file tree
Hide file tree
Showing 21 changed files with 1,124 additions and 863 deletions.
6 changes: 3 additions & 3 deletions MPChartExample/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxmassdeveloper.mpchartexample"
android:versionCode="38"
android:versionName="2.0.8" >
android:versionCode="40"
android:versionName="2.1.0" >

<uses-sdk
android:minSdkVersion="8"
Expand All @@ -24,7 +24,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="LineChartActivity1"></activity>
<activity android:name="LineChartActivity1"></activity> <!-- android:configChanges="keyboardHidden|orientation|screenSize" -->
<activity android:name="LineChartActivity2"></activity>
<activity android:screenOrientation="landscape" android:name="MultipleChartsActivity"></activity>
<activity android:name="BarChartActivity"></activity>
Expand Down
6 changes: 3 additions & 3 deletions MPChartExample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 21
versionCode 38
versionName '2.0.8'
versionCode 40
versionName '2.1.0'

sourceSets {
main {
Expand Down Expand Up @@ -53,5 +53,5 @@ dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':MPChartLib') // remove this if you only imported the example project
compile 'com.android.support:appcompat-v7:21.0.3'
//compile 'com.github.PhilJay:MPAndroidChart:v2.0.8'
//compile 'com.github.PhilJay:MPAndroidChart:v2.0.9'
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import android.widget.TextView;
import android.widget.Toast;

import com.github.mikephil.charting.animation.Easing;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.Legend.LegendForm;
Expand Down Expand Up @@ -140,7 +141,8 @@ protected void onCreate(Bundle savedInstanceState) {
// mChart.setVisibleYRange(20f, AxisDependency.LEFT);
// mChart.centerViewTo(20, 50, AxisDependency.LEFT);

mChart.animateX(2500);
mChart.animateX(2500, Easing.EasingOption.EaseInOutQuart);
// mChart.invalidate();

// get the legend (only possible after setting data)
Legend l = mChart.getLegend();
Expand Down Expand Up @@ -243,7 +245,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
break;
}
case R.id.animateY: {
mChart.animateY(3000);
mChart.animateY(3000, Easing.EasingOption.EaseInCubic);
break;
}
case R.id.animateXY: {
Expand Down Expand Up @@ -359,6 +361,7 @@ private void setData(int count, float range) {
set1.setValueTextSize(9f);
set1.setFillAlpha(65);
set1.setFillColor(Color.BLACK);
// set1.setDrawFilled(true);
// set1.setShader(new LinearGradient(0, 0, 0, mChart.getHeight(),
// Color.BLACK, Color.WHITE, Shader.TileMode.MIRROR));

Expand All @@ -371,7 +374,7 @@ private void setData(int count, float range) {
// set data
mChart.setData(data);
}

@Override
public void onChartLongPressed(MotionEvent me) {
Log.i("LongPress", "Chart longpressed.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.github.mikephil.charting.animation.Easing;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.XAxis.XAxisPosition;
Expand Down Expand Up @@ -110,7 +111,7 @@ public View getView(int position, View convertView, ViewGroup parent) {

// do not forget to refresh the chart
// holder.chart.invalidate();
holder.chart.animateY(700);
holder.chart.animateY(700, Easing.EasingOption.EaseInCubic);

return convertView;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;

import com.github.mikephil.charting.animation.Easing;
import com.github.mikephil.charting.charts.PieChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.Legend.LegendPosition;
Expand All @@ -20,7 +21,6 @@
import com.github.mikephil.charting.data.PieData;
import com.github.mikephil.charting.data.PieDataSet;
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
import com.github.mikephil.charting.animation.AnimationEasing;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.mikephil.charting.utils.Highlight;
import com.github.mikephil.charting.utils.PercentFormatter;
Expand Down Expand Up @@ -57,22 +57,21 @@ protected void onCreate(Bundle savedInstanceState) {

mChart = (PieChart) findViewById(R.id.chart1);
mChart.setUsePercentValues(true);

// change the color of the center-hole
// mChart.setHoleColor(Color.rgb(235, 235, 235));
mChart.setHoleColorTransparent(true);
mChart.setDescription("");

tf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");

mChart.setCenterTextTypeface(Typeface.createFromAsset(getAssets(), "OpenSans-Light.ttf"));

mChart.setHoleRadius(60f);

mChart.setDescription("");

mChart.setDrawCenterText(true);

mChart.setDrawHoleEnabled(true);
mChart.setHoleColorTransparent(true);

mChart.setTransparentCircleColor(Color.WHITE);

mChart.setHoleRadius(58f);
mChart.setTransparentCircleRadius(61f);

mChart.setDrawCenterText(true);

mChart.setRotationAngle(0);
// enable rotation of the chart by touch
Expand All @@ -83,13 +82,12 @@ protected void onCreate(Bundle savedInstanceState) {

// add a selection listener
mChart.setOnChartValueSelectedListener(this);
// mChart.setTouchEnabled(false);

mChart.setCenterText("MPAndroidChart\nby Philipp Jahoda");

setData(3, 100);

mChart.animateXY(1500, 1500, AnimationEasing.EasingOption.EaseOutBack);
mChart.animateY(1500, Easing.EasingOption.EaseInOutQuad);
// mChart.spin(2000, 0, 360);

Legend l = mChart.getLegend();
Expand Down Expand Up @@ -191,6 +189,7 @@ private void setData(int count, float range) {

PieDataSet dataSet = new PieDataSet(yVals1, "Election Results");
dataSet.setSliceSpace(3f);
dataSet.setSelectionShift(5f);

// add a lot of colors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.view.WindowManager;
import android.widget.Toast;

import com.github.mikephil.charting.animation.Easing;
import com.github.mikephil.charting.charts.RadarChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.Legend.LegendPosition;
Expand Down Expand Up @@ -139,7 +140,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
break;
}
case R.id.actionToggleSpin: {
mChart.spin(2000, mChart.getRotationAngle(), mChart.getRotationAngle() + 360);
mChart.spin(2000, mChart.getRotationAngle(), mChart.getRotationAngle() + 360, Easing.EasingOption.EaseInCubic);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

package com.xxmassdeveloper.mpchartexample.custom;

import com.github.mikephil.charting.animation.AnimationEasing.EasingFunction;
import com.github.mikephil.charting.animation.EasingFunction;

/**
* Example of a custom made animation EasingFunction.
Expand All @@ -11,10 +11,8 @@
public class MyEasingFunction implements EasingFunction {

@Override
public float ease(long elapsed, long duration) {

public float getInterpolation(float input) {
// do awesome stuff here, this is just linear easing
return elapsed / (float) duration;
return input;
}

}

0 comments on commit 9531ba6

Please sign in to comment.