Skip to content

Commit 40f2c6d

Browse files
committed
Minor changes.
1 parent 8cdae74 commit 40f2c6d

5 files changed

Lines changed: 23 additions & 28 deletions

File tree

MPChartExample/res/layout/activity_performance_linechart.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
4-
android:layout_height="match_parent">
4+
android:layout_height="match_parent"
5+
android:background="@android:color/white">
56

67
<com.github.mikephil.charting.charts.LineChart
78
android:id="@+id/chart1"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ protected void onCreate(Bundle savedInstanceState) {
6363
mChart = (LineChart) findViewById(R.id.chart1);
6464
mChart.setOnChartGestureListener(this);
6565
mChart.setOnChartValueSelectedListener(this);
66+
mChart.setDrawGridBackground(false);
6667

6768
// no description text
6869
mChart.setDescription("");

MPChartLib/src/com/github/mikephil/charting/listener/BarLineChartTouchListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ public void computeScroll() {
604604

605605
mDecelerationLastTime = currentTime;
606606

607-
if (Math.abs(mDecelerationVelocity.x) >= 0.001 || Math.abs(mDecelerationVelocity.y) >= 0.001)
607+
if (Math.abs(mDecelerationVelocity.x) >= 0.01 || Math.abs(mDecelerationVelocity.y) >= 0.01)
608608
Utils.postInvalidateOnAnimation(mChart); // This causes computeScroll to fire, recommended for this by Google
609609
else
610610
stopDeceleration();

MPChartLib/src/com/github/mikephil/charting/utils/ColorTemplate.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,6 @@ public class ColorTemplate {
4343
Color.rgb(140, 234, 255), Color.rgb(255, 140, 157)
4444
};
4545

46-
// public static final int[] FRESH_COLORS = {
47-
// R.color.fresh_1, R.color.fresh_2, R.color.fresh_3, R.color.fresh_4,
48-
// R.color.fresh_5
49-
// };
50-
// public static final int[] MONO_COLORS = {
51-
// R.color.mono_1, R.color.mono_2, R.color.mono_3, R.color.mono_4,
52-
// R.color.mono_5
53-
// };
54-
// public static final int[] GREEN_COLORS = {
55-
// R.color.greens_1, R.color.greens_2, R.color.greens_3, R.color.greens_4,
56-
// R.color.greens_5
57-
// };
58-
5946
/**
6047
* Returns the Android ICS holo blue light color.
6148
*

MPChartLib/src/com/github/mikephil/charting/utils/Utils.java

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,30 @@ public abstract class Utils {
3939
*
4040
* @param res
4141
*/
42+
@SuppressWarnings("deprecation")
4243
public static void init(Context context) {
4344

4445
if (context == null) {
45-
//noinspection deprecation
46+
// noinspection deprecation
4647
mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
47-
//noinspection deprecation
48+
// noinspection deprecation
4849
mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();
50+
51+
Log.e("MPAndroidChart, Utils.init(...)", "PROVIDED CONTEXT OBJECT IS NULL");
52+
4953
} else {
5054
ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
5155
mMinimumFlingVelocity = viewConfiguration.getScaledMinimumFlingVelocity();
5256
mMaximumFlingVelocity = viewConfiguration.getScaledMaximumFlingVelocity();
57+
58+
Resources res = context.getResources();
59+
mMetrics = res.getDisplayMetrics();
5360
}
54-
55-
Resources res = context.getResources();
56-
mMetrics = res.getDisplayMetrics();
5761
}
5862

5963
/**
60-
* initialize method, called inside the Chart.init() method.
61-
* backwards compatibility - to not break existing code
64+
* initialize method, called inside the Chart.init() method. backwards
65+
* compatibility - to not break existing code
6266
*
6367
* @param res
6468
*/
@@ -67,9 +71,9 @@ public static void init(Resources res) {
6771

6872
mMetrics = res.getDisplayMetrics();
6973

70-
//noinspection deprecation
74+
// noinspection deprecation
7175
mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
72-
//noinspection deprecation
76+
// noinspection deprecation
7377
mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();
7478
}
7579

@@ -471,7 +475,8 @@ public static PointF getPosition(PointF center, float dist, float angle) {
471475
return p;
472476
}
473477

474-
public static void velocityTrackerPointerUpCleanUpIfNecessary(MotionEvent ev, VelocityTracker tracker) {
478+
public static void velocityTrackerPointerUpCleanUpIfNecessary(MotionEvent ev,
479+
VelocityTracker tracker) {
475480

476481
// Check the dot product of current velocities.
477482
// If the pointer that left was opposing another velocity vector, clear.
@@ -481,7 +486,8 @@ public static void velocityTrackerPointerUpCleanUpIfNecessary(MotionEvent ev, Ve
481486
final float x1 = tracker.getXVelocity(id1);
482487
final float y1 = tracker.getYVelocity(id1);
483488
for (int i = 0, count = ev.getPointerCount(); i < count; i++) {
484-
if (i == upIndex) continue;
489+
if (i == upIndex)
490+
continue;
485491

486492
final int id2 = ev.getPointerId(i);
487493
final float x = x1 * tracker.getXVelocity(id2);
@@ -496,8 +502,8 @@ public static void velocityTrackerPointerUpCleanUpIfNecessary(MotionEvent ev, Ve
496502
}
497503

498504
/**
499-
* Original method view.postInvalidateOnAnimation() only supportd in API >= 16,
500-
* This is a replica of the code from ViewCompat.
505+
* Original method view.postInvalidateOnAnimation() only supportd in API >=
506+
* 16, This is a replica of the code from ViewCompat.
501507
*
502508
* @param view
503509
*/

0 commit comments

Comments
 (0)