Rename PointD to MPPointD
This commit is contained in:
parent
43fa1e6cec
commit
6d21817c8a
15 changed files with 81 additions and 80 deletions
|
@ -31,8 +31,8 @@ import com.github.mikephil.charting.listener.BarLineChartTouchListener;
|
|||
import com.github.mikephil.charting.listener.OnDrawListener;
|
||||
import com.github.mikephil.charting.renderer.XAxisRenderer;
|
||||
import com.github.mikephil.charting.renderer.YAxisRenderer;
|
||||
import com.github.mikephil.charting.utils.MPPointD;
|
||||
import com.github.mikephil.charting.utils.MPPointF;
|
||||
import com.github.mikephil.charting.utils.PointD;
|
||||
import com.github.mikephil.charting.utils.Transformer;
|
||||
import com.github.mikephil.charting.utils.Utils;
|
||||
|
||||
|
@ -683,14 +683,14 @@ public abstract class BarLineChartBase<T extends BarLineScatterCandleBubbleData<
|
|||
|
||||
if (android.os.Build.VERSION.SDK_INT >= 11) {
|
||||
|
||||
PointD origin = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);
|
||||
MPPointD origin = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);
|
||||
|
||||
Runnable job = AnimatedZoomJob.getInstance(mViewPortHandler, this, getTransformer(axis), getAxis(axis), mXAxis
|
||||
.mAxisRange, scaleX, scaleY, mViewPortHandler.getScaleX(), mViewPortHandler.getScaleY(),
|
||||
xValue, yValue, (float) origin.x, (float) origin.y, duration);
|
||||
addViewportJob(job);
|
||||
|
||||
PointD.recycleInstance(origin);
|
||||
MPPointD.recycleInstance(origin);
|
||||
|
||||
} else {
|
||||
Log.e(LOG_TAG, "Unable to execute zoomAndCenterAnimated(...) on API level < 11");
|
||||
|
@ -848,7 +848,7 @@ public abstract class BarLineChartBase<T extends BarLineScatterCandleBubbleData<
|
|||
|
||||
if (android.os.Build.VERSION.SDK_INT >= 11) {
|
||||
|
||||
PointD bounds = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);
|
||||
MPPointD bounds = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);
|
||||
|
||||
float yInView = getDeltaY(axis) / mViewPortHandler.getScaleY();
|
||||
|
||||
|
@ -857,7 +857,7 @@ public abstract class BarLineChartBase<T extends BarLineScatterCandleBubbleData<
|
|||
|
||||
addViewportJob(job);
|
||||
|
||||
PointD.recycleInstance(bounds);
|
||||
MPPointD.recycleInstance(bounds);
|
||||
} else {
|
||||
Log.e(LOG_TAG, "Unable to execute moveViewToAnimated(...) on API level < 11");
|
||||
}
|
||||
|
@ -915,7 +915,7 @@ public abstract class BarLineChartBase<T extends BarLineScatterCandleBubbleData<
|
|||
|
||||
if (android.os.Build.VERSION.SDK_INT >= 11) {
|
||||
|
||||
PointD bounds = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);
|
||||
MPPointD bounds = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);
|
||||
|
||||
float yInView = getDeltaY(axis) / mViewPortHandler.getScaleY();
|
||||
float xInView = getXAxis().mAxisRange / mViewPortHandler.getScaleX();
|
||||
|
@ -926,7 +926,7 @@ public abstract class BarLineChartBase<T extends BarLineScatterCandleBubbleData<
|
|||
|
||||
addViewportJob(job);
|
||||
|
||||
PointD.recycleInstance(bounds);
|
||||
MPPointD.recycleInstance(bounds);
|
||||
} else {
|
||||
Log.e(LOG_TAG, "Unable to execute centerViewToAnimated(...) on API level < 11");
|
||||
}
|
||||
|
@ -1202,9 +1202,9 @@ public abstract class BarLineChartBase<T extends BarLineScatterCandleBubbleData<
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a recyclable PointD instance
|
||||
* Returns a recyclable MPPointD instance
|
||||
* Returns the x and y values in the chart at the given touch point
|
||||
* (encapsulated in a PointD). This method transforms pixel coordinates to
|
||||
* (encapsulated in a MPPointD). This method transforms pixel coordinates to
|
||||
* coordinates / values in the chart. This is the opposite method to
|
||||
* getPixelsForValues(...).
|
||||
*
|
||||
|
@ -1212,18 +1212,18 @@ public abstract class BarLineChartBase<T extends BarLineScatterCandleBubbleData<
|
|||
* @param y
|
||||
* @return
|
||||
*/
|
||||
public PointD getValuesByTouchPoint(float x, float y, AxisDependency axis) {
|
||||
PointD result = PointD.getInstance(0,0);
|
||||
public MPPointD getValuesByTouchPoint(float x, float y, AxisDependency axis) {
|
||||
MPPointD result = MPPointD.getInstance(0,0);
|
||||
getValuesByTouchPoint(x,y,axis,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void getValuesByTouchPoint(float x, float y, AxisDependency axis, PointD outputPoint){
|
||||
public void getValuesByTouchPoint(float x, float y, AxisDependency axis, MPPointD outputPoint){
|
||||
getTransformer(axis).getValuesByTouchPoint(x, y, outputPoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a recyclable PointD instance
|
||||
* Returns a recyclable MPPointD instance
|
||||
* Transforms the given chart values into pixels. This is the opposite
|
||||
* method to getValuesByTouchPoint(...).
|
||||
*
|
||||
|
@ -1231,11 +1231,11 @@ public abstract class BarLineChartBase<T extends BarLineScatterCandleBubbleData<
|
|||
* @param y
|
||||
* @return
|
||||
*/
|
||||
public PointD getPixelsForValues(float x, float y, AxisDependency axis) {
|
||||
public MPPointD getPixelsForValues(float x, float y, AxisDependency axis) {
|
||||
return getTransformer(axis).getPixelsForValues(x, y);
|
||||
}
|
||||
|
||||
PointD pointForGetYValueByTouchPoint = PointD.getInstance(0,0);
|
||||
MPPointD pointForGetYValueByTouchPoint = MPPointD.getInstance(0,0);
|
||||
/**
|
||||
* Returns y value at the given touch position (must not necessarily be
|
||||
* a value contained in one of the datasets)
|
||||
|
@ -1281,7 +1281,7 @@ public abstract class BarLineChartBase<T extends BarLineScatterCandleBubbleData<
|
|||
}
|
||||
|
||||
/** buffer for storing lowest visible x point */
|
||||
protected PointD posForGetLowestVisibleX = PointD.getInstance(0,0);
|
||||
protected MPPointD posForGetLowestVisibleX = MPPointD.getInstance(0,0);
|
||||
|
||||
/**
|
||||
* Returns the lowest x-index (value on the x-axis) that is still visible on
|
||||
|
@ -1298,7 +1298,7 @@ public abstract class BarLineChartBase<T extends BarLineScatterCandleBubbleData<
|
|||
}
|
||||
|
||||
/** buffer for storing highest visible x point */
|
||||
protected PointD posForGetHighestVisibleX = PointD.getInstance(0,0);
|
||||
protected MPPointD posForGetHighestVisibleX = MPPointD.getInstance(0,0);
|
||||
|
||||
/**
|
||||
* Returns the highest x-index (value on the x-axis) that is still visible
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.github.mikephil.charting.data.BarEntry;
|
|||
import com.github.mikephil.charting.data.BarLineScatterCandleBubbleData;
|
||||
import com.github.mikephil.charting.interfaces.dataprovider.BarDataProvider;
|
||||
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet;
|
||||
import com.github.mikephil.charting.utils.PointD;
|
||||
import com.github.mikephil.charting.utils.MPPointD;
|
||||
|
||||
/**
|
||||
* Created by Philipp Jahoda on 22/07/15.
|
||||
|
@ -24,7 +24,7 @@ public class BarHighlighter extends ChartHighlighter<BarDataProvider> {
|
|||
return null;
|
||||
}
|
||||
|
||||
PointD pos = getValsForTouch(x, y);
|
||||
MPPointD pos = getValsForTouch(x, y);
|
||||
|
||||
BarData barData = mChart.getBarData();
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class BarHighlighter extends ChartHighlighter<BarDataProvider> {
|
|||
(float) pos.y);
|
||||
}
|
||||
|
||||
PointD.recycleInstance(pos);
|
||||
MPPointD.recycleInstance(pos);
|
||||
|
||||
return high;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class BarHighlighter extends ChartHighlighter<BarDataProvider> {
|
|||
if (ranges.length > 0) {
|
||||
int stackIndex = getClosestStackIndex(ranges, yVal);
|
||||
|
||||
PointD pixels = mChart.getTransformer(set.getAxisDependency()).getPixelsForValues(high.getX(), ranges[stackIndex].to);
|
||||
MPPointD pixels = mChart.getTransformer(set.getAxisDependency()).getPixelsForValues(high.getX(), ranges[stackIndex].to);
|
||||
|
||||
Highlight stackedHigh = new Highlight(
|
||||
entry.getX(),
|
||||
|
@ -80,7 +80,7 @@ public class BarHighlighter extends ChartHighlighter<BarDataProvider> {
|
|||
high.getAxis()
|
||||
);
|
||||
|
||||
PointD.recycleInstance(pixels);
|
||||
MPPointD.recycleInstance(pixels);
|
||||
|
||||
return stackedHigh;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.github.mikephil.charting.data.DataSet;
|
|||
import com.github.mikephil.charting.data.Entry;
|
||||
import com.github.mikephil.charting.interfaces.dataprovider.BarLineScatterCandleBubbleDataProvider;
|
||||
import com.github.mikephil.charting.interfaces.datasets.IDataSet;
|
||||
import com.github.mikephil.charting.utils.PointD;
|
||||
import com.github.mikephil.charting.utils.MPPointD;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -33,26 +33,26 @@ public class ChartHighlighter<T extends BarLineScatterCandleBubbleDataProvider>
|
|||
@Override
|
||||
public Highlight getHighlight(float x, float y) {
|
||||
|
||||
PointD pos = getValsForTouch(x, y);
|
||||
MPPointD pos = getValsForTouch(x, y);
|
||||
float xVal = (float) pos.x;
|
||||
PointD.recycleInstance(pos);
|
||||
MPPointD.recycleInstance(pos);
|
||||
|
||||
Highlight high = getHighlightForX(xVal, x, y);
|
||||
return high;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a recyclable PointD instance.
|
||||
* Returns a recyclable MPPointD instance.
|
||||
* Returns the corresponding xPos for a given touch-position in pixels.
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @return
|
||||
*/
|
||||
protected PointD getValsForTouch(float x, float y) {
|
||||
protected MPPointD getValsForTouch(float x, float y) {
|
||||
|
||||
// take any transformer to determine the x-axis value
|
||||
PointD pos = mChart.getTransformer(YAxis.AxisDependency.LEFT).getValuesByTouchPoint(x, y);
|
||||
MPPointD pos = mChart.getTransformer(YAxis.AxisDependency.LEFT).getValuesByTouchPoint(x, y);
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ public class ChartHighlighter<T extends BarLineScatterCandleBubbleDataProvider>
|
|||
if (e == null)
|
||||
return null;
|
||||
|
||||
PointD pixels = mChart.getTransformer(set.getAxisDependency()).getPixelsForValues(e.getX(), e.getY());
|
||||
MPPointD pixels = mChart.getTransformer(set.getAxisDependency()).getPixelsForValues(e.getX(), e.getY());
|
||||
|
||||
return new Highlight(e.getX(), e.getY(), (float) pixels.x, (float) pixels.y, dataSetIndex, set.getAxisDependency());
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.github.mikephil.charting.data.Entry;
|
|||
import com.github.mikephil.charting.interfaces.dataprovider.BarDataProvider;
|
||||
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet;
|
||||
import com.github.mikephil.charting.interfaces.datasets.IDataSet;
|
||||
import com.github.mikephil.charting.utils.PointD;
|
||||
import com.github.mikephil.charting.utils.MPPointD;
|
||||
|
||||
/**
|
||||
* Created by Philipp Jahoda on 22/07/15.
|
||||
|
@ -22,7 +22,7 @@ public class HorizontalBarHighlighter extends BarHighlighter {
|
|||
|
||||
BarData barData = mChart.getBarData();
|
||||
|
||||
PointD pos = getValsForTouch(y, x);
|
||||
MPPointD pos = getValsForTouch(y, x);
|
||||
|
||||
Highlight high = getHighlightForX((float) pos.y, y, x);
|
||||
if (high == null)
|
||||
|
@ -37,7 +37,7 @@ public class HorizontalBarHighlighter extends BarHighlighter {
|
|||
(float) pos.x);
|
||||
}
|
||||
|
||||
PointD.recycleInstance(pos);
|
||||
MPPointD.recycleInstance(pos);
|
||||
|
||||
return high;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class HorizontalBarHighlighter extends BarHighlighter {
|
|||
|
||||
final Entry e = set.getEntryForXPos(xVal, rounding);
|
||||
|
||||
PointD pixels = mChart.getTransformer(set.getAxisDependency()).getPixelsForValues(e.getY(), e.getX());
|
||||
MPPointD pixels = mChart.getTransformer(set.getAxisDependency()).getPixelsForValues(e.getY(), e.getX());
|
||||
|
||||
return new Highlight(e.getX(), e.getY(), (float) pixels.x, (float) pixels.y, dataSetIndex, set.getAxisDependency());
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import android.graphics.Paint;
|
|||
import android.graphics.Paint.Style;
|
||||
|
||||
import com.github.mikephil.charting.components.AxisBase;
|
||||
import com.github.mikephil.charting.utils.PointD;
|
||||
import com.github.mikephil.charting.utils.MPPointD;
|
||||
import com.github.mikephil.charting.utils.Transformer;
|
||||
import com.github.mikephil.charting.utils.Utils;
|
||||
import com.github.mikephil.charting.utils.ViewPortHandler;
|
||||
|
@ -121,8 +121,8 @@ public abstract class AxisRenderer extends Renderer {
|
|||
// zoom / contentrect bounds)
|
||||
if (mViewPortHandler != null && mViewPortHandler.contentWidth() > 10 && !mViewPortHandler.isFullyZoomedOutY()) {
|
||||
|
||||
PointD p1 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop());
|
||||
PointD p2 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentBottom());
|
||||
MPPointD p1 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop());
|
||||
MPPointD p2 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentBottom());
|
||||
|
||||
if (!inverted) {
|
||||
|
||||
|
@ -134,8 +134,8 @@ public abstract class AxisRenderer extends Renderer {
|
|||
max = (float) p2.y;
|
||||
}
|
||||
|
||||
PointD.recycleInstance(p1);
|
||||
PointD.recycleInstance(p2);
|
||||
MPPointD.recycleInstance(p1);
|
||||
MPPointD.recycleInstance(p2);
|
||||
}
|
||||
|
||||
computeAxisValues(min, max);
|
||||
|
|
|
@ -11,7 +11,7 @@ import com.github.mikephil.charting.highlight.Highlight;
|
|||
import com.github.mikephil.charting.interfaces.dataprovider.CandleDataProvider;
|
||||
import com.github.mikephil.charting.interfaces.datasets.ICandleDataSet;
|
||||
import com.github.mikephil.charting.utils.ColorTemplate;
|
||||
import com.github.mikephil.charting.utils.PointD;
|
||||
import com.github.mikephil.charting.utils.MPPointD;
|
||||
import com.github.mikephil.charting.utils.Transformer;
|
||||
import com.github.mikephil.charting.utils.Utils;
|
||||
import com.github.mikephil.charting.utils.ViewPortHandler;
|
||||
|
@ -326,7 +326,7 @@ public class CandleStickChartRenderer extends LineScatterCandleRadarRenderer {
|
|||
float highValue = e.getHigh() * mAnimator.getPhaseY();
|
||||
float y = (lowValue + highValue) / 2f;
|
||||
|
||||
PointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelsForValues(e.getX(), y);
|
||||
MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelsForValues(e.getX(), y);
|
||||
|
||||
high.setDraw((float) pix.x, (float) pix.y);
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import com.github.mikephil.charting.interfaces.dataprovider.LineDataProvider;
|
|||
import com.github.mikephil.charting.interfaces.datasets.IDataSet;
|
||||
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
|
||||
import com.github.mikephil.charting.utils.ColorTemplate;
|
||||
import com.github.mikephil.charting.utils.PointD;
|
||||
import com.github.mikephil.charting.utils.MPPointD;
|
||||
import com.github.mikephil.charting.utils.Transformer;
|
||||
import com.github.mikephil.charting.utils.ViewPortHandler;
|
||||
|
||||
|
@ -750,7 +750,7 @@ public class LineChartRenderer extends LineRadarRenderer {
|
|||
if (!isInBoundsX(e, set))
|
||||
continue;
|
||||
|
||||
PointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelsForValues(e.getX(), e.getY() * mAnimator
|
||||
MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelsForValues(e.getX(), e.getY() * mAnimator
|
||||
.getPhaseY());
|
||||
|
||||
high.setDraw((float) pix.x, (float) pix.y);
|
||||
|
|
|
@ -11,7 +11,7 @@ import com.github.mikephil.charting.highlight.Highlight;
|
|||
import com.github.mikephil.charting.interfaces.dataprovider.ScatterDataProvider;
|
||||
import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet;
|
||||
import com.github.mikephil.charting.renderer.scatter.ShapeRenderer;
|
||||
import com.github.mikephil.charting.utils.PointD;
|
||||
import com.github.mikephil.charting.utils.MPPointD;
|
||||
import com.github.mikephil.charting.utils.Transformer;
|
||||
import com.github.mikephil.charting.utils.Utils;
|
||||
import com.github.mikephil.charting.utils.ViewPortHandler;
|
||||
|
@ -148,7 +148,7 @@ public class ScatterChartRenderer extends LineScatterCandleRadarRenderer {
|
|||
if (!isInBoundsX(e, set))
|
||||
continue;
|
||||
|
||||
PointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelsForValues(e.getX(), e.getY() * mAnimator
|
||||
MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelsForValues(e.getX(), e.getY() * mAnimator
|
||||
.getPhaseY());
|
||||
|
||||
high.setDraw((float) pix.x, (float) pix.y);
|
||||
|
|
|
@ -11,8 +11,8 @@ import com.github.mikephil.charting.components.LimitLine;
|
|||
import com.github.mikephil.charting.components.XAxis;
|
||||
import com.github.mikephil.charting.components.XAxis.XAxisPosition;
|
||||
import com.github.mikephil.charting.utils.FSize;
|
||||
import com.github.mikephil.charting.utils.MPPointD;
|
||||
import com.github.mikephil.charting.utils.MPPointF;
|
||||
import com.github.mikephil.charting.utils.PointD;
|
||||
import com.github.mikephil.charting.utils.Transformer;
|
||||
import com.github.mikephil.charting.utils.Utils;
|
||||
import com.github.mikephil.charting.utils.ViewPortHandler;
|
||||
|
@ -46,8 +46,8 @@ public class XAxisRenderer extends AxisRenderer {
|
|||
// zoom / contentrect bounds)
|
||||
if (mViewPortHandler.contentWidth() > 10 && !mViewPortHandler.isFullyZoomedOutX()) {
|
||||
|
||||
PointD p1 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop());
|
||||
PointD p2 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentRight(), mViewPortHandler.contentTop());
|
||||
MPPointD p1 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop());
|
||||
MPPointD p2 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentRight(), mViewPortHandler.contentTop());
|
||||
|
||||
if (inverted) {
|
||||
|
||||
|
@ -59,8 +59,8 @@ public class XAxisRenderer extends AxisRenderer {
|
|||
max = (float) p2.x;
|
||||
}
|
||||
|
||||
PointD.recycleInstance(p1);
|
||||
PointD.recycleInstance(p2);
|
||||
MPPointD.recycleInstance(p1);
|
||||
MPPointD.recycleInstance(p2);
|
||||
}
|
||||
|
||||
computeAxisValues(min, max);
|
||||
|
|
|
@ -12,7 +12,7 @@ import com.github.mikephil.charting.components.XAxis;
|
|||
import com.github.mikephil.charting.components.XAxis.XAxisPosition;
|
||||
import com.github.mikephil.charting.utils.FSize;
|
||||
import com.github.mikephil.charting.utils.MPPointF;
|
||||
import com.github.mikephil.charting.utils.PointD;
|
||||
import com.github.mikephil.charting.utils.MPPointD;
|
||||
import com.github.mikephil.charting.utils.Transformer;
|
||||
import com.github.mikephil.charting.utils.Utils;
|
||||
import com.github.mikephil.charting.utils.ViewPortHandler;
|
||||
|
@ -37,8 +37,8 @@ public class XAxisRendererHorizontalBarChart extends XAxisRenderer {
|
|||
// zoom / contentrect bounds)
|
||||
if (mViewPortHandler.contentWidth() > 10 && !mViewPortHandler.isFullyZoomedOutY()) {
|
||||
|
||||
PointD p1 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentBottom());
|
||||
PointD p2 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop());
|
||||
MPPointD p1 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentBottom());
|
||||
MPPointD p2 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop());
|
||||
|
||||
if (inverted) {
|
||||
|
||||
|
@ -50,8 +50,8 @@ public class XAxisRendererHorizontalBarChart extends XAxisRenderer {
|
|||
max = (float) p2.y;
|
||||
}
|
||||
|
||||
PointD.recycleInstance(p1);
|
||||
PointD.recycleInstance(p2);
|
||||
MPPointD.recycleInstance(p1);
|
||||
MPPointD.recycleInstance(p2);
|
||||
}
|
||||
|
||||
computeAxisValues(min, max);
|
||||
|
|
|
@ -10,7 +10,7 @@ import com.github.mikephil.charting.components.LimitLine;
|
|||
import com.github.mikephil.charting.components.YAxis;
|
||||
import com.github.mikephil.charting.components.YAxis.AxisDependency;
|
||||
import com.github.mikephil.charting.components.YAxis.YAxisLabelPosition;
|
||||
import com.github.mikephil.charting.utils.PointD;
|
||||
import com.github.mikephil.charting.utils.MPPointD;
|
||||
import com.github.mikephil.charting.utils.Transformer;
|
||||
import com.github.mikephil.charting.utils.Utils;
|
||||
import com.github.mikephil.charting.utils.ViewPortHandler;
|
||||
|
@ -203,7 +203,7 @@ public class YAxisRenderer extends AxisRenderer {
|
|||
protected void drawZeroLine(Canvas c) {
|
||||
|
||||
// draw zero line
|
||||
PointD pos = mTrans.getPixelsForValues(0f, 0f);
|
||||
MPPointD pos = mTrans.getPixelsForValues(0f, 0f);
|
||||
|
||||
mZeroLinePaint.setColor(mYAxis.getZeroLineColor());
|
||||
mZeroLinePaint.setStrokeWidth(mYAxis.getZeroLineWidth());
|
||||
|
|
|
@ -10,7 +10,7 @@ import com.github.mikephil.charting.components.LimitLine;
|
|||
import com.github.mikephil.charting.components.YAxis;
|
||||
import com.github.mikephil.charting.components.YAxis.AxisDependency;
|
||||
import com.github.mikephil.charting.components.YAxis.YAxisLabelPosition;
|
||||
import com.github.mikephil.charting.utils.PointD;
|
||||
import com.github.mikephil.charting.utils.MPPointD;
|
||||
import com.github.mikephil.charting.utils.Transformer;
|
||||
import com.github.mikephil.charting.utils.Utils;
|
||||
import com.github.mikephil.charting.utils.ViewPortHandler;
|
||||
|
@ -39,9 +39,9 @@ public class YAxisRendererHorizontalBarChart extends YAxisRenderer {
|
|||
// zoom / contentrect bounds)
|
||||
if (mViewPortHandler.contentHeight() > 10 && !mViewPortHandler.isFullyZoomedOutX()) {
|
||||
|
||||
PointD p1 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(),
|
||||
MPPointD p1 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(),
|
||||
mViewPortHandler.contentTop());
|
||||
PointD p2 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentRight(),
|
||||
MPPointD p2 = mTrans.getValuesByTouchPoint(mViewPortHandler.contentRight(),
|
||||
mViewPortHandler.contentTop());
|
||||
|
||||
if (!inverted) {
|
||||
|
@ -52,8 +52,8 @@ public class YAxisRendererHorizontalBarChart extends YAxisRenderer {
|
|||
yMax = (float) p1.x;
|
||||
}
|
||||
|
||||
PointD.recycleInstance(p1);
|
||||
PointD.recycleInstance(p2);
|
||||
MPPointD.recycleInstance(p1);
|
||||
MPPointD.recycleInstance(p2);
|
||||
}
|
||||
|
||||
computeAxisValues(yMin, yMax);
|
||||
|
@ -179,7 +179,7 @@ public class YAxisRendererHorizontalBarChart extends YAxisRenderer {
|
|||
protected void drawZeroLine(Canvas c) {
|
||||
|
||||
// draw zero line
|
||||
PointD pos = mTrans.getPixelsForValues(0f, 0f);
|
||||
MPPointD pos = mTrans.getPixelsForValues(0f, 0f);
|
||||
|
||||
mZeroLinePaint.setColor(mYAxis.getZeroLineColor());
|
||||
mZeroLinePaint.setStrokeWidth(mYAxis.getZeroLineWidth());
|
||||
|
|
|
@ -8,27 +8,27 @@ import java.util.List;
|
|||
*
|
||||
* @author Philipp Jahoda
|
||||
*/
|
||||
public class PointD extends ObjectPool.Poolable {
|
||||
public class MPPointD extends ObjectPool.Poolable {
|
||||
|
||||
private static ObjectPool<PointD> pool;
|
||||
private static ObjectPool<MPPointD> pool;
|
||||
|
||||
static {
|
||||
pool = ObjectPool.create(64, new PointD(0,0));
|
||||
pool = ObjectPool.create(64, new MPPointD(0,0));
|
||||
pool.setReplenishPercentage(0.5f);
|
||||
}
|
||||
|
||||
public static PointD getInstance(double x, double y){
|
||||
PointD result = pool.get();
|
||||
public static MPPointD getInstance(double x, double y){
|
||||
MPPointD result = pool.get();
|
||||
result.x = x;
|
||||
result.y = y;
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void recycleInstance(PointD instance){
|
||||
public static void recycleInstance(MPPointD instance){
|
||||
pool.recycle(instance);
|
||||
}
|
||||
|
||||
public static void recycleInstances(List<PointD> instances){
|
||||
public static void recycleInstances(List<MPPointD> instances){
|
||||
pool.recycle(instances);
|
||||
}
|
||||
|
||||
|
@ -36,10 +36,10 @@ public class PointD extends ObjectPool.Poolable {
|
|||
public double y;
|
||||
|
||||
protected ObjectPool.Poolable instantiate(){
|
||||
return new PointD(0,0);
|
||||
return new MPPointD(0,0);
|
||||
}
|
||||
|
||||
private PointD(double x, double y) {
|
||||
private MPPointD(double x, double y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
@ -48,6 +48,6 @@ public class PointD extends ObjectPool.Poolable {
|
|||
* returns a string representation of the object
|
||||
*/
|
||||
public String toString() {
|
||||
return "PointD, x: " + x + ", y: " + y;
|
||||
return "MPPointD, x: " + x + ", y: " + y;
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ import java.util.List;
|
|||
* Created by Tony Patino on 6/24/16.
|
||||
*/
|
||||
public class MPPointF extends ObjectPool.Poolable {
|
||||
|
||||
private static ObjectPool<MPPointF> pool;
|
||||
|
||||
public float x;
|
||||
|
|
|
@ -385,9 +385,9 @@ public class Transformer {
|
|||
float[] ptsBuffer = new float[2];
|
||||
|
||||
/**
|
||||
* Returns a recyclable PointD instance.
|
||||
* Returns a recyclable MPPointD instance.
|
||||
* returns the x and y values in the chart at the given touch point
|
||||
* (encapsulated in a PointD). This method transforms pixel coordinates to
|
||||
* (encapsulated in a MPPointD). This method transforms pixel coordinates to
|
||||
* coordinates / values in the chart. This is the opposite method to
|
||||
* getPixelsForValues(...).
|
||||
*
|
||||
|
@ -395,14 +395,14 @@ public class Transformer {
|
|||
* @param y
|
||||
* @return
|
||||
*/
|
||||
public PointD getValuesByTouchPoint(float x, float y) {
|
||||
public MPPointD getValuesByTouchPoint(float x, float y) {
|
||||
|
||||
PointD result = PointD.getInstance(0,0);
|
||||
MPPointD result = MPPointD.getInstance(0,0);
|
||||
getValuesByTouchPoint(x,y,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void getValuesByTouchPoint(float x, float y, PointD outputPoint){
|
||||
public void getValuesByTouchPoint(float x, float y, MPPointD outputPoint){
|
||||
|
||||
ptsBuffer[0] = x;
|
||||
ptsBuffer[1] = y;
|
||||
|
@ -414,14 +414,14 @@ public class Transformer {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a recyclable PointD instance.
|
||||
* Returns a recyclable MPPointD instance.
|
||||
* Returns the x and y coordinates (pixels) for a given x and y value in the chart.
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @return
|
||||
*/
|
||||
public PointD getPixelsForValues(float x, float y) {
|
||||
public MPPointD getPixelsForValues(float x, float y) {
|
||||
|
||||
ptsBuffer[0] = x;
|
||||
ptsBuffer[1] = y;
|
||||
|
@ -431,7 +431,7 @@ public class Transformer {
|
|||
double xPx = ptsBuffer[0];
|
||||
double yPx = ptsBuffer[1];
|
||||
|
||||
return PointD.getInstance(xPx, yPx);
|
||||
return MPPointD.getInstance(xPx, yPx);
|
||||
}
|
||||
|
||||
public Matrix getValueMatrix() {
|
||||
|
|
Loading…
Add table
Reference in a new issue