Java Code Examples for com.github.mikephil.charting.highlight.Highlight#getDrawY()
The following examples show how to use
com.github.mikephil.charting.highlight.Highlight#getDrawY() .
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: MyCandleStickChartRenderer.java From shinny-futures-android with GNU General Public License v3.0 | 5 votes |
@Override public void drawHighlighted(Canvas c, Highlight[] indices) { CandleData candleData = mChart.getCandleData(); for (Highlight high : indices) { ICandleDataSet set = candleData.getDataSetByIndex(high.getDataSetIndex()); if (set == null || !set.isHighlightEnabled()) continue; CandleEntry e = set.getEntryForXValue(high.getX(), high.getY()); if (!isInBoundsX(e, set)) continue; float lowValue = e.getLow() * mAnimator.getPhaseY(); float highValue = e.getHigh() * mAnimator.getPhaseY(); MPPointD pix = mChart.getTransformer(set.getAxisDependency()) .getPixelForValues(e.getX(), (lowValue + highValue) / 2f); float xp = (float) pix.x; mHighlightPaint.setColor(set.getHighLightColor()); mHighlightPaint.setStrokeWidth(set.getHighlightLineWidth()); float xMax = mViewPortHandler.contentRight(); float contentBottom = mViewPortHandler.contentBottom(); //绘制竖线 c.drawLine(xp, 1, xp, mChart.getHeight(), mHighlightPaint); //判断是否画横线 float y = high.getDrawY(); if (y >= 0 && y <= contentBottom) {//在区域内即绘制横线 //绘制横线 c.drawLine(0, y, xMax, y, mHighlightPaint); } } }
Example 2
Source File: MyBarChartRenderer.java From shinny-futures-android with GNU General Public License v3.0 | 5 votes |
@Override public void drawHighlighted(Canvas c, Highlight[] indices) { BarData barData = mChart.getBarData(); for (Highlight high : indices) { IBarDataSet set = barData.getDataSetByIndex(high.getDataSetIndex()); if (set == null || !set.isHighlightEnabled()) continue; BarEntry e = set.getEntryForXValue(high.getX(), high.getY()); if (!isInBoundsX(e, set)) continue; mHighlightPaint.setColor(set.getHighLightColor()); //保持和顶层图的十字光标一致 //mHighlightPaint.setAlpha(set.getHighLightAlpha()); float barWidth = barData.getBarWidth(); Transformer trans = mChart.getTransformer(set.getAxisDependency()); prepareBarHighlight(e.getX(), 0, 0, barWidth / 2, trans); //画竖线 float xp = mBarRect.centerX(); c.drawLine(xp, mViewPortHandler.getContentRect().bottom, xp, 0, mHighlightPaint); //判断是否画横线 float y = high.getDrawY(); float yMax = mChart.getHeight(); float xMax = mChart.getWidth(); if (y >= 0 && y <= yMax) {//在区域内即绘制横线 //绘制横线 c.drawLine(0, y, xMax, y, mHighlightPaint); } } }
Example 3
Source File: MyLineChartRenderer.java From shinny-futures-android with GNU General Public License v3.0 | 5 votes |
@Override public void drawHighlighted(Canvas c, Highlight[] indices) { LineData lineData = mChart.getLineData(); for (Highlight high : indices) { ILineDataSet set = lineData.getDataSetByIndex(high.getDataSetIndex()); if (set == null || !set.isHighlightEnabled()) continue; Entry e = set.getEntryForXValue(high.getX(), high.getY()); if (!isInBoundsX(e, set)) continue; MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(e.getX(), e.getY() * mAnimator.getPhaseY()); float xp = (float) pix.x; mHighlightPaint.setColor(set.getHighLightColor()); mHighlightPaint.setStrokeWidth(set.getHighlightLineWidth()); float xMax = mViewPortHandler.contentRight(); //绘制竖线 c.drawLine(xp, 1, xp, mChart.getHeight(), mHighlightPaint); //判断是否画横线 float y = high.getDrawY(); if (y >= 0 && y <= mViewPortHandler.contentBottom()) {//在区域内即绘制横线 //绘制横线 c.drawLine(0, y, xMax, y, mHighlightPaint); } } }
Example 4
Source File: HorizontalBarChart.java From StockChart-MPAndroidChart with MIT License | 4 votes |
@Override protected float[] getMarkerPosition(Highlight high) { return new float[]{high.getDrawY(), high.getDrawX()}; }
Example 5
Source File: HorizontalBarChart.java From Ticket-Analysis with MIT License | 4 votes |
@Override protected float[] getMarkerPosition(Highlight high) { return new float[]{high.getDrawY(), high.getDrawX()}; }
Example 6
Source File: HorizontalBarChart.java From android-kline with Apache License 2.0 | 4 votes |
@Override protected float[] getMarkerPosition(Highlight high) { return new float[]{high.getDrawY(), high.getDrawX()}; }
Example 7
Source File: Chart.java From StockChart-MPAndroidChart with MIT License | 2 votes |
/** * Returns the actual position in pixels of the MarkerView for the given * Highlight object. * * @param high * @return */ protected float[] getMarkerPosition(Highlight high) { return new float[]{high.getDrawX(), high.getDrawY()}; }
Example 8
Source File: Chart.java From Ticket-Analysis with MIT License | 2 votes |
/** * Returns the actual position in pixels of the MarkerView for the given * Highlight object. * * @param high * @return */ protected float[] getMarkerPosition(Highlight high) { return new float[]{high.getDrawX(), high.getDrawY()}; }
Example 9
Source File: Chart.java From android-kline with Apache License 2.0 | 2 votes |
/** * Returns the actual position in pixels of the MarkerView for the given * Highlight object. * * @param high * @return */ protected float[] getMarkerPosition(Highlight high) { return new float[]{high.getDrawX(), high.getDrawY()}; }