Search in sources :

Example 1 with DataPoint

use of com.jjoe64.graphview.series.DataPoint in project SR-Tracker-for-Overwatch by Rexios80.

the class AnalysisFragment method refresh.

public void refresh() {
    parser = new DatabaseParser(getContext());
    // The 10's skip over placement matches in the lists
    ArrayList<Integer> srs = parser.getSRs();
    DataPoint[] dpSRs = new DataPoint[srs.size() - 10];
    for (int i = 10; i < srs.size(); i++) dpSRs[i - 10] = new DataPoint(i - 10, srs.get(i));
    // The 11's skip the placements and initial sr
    ArrayList<Integer> winStreaks = parser.getWinStreaks();
    ArrayList<Integer> lossStreaks = parser.getLossStreaks();
    DataPoint[] dpWinStreaks = new DataPoint[winStreaks.size()];
    DataPoint[] dpLossStreaks = new DataPoint[lossStreaks.size()];
    for (int i = 0; i < winStreaks.size(); i++) {
        dpWinStreaks[i] = new DataPoint(i, winStreaks.get(i));
    }
    for (int i = 0; i < lossStreaks.size(); i++) dpLossStreaks[i] = new DataPoint(i, lossStreaks.get(i));
    srGraph.getViewport().setMaxX(srs.size() - 10);
    srSeries.resetData(dpSRs);
    streakGraph.getViewport().setMaxX(winStreaks.size());
    streakGraph.getGridLabelRenderer().setNumVerticalLabels(parser.getLongestStreak() + 1);
    winStreakSeries.resetData(dpWinStreaks);
    lossStreakSeries.resetData(dpLossStreaks);
}
Also used : DataPoint(com.jjoe64.graphview.series.DataPoint) DataPoint(com.jjoe64.graphview.series.DataPoint)

Aggregations

DataPoint (com.jjoe64.graphview.series.DataPoint)1