Skip to content

Commit

Permalink
Merge pull request #4 from PhilJay/master
Browse files Browse the repository at this point in the history
pull changes from master branch
  • Loading branch information
simplaapliko committed Nov 14, 2015
2 parents aa50a4b + 7d385a2 commit 83a2abb
Show file tree
Hide file tree
Showing 54 changed files with 817 additions and 460 deletions.
4 changes: 2 additions & 2 deletions MPChartExample/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -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="44"
android:versionName="2.1.3" >
android:versionCode="46"
android:versionName="2.1.6" >

<uses-sdk
android:minSdkVersion="8"
Expand Down
4 changes: 2 additions & 2 deletions MPChartExample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 23
versionCode 44
versionName '2.1.3'
versionCode 46
versionName '2.1.6'

sourceSets {
main {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ public boolean onOptionsItemSelected(MenuItem item) {
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();

if(mChart.getData() != null) {
mChart.getData().setHighlightEnabled(!mChart.getData().isHighlightEnabled());
mChart.invalidate();
}
break;
}
case R.id.actionTogglePinch: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ protected void onCreate(Bundle savedInstanceState) {
// scaling can now only be done on x- and y-axis separately
mChart.setPinchZoom(false);

// draw shadows for each bar that show the maximum value
// mChart.setDrawBarShadow(true);

// mChart.setDrawXLabels(false);

mChart.setDrawGridBackground(false);
// mChart.setDrawYLabels(false);

Expand Down Expand Up @@ -149,11 +144,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
if(mChart.getData() != null) {
mChart.getData().setHighlightEnabled(!mChart.getData().isHighlightEnabled());
mChart.invalidate();
}
break;
}
case R.id.actionTogglePinch: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
if(mChart.getData() != null) {
mChart.getData().setHighlightEnabled(!mChart.getData().isHighlightEnabled());
mChart.invalidate();
}
break;
}
case R.id.actionToggleHighlightArrow: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
if(mChart.getData() != null) {
mChart.getData().setHighlightEnabled(!mChart.getData().isHighlightEnabled());
mChart.invalidate();
}
break;
}
case R.id.actionTogglePinch: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ protected void onCreate(Bundle savedInstanceState) {
mChart.setDrawGridBackground(false);

mChart.setTouchEnabled(true);
mChart.setHighlightEnabled(true);

// enable scaling and dragging
mChart.setDragEnabled(true);
Expand Down Expand Up @@ -116,11 +115,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
if(mChart.getData() != null) {
mChart.getData().setHighlightEnabled(!mChart.getData().isHighlightEnabled());
mChart.invalidate();
}
break;
}
case R.id.actionTogglePinch: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,10 @@ public boolean onOptionsItemSelected(MenuItem item) {

switch (item.getItemId()) {
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
if(mChart.getData() != null) {
mChart.getData().setHighlightEnabled(!mChart.getData().isHighlightEnabled());
mChart.invalidate();
}
break;
}
case R.id.actionTogglePinch: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
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.formatter.FillFormatter;
import com.github.mikephil.charting.interfaces.LineDataProvider;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase;

Expand Down Expand Up @@ -54,14 +56,12 @@ protected void onCreate(Bundle savedInstanceState) {
mSeekBarX.setOnSeekBarChangeListener(this);

mChart = (LineChart) findViewById(R.id.chart1);
// if enabled, the chart will always start at zero on the y-axis
mChart.setViewPortOffsets(0, 20, 0, 0);
mChart.setBackgroundColor(Color.rgb(104, 241, 175));

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

// enable value highlighting
mChart.setHighlightEnabled(true);

// enable touch gestures
mChart.setTouchEnabled(true);

Expand All @@ -77,13 +77,16 @@ protected void onCreate(Bundle savedInstanceState) {
tf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");

XAxis x = mChart.getXAxis();
x.setTypeface(tf);
x.setEnabled(false);

YAxis y = mChart.getAxisLeft();
y.setTypeface(tf);
y.setLabelCount(5, false);
y.setEnabled(false);
y.setLabelCount(6, false);
y.setStartAtZero(false);
y.setTextColor(Color.WHITE);
y.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
y.setDrawGridLines(false);
y.setAxisLineColor(Color.WHITE);

mChart.getAxisRight().setEnabled(false);

Expand Down Expand Up @@ -116,11 +119,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
if(mChart.getData() != null) {
mChart.getData().setHighlightEnabled(!mChart.getData().isHighlightEnabled());
mChart.invalidate();
}
break;
}
case R.id.actionToggleFilled: {
Expand Down Expand Up @@ -270,12 +272,20 @@ private void setData(int count, float range) {
set1.setCubicIntensity(0.2f);
//set1.setDrawFilled(true);
set1.setDrawCircles(false);
set1.setLineWidth(2f);
set1.setCircleSize(5f);
set1.setLineWidth(1.8f);
set1.setCircleSize(4f);
set1.setCircleColor(Color.WHITE);
set1.setHighLightColor(Color.rgb(244, 117, 117));
set1.setColor(Color.rgb(104, 241, 175));
set1.setFillColor(ColorTemplate.getHoloBlue());
set1.setColor(Color.WHITE);
set1.setFillColor(Color.WHITE);
set1.setFillAlpha(100);
set1.setDrawHorizontalHighlightIndicator(false);
set1.setFillFormatter(new FillFormatter() {
@Override
public float getFillLinePosition(LineDataSet dataSet, LineDataProvider dataProvider) {
return -10;
}
});

// create a data object with the datasets
LineData data = new LineData(xVals, set1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ protected void onCreate(Bundle savedInstanceState) {
mChart.setOnChartValueSelectedListener(this);
mChart.setOnDrawListener(this);

// enable drawing with the finger
// mChart.setDrawingEnabled(true);

// mChart.setLineWidth(5f);
// mChart.setCircleSize(5f);

mChart.setHighlightEnabled(true);

// if disabled, drawn datasets with the finger will not be automatically
// finished
// mChart.setAutoFinish(true);
Expand Down Expand Up @@ -119,11 +111,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
if(mChart.getData() != null) {
mChart.getData().setHighlightEnabled(!mChart.getData().isHighlightEnabled());
mChart.invalidate();
}
break;
}
case R.id.actionToggleStartzero: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
if(mChart.getData() != null) {
mChart.getData().setHighlightEnabled(!mChart.getData().isHighlightEnabled());
mChart.invalidate();
}
break;
}
case R.id.actionTogglePinch: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ protected void onCreate(Bundle savedInstanceState) {
// no description text
mChart.setDescription("");

// enable value highlighting
mChart.setHighlightEnabled(true);

// enable touch gestures
mChart.setTouchEnabled(true);

Expand All @@ -84,10 +81,6 @@ protected void onCreate(Bundle savedInstanceState) {

// set the marker to the chart
mChart.setMarkerView(mv);

// enable/disable highlight indicators (the lines that indicate the
// highlighted Entry)
mChart.setHighlightEnabled(false);

XAxis xl = mChart.getXAxis();
xl.setAvoidFirstLastClipping(true);
Expand Down Expand Up @@ -136,11 +129,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
if(mChart.getData() != null) {
mChart.getData().setHighlightEnabled(!mChart.getData().isHighlightEnabled());
mChart.invalidate();
}
break;
}
case R.id.actionToggleFilled: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ protected void onCreate(Bundle savedInstanceState) {
mChart.setDescription("");
mChart.setNoDataTextDescription("You need to provide data for the chart.");

// enable value highlighting
mChart.setHighlightEnabled(true);

// enable touch gestures
mChart.setTouchEnabled(true);

Expand Down Expand Up @@ -186,11 +183,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
if(mChart.getData() != null) {
mChart.getData().setHighlightEnabled(!mChart.getData().isHighlightEnabled());
mChart.invalidate();
}
break;
}
case R.id.actionToggleFilled: {
Expand Down Expand Up @@ -374,8 +370,9 @@ public void onChartGestureStart(MotionEvent me, ChartTouchListener.ChartGesture
public void onChartGestureEnd(MotionEvent me, ChartTouchListener.ChartGesture lastPerformedGesture) {
Log.i("Gesture", "END, lastGesture: " + lastPerformedGesture);

// un-highlight values after the gesture is finished and no single-tap
if(lastPerformedGesture != ChartTouchListener.ChartGesture.SINGLE_TAP)
mChart.highlightValues(null);
mChart.highlightValues(null); // or highlightTouch(null) for callback to onNothingSelected(...)
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ protected void onCreate(Bundle savedInstanceState) {
mChart.setDescription("");
mChart.setNoDataTextDescription("You need to provide data for the chart.");

// enable value highlighting
mChart.setHighlightEnabled(true);

// enable touch gestures
mChart.setTouchEnabled(true);

Expand Down Expand Up @@ -146,11 +143,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
if(mChart.getData() != null) {
mChart.getData().setHighlightEnabled(!mChart.getData().isHighlightEnabled());
mChart.invalidate();
}
break;
}
case R.id.actionToggleFilled: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ protected void onCreate(Bundle savedInstanceState) {
mChart.getXAxis().setDrawAxisLine(false);
mChart.getXAxis().setDrawGridLines(false);

// enable value highlighting
mChart.setHighlightEnabled(true);

// enable touch gestures
mChart.setTouchEnabled(true);

Expand Down Expand Up @@ -115,11 +112,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
break;
}
case R.id.actionToggleHighlight: {
if (mChart.isHighlightEnabled())
mChart.setHighlightEnabled(false);
else
mChart.setHighlightEnabled(true);
mChart.invalidate();
if(mChart.getData() != null) {
mChart.getData().setHighlightEnabled(!mChart.getData().isHighlightEnabled());
mChart.invalidate();
}
break;
}
case R.id.actionToggleFilled: {
Expand Down
Loading

0 comments on commit 83a2abb

Please sign in to comment.