Search in sources :

Example 21 with IBarDataSet

use of com.github.mikephil.charting.interfaces.datasets.IBarDataSet in project MPAndroidChart by PhilJay.

the class BarHighlighter method getHighlight.

@Override
public Highlight getHighlight(float x, float y) {
    Highlight high = super.getHighlight(x, y);
    if (high == null) {
        return null;
    }
    MPPointD pos = getValsForTouch(x, y);
    BarData barData = mChart.getBarData();
    IBarDataSet set = barData.getDataSetByIndex(high.getDataSetIndex());
    if (set.isStacked()) {
        return getStackedHighlight(high, set, (float) pos.x, (float) pos.y);
    }
    MPPointD.recycleInstance(pos);
    return high;
}
Also used : BarData(com.github.mikephil.charting.data.BarData) IBarDataSet(com.github.mikephil.charting.interfaces.datasets.IBarDataSet) MPPointD(com.github.mikephil.charting.utils.MPPointD)

Example 22 with IBarDataSet

use of com.github.mikephil.charting.interfaces.datasets.IBarDataSet in project LeMondeRssReader by MBach.

the class GraphExtractor method generate.

Object generate() {
    BarChart barChart = new BarChart(context);
    List<BarEntry> yVals1 = new ArrayList<>();
    for (int i = 0; i < 30; i++) {
        float mult = 5;
        float val = (float) (Math.random() * mult);
        yVals1.add(new BarEntry(i, val));
    }
    BarDataSet set1 = new BarDataSet(yVals1, "The year 2017");
    List<IBarDataSet> dataSets = new ArrayList<>();
    dataSets.add(set1);
    BarData barData = new BarData(dataSets);
    barChart.setData(barData);
    return barChart;
}
Also used : BarDataSet(com.github.mikephil.charting.data.BarDataSet) IBarDataSet(com.github.mikephil.charting.interfaces.datasets.IBarDataSet) BarData(com.github.mikephil.charting.data.BarData) IBarDataSet(com.github.mikephil.charting.interfaces.datasets.IBarDataSet) BarChart(com.github.mikephil.charting.charts.BarChart) ArrayList(java.util.ArrayList) BarEntry(com.github.mikephil.charting.data.BarEntry)

Aggregations

IBarDataSet (com.github.mikephil.charting.interfaces.datasets.IBarDataSet)22 BarData (com.github.mikephil.charting.data.BarData)16 BarEntry (com.github.mikephil.charting.data.BarEntry)11 ArrayList (java.util.ArrayList)11 BarDataSet (com.github.mikephil.charting.data.BarDataSet)8 Paint (android.graphics.Paint)3 BarBuffer (com.github.mikephil.charting.buffer.BarBuffer)3 RealmBarDataSet (com.github.mikephil.charting.data.realm.implementation.RealmBarDataSet)3 Transformer (com.github.mikephil.charting.utils.Transformer)3 SuppressLint (android.annotation.SuppressLint)2 RectF (android.graphics.RectF)2 Drawable (android.graphics.drawable.Drawable)2 HorizontalBarBuffer (com.github.mikephil.charting.buffer.HorizontalBarBuffer)2 LineData (com.github.mikephil.charting.data.LineData)2 IAxisValueFormatter (com.github.mikephil.charting.formatter.IAxisValueFormatter)2 MPPointD (com.github.mikephil.charting.utils.MPPointD)2 MPPointF (com.github.mikephil.charting.utils.MPPointF)2 RealmDemoData (com.xxmassdeveloper.mpchartexample.custom.RealmDemoData)2 Typeface (android.graphics.Typeface)1 BarChart (com.github.mikephil.charting.charts.BarChart)1