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

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

43 Examples 7

16 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 : CommonChartSupport.java
Copyright GNU General Public License v3.0
Author : timomer
public Line minShowLine() {
    List<PointValue> minShowValues = new ArrayList<PointValue>();
    minShowValues.add(new PointValue((float) start_time.getTime(), (float) defaultMinY));
    minShowValues.add(new PointValue((float) end_time, (float) defaultMinY));
    Line minShowLine = new Line(minShowValues);
    minShowLine.setHasPoints(false);
    minShowLine.setHasLines(false);
    return minShowLine;
}

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(lowColor);
    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 highValuesLine() {
    Line highValuesLine = new Line(highValues);
    highValuesLine.setColor(highColor);
    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 : jamorham
public Line maxShowLine() {
    List<PointValue> maxShowValues = new ArrayList<PointValue>();
    maxShowValues.add(new PointValue((float) start_time / FUZZER, (float) defaultMaxY));
    maxShowValues.add(new PointValue((float) end_time / FUZZER, (float) defaultMaxY));
    Line maxShowLine = new Line(maxShowValues);
    maxShowLine.setHasLines(false);
    maxShowLine.setHasPoints(false);
    return maxShowLine;
}

15 View Complete Implementation : BgGraphBuilder.java
Copyright GNU General Public License v3.0
Author : jamorham
public Line minShowLine() {
    List<PointValue> minShowValues = new ArrayList<PointValue>();
    minShowValues.add(new PointValue((float) start_time / FUZZER, (float) defaultMinY));
    minShowValues.add(new PointValue((float) end_time / FUZZER, (float) defaultMinY));
    Line minShowLine = new Line(minShowValues);
    minShowLine.setHasPoints(false);
    minShowLine.setHasLines(false);
    return minShowLine;
}

15 View Complete Implementation : BgGraphBuilder.java
Copyright GNU General Public License v3.0
Author : StephenBlackWasAlreadyTaken
public Line maxShowLine() {
    List<PointValue> maxShowValues = new ArrayList<PointValue>();
    maxShowValues.add(new PointValue((float) start_time, (float) defaultMaxY));
    maxShowValues.add(new PointValue((float) end_time, (float) defaultMaxY));
    Line maxShowLine = new Line(maxShowValues);
    maxShowLine.setHasLines(false);
    maxShowLine.setHasPoints(false);
    return maxShowLine;
}

15 View Complete Implementation : BgGraphBuilder.java
Copyright GNU General Public License v3.0
Author : StephenBlackWasAlreadyTaken
public Line minShowLine() {
    List<PointValue> minShowValues = new ArrayList<PointValue>();
    minShowValues.add(new PointValue((float) start_time, (float) defaultMinY));
    minShowValues.add(new PointValue((float) end_time, (float) defaultMinY));
    Line minShowLine = new Line(minShowValues);
    minShowLine.setHasPoints(false);
    minShowLine.setHasLines(false);
    return minShowLine;
}

15 View Complete Implementation : BgGraph.java
Copyright GNU General Public License v3.0
Author : timomer
public Line maxShowLine() {
    List<PointValue> maxShowValues = new ArrayList<PointValue>();
    maxShowValues.add(new PointValue((float) start_time.getTime(), (float) defaultMaxY));
    maxShowValues.add(new PointValue((float) end_time, (float) defaultMaxY));
    Line maxShowLine = new Line(maxShowValues);
    maxShowLine.setHasLines(false);
    maxShowLine.setHasPoints(false);
    return maxShowLine;
}

15 View Complete Implementation : IOBCOBLineGraph.java
Copyright GNU General Public License v3.0
Author : timomer
public Line maxiobcobShowLine() {
    List<PointValue> maxShowValues = new ArrayList<PointValue>();
    maxShowValues.add(new PointValue((float) start_time.getTime(), (float) 50));
    maxShowValues.add(new PointValue((float) end_time, (float) 50));
    Line maxShowLine = new Line(maxShowValues);
    maxShowLine.setHasLines(false);
    maxShowLine.setHasPoints(false);
    return maxShowLine;
}

14 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;
}

14 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;
}

14 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;
}

14 View Complete Implementation : BgGraphBuilder.java
Copyright GNU Affero General Public License v3.0
Author : MilosKozak
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;
}

14 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;
}

14 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;
}

14 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 : BasalVSTempBasalGraph.java
Copyright GNU General Public License v3.0
Author : timomer
public Line basalvsTempBasalLine() {
    Line cobValuesLine = new Line(tempBasalValues);
    cobValuesLine.setColor(ChartUtils.COLOR_BLUE);
    cobValuesLine.setHasLines(true);
    cobValuesLine.setHasPoints(false);
    cobValuesLine.setFilled(true);
    cobValuesLine.setCubic(false);
    return cobValuesLine;
}

14 View Complete Implementation : IOBCOBLineGraph.java
Copyright GNU General Public License v3.0
Author : timomer
public Line cobValuesLine() {
    Line cobValuesLine = new Line(cobValues);
    cobValuesLine.setColor(ChartUtils.COLOR_ORANGE);
    cobValuesLine.setHasLines(true);
    cobValuesLine.setHasPoints(false);
    cobValuesLine.setFilled(true);
    cobValuesLine.setCubic(true);
    return cobValuesLine;
}

14 View Complete Implementation : IOBCOBLineGraph.java
Copyright GNU General Public License v3.0
Author : timomer
public Line iobValuesLine() {
    Line iobValuesLine = new Line(iobValues);
    iobValuesLine.setColor(ChartUtils.COLOR_BLUE);
    iobValuesLine.setHasLines(true);
    iobValuesLine.setHasPoints(false);
    iobValuesLine.setFilled(true);
    iobValuesLine.setCubic(true);
    return iobValuesLine;
}

13 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;
}

12 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;
}

12 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;
}

12 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;
}

12 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;
}

12 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;
}

11 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;
}

10 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;
}

10 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;
}

9 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);
    }
}

7 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 : 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;
}

6 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;
}

6 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;
}

5 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;
}

2 View Complete Implementation : RankChartFragment.java
Copyright Apache License 2.0
Author : hanFengSan
/**
 * 单独线图数据生成
 *
 * @return
 */
private LineChartData generateLineData() {
    List<Integer> list = getDiscRankValueList(mDiscRank);
    List<Line> lines = new ArrayList<Line>();
    List<PointValue> values = new ArrayList<>();
    for (int j = 0; j < list.size(); ++j) {
        values.add(new PointValue(j, list.get(j)));
    }
    Line line = new Line(values);
    line.setColor(mLineColor != 0 ? mLineColor : COLORS[0]);
    line.setShape(shape);
    line.setCubic(isCubic);
    line.setFilled(isFilled);
    line.setHasLabels(hasLabels);
    line.setHasLabelsOnlyForSelected(hasLabelForSelected);
    line.setHasLines(hasLines);
    line.setHasPoints(hasPoints);
    lines.add(line);
    LineChartData data = new LineChartData(lines);
    if (hasAxes) {
        Axis axisX = new Axis();
        Axis axisY = new Axis().setHasLines(true);
        if (hasAxesNames) {
            axisX.setName(mDiscRank.getName() + " " + mRes.getString(R.string.five_hours_situation));
            axisY.setName(mRes.getString(R.string.amazon_rank));
        }
        data.setAxisXBottom(axisX);
        data.setAxisYLeft(axisY);
    } else {
        data.setAxisXBottom(null);
        data.setAxisYLeft(null);
    }
    data.setBaseValue(Float.NEGATIVE_INFINITY);
    return data;
}

2 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);
}

1 View Complete Implementation : ChartActivity.java
Copyright Apache License 2.0
Author : scp504677840
// ��������
private void generateData() {
    List<Line> lines = new ArrayList<Line>();
    for (int i = 0; i < 1; i++) {
        // ����Դ
        List<PointValue> values = new ArrayList<PointValue>();
        for (int j = 0; j < listLevel.size(); j++) {
            values.add(new PointValue(j, listLevel.get(j)));
        }
        // ������
        Line line = new Line(values);
        // �����е���ɫ
        line.setColor(ChartUtils.COLORS[i]);
        // ��״
        line.setShape(shape);
        // �Ƿ�������
        line.setCubic(isCubic);
        // ���
        line.setFilled(isFilled);
        // ��ǩ
        line.setHasLabels(hasLabels);
        // ������ѡ�е����ñ�ǩ
        line.setHasLabelsOnlyForSelected(hasLabelsOnlyForSelected);
        // ����
        line.setHasLines(hasLines);
        // ��
        line.setHasPoints(hasPoints);
        lines.add(line);
    }
    data = new LineChartData();
    data.setLines(lines);
    if (hasAxes) {
        Axis axisX = new Axis();
        Axis axisY = new Axis().setHasLines(true);
        if (hasAxesNames) {
            axisX.setName("ʱ��(s)");
            axisY.setName("�ź�ǿ��");
        }
        data.setAxisXBottom(axisX);
        data.setAxisYLeft(axisY);
    } else {
        data.setAxisXBottom(null);
        data.setAxisYLeft(null);
    }
    data.setBaseValue(Float.NEGATIVE_INFINITY);
    mChartView.setLineChartData(data);
}

1 View Complete Implementation : CalibrationGraph.java
Copyright GNU General Public License v3.0
Author : StephenBlackWasAlreadyTaken
public void setupCharts() {
    chart = (LineChartView) findViewById(R.id.chart);
    List<Line> lines = new ArrayList<Line>();
    Calibration calibration = Calibration.last();
    if (calibration != null) {
        // set header
        DecimalFormat df = new DecimalFormat("#");
        df.setMaximumFractionDigits(2);
        df.setMinimumFractionDigits(2);
        String Header = "slope = " + df.format(calibration.slope) + " intercept = " + df.format(calibration.intercept);
        GraphHeader.setText(Header);
        // red line
        List<PointValue> lineValues = new ArrayList<PointValue>();
        lineValues.add(new PointValue((float) start_x, (float) (start_x * calibration.slope + calibration.intercept)));
        lineValues.add(new PointValue((float) end_x, (float) (end_x * calibration.slope + calibration.intercept)));
        Line calibrationLine = new Line(lineValues);
        calibrationLine.setColor(ChartUtils.COLOR_RED);
        calibrationLine.setHasLines(true);
        calibrationLine.setHasPoints(false);
        // calibration values
        List<Calibration> calibrations = Calibration.allForSensor();
        Line greyLine = getCalibrationsLine(calibrations, Color.parseColor("#66FFFFFF"));
        calibrations = Calibration.allForSensorInLastFourDays();
        Line blueLine = getCalibrationsLine(calibrations, ChartUtils.COLOR_BLUE);
        // add lines in order
        lines.add(greyLine);
        lines.add(blueLine);
        lines.add(calibrationLine);
    }
    Axis axisX = new Axis();
    Axis axisY = new Axis().setHasLines(true);
    axisX.setName("Raw Value");
    axisY.setName("BG");
    data = new LineChartData(lines);
    data.setAxisXBottom(axisX);
    data.setAxisYLeft(axisY);
    chart.setLineChartData(data);
}

0 View Complete Implementation : RankChartFragment.java
Copyright Apache License 2.0
Author : hanFengSan
/**
 * 系列线图数据生成
 *
 * @return
 */
private LineChartData generateLinesData() {
    List<Line> lines = new ArrayList<>();
    int i = 0;
    for (DiscRank rank : mGroupList) {
        List<Integer> list = getDiscRankValueList(rank);
        if (Tools.getMaxNum(list) == 0) {
            mSuperFishList.add(rank);
            addAnnotation(String.format("未显示:%s super杂鱼", rank.getName()), COLORS[i % COLORS.length]);
            continue;
        }
        List<PointValue> values = new ArrayList<>();
        for (int j = 0; j < list.size(); ++j) {
            values.add(new PointValue(j, list.get(j)));
        }
        Line line = new Line(values);
        int color = COLORS[i % COLORS.length];
        line.setColor(color);
        line.setShape(shape);
        line.setCubic(true);
        line.setFilled(isFilled);
        line.setHasLabels(hasLabels);
        line.setHasLabelsOnlyForSelected(hasLabelForSelected);
        line.setHasLines(hasLines);
        line.setHasPoints(true);
        lines.add(line);
        // 添加line annotation
        addAnnotation(rank.getName(), color);
        i++;
    }
    LineChartData data = new LineChartData(lines);
    if (hasAxes) {
        Axis axisX = new Axis();
        Axis axisY = new Axis().setHasLines(true);
        if (hasAxesNames) {
            axisX.setName(BangumiNameService.newInstance(mGroupList.get(0).getName()).getTrueName() + mRes.getString(R.string.series) + " " + mRes.getString(R.string.five_hours_situation));
            axisY.setName(mRes.getString(R.string.amazon_rank));
        }
        data.setAxisXBottom(axisX);
        data.setAxisYLeft(axisY);
    } else {
        data.setAxisXBottom(null);
        data.setAxisYLeft(null);
    }
    data.setBaseValue(Float.NEGATIVE_INFINITY);
    return data;
}

0 View Complete Implementation : CalibrationGraph.java
Copyright GNU General Public License v3.0
Author : jamorham
public void setupCharts() {
    chart = (LineChartView) findViewById(R.id.chart);
    List<Line> lines = new ArrayList<Line>();
    // calibration values
    List<Calibration> calibrations = Calibration.allForSensor();
    List<Line> greyLines = getCalibrationsLine(calibrations, Color.parseColor("#66FFFFFF"));
    calibrations = Calibration.allForSensorInLastFourDays();
    List<Line> blueLines = getCalibrationsLine(calibrations, ChartUtils.COLOR_BLUE);
    Calibration calibration = Calibration.lastValid();
    if (calibration != null) {
        // set header
        DecimalFormat df = new DecimalFormat("#");
        df.setMaximumFractionDigits(2);
        df.setMinimumFractionDigits(2);
        String Header = "slope = " + df.format(calibration.slope) + " intercept = " + df.format(calibration.intercept);
        GraphHeader.setText(Header);
        // red line
        List<PointValue> lineValues = new ArrayList<PointValue>();
        final float conversion_factor = (float) (doMgdl ? 1 : Constants.MGDL_TO_MMOLL);
        lineValues.add(new PointValue((float) start_x, (conversion_factor * (float) (start_x * calibration.slope + calibration.intercept))));
        lineValues.add(new PointValue((float) end_x, (conversion_factor * (float) (end_x * calibration.slope + calibration.intercept))));
        Line calibrationLine = new Line(lineValues);
        calibrationLine.setColor(ChartUtils.COLOR_RED);
        calibrationLine.setHasLines(true);
        calibrationLine.setHasPoints(false);
        lines.add(calibrationLine);
        // calibration plugin
        final CalibrationAbstract plugin = getCalibrationPluginFromPreferences();
        if (plugin != null) {
            final CalibrationAbstract.CalibrationData pcalibration = plugin.getCalibrationData();
            final List<PointValue> plineValues = new ArrayList<PointValue>();
            plineValues.add(new PointValue((float) start_x, (conversion_factor * (float) (plugin.getGlucoseFromSensorValue(start_x, pcalibration)))));
            plineValues.add(new PointValue((float) end_x, (conversion_factor * (float) (plugin.getGlucoseFromSensorValue(end_x, pcalibration)))));
            final Line pcalibrationLine = new Line(plineValues);
            pcalibrationLine.setColor(Color.parseColor(plugin_color));
            pcalibrationLine.setHasLines(true);
            pcalibrationLine.setHasPoints(false);
            lines.add(pcalibrationLine);
            PluginHeader.setText("(" + plugin.getAlgorithmName() + ")  " + "s = " + df.format(pcalibration.slope) + "  i = " + df.format(pcalibration.intercept));
            PluginHeader.setTextColor(Color.parseColor(plugin_color));
        }
        // add lines in order
        for (Line greyLine : greyLines) {
            lines.add(greyLine);
        }
        for (Line blueLine : blueLines) {
            lines.add(blueLine);
        }
    }
    Axis axisX = new Axis();
    Axis axisY = new Axis().setHasLines(true);
    axisX.setName("Raw Value");
    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 : TodayWeatherDetailActivity.java
Copyright Apache License 2.0
Author : Moosphan
/**
 * 初始化图表
 */
private void setUpChart() {
    initChartData();
    Line line = new Line(pointValues).setColor(getResources().getColor(R.color.cornflower_blue));
    List<Line> lines = new ArrayList<>();
    // 设置点的形状
    line.setShape(ValueShape.CIRCLE);
    // 是曲线还是折线
    line.setCubic(true);
    // 是否填充曲线区域
    line.setFilled(false);
    // 是否显示点备注
    line.setHasLabels(true);
    // 点击数据坐标提示数据(设置了这个line.setHasLabels(true);就无效)
    line.setHasLabelsOnlyForSelected(false);
    // 是否用线条表示
    line.setHasLines(true);
    // 是否显示坐标圆点
    line.setHasPoints(true);
    lines.add(line);
    LineChartData chartData = new LineChartData();
    chartData.setLines(lines);
    /**
     * 初始化x坐标轴
     */
    Axis axisX = new Axis();
    // x轴文字是斜的还是直的(true是斜的)
    axisX.setHasTiltedLabels(true);
    axisX.setTextColor(getResources().getColor(R.color.orchid));
    axisX.setTextSize(10);
    axisX.setMaxLabelChars(8);
    axisX.setValues(axisValues);
    // x轴设置在底部展示
    chartData.setAxisXBottom(axisX);
    // 是否显示x轴的刻度
    axisX.setHasLines(true);
    /**
     * 初始化y坐标轴
     */
    Axis axisY = new Axis();
    // y轴标注
    axisY.setName("时间");
    axisY.setTextSize(10);
    // y轴设置在左边
    chartData.setAxisYLeft(axisY);
    /**
     * 设置图表行为属性
     */
    chartHours.setInteractive(true);
    chartHours.setZoomType(ZoomType.HORIZONTAL);
    chartHours.setMaxZoom(6f);
    chartHours.setContainerScrollEnabled(true, ContainerScrollType.HORIZONTAL);
    chartHours.setLineChartData(chartData);
    chartHours.setVisibility(View.VISIBLE);
    /**
     * 展示x轴刻度个数
     */
    Viewport v = new Viewport(chartHours.getMaximumViewport());
    v.left = 0;
    v.right = 9;
    chartHours.setCurrentViewport(v);
}

0 View Complete Implementation : MainActivity.java
Copyright GNU General Public License v3.0
Author : gojuukaze
private void initLineChart() {
    // 折线的颜色(橙色)
    Line line = new Line(mPointValues).setColor(Color.parseColor("#FFFAFA"));
    List<Line> lines = new ArrayList<>();
    // 折线图上每个数据点的形状  这里是圆形 (有三种 :ValueShape.SQUARE  ValueShape.CIRCLE  ValueShape.DIAMOND)
    line.setShape(ValueShape.CIRCLE);
    // 曲线是否平滑,即是曲线还是折线
    line.setCubic(false);
    // 是否填充曲线的面积
    line.setFilled(false);
    // 曲线的数据坐标是否加上备注
    line.setHasLabels(true);
    // line.setHasLabelsOnlyForSelected(true);//点击数据坐标提示数据(设置了这个line.setHasLabels(true);就无效)
    // 是否用线显示。如果为false 则没有曲线只有点显示
    line.setHasLines(true);
    // 是否显示圆点 如果为false 则没有原点只有点显示(每个数据点都是个大的圆点)
    line.setHasPoints(true);
    lines.add(line);
    LineChartData data = new LineChartData();
    data.setLines(lines);
    // 坐标轴
    // X轴
    Axis axisX = new Axis();
    // X坐标轴字体是斜的显示还是直的,true是斜的显示
    axisX.setHasTiltedLabels(true);
    // 设置字体颜色
    axisX.setTextColor(Color.WHITE);
    // axisX.setName("date");  //表格名称
    // 设置字体大小
    axisX.setTextSize(10);
    // 最多几个X轴坐标,意思就是你的缩放让X轴上数据的个数7<=x<=mAxisXValues.length
    axisX.setMaxLabelChars(8);
    // 填充X轴的坐标名称
    axisX.setValues(mAxisXValues);
    // x 轴在底部
    data.setAxisXBottom(axisX);
    // data.setAxisXTop(axisX);  //x 轴在顶部
    // x 轴分割线
    axisX.setHasLines(true);
    // Y轴是根据数据的大小自动设置Y轴上限(在下面我会给出固定Y轴数据个数的解决方案)
    Axis axisY = new Axis();
    // y轴标注
    axisY.setName("");
    // axisY.setTextSize(10);//设置字体大小
    axisY.setTextColor(Color.parseColor("#ffffff"));
    // Y轴设置在左边
    data.setAxisYLeft(axisY);
    // data.setAxisYRight(axisY);  //y轴设置在右边
    // 设置行为属性,支持缩放、滑动以及平移
    lineChart.setInteractive(true);
    lineChart.setZoomType(ZoomType.HORIZONTAL);
    // 最大方法比例
    lineChart.setMaxZoom((float) 2);
    lineChart.setContainerScrollEnabled(true, ContainerScrollType.HORIZONTAL);
    lineChart.setLineChartData(data);
    lineChart.setVisibility(View.VISIBLE);
/**
 * 注:下面的7,10只是代表一个数字去类比而已
 *  当时是为了解决X轴固定数据个数。见(http://forum.xda-developers.com/tools/programming/library-hellocharts-charting-library-t2904456/page2);
 */
// Viewport v = new Viewport(lineChart.getMaximumViewport());
// v.left = 0;
// v.right= 7;
// lineChart.setCurrentViewport(v);
}