Search in sources :

Example 36 with BarEntry

use of com.github.mikephil.charting.data.BarEntry 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

BarEntry (com.github.mikephil.charting.data.BarEntry)36 ArrayList (java.util.ArrayList)23 BarData (com.github.mikephil.charting.data.BarData)22 BarDataSet (com.github.mikephil.charting.data.BarDataSet)20 IBarDataSet (com.github.mikephil.charting.interfaces.datasets.IBarDataSet)14 Entry (com.github.mikephil.charting.data.Entry)5 Transformer (com.github.mikephil.charting.utils.Transformer)5 BufferedReader (java.io.BufferedReader)5 IOException (java.io.IOException)5 Paint (android.graphics.Paint)4 BarBuffer (com.github.mikephil.charting.buffer.BarBuffer)4 IAxisValueFormatter (com.github.mikephil.charting.formatter.IAxisValueFormatter)3 InputStreamReader (java.io.InputStreamReader)3 SuppressLint (android.annotation.SuppressLint)2 Drawable (android.graphics.drawable.Drawable)2 HorizontalBarBuffer (com.github.mikephil.charting.buffer.HorizontalBarBuffer)2 IValueFormatter (com.github.mikephil.charting.formatter.IValueFormatter)2 MPPointF (com.github.mikephil.charting.utils.MPPointF)2 File (java.io.File)2 FileReader (java.io.FileReader)2