Search in sources :

Example 6 with ScatterData

use of com.github.mikephil.charting.data.ScatterData in project MPAndroidChart by PhilJay.

the class ScatterChartRenderer method drawHighlighted.

@Override
public void drawHighlighted(Canvas c, Highlight[] indices) {
    ScatterData scatterData = mChart.getScatterData();
    for (Highlight high : indices) {
        IScatterDataSet set = scatterData.getDataSetByIndex(high.getDataSetIndex());
        if (set == null || !set.isHighlightEnabled())
            continue;
        final 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());
        high.setDraw((float) pix.x, (float) pix.y);
        // draw the lines
        drawHighlightLines(c, (float) pix.x, (float) pix.y, set);
    }
}
Also used : Entry(com.github.mikephil.charting.data.Entry) Highlight(com.github.mikephil.charting.highlight.Highlight) IScatterDataSet(com.github.mikephil.charting.interfaces.datasets.IScatterDataSet) MPPointD(com.github.mikephil.charting.utils.MPPointD) ScatterData(com.github.mikephil.charting.data.ScatterData)

Aggregations

ScatterData (com.github.mikephil.charting.data.ScatterData)6 Entry (com.github.mikephil.charting.data.Entry)5 ArrayList (java.util.ArrayList)5 ScatterDataSet (com.github.mikephil.charting.data.ScatterDataSet)4 IScatterDataSet (com.github.mikephil.charting.interfaces.datasets.IScatterDataSet)4 BarEntry (com.github.mikephil.charting.data.BarEntry)2 BubbleEntry (com.github.mikephil.charting.data.BubbleEntry)1 CandleEntry (com.github.mikephil.charting.data.CandleEntry)1 LineData (com.github.mikephil.charting.data.LineData)1 LineDataSet (com.github.mikephil.charting.data.LineDataSet)1 PieEntry (com.github.mikephil.charting.data.PieEntry)1 RealmScatterDataSet (com.github.mikephil.charting.data.realm.implementation.RealmScatterDataSet)1 Highlight (com.github.mikephil.charting.highlight.Highlight)1 MPPointD (com.github.mikephil.charting.utils.MPPointD)1 CustomScatterShapeRenderer (com.xxmassdeveloper.mpchartexample.custom.CustomScatterShapeRenderer)1 RealmDemoData (com.xxmassdeveloper.mpchartexample.custom.RealmDemoData)1 Test (org.junit.Test)1