Java Code Examples for lecho.lib.hellocharts.model.Line#setStrokeWidth()

The following examples show how to use lecho.lib.hellocharts.model.Line#setStrokeWidth() . 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-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 2
Source File: BgGraphBuilder.java    From AndroidAPS with GNU Affero General Public License v3.0 6 votes vote down vote up
public Line tempValuesLine(TempWatchData twd, float offset, double factor, boolean isHighlightLine, int strokeWidth) {
    List<PointValue> lineValues = new ArrayList<PointValue>();
    long begin = (long) Math.max(start_time, twd.startTime);
    lineValues.add(new PointValue(fuzz(begin), offset + (float) (factor * twd.startBasal)));
    lineValues.add(new PointValue(fuzz(begin), offset + (float) (factor * twd.amount)));
    lineValues.add(new PointValue(fuzz(twd.endTime), offset + (float) (factor * twd.amount)));
    lineValues.add(new PointValue(fuzz(twd.endTime), offset + (float) (factor * twd.endBasal)));
    Line valueLine = new Line(lineValues);
    valueLine.setHasPoints(false);
    if (isHighlightLine){
        valueLine.setColor(basalCenterColor);
        valueLine.setStrokeWidth(1);
    }else {
        valueLine.setColor(basalBackgroundColor);
        valueLine.setStrokeWidth(strokeWidth);
    }
    return valueLine;
}
 
Example 3
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 4
Source File: BgGraphBuilder.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public ArrayList<Line> filteredLines() {
    ArrayList<Line> line_array = new ArrayList<Line>();
    float last_x_pos = -999999; // bogus mark value
    final float jump_threshold = 15; // in minutes
    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();
            local_points.add(current_point); // grow current line list
        }
    }
    return line_array;
}
 
Example 5
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 6
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 7
Source File: BgGraphBuilder.java    From xDrip-plus 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 8
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 9
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 10
Source File: BgGraphBuilder.java    From xDrip-Experimental with GNU General Public License v3.0 5 votes vote down vote up
public ArrayList<Line> filteredLines() {
    ArrayList<Line> line_array = new ArrayList<Line>();
    float last_x_pos = -999999; // bogus mark value
    final float jump_threshold = 15; // in minutes
    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();
            local_points.add(current_point); // grow current line list
        }
    }
    return line_array;
}
 
Example 11
Source File: BgGraphBuilder.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public ArrayList<Line> filteredLines() {
    ArrayList<Line> linearray = new ArrayList<Line>();
    float lastx = -999999; // bogus mark value
    final float jumpthresh = 15; // in minutes
    List<PointValue> thesepoints = new ArrayList<PointValue>();

    if (filteredValues.size() > 0) {

        final float endmarker = filteredValues.get(filteredValues.size() - 1).getX();

        for (PointValue thispoint : filteredValues) {
            // a jump too far for a line? make it a new one
            if (((lastx != -999999) && (Math.abs(thispoint.getX() - lastx) > jumpthresh))
                    || thispoint.getX() == endmarker) {
                Line line = new Line(thesepoints);
                line.setHasPoints(true);
                line.setPointRadius(2);
                line.setStrokeWidth(1);
                line.setColor(getCol(X.color_filtered));
                line.setCubic(true);
                line.setHasLines(true);
                linearray.add(line);
                thesepoints = new ArrayList<PointValue>();
            }

            lastx = thispoint.getX();
            thesepoints.add(thispoint); // grow current line list
        }
    } else {
        UserError.Log.i(TAG, "Raw points size is zero");
    }


    //UserError.Log.i(TAG, "Returning linearray: " + Integer.toString(linearray.size()));
    return linearray;
}
 
Example 12
Source File: BgGraphBuilder.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public ArrayList<Line> filteredLines() {
    ArrayList<Line> line_array = new ArrayList<Line>();
    float last_x_pos = -999999; // bogus mark value
    final float jump_threshold = 15; // in minutes
    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();
            local_points.add(current_point); // grow current line list
        }
    }
    return line_array;
}
 
Example 13
Source File: BgGraphBuilder.java    From xDrip 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 14
Source File: BgGraphBuilder.java    From xDrip 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 15
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 16
Source File: BgGraphBuilder.java    From xDrip 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 17
Source File: BgGraphBuilder.java    From xDrip 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 18
Source File: BgGraphBuilder.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public ArrayList<Line> filteredLines() {
    ArrayList<Line> linearray = new ArrayList<Line>();
    float lastx = -999999; // bogus mark value
    final float jumpthresh = 15; // in minutes
    List<PointValue> thesepoints = new ArrayList<PointValue>();

    if (filteredValues.size() > 0) {

        final float endmarker = filteredValues.get(filteredValues.size() - 1).getX();

        for (PointValue thispoint : filteredValues) {
            // a jump too far for a line? make it a new one
            if (((lastx != -999999) && (Math.abs(thispoint.getX() - lastx) > jumpthresh))
                    || thispoint.getX() == endmarker) {
                Line line = new Line(thesepoints);
                line.setHasPoints(true);
                line.setPointRadius(2);
                line.setStrokeWidth(1);
                line.setColor(getCol(X.color_filtered));
                line.setCubic(true);
                line.setHasLines(true);
                linearray.add(line);
                thesepoints = new ArrayList<PointValue>();
            }

            lastx = thispoint.getX();
            thesepoints.add(thispoint); // grow current line list
        }
    } else {
        UserError.Log.i(TAG, "Raw points size is zero");
    }


    //UserError.Log.i(TAG, "Returning linearray: " + Integer.toString(linearray.size()));
    return linearray;
}
 
Example 19
Source File: BgGraphBuilder.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
private List<Line> motionLine() {

        final ArrayList<ActivityRecognizedService.motionData> motion_datas = ActivityRecognizedService.getForGraph((long) start_time * FUZZER, (long) end_time * FUZZER);
        List<PointValue> linePoints = new ArrayList<>();

        final float ypos = (float)highMark;
        int last_type = -9999;


        final ArrayList<Line> line_array = new ArrayList<>();

        Log.d(TAG,"Motion datas size: "+motion_datas.size());
        if (motion_datas.size() > 0) {
            motion_datas.add(new ActivityRecognizedService.motionData((long) end_time * FUZZER, DetectedActivity.UNKNOWN)); // terminator

            for (ActivityRecognizedService.motionData item : motion_datas) {

                Log.d(TAG, "Motion detail: " + JoH.dateTimeText(item.timestamp) + " activity: " + item.activity);
                if ((last_type != -9999) && (last_type != item.activity)) {
                    extend_line(linePoints, item.timestamp / FUZZER, ypos);
                    Line new_line = new Line(linePoints);
                    new_line.setHasLines(true);
                    new_line.setPointRadius(0);
                    new_line.setStrokeWidth(1);
                    new_line.setAreaTransparency(40);
                    new_line.setHasPoints(false);
                    new_line.setFilled(true);

                    switch (last_type) {
                        case DetectedActivity.IN_VEHICLE:
                            new_line.setColor(Color.parseColor("#70445599"));
                            break;
                        case DetectedActivity.ON_FOOT:
                            new_line.setColor(Color.parseColor("#70995599"));
                            break;
                    }
                    line_array.add(new_line);
                    linePoints = new ArrayList<>();
                }
                //current
                switch (item.activity) {
                    case DetectedActivity.ON_FOOT:
                    case DetectedActivity.IN_VEHICLE:
                        extend_line(linePoints, item.timestamp / FUZZER, ypos);
                        last_type = item.activity;
                        break;

                    default:
                        // do nothing?
                        break;
                }
            }

        }
        Log.d(TAG,"Motion array size: "+line_array.size());
            return line_array;
    }
 
Example 20
Source File: BgGraphBuilder.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
private List<Line> motionLine() {

        final ArrayList<ActivityRecognizedService.motionData> motion_datas = ActivityRecognizedService.getForGraph((long) start_time * FUZZER, (long) end_time * FUZZER);
        List<PointValue> linePoints = new ArrayList<>();

        final float ypos = (float)highMark;
        int last_type = -9999;


        final ArrayList<Line> line_array = new ArrayList<>();

        Log.d(TAG,"Motion datas size: "+motion_datas.size());
        if (motion_datas.size() > 0) {
            motion_datas.add(new ActivityRecognizedService.motionData((long) end_time * FUZZER, DetectedActivity.UNKNOWN)); // terminator

            for (ActivityRecognizedService.motionData item : motion_datas) {

                Log.d(TAG, "Motion detail: " + JoH.dateTimeText(item.timestamp) + " activity: " + item.activity);
                if ((last_type != -9999) && (last_type != item.activity)) {
                    extend_line(linePoints, item.timestamp / FUZZER, ypos);
                    Line new_line = new Line(linePoints);
                    new_line.setHasLines(true);
                    new_line.setPointRadius(0);
                    new_line.setStrokeWidth(1);
                    new_line.setAreaTransparency(40);
                    new_line.setHasPoints(false);
                    new_line.setFilled(true);

                    switch (last_type) {
                        case DetectedActivity.IN_VEHICLE:
                            new_line.setColor(Color.parseColor("#70445599"));
                            break;
                        case DetectedActivity.ON_FOOT:
                            new_line.setColor(Color.parseColor("#70995599"));
                            break;
                    }
                    line_array.add(new_line);
                    linePoints = new ArrayList<>();
                }
                //current
                switch (item.activity) {
                    case DetectedActivity.ON_FOOT:
                    case DetectedActivity.IN_VEHICLE:
                        extend_line(linePoints, item.timestamp / FUZZER, ypos);
                        last_type = item.activity;
                        break;

                    default:
                        // do nothing?
                        break;
                }
            }

        }
        Log.d(TAG,"Motion array size: "+line_array.size());
            return line_array;
    }