Skip to content

Commit 43fa1e6

Browse files
committed
Merge #1947
1 parent 40c5c87 commit 43fa1e6

27 files changed

+191
-333
lines changed

MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivity2.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ protected void onCreate(Bundle savedInstanceState) {
5858

5959
mChart = (LineChart) findViewById(R.id.chart1);
6060
mChart.setOnChartValueSelectedListener(this);
61+
mChart.setLogEnabled(true);
6162

6263
// no description text
6364
mChart.setDescription("");

MPChartLib/src/main/java/com/github/mikephil/charting/charts/BarChart.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ public Highlight getHighlightByTouchPoint(float x, float y) {
105105
*/
106106
public RectF getBarBounds(BarEntry e) {
107107

108-
109108
RectF bounds = new RectF();
110109
getBarBounds(e, bounds);
111110

@@ -143,7 +142,6 @@ public void getBarBounds(BarEntry e, RectF outputRect){
143142
bounds.set(left, top, right, bottom);
144143

145144
getTransformer(set.getAxisDependency()).rectValueToPixel(outputRect);
146-
147145
}
148146

149147
/**

MPChartLib/src/main/java/com/github/mikephil/charting/charts/BarLineChartBase.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,7 +1280,9 @@ public IBarLineScatterCandleBubbleDataSet getDataSetByTouchPoint(float x, float
12801280
return null;
12811281
}
12821282

1283+
/** buffer for storing lowest visible x point */
12831284
protected PointD posForGetLowestVisibleX = PointD.getInstance(0,0);
1285+
12841286
/**
12851287
* Returns the lowest x-index (value on the x-axis) that is still visible on
12861288
* the chart.
@@ -1295,7 +1297,9 @@ public float getLowestVisibleX() {
12951297
return result;
12961298
}
12971299

1300+
/** buffer for storing highest visible x point */
12981301
protected PointD posForGetHighestVisibleX = PointD.getInstance(0,0);
1302+
12991303
/**
13001304
* Returns the highest x-index (value on the x-axis) that is still visible
13011305
* on the chart.

MPChartLib/src/main/java/com/github/mikephil/charting/charts/Chart.java

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import android.graphics.Color;
1313
import android.graphics.Paint;
1414
import android.graphics.Paint.Align;
15-
import android.graphics.PointF;
1615
import android.graphics.RectF;
1716
import android.graphics.Typeface;
1817
import android.graphics.drawable.Drawable;
@@ -1429,50 +1428,6 @@ public void setDrawMarkerViews(boolean enabled) {
14291428
mDrawMarkerViews = enabled;
14301429
}
14311430

1432-
/**
1433-
* Get all Entry objects at the given index across all DataSets.
1434-
* INFORMATION: This method does calculations at runtime. Do not over-use in
1435-
* performance critical situations.
1436-
*
1437-
* @param xIndex
1438-
* @return
1439-
*/
1440-
public List<Entry> getEntriesAtIndex(int xIndex) {
1441-
1442-
List<Entry> vals = new ArrayList<Entry>();
1443-
1444-
for (int i = 0; i < mData.getDataSetCount(); i++) {
1445-
1446-
IDataSet set = mData.getDataSetByIndex(i);
1447-
1448-
Entry e = set.getEntryForXPos(xIndex);
1449-
1450-
if (e != null) {
1451-
vals.add(e);
1452-
}
1453-
}
1454-
1455-
return vals;
1456-
}
1457-
1458-
public void getEntriesAtIndex(int xIndex, List<Entry> entriesOutput){
1459-
1460-
List<Entry> vals = entriesOutput;
1461-
vals.clear();
1462-
1463-
for (int i = 0; i < mData.getDataSetCount(); i++) {
1464-
1465-
IDataSet set = mData.getDataSetByIndex(i);
1466-
1467-
Entry e = set.getEntryForXPos(xIndex);
1468-
1469-
if (e != null) {
1470-
vals.add(e);
1471-
}
1472-
}
1473-
1474-
}
1475-
14761431
/**
14771432
* Returns the ChartData object that has been set for the chart.
14781433
*

MPChartLib/src/main/java/com/github/mikephil/charting/charts/HorizontalBarChart.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.github.mikephil.charting.charts;
22

33
import android.content.Context;
4-
import android.graphics.PointF;
54
import android.graphics.RectF;
65
import android.util.AttributeSet;
76
import android.util.Log;
@@ -18,7 +17,6 @@
1817
import com.github.mikephil.charting.renderer.YAxisRendererHorizontalBarChart;
1918
import com.github.mikephil.charting.utils.HorizontalViewPortHandler;
2019
import com.github.mikephil.charting.utils.MPPointF;
21-
import com.github.mikephil.charting.utils.PointD;
2220
import com.github.mikephil.charting.utils.TransformerHorizontalBarChart;
2321
import com.github.mikephil.charting.utils.Utils;
2422

@@ -209,7 +207,6 @@ public Highlight getHighlightByTouchPoint(float x, float y) {
209207
return getHighlighter().getHighlight(y, x); // switch x and y
210208
}
211209

212-
protected PointD posForGetLowestVisibleX = PointD.getInstance(0,0);
213210
@Override
214211
public float getLowestVisibleX() {
215212
getTransformer(AxisDependency.LEFT).getValuesByTouchPoint(mViewPortHandler.contentLeft(),
@@ -218,7 +215,6 @@ public float getLowestVisibleX() {
218215
return result;
219216
}
220217

221-
protected PointD posForGetHighestVisibleX = PointD.getInstance(0,0);
222218
@Override
223219
public float getHighestVisibleX() {
224220
getTransformer(AxisDependency.LEFT).getValuesByTouchPoint(mViewPortHandler.contentLeft(),

MPChartLib/src/main/java/com/github/mikephil/charting/data/BarDataSet.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,10 @@ public BarDataSet(List<BarEntry> yVals, String label) {
5151
calcEntryCountIncludingStacks(yVals);
5252
}
5353

54-
protected List<BarEntry> barEntriesForCopy = new ArrayList<>();
5554
@Override
5655
public DataSet<BarEntry> copy() {
5756

58-
List<BarEntry> yVals = barEntriesForCopy;
57+
List<BarEntry> yVals = new ArrayList<BarEntry>();
5958
yVals.clear();
6059

6160
for (int i = 0; i < mValues.size(); i++) {

MPChartLib/src/main/java/com/github/mikephil/charting/data/BaseDataSet.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,12 @@ public void setColors(int[] colors, Context c) {
169169
if(mColors == null){
170170
mColors = new ArrayList<>();
171171
}
172-
List<Integer> clrs = mColors;
173-
clrs.clear();
172+
173+
mColors.clear();
174174

175175
for (int color : colors) {
176-
clrs.add(c.getResources().getColor(color));
176+
mColors.add(c.getResources().getColor(color));
177177
}
178-
179-
mColors = clrs;
180178
}
181179

182180
/**

MPChartLib/src/main/java/com/github/mikephil/charting/data/BubbleData.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import com.github.mikephil.charting.interfaces.datasets.IBubbleDataSet;
55

6-
import java.util.ArrayList;
76
import java.util.List;
87

98
public class BubbleData extends BarLineScatterCandleBubbleData<IBubbleDataSet> {
@@ -28,11 +27,8 @@ public BubbleData(List<IBubbleDataSet> dataSets) {
2827
* @param width
2928
*/
3029
public void setHighlightCircleWidth(float width) {
31-
IBubbleDataSet set;
32-
final int setCount = mDataSets.size();
33-
for(int i = 0 ; i < setCount ; i++){
34-
set = mDataSets.get(i);
35-
set.setHighlightCircleWidth(width);
30+
for(int i = 0 ; i < mDataSets.size() ; i++){
31+
mDataSets.get(i).setHighlightCircleWidth(width);
3632
}
3733
}
3834
}

MPChartLib/src/main/java/com/github/mikephil/charting/data/BubbleDataSet.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,10 @@ public void calcMinMax() {
5151
}
5252
}
5353

54-
protected ArrayList<BubbleEntry> bubbleEntriesForCopy = new ArrayList<>();
5554
@Override
5655
public DataSet<BubbleEntry> copy() {
5756

58-
List<BubbleEntry> yVals = bubbleEntriesForCopy;
59-
yVals.clear();
57+
List<BubbleEntry> yVals = new ArrayList<BubbleEntry>();
6058

6159
for (int i = 0; i < mValues.size(); i++) {
6260
yVals.add(mValues.get(i).copy());

MPChartLib/src/main/java/com/github/mikephil/charting/data/CandleDataSet.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,14 @@ public CandleDataSet(List<CandleEntry> yVals, String label) {
7777
super(yVals, label);
7878
}
7979

80-
protected ArrayList<CandleEntry> candleEntriesForCopy = new ArrayList<>();
8180
@Override
8281
public DataSet<CandleEntry> copy() {
8382

84-
List<CandleEntry> yVals = candleEntriesForCopy;
83+
List<CandleEntry> yVals = new ArrayList<CandleEntry>();
8584
yVals.clear();
8685

8786
for (int i = 0; i < mValues.size(); i++) {
88-
yVals.add(((CandleEntry) mValues.get(i)).copy());
87+
yVals.add(mValues.get(i).copy());
8988
}
9089

9190
CandleDataSet copied = new CandleDataSet(yVals, getLabel());

0 commit comments

Comments
 (0)