Remove highlight-arrow feature, this can be done by markerview
This commit is contained in:
parent
66434c6a8e
commit
b5cf9e120b
12 changed files with 40 additions and 107 deletions
|
@ -9,10 +9,6 @@
|
|||
android:id="@+id/actionToggleHighlight"
|
||||
android:title="Toggle Highlight">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/actionToggleHighlightArrow"
|
||||
android:title="Toggle Highlight Arrow">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/animateX"
|
||||
android:title="Animate X">
|
||||
|
|
|
@ -130,14 +130,6 @@ public class AnotherBarActivity extends DemoBase implements OnSeekBarChangeListe
|
|||
mChart.invalidate();
|
||||
break;
|
||||
}
|
||||
case R.id.actionToggleHighlightArrow: {
|
||||
if (mChart.isDrawHighlightArrowEnabled())
|
||||
mChart.setDrawHighlightArrow(false);
|
||||
else
|
||||
mChart.setDrawHighlightArrow(true);
|
||||
mChart.invalidate();
|
||||
break;
|
||||
}
|
||||
case R.id.animateX: {
|
||||
mChart.animateX(3000);
|
||||
break;
|
||||
|
|
|
@ -178,14 +178,6 @@ public class BarChartActivity extends DemoBase implements OnSeekBarChangeListene
|
|||
mChart.invalidate();
|
||||
break;
|
||||
}
|
||||
case R.id.actionToggleHighlightArrow: {
|
||||
if (mChart.isDrawHighlightArrowEnabled())
|
||||
mChart.setDrawHighlightArrow(false);
|
||||
else
|
||||
mChart.setDrawHighlightArrow(true);
|
||||
mChart.invalidate();
|
||||
break;
|
||||
}
|
||||
case R.id.animateX: {
|
||||
mChart.animateX(3000);
|
||||
break;
|
||||
|
|
|
@ -151,14 +151,6 @@ public class BarChartActivityMultiDataset extends DemoBase implements OnSeekBarC
|
|||
}
|
||||
break;
|
||||
}
|
||||
case R.id.actionToggleHighlightArrow: {
|
||||
if (mChart.isDrawHighlightArrowEnabled())
|
||||
mChart.setDrawHighlightArrow(false);
|
||||
else
|
||||
mChart.setDrawHighlightArrow(true);
|
||||
mChart.invalidate();
|
||||
break;
|
||||
}
|
||||
case R.id.actionSave: {
|
||||
// mChart.saveToGallery("title"+System.currentTimeMillis());
|
||||
mChart.saveToPath("title" + System.currentTimeMillis(), "");
|
||||
|
|
|
@ -152,14 +152,6 @@ public class BarChartActivitySinus extends DemoBase implements OnSeekBarChangeLi
|
|||
mChart.invalidate();
|
||||
break;
|
||||
}
|
||||
case R.id.actionToggleHighlightArrow: {
|
||||
if (mChart.isDrawHighlightArrowEnabled())
|
||||
mChart.setDrawHighlightArrow(false);
|
||||
else
|
||||
mChart.setDrawHighlightArrow(true);
|
||||
mChart.invalidate();
|
||||
break;
|
||||
}
|
||||
case R.id.animateX: {
|
||||
mChart.animateX(1500);
|
||||
break;
|
||||
|
|
|
@ -171,14 +171,6 @@ public class HorizontalBarChartActivity extends DemoBase implements OnSeekBarCha
|
|||
mChart.invalidate();
|
||||
break;
|
||||
}
|
||||
case R.id.actionToggleHighlightArrow: {
|
||||
if (mChart.isDrawHighlightArrowEnabled())
|
||||
mChart.setDrawHighlightArrow(false);
|
||||
else
|
||||
mChart.setDrawHighlightArrow(true);
|
||||
mChart.invalidate();
|
||||
break;
|
||||
}
|
||||
case R.id.animateX: {
|
||||
mChart.animateX(3000);
|
||||
break;
|
||||
|
|
|
@ -146,14 +146,6 @@ public class StackedBarActivity extends DemoBase implements OnSeekBarChangeListe
|
|||
mChart.invalidate();
|
||||
break;
|
||||
}
|
||||
case R.id.actionToggleHighlightArrow: {
|
||||
if (mChart.isDrawHighlightArrowEnabled())
|
||||
mChart.setDrawHighlightArrow(false);
|
||||
else
|
||||
mChart.setDrawHighlightArrow(true);
|
||||
mChart.invalidate();
|
||||
break;
|
||||
}
|
||||
case R.id.animateX: {
|
||||
mChart.animateX(3000);
|
||||
break;
|
||||
|
|
|
@ -179,14 +179,6 @@ public class StackedBarActivityNegative extends DemoBase implements
|
|||
mChart.invalidate();
|
||||
break;
|
||||
}
|
||||
case R.id.actionToggleHighlightArrow: {
|
||||
if (mChart.isDrawHighlightArrowEnabled())
|
||||
mChart.setDrawHighlightArrow(false);
|
||||
else
|
||||
mChart.setDrawHighlightArrow(true);
|
||||
mChart.invalidate();
|
||||
break;
|
||||
}
|
||||
case R.id.animateX: {
|
||||
mChart.animateX(3000);
|
||||
break;
|
||||
|
|
|
@ -129,23 +129,23 @@ public class BarChart extends BarLineChartBase<BarData> implements BarDataProvid
|
|||
return bounds;
|
||||
}
|
||||
|
||||
/**
|
||||
* set this to true to draw the highlightning arrow
|
||||
*
|
||||
* @param enabled
|
||||
*/
|
||||
public void setDrawHighlightArrow(boolean enabled) {
|
||||
mDrawHighlightArrow = enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns true if drawing the highlighting arrow is enabled, false if not
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isDrawHighlightArrowEnabled() {
|
||||
return mDrawHighlightArrow;
|
||||
}
|
||||
// /**
|
||||
// * set this to true to draw the highlightning arrow
|
||||
// *
|
||||
// * @param enabled
|
||||
// */
|
||||
// public void setDrawHighlightArrow(boolean enabled) {
|
||||
// mDrawHighlightArrow = enabled;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * returns true if drawing the highlighting arrow is enabled, false if not
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
// public boolean isDrawHighlightArrowEnabled() {
|
||||
// return mDrawHighlightArrow;
|
||||
// }
|
||||
|
||||
/**
|
||||
* If set to true, all values are drawn above their bars, instead of below their top.
|
||||
|
|
|
@ -167,11 +167,6 @@ public class CombinedChart extends BarLineChartBase<CombinedData> implements Lin
|
|||
return mDrawValueAboveBar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDrawHighlightArrowEnabled() {
|
||||
return mDrawHighlightArrow;
|
||||
}
|
||||
|
||||
/**
|
||||
* set this to true to draw the highlightning arrow
|
||||
*
|
||||
|
|
|
@ -7,5 +7,4 @@ public interface BarDataProvider extends BarLineScatterCandleBubbleDataProvider
|
|||
BarData getBarData();
|
||||
boolean isDrawBarShadowEnabled();
|
||||
boolean isDrawValueAboveBarEnabled();
|
||||
boolean isDrawHighlightArrowEnabled();
|
||||
}
|
||||
|
|
|
@ -3,7 +3,9 @@ package com.github.mikephil.charting.renderer;
|
|||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.RectF;
|
||||
|
||||
import com.github.mikephil.charting.animation.ChartAnimator;
|
||||
|
@ -236,7 +238,8 @@ public class BarChartRenderer extends DataRenderer {
|
|||
float val = entry.getY();
|
||||
|
||||
drawValue(c, dataSet.getValueFormatter(), val, entry, i, x,
|
||||
val >= 0 ? (buffer.buffer[j + 1] + posOffset) : (buffer.buffer[j + 3] + negOffset), dataSet.getValueTextColor
|
||||
val >= 0 ? (buffer.buffer[j + 1] + posOffset) : (buffer.buffer[j + 3] + negOffset),
|
||||
dataSet.getValueTextColor
|
||||
(j / 4));
|
||||
}
|
||||
|
||||
|
@ -355,7 +358,6 @@ public class BarChartRenderer extends DataRenderer {
|
|||
float x = high.getX();
|
||||
|
||||
BarEntry e = set.getEntryForXPos(x);
|
||||
int entryIndex = set.getEntryIndex(e);
|
||||
|
||||
if (e == null)
|
||||
continue;
|
||||
|
@ -375,37 +377,34 @@ public class BarChartRenderer extends DataRenderer {
|
|||
|
||||
prepareBarHighlight(e.getX(), y1, y2, barData.getBarWidth() / 2f, trans);
|
||||
|
||||
//prepareBarHighlight(y1, y2, interval, entryIndex, dataSetIndex, setCount, barSpace, groupSpace,
|
||||
// trans);
|
||||
|
||||
c.drawRect(mBarRect, mHighlightPaint);
|
||||
|
||||
// if (mChart.isDrawHighlightArrowEnabled()) {
|
||||
// if (mChart.isDrawHighlightArrowEnabled()) {
|
||||
//
|
||||
// mHighlightPaint.setAlpha(255);
|
||||
// mHighlightPaint.setAlpha(255);
|
||||
//
|
||||
// // distance between highlight arrow and bar
|
||||
// float offsetY = mAnimator.getPhaseY() * 0.07f;
|
||||
// // distance between highlight arrow and bar
|
||||
// float offsetY = mAnimator.getPhaseY() * 0.07f;
|
||||
//
|
||||
// float[] values = new float[9];
|
||||
// trans.getPixelToValueMatrix().getValues(values);
|
||||
// final float xToYRel = Math.abs(
|
||||
// values[Matrix.MSCALE_Y] / values[Matrix.MSCALE_X]);
|
||||
// float[] values = new float[9];
|
||||
// trans.getPixelToValueMatrix().getValues(values);
|
||||
// final float xToYRel = Math.abs(
|
||||
// values[Matrix.MSCALE_Y] / values[Matrix.MSCALE_X]);
|
||||
//
|
||||
// final float arrowWidth = set.getBarSpace() / 2.f;
|
||||
// final float arrowHeight = arrowWidth * xToYRel;
|
||||
// final float arrowWidth = barData.getBarWidth();
|
||||
// final float arrowWidthHalf = arrowWidth / 2f;
|
||||
// final float arrowHeight = arrowWidth * xToYRel;
|
||||
//
|
||||
// final float yArrow = (y1 > -y2 ? y1 : y1) * mAnimator.getPhaseY();
|
||||
// final float yArrow = (y1 > -y2 ? y1 : y1) * mAnimator.getPhaseY();
|
||||
//
|
||||
// Path arrow = new Path();
|
||||
// arrow.moveTo(xPx + 0.4f, yArrow + offsetY);
|
||||
// arrow.lineTo(xPx + 0.4f + arrowWidth, yArrow + offsetY - arrowHeight);
|
||||
// arrow.lineTo(xPx + 0.4f + arrowWidth, yArrow + offsetY + arrowHeight);
|
||||
// Path arrow = new Path();
|
||||
// arrow.moveTo(e.getX() - arrowWidthHalf, yArrow + offsetY + arrowHeight);
|
||||
// arrow.lineTo(e.getX(), yArrow + offsetY);
|
||||
// arrow.lineTo(e.getX() + arrowWidthHalf, yArrow + offsetY + arrowHeight);
|
||||
//
|
||||
// trans.pathValueToPixel(arrow);
|
||||
// c.drawPath(arrow, mHighlightPaint);
|
||||
// }
|
||||
|
||||
// trans.pathValueToPixel(arrow);
|
||||
// c.drawPath(arrow, mHighlightPaint);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue