lecho.lib.hellocharts.model.Line Java Examples

The following examples show how to use lecho.lib.hellocharts.model.Line. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BgGraphBuilder.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
private List<Line> iconLines() {
    final List<Line> lines = new LinkedList<>();

    final Line line = new Line(iconValues);
    line.setTag("icon");
    line.setHasPoints(true);
    line.setHasLines(false);
    line.setPointRadius(5);
    line.setPointColor(ColorUtil.blendColor(Color.BLACK,Color.TRANSPARENT, 0.99f));
    line.setBitmapScale(1f);
    line.setBitmapLabels(true);
    line.setBitmapLabelShadowColor(Color.WHITE);
    line.setFullShadow(true);
    line.setBitmapCacheProvider(BitmapLoader.getInstance());
    lines.add(line);
    return lines;
}
 
Example #2
Source File: BgGraphBuilder.java    From xDrip-plus with GNU General Public License v3.0 6 votes vote down vote up
public List<Line> extraLines()
{
    final List<Line> lines = new ArrayList<>();
    Line bloodtest = new Line(bloodTestValues);
    bloodtest.setHasLines(false);
    bloodtest.setPointRadius(pointSize * 5 / 3);//3 / 2
    bloodtest.setHasPoints(true);
    bloodtest.setColor(highColor);//ChartUtils.darkenColor(getCol(X.color_calibration_dot_background))
    bloodtest.setShape(ValueShape.SQUARE);
    lines.add(bloodtest);

    Line bloodtesti = new Line(bloodTestValues);
    bloodtesti.setHasLines(false);
    bloodtesti.setPointRadius(pointSize * 5 / 4);//3 / 4
    bloodtesti.setHasPoints(true);
    bloodtesti.setColor(lowColor);//ChartUtils.darkenColor(getCol(X.color_calibration_dot_foreground))
    bloodtesti.setShape(ValueShape.SQUARE);
    lines.add(bloodtesti);

    return lines;
}
 
Example #3
Source File: LineChartRenderer.java    From hellocharts-android with Apache License 2.0 6 votes vote down vote up
@Override
public boolean checkTouch(float touchX, float touchY) {
    selectedValue.clear();
    final LineChartData data = dataProvider.getLineChartData();
    int lineIndex = 0;
    for (Line line : data.getLines()) {
        if (checkIfShouldDrawPoints(line)) {
            int pointRadius = ChartUtils.dp2px(density, line.getPointRadius());
            int valueIndex = 0;
            for (PointValue pointValue : line.getValues()) {
                final float rawValueX = computator.computeRawX(pointValue.getX());
                final float rawValueY = computator.computeRawY(pointValue.getY());
                if (isInArea(rawValueX, rawValueY, touchX, touchY, pointRadius + touchToleranceMargin)) {
                    selectedValue.set(lineIndex, valueIndex, SelectedValueType.LINE);
                }
                ++valueIndex;
            }
        }
        ++lineIndex;
    }
    return isTouched();
}
 
Example #4
Source File: BgGraphBuilder.java    From AndroidAPS with GNU Affero General Public License v3.0 6 votes vote down vote up
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;
    }
 
Example #5
Source File: CalibrationGraph.java    From xDrip-Experimental with GNU General Public License v3.0 6 votes vote down vote up
@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;
}
 
Example #6
Source File: BgGraphBuilder.java    From AndroidAPS with GNU Affero General Public License v3.0 6 votes vote down vote up
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);
    }
}
 
Example #7
Source File: BgGraphBuilder.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
public List<Line> defaultLines() {
    addBgReadingValues();
    List<Line> lines = new ArrayList<Line>();
    Line[] calib = calibrationValuesLine();
    lines.add(calib[0]); // white circle of calib in background
    lines.add(minShowLine());
    lines.add(maxShowLine());
    lines.add(highLine());
    lines.add(lowLine());

    if (prefs.getBoolean("show_filtered_curve", false)) {
        final ArrayList<Line> filtered_lines = filteredLines();
        for (Line thisline : filtered_lines) {
            lines.add(thisline);
        }
    }
    // these last entries cannot be moved if
    // the point size change in previewLineData is to work
    lines.add(inRangeValuesLine());
    lines.add(lowValuesLine());
    lines.add(highValuesLine());
    lines.add(rawInterpretedLine());
    lines.add(calib[1]); // red dot of calib in foreground
    return lines;
}
 
Example #8
Source File: BgGraphBuilder.java    From xDrip-plus with GNU General Public License v3.0 6 votes vote down vote up
public List<Line> defaultLines() {
    addBgReadingValues();
    List<Line> lines = new ArrayList<Line>();
    Line[] calib = calibrationValuesLine();
    lines.add(calib[0]); // white circle of calib in background
    lines.add(minShowLine());
    lines.add(maxShowLine());
    lines.add(highLine());
    lines.add(lowLine());

    if (prefs.getBoolean("show_filtered_curve", false)) {
        final ArrayList<Line> filtered_lines = filteredLines();
        for (Line thisline : filtered_lines) {
            lines.add(thisline);
        }
    }
    // these last entries cannot be moved if
    // the point size change in previewLineData is to work
    lines.add(inRangeValuesLine());
    lines.add(lowValuesLine());
    lines.add(highValuesLine());
    lines.add(rawInterpretedLine());
    lines.add(calib[1]); // red dot of calib in foreground
    return lines;
}
 
Example #9
Source File: BgGraphBuilder.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
private List<Line> smbLines() {
    final List<Line> lines = new LinkedList<>();
    final Line line = new Line(smbValues);
    line.setTag("smb");
    line.setHasPoints(true);
    line.setHasLines(false);
    line.setPointRadius(4);
    line.setPointColor(Color.TRANSPARENT);
    line.setStrokeWidth(1);
    line.setColor(getCol(X.color_smb_line));
    line.setPointColor(ColorUtil.blendColor(getCol(X.color_smb_line), Color.TRANSPARENT, 0.99f));
    line.setBitmapScale(0.5f);
    line.setBitmapLabels(true);
    line.setBitmapCacheProvider(BitmapLoader.getInstance());
    lines.add(line);
    return lines;
}
 
Example #10
Source File: ViewPagerChartsActivity.java    From hellocharts-android with Apache License 2.0 6 votes vote down vote up
private LineChartData generateLineChartData() {
    int numValues = 20;

    List<PointValue> values = new ArrayList<PointValue>();
    for (int i = 0; i < numValues; ++i) {
        values.add(new PointValue(i, (float) Math.random() * 100f));
    }

    Line line = new Line(values);
    line.setColor(ChartUtils.COLOR_GREEN);

    List<Line> lines = new ArrayList<Line>();
    lines.add(line);

    LineChartData data = new LineChartData(lines);
    data.setAxisXBottom(new Axis().setName("Axis X"));
    data.setAxisYLeft(new Axis().setName("Axis Y").setHasLines(true));
    return data;

}
 
Example #11
Source File: StatisticViewModel.java    From OmniList with GNU Affero General Public License v3.0 6 votes vote down vote up
private LineChartData getLineChartData(List<Line> lines) {
    DateTime daysAgo = new DateTime().withTimeAtStartOfDay().minusDays(StatisticViewModel.DAYS_OF_ADDED_MODEL - 1);
    List<String> days = new ArrayList<>();
    SimpleDateFormat sdf = new SimpleDateFormat("dd", Locale.getDefault());
    for (int i=0; i<StatisticViewModel.DAYS_OF_ADDED_MODEL; i++){
        days.add(sdf.format(daysAgo.toDate()));
        daysAgo = daysAgo.plusDays(1);
    }

    LineChartData data = new LineChartData();
    data.setLines(lines);
    data.setAxisXBottom(null);
    data.setAxisYLeft(null);
    data.setBaseValue(-0.1f);
    data.setValueLabelBackgroundColor(Color.TRANSPARENT);
    Axis axis = Axis.generateAxisFromCollection(Arrays.asList(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f), days);
    data.setAxisXBottom(axis);
    return data;
}
 
Example #12
Source File: StatisticViewModel.java    From OmniList with GNU Affero General Public License v3.0 6 votes vote down vote up
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;
}
 
Example #13
Source File: BgGraphBuilder.java    From AndroidAPS with GNU Affero General Public License v3.0 6 votes vote down vote up
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;
    }
 
Example #14
Source File: BgGraphBuilder.java    From xDrip-plus with GNU General Public License v3.0 6 votes vote down vote up
private List<Line> smbLines() {
    final List<Line> lines = new LinkedList<>();
    final Line line = new Line(smbValues);
    line.setTag("smb");
    line.setHasPoints(true);
    line.setHasLines(false);
    line.setPointRadius(4);
    line.setPointColor(Color.TRANSPARENT);
    line.setStrokeWidth(1);
    line.setColor(getCol(X.color_smb_line));
    line.setPointColor(ColorUtil.blendColor(getCol(X.color_smb_line), Color.TRANSPARENT, 0.99f));
    line.setBitmapScale(0.5f);
    line.setBitmapLabels(true);
    line.setBitmapCacheProvider(BitmapLoader.getInstance());
    lines.add(line);
    return lines;
}
 
Example #15
Source File: BgGraphBuilder.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
private Line libreTrendLine() {
    final List<PointValue> libreTrendValues =  LibreTrendGraph.getTrendDataPoints(doMgdl, (long)(start_time * FUZZER), (long)(end_time * FUZZER));
    final Line line = new Line(libreTrendValues);
    line.setHasPoints(true);
    line.setHasLines(false);
    line.setCubic(false);
    line.setStrokeWidth(2);
    line.setPointRadius(1);
    line.setColor(Color.argb(240,25,206,244)); // temporary pending preference
    return line;
}
 
Example #16
Source File: BgGraphBuilder.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public Line idealLine() {
    // if profile has more than 1 target bg value then we need to iterate those and plot them for completeness
    List<PointValue> myLineValues = new ArrayList<PointValue>();
    myLineValues.add(new PointValue((float) start_time, (float)  Profile.getTargetRangeInUnits(start_time)));
    myLineValues.add(new PointValue((float) predictive_end_time, (float) Profile.getTargetRangeInUnits(predictive_end_time)));
    Line myLine = new Line(myLineValues);
    myLine.setHasPoints(false);
    myLine.setStrokeWidth(1);
    myLine.setColor(getCol(X.color_target_line));
    myLine.setPathEffect(new DashPathEffect(new float[]{5f, 5f}, 0));
    myLine.setAreaTransparency(50);
    return myLine;
}
 
Example #17
Source File: BgGraphBuilder.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public Line avg2Line() {
    List<PointValue> myLineValues = new ArrayList<PointValue>();
    myLineValues.add(new PointValue((float) start_time, (float) unitized(avg2value)));
    myLineValues.add(new PointValue((float) end_time, (float) unitized(avg2value)));
    Line myLine = new Line(myLineValues);
    myLine.setHasPoints(false);
    myLine.setStrokeWidth(1);
    myLine.setColor(getCol(X.color_average2_line));
    myLine.setPathEffect(new DashPathEffect(new float[]{30.0f, 10.0f}, 0));
    myLine.setAreaTransparency(50);
    return myLine;
}
 
Example #18
Source File: BgGraphBuilder.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public Line avg1Line() {
    List<PointValue> myLineValues = new ArrayList<PointValue>();
    myLineValues.add(new PointValue((float) avg1startfuzzed, (float) unitized(avg1value)));
    myLineValues.add(new PointValue((float) end_time, (float) unitized(avg1value)));
    Line myLine = new Line(myLineValues);
    myLine.setHasPoints(false);
    myLine.setStrokeWidth(1);
    myLine.setColor(getCol(X.color_average1_line));
    myLine.setPathEffect(new DashPathEffect(new float[]{10.0f, 10.0f}, 0));
    myLine.setAreaTransparency(50);
    return myLine;
}
 
Example #19
Source File: BgGraphBuilder.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public Line predictiveLowLine() {
    List<PointValue> lowLineValues = new ArrayList<PointValue>();
    lowLineValues.add(new PointValue((float) end_time, (float) lowMark));
    lowLineValues.add(new PointValue((float) predictive_end_time, (float) lowMark));
    Line lowLine = new Line(lowLineValues);
    lowLine.setHasPoints(false);
    lowLine.setAreaTransparency(40);
    lowLine.setColor(ChartUtils.darkenColor(ChartUtils.darkenColor(ChartUtils.darkenColor(getCol(X.color_low_values)))));
    lowLine.setStrokeWidth(1);
    lowLine.setFilled(true);
    return lowLine;
}
 
Example #20
Source File: IOBCOBLineGraph.java    From HAPP with GNU General Public License v3.0 5 votes vote down vote up
public List<Line> iobcobPastdefaultLines() {
    addIOBValues();
    addCOBValues();
    addfutureValues();
    List<Line> lines = new ArrayList<Line>();
    lines.add(minShowLine());
    lines.add(cobValuesLine());
    lines.add(cobFutureLine());
    lines.add(iobValuesLine());
    lines.add(iobFutureLine());
    return lines;
}
 
Example #21
Source File: BgGraphBuilder.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public Line[] calibrationValuesLine() {
    Line[] lines = new Line[2];
    lines[0] = new Line(calibrationValues);
    lines[0].setColor(getCol(X.color_calibration_dot_background));
    lines[0].setHasLines(false);
    lines[0].setPointRadius(pointSize * 3 / 2);
    lines[0].setHasPoints(true);
    lines[1] = new Line(calibrationValues);
    lines[1].setColor(getCol(X.color_calibration_dot_foreground));
    lines[1].setHasLines(false);
    lines[1].setPointRadius(pointSize * 3 / 4);
    lines[1].setHasPoints(true);
    return lines;
}
 
Example #22
Source File: BgGraphBuilder.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
private Line remoteValuesLine() {
    final Line line = new Line(remoteValues);
    line.setColor(Color.parseColor("#55333388"));
    line.setHasLines(false);
    line.setPointRadius(pointSize + 4);
    line.setHasPoints(true);
    return line;
}
 
Example #23
Source File: BgSparklineBuilder.java    From NightWatch with GNU General Public License v3.0 5 votes vote down vote up
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);
}
 
Example #24
Source File: BgGraphBuilder.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
private List<Line> predictiveLines() {
    final List<Line> lines = new LinkedList<>();

    final boolean g_prediction = Pref.getBooleanDefaultFalse("show_g_prediction");
    final boolean medtrum = Pref.getBooleanDefaultFalse("show_medtrum_secondary");
    if (medtrum || g_prediction) {
        final List<Prediction> plist = Prediction.latestForGraph(4000, loaded_start, loaded_end);
        if (plist.size() > 0) {
            final List<PointValue> gpoints = new ArrayList<>(plist.size());
            final float yscale = !doMgdl ? (float) Constants.MGDL_TO_MMOLL : 1f;
            for (Prediction p : plist) {
                switch (p.source) {
                    case "EGlucoseRx":
                        final PointValue point = new PointValue(((float) (p.timestamp + (Constants.MINUTE_IN_MS * 10)) / FUZZER), (float) (p.glucose * yscale));
                        gpoints.add(point);
                        break;
                    case "Medtrum2nd":
                        final PointValue mpoint = new PointValue(((float) p.timestamp / FUZZER), (float) (p.glucose * yscale));
                        gpoints.add(mpoint);
                        break;
                }
            }

            if (gpoints.size() > 0) {
                lines.add(new Line(gpoints)
                        .setHasLabels(false)
                        .setHasPoints(true)
                        .setHasLines(false)
                        .setPointRadius(1)
                        .setColor(ChartUtils.darkenColor(ChartUtils.darkenColor(getCol(X.color_predictive)))));
            }
        }
    }

    return lines;
}
 
Example #25
Source File: BgGraphBuilder.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public Line[] treatmentValuesLine() {
    Line[] lines = new Line[2];
    try {

        lines[0] = new Line(treatmentValues);
        lines[0].setColor(highColor);//getCol(X.color_treatment_dot_background) 0xFFFFFF
        lines[0].setHasLines(false);
        lines[0].setPointRadius(pointSize * 5 / 3);//pointSize * 5 / 2
        lines[0].setHasPoints(true);
        lines[0].setShape(ValueShape.DIAMOND);//KS

        lines[1] = new Line(treatmentValues);
        lines[1].setColor(Color.GREEN);//getCol(X.color_treatment_dot_foreground)//0x77aa00 //lowColor
        lines[1].setHasLines(false);
        lines[1].setPointRadius(pointSize * 5 / 4);//pointSize * 5 / 4
        lines[1].setHasPoints(true);
        lines[1].setShape(ValueShape.DIAMOND);
        //lines[1].setHasLabels(true);

        LineChartValueFormatter formatter = new SimpleLineChartValueFormatter(1);
        lines[1].setFormatter(formatter);

    } catch (Exception e) {
        if (d) UserError.Log.i(TAG, "Exception making treatment lines: " + e.toString());
    }
    return lines;
}
 
Example #26
Source File: BgGraphBuilder.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public Line[] calibrationValuesLine() {
    Line[] lines = new Line[2];
    lines[0] = new Line(calibrationValues);
    lines[0].setColor(highColor);//getCol(X.color_calibration_dot_background
    lines[0].setHasLines(false);
    lines[0].setPointRadius(pointSize * 5 / 3);//3 / 2
    lines[0].setHasPoints(true);
    lines[1] = new Line(calibrationValues);
    lines[1].setColor(lowColor);//getCol(X.color_calibration_dot_foreground)
    lines[1].setHasLines(false);
    lines[1].setPointRadius(pointSize * 5 / 4);//3 / 4
    lines[1].setHasPoints(true);
    return lines;
}
 
Example #27
Source File: BgGraphBuilder.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public Line rawInterpretedLine() {
    Line line = new Line(rawInterpretedValues);
    line.setHasLines(false);
    line.setPointRadius(1);
    line.setHasPoints(true);
    return line;
}
 
Example #28
Source File: BgSparklineBuilder.java    From NightWatch with GNU General Public License v3.0 5 votes vote down vote up
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);
}
 
Example #29
Source File: BgGraphBuilder.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public Line predictiveHighLine() {
    List<PointValue> predictiveHighLineValues = new ArrayList<PointValue>();
    predictiveHighLineValues.add(new PointValue((float) end_time, (float) highMark));
    predictiveHighLineValues.add(new PointValue((float) predictive_end_time, (float) highMark));
    Line highLine = new Line(predictiveHighLineValues);
    highLine.setHasPoints(false);
    highLine.setStrokeWidth(1);
    highLine.setColor(ChartUtils.darkenColor(ChartUtils.darkenColor(ChartUtils.darkenColor(getCol(X.color_high_values)))));
    return highLine;
}
 
Example #30
Source File: BgGraphBuilder.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public Line idealLine() {
    // if profile has more than 1 target bg value then we need to iterate those and plot them for completeness
    List<PointValue> myLineValues = new ArrayList<PointValue>();
    myLineValues.add(new PointValue((float) start_time, (float)  Profile.getTargetRangeInUnits(start_time)));
    myLineValues.add(new PointValue((float) predictive_end_time, (float) Profile.getTargetRangeInUnits(predictive_end_time)));
    Line myLine = new Line(myLineValues);
    myLine.setHasPoints(false);
    myLine.setStrokeWidth(1);
    myLine.setColor(getCol(X.color_target_line));
    myLine.setPathEffect(new DashPathEffect(new float[]{5f, 5f}, 0));
    myLine.setAreaTransparency(50);
    return myLine;
}