More bugfixes.
diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivity1.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivity1.java
index b045e11..cea967a 100644
--- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivity1.java
+++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivity1.java
@@ -342,6 +342,7 @@
ll2.setTextSize(10f);
YAxis leftAxis = mChart.getAxisLeft();
+ leftAxis.removeAllLimitLines(); // reset all limit lines to avoid overlapping lines
leftAxis.addLimitLine(ll1);
leftAxis.addLimitLine(ll2);
leftAxis.setAxisMaxValue(220f);
diff --git a/MPChartLib/src/com/github/mikephil/charting/charts/BarLineChartBase.java b/MPChartLib/src/com/github/mikephil/charting/charts/BarLineChartBase.java
index d73faf2..a3f0295 100644
--- a/MPChartLib/src/com/github/mikephil/charting/charts/BarLineChartBase.java
+++ b/MPChartLib/src/com/github/mikephil/charting/charts/BarLineChartBase.java
@@ -223,7 +223,7 @@
// canvas.drawBitmap(mDrawBitmap, 0, 0, mDrawPaint);
- if (true) {
+ if (mLogEnabled) {
long drawtime = (System.currentTimeMillis() - starttime);
totalTime += drawtime;
drawCycles += 1;
diff --git a/MPChartLib/src/com/github/mikephil/charting/components/YAxis.java b/MPChartLib/src/com/github/mikephil/charting/components/YAxis.java
index 9d821f1..4b42765 100644
--- a/MPChartLib/src/com/github/mikephil/charting/components/YAxis.java
+++ b/MPChartLib/src/com/github/mikephil/charting/components/YAxis.java
@@ -2,6 +2,7 @@
package com.github.mikephil.charting.components;
import android.graphics.Paint;
+import android.util.Log;
import com.github.mikephil.charting.utils.DefaultValueFormatter;
import com.github.mikephil.charting.utils.Utils;
@@ -95,6 +96,12 @@
LEFT, RIGHT
}
+ public YAxis() {
+ super();
+ this.mAxisDependency = AxisDependency.LEFT;
+ this.mLimitLines = new ArrayList<LimitLine>();
+ }
+
public YAxis(AxisDependency position) {
super();
this.mAxisDependency = position;
@@ -230,6 +237,11 @@
*/
public void addLimitLine(LimitLine l) {
mLimitLines.add(l);
+
+ if (mLimitLines.size() > 6) {
+ Log.e("MPAndroiChart",
+ "Warning! You have more than 6 LimitLines on your axis, do you really want that?");
+ }
}
/**
@@ -245,7 +257,7 @@
* Removes all LimitLines from the axis.
*/
public void removeAllLimitLines() {
- mLimitLines = new ArrayList<LimitLine>();
+ mLimitLines.clear();
}
/**
diff --git a/MPChartLib/src/com/github/mikephil/charting/renderer/YAxisRenderer.java b/MPChartLib/src/com/github/mikephil/charting/renderer/YAxisRenderer.java
index a003878..a9e89e6 100644
--- a/MPChartLib/src/com/github/mikephil/charting/renderer/YAxisRenderer.java
+++ b/MPChartLib/src/com/github/mikephil/charting/renderer/YAxisRenderer.java
@@ -5,6 +5,7 @@
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Align;
+import android.graphics.Path;
import com.github.mikephil.charting.components.LimitLine;
import com.github.mikephil.charting.components.LimitLine.LimitLabelPosition;
@@ -272,11 +273,12 @@
return;
float[] pts = new float[4];
-
+ Path limitLinePath = new Path();
+
for (int i = 0; i < limitLines.size(); i++) {
LimitLine l = limitLines.get(i);
-
+
pts[1] = l.getLimit();
pts[3] = l.getLimit();
@@ -284,12 +286,17 @@
pts[0] = mViewPortHandler.contentLeft();
pts[2] = mViewPortHandler.contentRight();
+
+ limitLinePath.moveTo(pts[0], pts[1]);
+ limitLinePath.lineTo(pts[2], pts[3]);
mLimitLinePaint.setColor(l.getLineColor());
mLimitLinePaint.setPathEffect(l.getDashPathEffect());
mLimitLinePaint.setStrokeWidth(l.getLineWidth());
- c.drawLines(pts, mLimitLinePaint);
+ c.drawPath(limitLinePath, mLimitLinePaint);
+ limitLinePath.reset();
+// c.drawLines(pts, mLimitLinePaint);
String label = l.getLabel();