Java Code Examples for com.github.mikephil.charting.components.YAxis#AxisDependency
The following examples show how to use
com.github.mikephil.charting.components.YAxis#AxisDependency .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChartHighlighter.java From android-kline with Apache License 2.0 | 6 votes |
/** * Returns the Highlight of the DataSet that contains the closest value on the * y-axis. * * @param closestValues contains two Highlight objects per DataSet closest to the selected x-position (determined by * rounding up an down) * @param x * @param y * @param axis the closest axis * @param minSelectionDistance * @return */ public Highlight getClosestHighlightByPixel(List<Highlight> closestValues, float x, float y, YAxis.AxisDependency axis, float minSelectionDistance) { Highlight closest = null; float distance = minSelectionDistance; for (int i = 0; i < closestValues.size(); i++) { Highlight high = closestValues.get(i); if (axis == null || high.getAxis() == axis) { float cDistance = getDistance(x, y, high.getXPx(), high.getYPx()); if (cDistance < distance) { closest = high; distance = cDistance; } } } return closest; }
Example 2
Source File: ZoomJob.java From StockChart-MPAndroidChart with MIT License | 5 votes |
public static ZoomJob getInstance(ViewPortHandler viewPortHandler, float scaleX, float scaleY, float xValue, float yValue, Transformer trans, YAxis.AxisDependency axis, View v) { ZoomJob result = pool.get(); result.xValue = xValue; result.yValue = yValue; result.scaleX = scaleX; result.scaleY = scaleY; result.mViewPortHandler = viewPortHandler; result.mTrans = trans; result.axisDependency = axis; result.view = v; return result; }
Example 3
Source File: ZoomJob.java From Ticket-Analysis with MIT License | 5 votes |
public ZoomJob(ViewPortHandler viewPortHandler, float scaleX, float scaleY, float xValue, float yValue, Transformer trans, YAxis.AxisDependency axis, View v) { super(viewPortHandler, xValue, yValue, trans, v); this.scaleX = scaleX; this.scaleY = scaleY; this.axisDependency = axis; }
Example 4
Source File: Highlight.java From StockChart-MPAndroidChart with MIT License | 5 votes |
/** * constructor * * @param x the x-value of the highlighted value * @param y the y-value of the highlighted value * @param dataSetIndex the index of the DataSet the highlighted value belongs to */ public Highlight(float x, float y, float xPx, float yPx, int dataSetIndex, YAxis.AxisDependency axis) { this.mX = x; this.mY = y; this.mXPx = xPx; this.mYPx = yPx; this.mDataSetIndex = dataSetIndex; this.axis = axis; }
Example 5
Source File: Highlight.java From android-kline with Apache License 2.0 | 5 votes |
/** * constructor * * @param x the x-value of the highlighted value * @param y the y-value of the highlighted value * @param dataSetIndex the index of the DataSet the highlighted value belongs to */ public Highlight(float x, float y, float xPx, float yPx, int dataSetIndex, YAxis.AxisDependency axis) { this.mX = x; this.mY = y; this.mXPx = xPx; this.mYPx = yPx; this.mDataSetIndex = dataSetIndex; this.axis = axis; }
Example 6
Source File: ZoomJob.java From NetKnight with Apache License 2.0 | 5 votes |
public ZoomJob(ViewPortHandler viewPortHandler, float scaleX, float scaleY, float xValue, float yValue, Transformer trans, YAxis.AxisDependency axis, View v) { super(viewPortHandler, xValue, yValue, trans, v); this.scaleX = scaleX; this.scaleY = scaleY; this.axisDependency = axis; }
Example 7
Source File: ZoomJob.java From Ticket-Analysis with MIT License | 5 votes |
public static ZoomJob getInstance(ViewPortHandler viewPortHandler, float scaleX, float scaleY, float xValue, float yValue, Transformer trans, YAxis.AxisDependency axis, View v) { ZoomJob result = pool.get(); result.xValue = xValue; result.yValue = yValue; result.scaleX = scaleX; result.scaleY = scaleY; result.mViewPortHandler = viewPortHandler; result.mTrans = trans; result.axisDependency = axis; result.view = v; return result; }
Example 8
Source File: YAxisRendererCurrentDay.java From shinny-futures-android with GNU General Public License v3.0 | 5 votes |
@Override public void renderAxisLabels(Canvas c) { if (!mYAxis.isEnabled() || !mYAxis.isDrawLabelsEnabled()) return; float[] positions = getTransformedPositions(); mAxisLabelPaint.setTypeface(mYAxis.getTypeface()); mAxisLabelPaint.setTextSize(mYAxis.getTextSize()); mAxisLabelPaint.setColor(mYAxis.getTextColor()); float yoffset = Utils.calcTextHeight(mAxisLabelPaint, "A") / 2.5f + mYAxis.getYOffset(); YAxis.AxisDependency dependency = mYAxis.getAxisDependency(); YAxis.YAxisLabelPosition labelPosition = mYAxis.getLabelPosition(); float xPos; if (dependency == YAxis.AxisDependency.LEFT) { if (labelPosition == YAxis.YAxisLabelPosition.OUTSIDE_CHART) { mAxisLabelPaint.setTextAlign(Paint.Align.RIGHT); } else { mAxisLabelPaint.setTextAlign(Paint.Align.LEFT); } xPos = mViewPortHandler.offsetLeft(); } else { if (labelPosition == YAxis.YAxisLabelPosition.OUTSIDE_CHART) { mAxisLabelPaint.setTextAlign(Paint.Align.LEFT); } else { mAxisLabelPaint.setTextAlign(Paint.Align.RIGHT); } xPos = mViewPortHandler.contentRight(); } drawYLabels(c, xPos, positions, yoffset); }
Example 9
Source File: BaseDataSet.java From StockChart-MPAndroidChart with MIT License | 4 votes |
@Override public void setAxisDependency(YAxis.AxisDependency dependency) { mAxisDependency = dependency; }
Example 10
Source File: BaseDataSet.java From StockChart-MPAndroidChart with MIT License | 4 votes |
@Override public YAxis.AxisDependency getAxisDependency() { return mAxisDependency; }
Example 11
Source File: CombinedChartKline.java From shinny-futures-android with GNU General Public License v3.0 | 4 votes |
@Override public MyTransformer getTransformer(YAxis.AxisDependency which) { return (MyTransformer) super.getTransformer(which); }
Example 12
Source File: BaseDataSet.java From NetKnight with Apache License 2.0 | 4 votes |
@Override public void setAxisDependency(YAxis.AxisDependency dependency) { mAxisDependency = dependency; }
Example 13
Source File: ChartHighlighter.java From android-kline with Apache License 2.0 | 4 votes |
/** * Returns the corresponding Highlight for a given xVal and x- and y-touch position in pixels. * * @param xVal * @param x * @param y * @return */ protected Highlight getHighlightForX(float xVal, float x, float y) { List<Highlight> closestValues = getHighlightsAtXValue(xVal, x, y); if(closestValues.isEmpty()) { return null; } float leftAxisMinDist = getMinimumDistance(closestValues, y, YAxis.AxisDependency.LEFT); float rightAxisMinDist = getMinimumDistance(closestValues, y, YAxis.AxisDependency.RIGHT); YAxis.AxisDependency axis = leftAxisMinDist < rightAxisMinDist ? YAxis.AxisDependency.LEFT : YAxis.AxisDependency.RIGHT; Highlight detail = getClosestHighlightByPixel(closestValues, x, y, axis, mChart.getMaxHighlightDistance()); return detail; }
Example 14
Source File: ChartHighlighter.java From NetKnight with Apache License 2.0 | 3 votes |
/** * Returns the corresponding SelectionDetail for a given xIndex and y-touch position in pixels. * * @param xIndex * @param y * @param dataSetIndex * @return */ protected SelectionDetail getSelectionDetail(int xIndex, float y, int dataSetIndex) { List<SelectionDetail> valsAtIndex = getSelectionDetailsAtIndex(xIndex, dataSetIndex); float leftdist = Utils.getMinimumDistance(valsAtIndex, y, YAxis.AxisDependency.LEFT); float rightdist = Utils.getMinimumDistance(valsAtIndex, y, YAxis.AxisDependency.RIGHT); YAxis.AxisDependency axis = leftdist < rightdist ? YAxis.AxisDependency.LEFT : YAxis.AxisDependency.RIGHT; SelectionDetail detail = Utils.getClosestSelectionDetailByPixelY(valsAtIndex, y, axis); return detail; }
Example 15
Source File: Highlight.java From android-kline with Apache License 2.0 | 2 votes |
/** * Returns the axis the highlighted value belongs to. * * @return */ public YAxis.AxisDependency getAxis() { return axis; }
Example 16
Source File: Highlight.java From StockChart-MPAndroidChart with MIT License | 2 votes |
/** * Constructor, only used for stacked-barchart. * * @param x the index of the highlighted value on the x-axis * @param y the y-value of the highlighted value * @param dataSetIndex the index of the DataSet the highlighted value belongs to * @param stackIndex references which value of a stacked-bar entry has been * selected */ public Highlight(float x, float y, float xPx, float yPx, int dataSetIndex, int stackIndex, YAxis.AxisDependency axis) { this(x, y, xPx, yPx, dataSetIndex, axis); this.mStackIndex = stackIndex; }
Example 17
Source File: IDataSet.java From Stayfit with Apache License 2.0 | 2 votes |
/** * Returns the axis this DataSet should be plotted against. * * @return */ YAxis.AxisDependency getAxisDependency();
Example 18
Source File: LineDataProvider.java From StockChart-MPAndroidChart with MIT License | votes |
YAxis getAxis(YAxis.AxisDependency dependency);
Example 19
Source File: LineDataProvider.java From iMoney with Apache License 2.0 | votes |
YAxis getAxis(YAxis.AxisDependency dependency);
Example 20
Source File: LineDataProvider.java From Stayfit with Apache License 2.0 | votes |
YAxis getAxis(YAxis.AxisDependency dependency);