X Tutup
Skip to content

Commit ec7130a

Browse files
committed
Minor fixes.
1 parent 68964e8 commit ec7130a

File tree

5 files changed

+15
-172
lines changed

5 files changed

+15
-172
lines changed

MPChartExample/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.xxmassdeveloper.mpchartexample"
44
android:versionCode="35"
5-
android:versionName="2.0.5" >
5+
android:versionName="2.0.3" >
66

77
<uses-sdk
88
android:minSdkVersion="8"

MPChartExample/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ android {
77
minSdkVersion 16
88
targetSdkVersion 21
99
versionCode 35
10-
versionName '2.0.5'
10+
versionName '2.0.3'
1111

1212
sourceSets {
1313
main {
@@ -53,5 +53,5 @@ dependencies {
5353
//compile fileTree(dir: 'libs', include: ['*.jar'])
5454
compile project(':MPChartLib') // remove this if you only imported the example project
5555
compile 'com.android.support:appcompat-v7:21.0.3'
56-
//compile 'com.github.PhilJay:MPAndroidChart:v2.0.5'
56+
//compile 'com.github.PhilJay:MPAndroidChart:v2.0.3'
5757
}

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

Lines changed: 0 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,16 @@
33

44
import android.graphics.Color;
55
import android.os.Bundle;
6-
import android.util.Log;
7-
import android.view.Menu;
8-
import android.view.MenuItem;
96
import android.view.WindowManager;
107
import android.widget.SeekBar;
118
import android.widget.SeekBar.OnSeekBarChangeListener;
129
import android.widget.TextView;
13-
import android.widget.Toast;
1410

1511
import com.github.mikephil.charting.charts.LineChart;
1612
import com.github.mikephil.charting.components.Legend;
17-
import com.github.mikephil.charting.components.XAxis;
18-
import com.github.mikephil.charting.data.DataSet;
1913
import com.github.mikephil.charting.data.Entry;
2014
import com.github.mikephil.charting.data.LineData;
2115
import com.github.mikephil.charting.data.LineDataSet;
22-
import com.github.mikephil.charting.data.filter.Approximator;
23-
import com.github.mikephil.charting.data.filter.Approximator.ApproximatorType;
24-
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
25-
import com.github.mikephil.charting.utils.Highlight;
2616
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;
2717

2818
import java.util.ArrayList;
@@ -81,147 +71,6 @@ protected void onCreate(Bundle savedInstanceState) {
8171
mChart.invalidate();
8272
}
8373

84-
@Override
85-
public boolean onCreateOptionsMenu(Menu menu) {
86-
getMenuInflater().inflate(R.menu.line, menu);
87-
return true;
88-
}
89-
90-
@Override
91-
public boolean onOptionsItemSelected(MenuItem item) {
92-
93-
switch (item.getItemId()) {
94-
case R.id.actionToggleValues: {
95-
mChart.resetAverage();
96-
break;
97-
}
98-
case R.id.actionToggleHighlight: {
99-
if (mChart.isHighlightEnabled())
100-
mChart.setHighlightEnabled(false);
101-
else
102-
mChart.setHighlightEnabled(true);
103-
mChart.invalidate();
104-
break;
105-
}
106-
case R.id.actionToggleFilled: {
107-
108-
ArrayList<LineDataSet> sets = (ArrayList<LineDataSet>) mChart.getData()
109-
.getDataSets();
110-
111-
for (LineDataSet set : sets) {
112-
if (set.isDrawFilledEnabled())
113-
set.setDrawFilled(false);
114-
else
115-
set.setDrawFilled(true);
116-
}
117-
mChart.invalidate();
118-
break;
119-
}
120-
case R.id.actionToggleCircles: {
121-
ArrayList<LineDataSet> sets = (ArrayList<LineDataSet>) mChart.getData()
122-
.getDataSets();
123-
124-
for (LineDataSet set : sets) {
125-
if (set.isDrawCirclesEnabled())
126-
set.setDrawCircles(false);
127-
else
128-
set.setDrawCircles(true);
129-
}
130-
mChart.invalidate();
131-
break;
132-
}
133-
case R.id.actionToggleCubic: {
134-
ArrayList<LineDataSet> sets = (ArrayList<LineDataSet>) mChart.getData()
135-
.getDataSets();
136-
137-
for (LineDataSet set : sets) {
138-
if (set.isDrawCubicEnabled())
139-
set.setDrawCubic(false);
140-
else
141-
set.setDrawCubic(true);
142-
}
143-
mChart.invalidate();
144-
break;
145-
}
146-
case R.id.actionToggleStartzero: {
147-
mChart.getAxisLeft().setStartAtZero(!mChart.getAxisLeft().isStartAtZeroEnabled());
148-
mChart.getAxisRight().setStartAtZero(!mChart.getAxisRight().isStartAtZeroEnabled());
149-
mChart.invalidate();
150-
break;
151-
}
152-
case R.id.actionTogglePinch: {
153-
if (mChart.isPinchZoomEnabled())
154-
mChart.setPinchZoom(false);
155-
else
156-
mChart.setPinchZoom(true);
157-
158-
mChart.invalidate();
159-
break;
160-
}
161-
case R.id.animateX: {
162-
mChart.animateX(3000);
163-
break;
164-
}
165-
case R.id.animateY: {
166-
mChart.animateY(3000);
167-
break;
168-
}
169-
case R.id.animateXY: {
170-
mChart.animateXY(3000, 3000);
171-
break;
172-
}
173-
case R.id.actionToggleAdjustXLegend: {
174-
XAxis xLabels = mChart.getXAxis();
175-
176-
if (xLabels.isAdjustXLabelsEnabled())
177-
xLabels.setAdjustXLabels(false);
178-
else
179-
xLabels.setAdjustXLabels(true);
180-
181-
mChart.invalidate();
182-
break;
183-
}
184-
case R.id.actionToggleFilter: {
185-
186-
// the angle of filtering is 35°
187-
Approximator a = new Approximator(ApproximatorType.DOUGLAS_PEUCKER, 35);
188-
189-
if (!mChart.isFilteringEnabled()) {
190-
mChart.enableFiltering(a);
191-
} else {
192-
mChart.disableFiltering();
193-
}
194-
mChart.invalidate();
195-
196-
//
197-
// for(int i = 0; i < 10; i++) {
198-
// mChart.addEntry(new Entry((float) (Math.random() * 100),
199-
// i+2), 0);
200-
// mChart.invalidate();
201-
// }
202-
//
203-
// Toast.makeText(getApplicationContext(), "valcount: " +
204-
// mChart.getDataOriginal().getYValCount() + ", valsum: " +
205-
// mChart.getDataOriginal().getYValueSum(),
206-
// Toast.LENGTH_SHORT).show();
207-
//
208-
break;
209-
}
210-
case R.id.actionSave: {
211-
if (mChart.saveToPath("title" + System.currentTimeMillis(), "")) {
212-
Toast.makeText(getApplicationContext(), "Saving SUCCESSFUL!",
213-
Toast.LENGTH_SHORT).show();
214-
} else
215-
Toast.makeText(getApplicationContext(), "Saving FAILED!", Toast.LENGTH_SHORT)
216-
.show();
217-
218-
// mChart.saveToGallery("title"+System.currentTimeMillis())
219-
break;
220-
}
221-
}
222-
return true;
223-
}
224-
22574
@Override
22675
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
22776

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

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -217,21 +217,10 @@ protected void onDraw(Canvas canvas) {
217217

218218
canvas.drawBitmap(mDrawBitmap, 0, 0, mDrawPaint);
219219

220-
// if (mLogEnabled)
221-
222-
long drawtime = (System.currentTimeMillis() - starttime);
223-
draws++;
224-
totaltime+=drawtime;
225-
long average = totaltime / draws;
226-
Log.i(LOG_TAG, "DrawTime: " + drawtime + " ms, average: " + average + " ms");
227-
}
228-
229-
long draws = 0;
230-
long totaltime = 0;
231-
232-
public void resetAverage() {
233-
draws = 0;
234-
totaltime = 0;
220+
if (mLogEnabled) {
221+
long drawtime = (System.currentTimeMillis() - starttime);
222+
Log.i(LOG_TAG, "DrawTime: " + drawtime + " ms");
223+
}
235224
}
236225

237226
protected void prepareValuePxMatrix() {
@@ -620,11 +609,11 @@ public void setViewPortOffsets(final float left, final float top,
620609
final float right, final float bottom) {
621610

622611
mCustomViewPortEnabled = true;
623-
612+
624613
post(new Runnable() {
625-
614+
626615
@Override
627-
public void run() {
616+
public void run() {
628617
mViewPortHandler.restrainViewPort(left, top, right, bottom);
629618
}
630619
});

MPChartLib/src/com/github/mikephil/charting/data/LineData.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

44
import java.util.ArrayList;
55

6+
/**
7+
* Data object that encapsulates all data associated with a LineChart.
8+
*
9+
* @author Philipp Jahoda
10+
*/
611
public class LineData extends BarLineScatterCandleData<LineDataSet> {
712

813
public LineData() {

0 commit comments

Comments
 (0)
X Tutup