Update gradle, fixed issue #284.
diff --git a/MPChartExample/AndroidManifest.xml b/MPChartExample/AndroidManifest.xml
index c152c2e..3ee2b9e 100644
--- a/MPChartExample/AndroidManifest.xml
+++ b/MPChartExample/AndroidManifest.xml
@@ -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="35"
- android:versionName="2.0.3" >
+ android:versionCode="36"
+ android:versionName="2.1.2" >
<uses-sdk
android:minSdkVersion="8"
diff --git a/MPChartExample/build.gradle b/MPChartExample/build.gradle
index ea64bd5..b632b14 100644
--- a/MPChartExample/build.gradle
+++ b/MPChartExample/build.gradle
@@ -6,8 +6,8 @@
defaultConfig {
minSdkVersion 16
targetSdkVersion 21
- versionCode 35
- versionName '2.0.3'
+ versionCode 36
+ versionName '2.1.1'
sourceSets {
main {
@@ -53,5 +53,5 @@
//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.3'
+ //compile 'com.github.PhilJay:MPAndroidChart:v2.1.1'
}
diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CubicLineChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CubicLineChartActivity.java
index 3d1e10f..026d455 100644
--- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CubicLineChartActivity.java
+++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CubicLineChartActivity.java
@@ -21,6 +21,7 @@
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.data.filter.Approximator;
import com.github.mikephil.charting.data.filter.Approximator.ApproximatorType;
+import com.github.mikephil.charting.utils.ColorTemplate;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
import java.util.ArrayList;
@@ -81,7 +82,8 @@
YAxis y = mChart.getAxisLeft();
y.setTypeface(tf);
y.setLabelCount(5);
- y.setDrawGridLines(false);
+
+ mChart.getAxisRight().setEnabled(false);
// add data
setData(45, 100);
@@ -270,18 +272,16 @@
LineDataSet set1 = new LineDataSet(vals1, "DataSet 1");
set1.setDrawCubic(true);
set1.setCubicIntensity(0.2f);
- set1.setDrawFilled(true);
+ //set1.setDrawFilled(true);
set1.setDrawCircles(false);
set1.setLineWidth(2f);
set1.setCircleSize(5f);
set1.setHighLightColor(Color.rgb(244, 117, 117));
set1.setColor(Color.rgb(104, 241, 175));
-
- ArrayList<LineDataSet> dataSets = new ArrayList<LineDataSet>();
- dataSets.add(set1);
+ set1.setFillColor(ColorTemplate.getHoloBlue());
// create a data object with the datasets
- LineData data = new LineData(xVals, dataSets);
+ LineData data = new LineData(xVals, set1);
data.setValueTypeface(tf);
data.setValueTextSize(9f);
data.setDrawValues(false);
diff --git a/MPChartLib/src/com/github/mikephil/charting/charts/Chart.java b/MPChartLib/src/com/github/mikephil/charting/charts/Chart.java
index eff8b13..650916f 100644
--- a/MPChartLib/src/com/github/mikephil/charting/charts/Chart.java
+++ b/MPChartLib/src/com/github/mikephil/charting/charts/Chart.java
@@ -62,7 +62,7 @@
public static final String LOG_TAG = "MPAndroidChart";
/** flag that indicates if logging is enabled or not */
- protected boolean mLogEnabled = false;
+ protected boolean mLogEnabled = true;
/**
* object that holds all data that was originally set for the chart, before
diff --git a/MPChartLib/src/com/github/mikephil/charting/renderer/LineChartRenderer.java b/MPChartLib/src/com/github/mikephil/charting/renderer/LineChartRenderer.java
index 299deb8..ab5fb32 100644
--- a/MPChartLib/src/com/github/mikephil/charting/renderer/LineChartRenderer.java
+++ b/MPChartLib/src/com/github/mikephil/charting/renderer/LineChartRenderer.java
@@ -96,10 +96,6 @@
float phaseX = mAnimator.getPhaseX();
float phaseY = mAnimator.getPhaseY();
- // get the color that is specified for this position from the
- // DataSet
- mRenderPaint.setColor(dataSet.getColor());
-
float intensity = dataSet.getCubicIntensity();
// the path for the cubic-spline
@@ -145,20 +141,26 @@
}
}
}
-
+
// if filled is enabled, close the path
if (dataSet.isDrawFilledEnabled()) {
- drawCubicFill(dataSet, spline);
- } else {
- mRenderPaint.setStyle(Paint.Style.STROKE);
- }
-
+
+ // create a new path, this is bad for performance
+ drawCubicFill(c, dataSet, new Path(spline), trans);
+ }
+
+ mRenderPaint.setColor(dataSet.getColor());
+
+ mRenderPaint.setStyle(Paint.Style.STROKE);
+
trans.pathValueToPixel(spline);
c.drawPath(spline, mRenderPaint);
+
+ mRenderPaint.setPathEffect(null);
}
- protected void drawCubicFill(LineDataSet dataSet, Path spline) {
+ protected void drawCubicFill(Canvas c, LineDataSet dataSet, Path spline, Transformer trans) {
float fillMin = mChart.getFillFormatter()
.getFillLinePosition(dataSet, mChart.getLineData(), mChart.getYChartMax(),
@@ -169,6 +171,15 @@
spline.close();
mRenderPaint.setStyle(Paint.Style.FILL);
+
+ mRenderPaint.setColor(dataSet.getFillColor());
+ // filled is drawn with less alpha
+ mRenderPaint.setAlpha(dataSet.getFillAlpha());
+
+ trans.pathValueToPixel(spline);
+ c.drawPath(spline, mRenderPaint);
+
+ mRenderPaint.setAlpha(255);
}
protected void drawLinear(Canvas c, LineDataSet dataSet, ArrayList<Entry> entries) {
@@ -225,10 +236,6 @@
protected void drawLinearFill(Canvas c, LineDataSet dataSet, ArrayList<Entry> entries,
Transformer trans) {
- // mDrawCanvas.drawVertices(VertexMode.TRIANGLE_STRIP,
- // valuePoints.length, valuePoints, 0,
- // null, 0, null, 0, null, 0, 0, paint);
-
mRenderPaint.setStyle(Paint.Style.FILL);
mRenderPaint.setColor(dataSet.getFillColor());