These return a single pixel (x/y), for values (x value and y value)

This commit is contained in:
Daniel Cohen Gindi 2016-08-08 10:03:51 +03:00
parent 2d54fd1f3f
commit 77c10fc9e5
10 changed files with 15 additions and 15 deletions

View file

@ -1206,7 +1206,7 @@ public abstract class BarLineChartBase<T extends BarLineScatterCandleBubbleData<
* Returns the x and y values in the chart at the given touch point
* (encapsulated in a MPPointD). This method transforms pixel coordinates to
* coordinates / values in the chart. This is the opposite method to
* getPixelsForValues(...).
* getPixelForValues(...).
*
* @param x
* @param y
@ -1231,8 +1231,8 @@ public abstract class BarLineChartBase<T extends BarLineScatterCandleBubbleData<
* @param y
* @return
*/
public MPPointD getPixelsForValues(float x, float y, AxisDependency axis) {
return getTransformer(axis).getPixelsForValues(x, y);
public MPPointD getPixelForValues(float x, float y, AxisDependency axis) {
return getTransformer(axis).getPixelForValues(x, y);
}
/**

View file

@ -68,7 +68,7 @@ public class BarHighlighter extends ChartHighlighter<BarDataProvider> {
if (ranges.length > 0) {
int stackIndex = getClosestStackIndex(ranges, yVal);
MPPointD pixels = mChart.getTransformer(set.getAxisDependency()).getPixelsForValues(high.getX(), ranges[stackIndex].to);
MPPointD pixels = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(high.getX(), ranges[stackIndex].to);
Highlight stackedHigh = new Highlight(
entry.getX(),

View file

@ -167,7 +167,7 @@ public class ChartHighlighter<T extends BarLineScatterCandleBubbleDataProvider>
if (e == null)
return null;
MPPointD pixels = mChart.getTransformer(set.getAxisDependency()).getPixelsForValues(e.getX(), e.getY());
MPPointD pixels = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(e.getX(), e.getY());
return new Highlight(e.getX(), e.getY(), (float) pixels.x, (float) pixels.y, dataSetIndex, set.getAxisDependency());
}

View file

@ -47,7 +47,7 @@ public class HorizontalBarHighlighter extends BarHighlighter {
final Entry e = set.getEntryForXPos(xVal, rounding);
MPPointD pixels = mChart.getTransformer(set.getAxisDependency()).getPixelsForValues(e.getY(), e.getX());
MPPointD pixels = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(e.getY(), e.getX());
return new Highlight(e.getX(), e.getY(), (float) pixels.x, (float) pixels.y, dataSetIndex, set.getAxisDependency());
}

View file

@ -326,7 +326,7 @@ public class CandleStickChartRenderer extends LineScatterCandleRadarRenderer {
float highValue = e.getHigh() * mAnimator.getPhaseY();
float y = (lowValue + highValue) / 2f;
MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelsForValues(e.getX(), y);
MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(e.getX(), y);
high.setDraw((float) pix.x, (float) pix.y);

View file

@ -668,7 +668,7 @@ public class LineChartRenderer extends LineRadarRenderer {
if (!isInBoundsX(e, set))
continue;
MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelsForValues(e.getX(), e.getY() * mAnimator
MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(e.getX(), e.getY() * mAnimator
.getPhaseY());
high.setDraw((float) pix.x, (float) pix.y);

View file

@ -148,7 +148,7 @@ public class ScatterChartRenderer extends LineScatterCandleRadarRenderer {
if (!isInBoundsX(e, set))
continue;
MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelsForValues(e.getX(), e.getY() * mAnimator
MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(e.getX(), e.getY() * mAnimator
.getPhaseY());
high.setDraw((float) pix.x, (float) pix.y);

View file

@ -203,7 +203,7 @@ public class YAxisRenderer extends AxisRenderer {
protected void drawZeroLine(Canvas c) {
// draw zero line
MPPointD pos = mTrans.getPixelsForValues(0f, 0f);
MPPointD pos = mTrans.getPixelForValues(0f, 0f);
mZeroLinePaint.setColor(mYAxis.getZeroLineColor());
mZeroLinePaint.setStrokeWidth(mYAxis.getZeroLineWidth());

View file

@ -179,7 +179,7 @@ public class YAxisRendererHorizontalBarChart extends YAxisRenderer {
protected void drawZeroLine(Canvas c) {
// draw zero line
MPPointD pos = mTrans.getPixelsForValues(0f, 0f);
MPPointD pos = mTrans.getPixelForValues(0f, 0f);
mZeroLinePaint.setColor(mYAxis.getZeroLineColor());
mZeroLinePaint.setStrokeWidth(mYAxis.getZeroLineWidth());

View file

@ -353,7 +353,7 @@ public class Transformer {
m.mapRect(rects.get(i));
}
protected Matrix mPixelsToValueMatrixBuffer = new Matrix();
protected Matrix mPixelToValueMatrixBuffer = new Matrix();
/**
* Transforms the given array of touch positions (pixels) (x, y, x, y, ...)
@ -363,7 +363,7 @@ public class Transformer {
*/
public void pixelsToValue(float[] pixels) {
Matrix tmp = mPixelsToValueMatrixBuffer;
Matrix tmp = mPixelToValueMatrixBuffer;
tmp.reset();
// invert all matrixes to convert back to the original value
@ -387,7 +387,7 @@ public class Transformer {
* returns the x and y values in the chart at the given touch point
* (encapsulated in a MPPointD). This method transforms pixel coordinates to
* coordinates / values in the chart. This is the opposite method to
* getPixelsForValues(...).
* getPixelForValues(...).
*
* @param x
* @param y
@ -419,7 +419,7 @@ public class Transformer {
* @param y
* @return
*/
public MPPointD getPixelsForValues(float x, float y) {
public MPPointD getPixelForValues(float x, float y) {
ptsBuffer[0] = x;
ptsBuffer[1] = y;