@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; mHighlightPaint.setColor(set.getHighLightColor()); 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 min = mChart.getYChartMin(); float max = mChart.getYChartMax(); float[] vertPts = new float[] { xIndex - 0.5f, max, xIndex - 0.5f, min, xIndex + 0.5f, max, xIndex + 0.5f, min }; float[] horPts = new float[] { mChart.getXChartMin(), low, mChart.getXChartMax(), low, mChart.getXChartMin(), high, mChart.getXChartMax(), high }; mChart.getTransformer(set.getAxisDependency()).pointValuesToPixel(vertPts); mChart.getTransformer(set.getAxisDependency()).pointValuesToPixel(horPts); // draw the vertical highlight lines c.drawLines(vertPts, mHighlightPaint); // draw the horizontal highlight lines c.drawLines(horPts, mHighlightPaint); } }