Java Code Examples for com.github.mikephil.charting.data.CandleEntry#getXIndex()
The following examples show how to use
com.github.mikephil.charting.data.CandleEntry#getXIndex() .
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: CandleStickChart.java From Notification-Analyser with MIT License | 5 votes |
/** * Transforms the values of an entry in order to draw the candle-body. * * @param bodyPoints * @param e * @param bodySpace */ private void transformBody(float[] bodyPoints, CandleEntry e, float bodySpace) { bodyPoints[0] = e.getXIndex() + bodySpace; bodyPoints[1] = e.getClose() * mPhaseY; bodyPoints[2] = e.getXIndex() + (1f - bodySpace); bodyPoints[3] = e.getOpen() * mPhaseY; transformPointArray(bodyPoints); }
Example 2
Source File: CandleStickChart.java From Notification-Analyser with MIT License | 5 votes |
/** * Transforms the values of an entry in order to draw the candle-shadow. * * @param shadowPoints * @param e */ private void transformShadow(float[] shadowPoints, CandleEntry e) { shadowPoints[0] = e.getXIndex() + 0.5f; shadowPoints[1] = e.getHigh() * mPhaseY; shadowPoints[2] = e.getXIndex() + 0.5f; shadowPoints[3] = e.getLow() * mPhaseY; transformPointArray(shadowPoints); }
Example 3
Source File: Transformer.java From iMoney with Apache License 2.0 | 4 votes |
/** * Transforms an List of Entry into a float array containing the x and * y values transformed with all matrices for the CANDLESTICKCHART. * * @param entries * @return */ public float[] generateTransformedValuesCandle(List<CandleEntry> entries, float phaseX, float phaseY, int from, int to) { final int count = (int)Math.ceil((to - from) * phaseX) * 2; float[] valuePoints = new float[count]; for (int j = 0; j < count; j += 2) { CandleEntry e = entries.get(j / 2 + from); if (e != null) { valuePoints[j] = e.getXIndex(); valuePoints[j + 1] = e.getHigh() * phaseY; } } getValueToPixelMatrix().mapPoints(valuePoints); return valuePoints; }
Example 4
Source File: Transformer.java From Stayfit with Apache License 2.0 | 4 votes |
/** * Transforms an List of Entry into a float array containing the x and * y values transformed with all matrices for the CANDLESTICKCHART. * * @param data * @return */ public float[] generateTransformedValuesCandle(ICandleDataSet data, float phaseX, float phaseY, int from, int to) { final int count = (int) Math.ceil((to - from) * phaseX) * 2; float[] valuePoints = new float[count]; for (int j = 0; j < count; j += 2) { CandleEntry e = data.getEntryForIndex(j / 2 + from); if (e != null) { valuePoints[j] = e.getXIndex(); valuePoints[j + 1] = e.getHigh() * phaseY; } } getValueToPixelMatrix().mapPoints(valuePoints); return valuePoints; }
Example 5
Source File: CandleStickChartRenderer.java From NetKnight with Apache License 2.0 | 4 votes |
@Override public void drawHighlighted(Canvas c, Highlight[] indices) { CandleData candleData = mChart.getCandleData(); for (Highlight high : indices) { final int minDataSetIndex = high.getDataSetIndex() == -1 ? 0 : high.getDataSetIndex(); final int maxDataSetIndex = high.getDataSetIndex() == -1 ? candleData.getDataSetCount() : (high.getDataSetIndex() + 1); if (maxDataSetIndex - minDataSetIndex < 1) continue; for (int dataSetIndex = minDataSetIndex; dataSetIndex < maxDataSetIndex; dataSetIndex++) { int xIndex = high.getXIndex(); // get the // x-position ICandleDataSet set = mChart.getCandleData().getDataSetByIndex(dataSetIndex); if (set == null || !set.isHighlightEnabled()) continue; CandleEntry e = set.getEntryForXIndex(xIndex); if (e == null || e.getXIndex() != xIndex) continue; float lowValue = e.getLow() * mAnimator.getPhaseY(); float highValue = e.getHigh() * mAnimator.getPhaseY(); float y = (lowValue + highValue) / 2f; float[] pts = new float[]{ xIndex, y }; mChart.getTransformer(set.getAxisDependency()).pointValuesToPixel(pts); // draw the lines drawHighlightLines(c, pts, set); } } }
Example 6
Source File: Transformer.java From NetKnight with Apache License 2.0 | 4 votes |
/** * Transforms an List of Entry into a float array containing the x and * y values transformed with all matrices for the CANDLESTICKCHART. * * @param data * @return */ public float[] generateTransformedValuesCandle(ICandleDataSet data, float phaseX, float phaseY, int from, int to) { final int count = (int) Math.ceil((to - from) * phaseX) * 2; float[] valuePoints = new float[count]; for (int j = 0; j < count; j += 2) { CandleEntry e = data.getEntryForIndex(j / 2 + from); if (e != null) { valuePoints[j] = e.getXIndex(); valuePoints[j + 1] = e.getHigh() * phaseY; } } getValueToPixelMatrix().mapPoints(valuePoints); return valuePoints; }
Example 7
Source File: CandleStickChartRenderer.java From iMoney with Apache License 2.0 | 3 votes |
@Override public void drawHighlighted(Canvas c, Highlight[] indices) { for (int i = 0; i < indices.length; i++) { int xIndex = indices[i].getXIndex(); // get the // x-position CandleDataSet set = mChart.getCandleData().getDataSetByIndex( indices[i].getDataSetIndex()); if (set == null || !set.isHighlightEnabled()) continue; CandleEntry e = set.getEntryForXIndex(xIndex); if (e == null || e.getXIndex() != xIndex) continue; float low = e.getLow() * mAnimator.getPhaseY(); float high = e.getHigh() * mAnimator.getPhaseY(); float y = (low + high) / 2f; float min = mChart.getYChartMin(); float max = mChart.getYChartMax(); float[] pts = new float[] { xIndex, y }; mChart.getTransformer(set.getAxisDependency()).pointValuesToPixel(pts); // draw the lines drawHighlightLines(c, pts, set); } }
Example 8
Source File: CandleStickChartRenderer.java From Stayfit with Apache License 2.0 | 3 votes |
@Override public void drawHighlighted(Canvas c, Highlight[] indices) { for (int i = 0; i < indices.length; i++) { int xIndex = indices[i].getXIndex(); // get the // x-position ICandleDataSet set = mChart.getCandleData().getDataSetByIndex( indices[i].getDataSetIndex()); if (set == null || !set.isHighlightEnabled()) continue; CandleEntry e = set.getEntryForXIndex(xIndex); if (e == null || e.getXIndex() != xIndex) continue; float low = e.getLow() * mAnimator.getPhaseY(); float high = e.getHigh() * mAnimator.getPhaseY(); float y = (low + high) / 2f; float min = mChart.getYChartMin(); float max = mChart.getYChartMax(); float[] pts = new float[]{ xIndex, y }; mChart.getTransformer(set.getAxisDependency()).pointValuesToPixel(pts); // draw the lines drawHighlightLines(c, pts, set); } }