lecho.lib.hellocharts.model.Line.setPointRadius() - java examples

Here are the examples of the java api lecho.lib.hellocharts.model.Line.setPointRadius() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

30 Examples 7

17 View Complete Implementation : BgGraphBuilder.java
Copyright GNU General Public License v3.0
Author : jamorham
public Line rawInterpretedLine() {
    Line line = new Line(rawInterpretedValues);
    line.setHasLines(false);
    line.setPointRadius(1);
    line.setHasPoints(true);
    return line;
}

16 View Complete Implementation : BgGraphBuilder.java
Copyright GNU General Public License v3.0
Author : jamorham
public Line lowValuesLine() {
    Line lowValuesLine = new Line(lowValues);
    lowValuesLine.setColor(lowColor);
    lowValuesLine.setHasLines(false);
    lowValuesLine.setPointRadius(pointSize);
    lowValuesLine.setHasPoints(true);
    return lowValuesLine;
}

16 View Complete Implementation : BgGraphBuilder.java
Copyright GNU General Public License v3.0
Author : jamorham
public Line highValuesLine() {
    Line highValuesLine = new Line(highValues);
    highValuesLine.setColor(highColor);
    highValuesLine.setHasLines(false);
    highValuesLine.setPointRadius(pointSize);
    highValuesLine.setHasPoints(true);
    return highValuesLine;
}

16 View Complete Implementation : BgGraphBuilder.java
Copyright GNU General Public License v3.0
Author : StephenBlackWasAlreadyTaken
public Line inRangeValuesLine() {
    Line inRangeValuesLine = new Line(inRangeValues);
    inRangeValuesLine.setColor(midColor);
    if (singleLine) {
        inRangeValuesLine.setHasLines(true);
        inRangeValuesLine.setHasPoints(false);
        inRangeValuesLine.setStrokeWidth(pointSize);
    } else {
        inRangeValuesLine.setPointRadius(pointSize);
        inRangeValuesLine.setHasPoints(true);
        inRangeValuesLine.setHasLines(false);
    }
    return inRangeValuesLine;
}

15 View Complete Implementation : BgGraphBuilder.java
Copyright GNU General Public License v3.0
Author : jamorham
public Line lowValuesLine() {
    Line lowValuesLine = new Line(lowValues);
    lowValuesLine.setColor(Color.parseColor("#FF0000"));
    lowValuesLine.setHasLines(false);
    lowValuesLine.setPointRadius(pointSize);
    lowValuesLine.setHasPoints(true);
    return lowValuesLine;
}

15 View Complete Implementation : BgGraphBuilder.java
Copyright GNU General Public License v3.0
Author : jamorham
public Line inRangeValuesLine() {
    Line inRangeValuesLine = new Line(inRangeValues);
    inRangeValuesLine.setColor(Color.parseColor("#00FF00"));
    inRangeValuesLine.setHasLines(false);
    inRangeValuesLine.setPointRadius(pointSize);
    inRangeValuesLine.setHasPoints(true);
    return inRangeValuesLine;
}

15 View Complete Implementation : BgGraphBuilder.java
Copyright GNU General Public License v3.0
Author : jamorham
public Line highValuesLine() {
    Line highValuesLine = new Line(highValues);
    highValuesLine.setColor(Color.parseColor("#FFFF00"));
    highValuesLine.setHasLines(false);
    highValuesLine.setPointRadius(pointSize);
    highValuesLine.setHasPoints(true);
    return highValuesLine;
}

15 View Complete Implementation : BgGraphBuilder.java
Copyright GNU General Public License v3.0
Author : StephenBlackWasAlreadyTaken
public Line inRangeValuesLine() {
    Line inRangeValuesLine = new Line(inRangeValues);
    inRangeValuesLine.setColor(ChartUtils.COLOR_BLUE);
    inRangeValuesLine.setHasLines(false);
    inRangeValuesLine.setPointRadius(3);
    inRangeValuesLine.setHasPoints(true);
    return inRangeValuesLine;
}

15 View Complete Implementation : BgGraphBuilder.java
Copyright GNU General Public License v3.0
Author : StephenBlackWasAlreadyTaken
public Line highValuesLine() {
    Line highValuesLine = new Line(highValues);
    highValuesLine.setColor(ChartUtils.COLOR_ORANGE);
    highValuesLine.setHasLines(false);
    highValuesLine.setPointRadius(3);
    highValuesLine.setHasPoints(true);
    return highValuesLine;
}

15 View Complete Implementation : BgGraphBuilder.java
Copyright GNU General Public License v3.0
Author : StephenBlackWasAlreadyTaken
public Line lowValuesLine() {
    Line lowValuesLine = new Line(lowValues);
    lowValuesLine.setColor(Color.parseColor("#C30909"));
    lowValuesLine.setHasLines(false);
    lowValuesLine.setPointRadius(3);
    lowValuesLine.setHasPoints(true);
    return lowValuesLine;
}

14 View Complete Implementation : BgGraphBuilder.java
Copyright GNU General Public License v3.0
Author : jamorham
private Line inRangeValuesLine() {
    Line inRangeValuesLine = new Line(inRangeValues);
    inRangeValuesLine.setColor(midColor);
    // some problem with hellocharts at low resolutions maybe, but lines and cubic lines work so use those instead
    if (singleLine) {
        inRangeValuesLine.setPointRadius(pointSize);
        // maybe a bit horrible cpu wise but seems to remove artifacts in tests so far
        inRangeValuesLine.setCubic(true);
        inRangeValuesLine.setHasLines(true);
        inRangeValuesLine.setHasPoints(false);
        // or maybe should just be 4
        inRangeValuesLine.setStrokeWidth(pointSize * 2);
    } else {
        inRangeValuesLine.setPointRadius(pointSize);
        inRangeValuesLine.setHasPoints(true);
        inRangeValuesLine.setHasLines(false);
    }
    return inRangeValuesLine;
}

14 View Complete Implementation : BgGraphBuilder.java
Copyright GNU General Public License v3.0
Author : jamorham
public List<Line> extraLines() {
    final List<Line> lines = new ArrayList<>();
    Line bloodtest = new Line(bloodTestValues);
    bloodtest.setHasLines(false);
    // 3 / 2
    bloodtest.setPointRadius(pointSize * 5 / 3);
    bloodtest.setHasPoints(true);
    // ChartUtils.darkenColor(getCol(X.color_calibration_dot_background))
    bloodtest.setColor(highColor);
    bloodtest.setShape(ValueShape.SQUARE);
    lines.add(bloodtest);
    Line bloodtesti = new Line(bloodTestValues);
    bloodtesti.setHasLines(false);
    // 3 / 4
    bloodtesti.setPointRadius(pointSize * 5 / 4);
    bloodtesti.setHasPoints(true);
    // ChartUtils.darkenColor(getCol(X.color_calibration_dot_foreground))
    bloodtesti.setColor(lowColor);
    bloodtesti.setShape(ValueShape.SQUARE);
    lines.add(bloodtesti);
    return lines;
}

13 View Complete Implementation : BgGraphBuilder.java
Copyright GNU Affero General Public License v3.0
Author : MilosKozak
private Line bolusLine(float offset) {
    List<PointValue> pointValues = new ArrayList<PointValue>();
    for (BolusWatchData bwd : bolusWatchDataList) {
        if (bwd.date > start_time && bwd.date <= end_time && !bwd.isSMB && bwd.isValid && bwd.bolus > 0) {
            pointValues.add(new PointValue(fuzz(bwd.date), (float) offset - 2));
        }
    }
    Line line = new Line(pointValues);
    line.setColor(basalCenterColor);
    line.setHasLines(false);
    line.setPointRadius(pointSize * 2);
    line.setHasPoints(true);
    return line;
}

13 View Complete Implementation : BgGraphBuilder.java
Copyright GNU Affero General Public License v3.0
Author : MilosKozak
private Line smbLine(float offset) {
    List<PointValue> pointValues = new ArrayList<PointValue>();
    for (BolusWatchData bwd : bolusWatchDataList) {
        if (bwd.date > start_time && bwd.date <= end_time && bwd.isSMB && bwd.isValid && bwd.bolus > 0) {
            pointValues.add(new PointValue(fuzz(bwd.date), (float) offset - 2));
        }
    }
    Line line = new Line(pointValues);
    line.setColor(basalCenterColor);
    line.setHasLines(false);
    line.setPointRadius(pointSize);
    line.setHasPoints(true);
    return line;
}

13 View Complete Implementation : BgGraphBuilder.java
Copyright GNU Affero General Public License v3.0
Author : MilosKozak
private Line carbsLine(float offset) {
    List<PointValue> pointValues = new ArrayList<PointValue>();
    for (BolusWatchData bwd : bolusWatchDataList) {
        if (bwd.date > start_time && bwd.date <= end_time && !bwd.isSMB && bwd.isValid && bwd.carbs > 0) {
            pointValues.add(new PointValue(fuzz(bwd.date), (float) offset + 2));
        }
    }
    Line line = new Line(pointValues);
    line.setColor(carbsColor);
    line.setHasLines(false);
    line.setPointRadius(pointSize * 2);
    line.setHasPoints(true);
    return line;
}

13 View Complete Implementation : BgGraphBuilder.java
Copyright GNU Affero General Public License v3.0
Author : MilosKozak
private Line bolusInvalidLine(float offset) {
    List<PointValue> pointValues = new ArrayList<PointValue>();
    for (BolusWatchData bwd : bolusWatchDataList) {
        if (bwd.date > start_time && bwd.date <= end_time && !(bwd.isValid && (bwd.bolus > 0 || bwd.carbs > 0))) {
            pointValues.add(new PointValue(fuzz(bwd.date), (float) offset - 2));
        }
    }
    Line line = new Line(pointValues);
    line.setColor(bolusInvalidColor);
    line.setHasLines(false);
    line.setPointRadius(pointSize);
    line.setHasPoints(true);
    return line;
}

13 View Complete Implementation : BgGraph.java
Copyright GNU General Public License v3.0
Author : timomer
public Line openAPSPredictLine() {
    getOpenAPSPredictValues();
    Line openAPSPredictLine = new Line(openAPSPredictValue);
    ValueShape shape = ValueShape.DIAMOND;
    openAPSPredictLine.setColor(ChartUtils.COLOR_VIOLET);
    openAPSPredictLine.setHasLines(false);
    openAPSPredictLine.setPointRadius(3);
    openAPSPredictLine.setHasPoints(true);
    openAPSPredictLine.setCubic(true);
    openAPSPredictLine.setShape(shape);
    return openAPSPredictLine;
}

11 View Complete Implementation : IOBCOBLineGraph.java
Copyright GNU General Public License v3.0
Author : timomer
public Line iobFutureLine() {
    List<PointValue> listValues = new ArrayList<>();
    for (int c = 0; c < iobFutureValues.length(); c++) {
        try {
            if (iobFutureValues.getJSONObject(c).getDouble("iob") > yIOBMax) {
                // Do not go above Max IOB
                listValues.add(new PointValue((float) (iobFutureValues.getJSONObject(c).getDouble("as_of")), (float) fitIOB2COBRange(yIOBMax)));
            } else if (iobFutureValues.getJSONObject(c).getDouble("iob") < yIOBMin) {
                // Do not go below Min IOB
                listValues.add(new PointValue((float) (iobFutureValues.getJSONObject(c).getDouble("as_of")), (float) fitIOB2COBRange(yIOBMin)));
            } else {
                listValues.add(new PointValue((float) (iobFutureValues.getJSONObject(c).getDouble("as_of")), (float) fitIOB2COBRange(iobFutureValues.getJSONObject(c).getDouble("iob"))));
            }
        } catch (JSONException e) {
            Crashlytics.logException(e);
            e.printStackTrace();
        }
    }
    Line cobValuesLine = new Line(listValues);
    cobValuesLine.setColor(ChartUtils.COLOR_BLUE);
    cobValuesLine.setHasLines(false);
    cobValuesLine.setHasPoints(true);
    cobValuesLine.setFilled(false);
    cobValuesLine.setCubic(false);
    cobValuesLine.setPointRadius(2);
    return cobValuesLine;
}

11 View Complete Implementation : IOBCOBLineGraph.java
Copyright GNU General Public License v3.0
Author : timomer
public Line cobFutureLine() {
    List<PointValue> listValues = new ArrayList<>();
    for (int c = 0; c < cobFutureValues.length(); c++) {
        try {
            if (cobFutureValues.getJSONObject(c).getDouble("display") > yCOBMax) {
                // Do not go above Max COB
                listValues.add(new PointValue((float) (cobFutureValues.getJSONObject(c).getDouble("as_of")), (float) yCOBMax.floatValue()));
            } else if (cobFutureValues.getJSONObject(c).getDouble("display") < yCOBMin) {
                // Do not go below Min COB
                listValues.add(new PointValue((float) (cobFutureValues.getJSONObject(c).getDouble("as_of")), (float) yCOBMin.floatValue()));
            } else {
                listValues.add(new PointValue((float) (cobFutureValues.getJSONObject(c).getDouble("as_of")), (float) cobFutureValues.getJSONObject(c).getDouble("display")));
            }
        } catch (JSONException e) {
            e.printStackTrace();
            Crashlytics.logException(e);
        }
    }
    Line cobValuesLine = new Line(listValues);
    cobValuesLine.setColor(ChartUtils.COLOR_ORANGE);
    cobValuesLine.setHasLines(false);
    cobValuesLine.setHasPoints(true);
    cobValuesLine.setFilled(false);
    cobValuesLine.setCubic(false);
    cobValuesLine.setPointRadius(2);
    return cobValuesLine;
}

10 View Complete Implementation : BgGraphBuilder.java
Copyright GNU Affero General Public License v3.0
Author : MilosKozak
private void addPredictionLines(List<Line> lines) {
    Map<Integer, List<PointValue>> values = new HashMap<>();
    long endTime = getPredictionEndTime();
    for (BgWatchData bwd : predictionsList) {
        if (bwd.timestamp <= endTime) {
            double value = bwd.sgv < 300 ? bwd.sgv : 300;
            if (!values.containsKey(bwd.color)) {
                values.put(bwd.color, new ArrayList<>());
            }
            values.get(bwd.color).add(new PointValue(fuzz(bwd.timestamp), (float) value));
        }
    }
    for (Map.Entry<Integer, List<PointValue>> entry : values.entrySet()) {
        Line line = new Line(entry.getValue());
        line.setColor(entry.getKey());
        line.setHasLines(false);
        int size = pointSize / 2;
        size = (size > 0) ? size : 1;
        line.setPointRadius(size);
        line.setHasPoints(true);
        lines.add(line);
    }
}

10 View Complete Implementation : StatisticViewModel.java
Copyright GNU Affero General Public License v3.0
Author : Shouheng88
private Line getLine(List<Integer> lineStatistics, int color) {
    List<PointValue> values = new LinkedList<>();
    int length = lineStatistics.size();
    for (int j = 0; j < length; ++j) {
        values.add(new PointValue(j, lineStatistics.get(j)));
    }
    LogUtils.d("getLineChartData: " + lineStatistics);
    Line line = new Line(values);
    line.setColor(color);
    line.setShape(ValueShape.CIRCLE);
    line.setCubic(false);
    line.setFilled(true);
    line.setHasLabels(true);
    line.setHasLines(true);
    line.setHasPoints(true);
    line.setPointRadius(3);
    return line;
}

9 View Complete Implementation : StatisticViewModel.java
Copyright GNU Affero General Public License v3.0
Author : Shouheng88
private Line getLine(List<Integer> lineStatistics, int color) {
    List<PointValue> values = new LinkedList<>();
    int length = lineStatistics.size();
    for (int j = 0; j < length; ++j) {
        values.add(new PointValue(j, lineStatistics.get(j)));
    }
    LogUtils.d("getLineChartData: " + lineStatistics);
    Line line = new Line(values);
    line.setColor(color);
    line.setShape(ValueShape.CIRCLE);
    line.setCubic(false);
    line.setFilled(true);
    line.setHasLabels(true);
    line.setHasLines(true);
    line.setHasPoints(true);
    line.setPointRadius(2);
    line.setStrokeWidth(2);
    return line;
}

8 View Complete Implementation : BgGraphBuilder.java
Copyright GNU General Public License v3.0
Author : jamorham
// Produce an array of cubic lines, split as needed
public ArrayList<Line> filteredLines() {
    ArrayList<Line> line_array = new ArrayList<Line>();
    // bogus mark value
    float last_x_pos = -999999;
    // in minutes
    final float jump_threshold = 15;
    List<PointValue> local_points = new ArrayList<PointValue>();
    if (filteredValues.size() > 0) {
        final float end_marker = filteredValues.get(filteredValues.size() - 1).getX();
        for (PointValue current_point : filteredValues) {
            // a jump too far for a line? make it a new one
            if (((last_x_pos != -999999) && (Math.abs(current_point.getX() - last_x_pos) > jump_threshold)) || current_point.getX() == end_marker) {
                Line line = new Line(local_points);
                line.setHasPoints(true);
                line.setPointRadius(2);
                line.setStrokeWidth(1);
                line.setColor(Color.parseColor("#a0a0a0"));
                line.setCubic(true);
                line.setHasLines(true);
                line_array.add(line);
                local_points = new ArrayList<PointValue>();
            }
            last_x_pos = current_point.getX();
            // grow current line list
            local_points.add(current_point);
        }
    }
    return line_array;
}

7 View Complete Implementation : CalibrationGraph.java
Copyright GNU General Public License v3.0
Author : StephenBlackWasAlreadyTaken
@NonNull
public Line getCalibrationsLine(List<Calibration> calibrations, int color) {
    List<PointValue> values = new ArrayList<PointValue>();
    for (Calibration calibration : calibrations) {
        PointValue point = new PointValue((float) calibration.estimate_raw_at_time_of_calibration, (float) calibration.bg);
        String time = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(new Date((long) calibration.raw_timestamp));
        point.setLabel(time.toCharArray());
        values.add(point);
    }
    Line line = new Line(values);
    line.setColor(color);
    line.setHasLines(false);
    line.setPointRadius(4);
    line.setHasPoints(true);
    line.setHasLabels(true);
    return line;
}

6 View Complete Implementation : CalibrationGraph.java
Copyright GNU General Public License v3.0
Author : jamorham
@NonNull
public List<Line> getCalibrationsLine(List<Calibration> calibrations, int color) {
    if (calibrations == null)
        return new ArrayList<>();
    List<PointValue> values = new ArrayList<PointValue>();
    List<PointValue> valuesb = new ArrayList<PointValue>();
    List<PointValue> valuesc = new ArrayList<PointValue>();
    for (Calibration calibration : calibrations) {
        if (calibration.estimate_raw_at_time_of_calibration > end_x) {
            end_x = calibration.estimate_raw_at_time_of_calibration;
        }
        PointValue point = new PointValue((float) calibration.estimate_raw_at_time_of_calibration, doMgdl ? (float) calibration.bg : ((float) calibration.bg) * (float) Constants.MGDL_TO_MMOLL);
        PointValue pointb = new PointValue((float) calibration.raw_value, doMgdl ? (float) calibration.bg : ((float) calibration.bg) * (float) Constants.MGDL_TO_MMOLL);
        PointValue pointc = new PointValue((float) calibration.adjusted_raw_value, doMgdl ? (float) calibration.bg : ((float) calibration.bg) * (float) Constants.MGDL_TO_MMOLL);
        String time;
        if (show_days_since) {
            final int days_ago = daysAgo(calibration.raw_timestamp);
            time = (days_ago > 0) ? Integer.toString(days_ago) + "d  " : "";
            time = time + (JoH.hourMinuteString(calibration.raw_timestamp));
        } else {
            time = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(new Date((long) calibration.raw_timestamp));
        }
        point.setLabel(time);
        values.add(point);
        // extra points showing real raw and age_adjusted raw for each calbration point
        valuesb.add(pointb);
        valuesc.add(pointc);
    }
    Line line = new Line(values);
    line.setColor(color);
    line.setHasLines(false);
    line.setPointRadius(4);
    line.setHasPoints(true);
    line.setHasLabels(true);
    List<Line> lines = new ArrayList<>();
    lines.add(line);
    if (Pref.getBooleanDefaultFalse("engineering_mode")) {
        // actual raw
        Line lineb = new Line(valuesb);
        lineb.setColor(Color.RED);
        lineb.setHasLines(false);
        lineb.setPointRadius(1);
        lineb.setHasPoints(true);
        lineb.setHasLabels(false);
        // age adjusted raw
        Line linec = new Line(valuesc);
        linec.setColor(Color.YELLOW);
        linec.setHasLines(false);
        linec.setPointRadius(1);
        linec.setHasPoints(true);
        linec.setHasLabels(false);
        lines.add(lineb);
        lines.add(linec);
    }
    return lines;
}

5 View Complete Implementation : BgSparklineBuilder.java
Copyright GNU General Public License v3.0
Author : StephenBlackWasAlreadyTaken
Bitmap build() {
    List<Line> lines = new ArrayList<>();
    bgGraphBuilder.defaultLines();
    lines.add(bgGraphBuilder.inRangeValuesLine());
    lines.add(bgGraphBuilder.lowValuesLine());
    lines.add(bgGraphBuilder.highValuesLine());
    if (showLowLine)
        lines.add(bgGraphBuilder.lowLine());
    if (showHighLine)
        lines.add(bgGraphBuilder.highLine());
    if (useSmallDots) {
        for (Line line : lines) line.setPointRadius(1);
    }
    LineChartData lineData = new LineChartData(lines);
    if (showAxes) {
        lineData.setAxisYLeft(bgGraphBuilder.yAxis());
        lineData.setAxisXBottom(bgGraphBuilder.xAxis());
    }
    // lines.add(bgGraphBuilder.rawInterpretedLine());
    chart.setLineChartData(lineData);
    Viewport viewport = chart.getMaximumViewport();
    viewport.left = start;
    viewport.right = end;
    chart.setViewportCalculationEnabled(false);
    chart.setInteractive(false);
    chart.setCurrentViewport(viewport);
    chart.setPadding(0, 0, 0, 0);
    chart.setLeft(0);
    chart.setTop(0);
    chart.setRight(width);
    chart.setBottom(height);
    return getViewBitmap(chart);
}

5 View Complete Implementation : BgSparklineBuilder.java
Copyright GNU General Public License v3.0
Author : StephenBlackWasAlreadyTaken
public Bitmap build() {
    List<Line> lines = new ArrayList<>();
    bgGraphBuilder.defaultLines();
    lines.add(bgGraphBuilder.inRangeValuesLine());
    lines.add(bgGraphBuilder.lowValuesLine());
    lines.add(bgGraphBuilder.highValuesLine());
    lines.add(bgGraphBuilder.lowLine(showLowLine, true));
    lines.add(bgGraphBuilder.highLine(showHighLine));
    if (useSmallDots) {
        for (Line line : lines) line.setPointRadius(2);
    }
    if (useTinyDots) {
        for (Line line : lines) line.setPointRadius(1);
    }
    LineChartData lineData = new LineChartData(lines);
    if (showAxes) {
        lineData.setAxisYLeft(bgGraphBuilder.yAxis());
        lineData.setAxisXBottom(bgGraphBuilder.chartXAxis());
    }
    // lines.add(bgGraphBuilder.rawInterpretedLine());
    chart.setLineChartData(lineData);
    Viewport viewport = chart.getMaximumViewport();
    viewport.left = start;
    viewport.right = end;
    chart.setViewportCalculationEnabled(false);
    chart.setInteractive(false);
    chart.setCurrentViewport(viewport);
    chart.setPadding(0, 0, 0, 0);
    chart.setLeft(0);
    chart.setTop(0);
    chart.setRight(width);
    chart.setBottom(height);
    return getViewBitmap(chart);
}

3 View Complete Implementation : LibreTrendGraph.java
Copyright GNU General Public License v3.0
Author : jamorham
public void setupCharts() {
    final TextView trendView = (TextView) findViewById(R.id.textLibreHeader);
    chart = (LineChartView) findViewById(R.id.libre_chart);
    List<Line> lines = new ArrayList<Line>();
    List<PointValue> lineValues = new ArrayList<PointValue>();
    final float conversion_factor_mmol = (float) (doMgdl ? 1 : Constants.MGDL_TO_MMOLL);
    LibreBlock libreBlock = LibreBlock.getLatestForTrend();
    if (libreBlock == null) {
        trendView.setText("No libre data to display");
        setupEmptyCharts();
        return;
    }
    String time = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(new Date((long) libreBlock.timestamp));
    ArrayList<Float> bg_data = getLatestBgForXMinutes(MINUTES_TO_DISPLAY);
    if (bg_data == null) {
        trendView.setText("Error displaying data for " + time);
        setupEmptyCharts();
        return;
    }
    trendView.setText("Scan from " + time);
    float min = 1000;
    float max = 0;
    int i = 0;
    for (float bg : bg_data) {
        if (bg <= 0) {
            i++;
            continue;
        }
        if (min > bg) {
            min = bg;
        }
        if (max < bg) {
            max = bg;
        }
        lineValues.add(new PointValue(-i, bg * conversion_factor_mmol));
        i++;
    }
    Line trendLine = new Line(lineValues);
    trendLine.setColor(ChartUtils.COLOR_RED);
    trendLine.setHasLines(false);
    trendLine.setHasPoints(true);
    trendLine.setPointRadius(3);
    lines.add(trendLine);
    final int MIN_GRAPH = 20;
    if (max - min < MIN_GRAPH) {
        // On relative flat trend the graph can look very noise althouth with the right resolution it is not that way.
        // I will add two dummy invisible points that will cause the graph to look with bigger Y range.
        float average = (max + min) / 2;
        List<PointValue> dummyPointValues = new ArrayList<PointValue>();
        Line dummyPointLine = new Line(dummyPointValues);
        dummyPointValues.add(new PointValue(0, (average - MIN_GRAPH / 2) * conversion_factor_mmol));
        dummyPointValues.add(new PointValue(0, (average + MIN_GRAPH / 2) * conversion_factor_mmol));
        dummyPointLine.setColor(ChartUtils.COLOR_RED);
        dummyPointLine.setHasLines(false);
        dummyPointLine.setHasPoints(false);
        lines.add(dummyPointLine);
    }
    Axis axisX = new Axis();
    Axis axisY = new Axis().setHasLines(true);
    axisX.setTextSize(16);
    axisY.setTextSize(16);
    axisX.setName("Time from last scan");
    axisY.setName("Glucose " + (doMgdl ? "mg/dl" : "mmol/l"));
    data = new LineChartData(lines);
    data.setAxisXBottom(axisX);
    data.setAxisYLeft(axisY);
    chart.setLineChartData(data);
}

0 View Complete Implementation : BgSparklineBuilder.java
Copyright GNU General Public License v3.0
Author : jamorham
public Bitmap build() {
    List<Line> lines = new ArrayList<>();
    // simple mode
    bgGraphBuilder.defaultLines(true);
    lines.add(bgGraphBuilder.inRangeValuesLine());
    lines.add(bgGraphBuilder.lowValuesLine());
    lines.add(bgGraphBuilder.highValuesLine());
    if (showFiltered) {
        for (Line line : bgGraphBuilder.filteredLines()) {
            line.setHasPoints(false);
            lines.add(line);
        }
    }
    if (showLowLine) {
        if (height <= SCALE_TRIGGER) {
            Line line = bgGraphBuilder.lowLine();
            line.setFilled(false);
            lines.add(line);
        } else {
            lines.add(bgGraphBuilder.lowLine());
        }
    }
    if (showHighLine)
        lines.add(bgGraphBuilder.highLine());
    if (useSmallDots) {
        for (Line line : lines) line.setPointRadius(2);
    }
    if (useTinyDots) {
        for (Line line : lines) line.setPointRadius(1);
    }
    LineChartData lineData = new LineChartData(lines);
    if (showAxes) {
        if (height <= SCALE_TRIGGER) {
            Axis xaxis = bgGraphBuilder.chartXAxis();
            xaxis.setTextSize(4);
        } else {
            Axis yaxis = bgGraphBuilder.yAxis();
            yaxis.setTextSize(6);
            lineData.setAxisYLeft(yaxis);
            Axis xaxis = bgGraphBuilder.chartXAxis();
            xaxis.setTextSize(6);
            lineData.setAxisXBottom(xaxis);
        }
    }
    // lines.add(bgGraphBuilder.rawInterpretedLine());
    chart.setBackgroundColor(backgroundColor);
    chart.setLineChartData(lineData);
    Viewport viewport = chart.getMaximumViewport();
    viewport.left = start;
    viewport.right = end;
    if (height <= SCALE_TRIGGER) {
        // for pebble clreplacedic we always want the lowest mark to be in the same place on the image
        viewport.bottom = (float) (bgGraphBuilder.doMgdl ? 2 * Constants.MMOLL_TO_MGDL : 2);
        viewport.top = (float) (bgGraphBuilder.doMgdl ? 16 * Constants.MMOLL_TO_MGDL : 16);
    }
    chart.setViewportCalculationEnabled(false);
    chart.setInteractive(false);
    chart.setCurrentViewport(viewport);
    chart.setPadding(0, 0, 0, 0);
    chart.setLeft(0);
    chart.setTop(0);
    if (height > SCALE_TRIGGER) {
        chart.setRight(width);
        chart.setBottom(height);
    } else {
        chart.setRight(width * 2);
        chart.setBottom(height * 2);
    }
    Log.d(TAG, "pebble debug: w:" + width + " h:" + height + " start:" + start + " end:" + end + " ");
    if (height > SCALE_TRIGGER) {
        return getViewBitmap(chart);
    } else {
        return getResizedBitmap(getViewBitmap(chart), width, height);
    }
}

0 View Complete Implementation : BgSparklineBuilder.java
Copyright GNU General Public License v3.0
Author : StephenBlackWasAlreadyTaken
public Bitmap build() {
    List<Line> lines = new ArrayList<>();
    bgGraphBuilder.defaultLines();
    lines.add(bgGraphBuilder.inRangeValuesLine());
    lines.add(bgGraphBuilder.lowValuesLine());
    lines.add(bgGraphBuilder.highValuesLine());
    if (showLowLine)
        lines.add(bgGraphBuilder.lowLine());
    if (showHighLine)
        lines.add(bgGraphBuilder.highLine());
    if (useSmallDots) {
        for (Line line : lines) line.setPointRadius(2);
    }
    LineChartData lineData = new LineChartData(lines);
    if (showAxes) {
        lineData.setAxisYLeft(bgGraphBuilder.yAxis());
        lineData.setAxisXBottom(bgGraphBuilder.xAxis());
    }
    // lines.add(bgGraphBuilder.rawInterpretedLine());
    chart.setLineChartData(lineData);
    Viewport viewport = chart.getMaximumViewport();
    viewport.left = start;
    viewport.right = end;
    chart.setViewportCalculationEnabled(false);
    chart.setInteractive(false);
    chart.setCurrentViewport(viewport);
    chart.setPadding(0, 0, 0, 0);
    chart.setLeft(0);
    chart.setTop(0);
    chart.setRight(width);
    chart.setBottom(height);
    return getViewBitmap(chart);
}