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

The following examples show how to use lecho.lib.hellocharts.model.Line#setValues() . 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 5 votes vote down vote up
private ArrayList<Line> autoSplitLine(Line macroline, final float jumpthresh) {
    ArrayList<Line> linearray = new ArrayList<>();
    float lastx = -999999;

    List<PointValue> macropoints = macroline.getValues();
    List<PointValue> thesepoints = new ArrayList<>();

    if (macropoints.size() > 0) {
        final float endmarker = macropoints.get(macropoints.size() - 1).getX();
        for (PointValue thispoint : macropoints) {

            // a jump too far for a line? make it a new one
            if (((lastx != -999999) && (Math.abs(thispoint.getX() - lastx) > jumpthresh))
                    || thispoint.getX() == endmarker) {

                if (thispoint.getX() == endmarker) {
                    thesepoints.add(thispoint);
                }
                Line line = (Line) cloneObject(macroline); // aieeee
                try {
                    line.setValues(thesepoints);
                    linearray.add(line);
                } catch (NullPointerException e) {
                //
                }
                    thesepoints = new ArrayList<PointValue>();
            }
            lastx = thispoint.getX();
            thesepoints.add(thispoint); // grow current line list
        }
    }
    return linearray;
}
 
Example 2
Source File: BgGraphBuilder.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public ArrayList<Line> autoSplitLine(Line macroline, final float jumpthresh) {
   // if (d) Log.d(TAG, "Enter autoSplit Line");
    ArrayList<Line> linearray = new ArrayList<Line>();
    float lastx = -999999;

    List<PointValue> macropoints = macroline.getValues();
    List<PointValue> thesepoints = new ArrayList<PointValue>();

    if (macropoints.size() > 0) {

        final float endmarker = macropoints.get(macropoints.size() - 1).getX();
        for (PointValue thispoint : macropoints) {

            // a jump too far for a line? make it a new one
            if (((lastx != -999999) && (Math.abs(thispoint.getX() - lastx) > jumpthresh))
                    || thispoint.getX() == endmarker) {

                if (thispoint.getX() == endmarker) {
                    thesepoints.add(thispoint);
                }
                Line line = (Line) JoH.cloneObject(macroline); // aieeee
                line.setValues(thesepoints);
                linearray.add(line);
                thesepoints = new ArrayList<PointValue>();
            }

            lastx = thispoint.getX();
            thesepoints.add(thispoint); // grow current line list
        }
    }
 //   if (d) Log.d(TAG, "Exit autoSplit Line");
    return linearray;
}
 
Example 3
Source File: BgGraphBuilder.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
private ArrayList<Line> autoSplitLine(Line macroline, final float jumpthresh) {
    ArrayList<Line> linearray = new ArrayList<>();
    float lastx = -999999;

    List<PointValue> macropoints = macroline.getValues();
    List<PointValue> thesepoints = new ArrayList<>();

    if (macropoints.size() > 0) {
        final float endmarker = macropoints.get(macropoints.size() - 1).getX();
        for (PointValue thispoint : macropoints) {

            // a jump too far for a line? make it a new one
            if (((lastx != -999999) && (Math.abs(thispoint.getX() - lastx) > jumpthresh))
                    || thispoint.getX() == endmarker) {

                if (thispoint.getX() == endmarker) {
                    thesepoints.add(thispoint);
                }
                Line line = (Line) cloneObject(macroline); // aieeee
                try {
                    line.setValues(thesepoints);
                    linearray.add(line);
                } catch (NullPointerException e) {
                //
                }
                    thesepoints = new ArrayList<PointValue>();
            }
            lastx = thispoint.getX();
            thesepoints.add(thispoint); // grow current line list
        }
    }
    return linearray;
}
 
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> autoSplitLine(Line macroline, final float jumpthresh) {
   // if (d) Log.d(TAG, "Enter autoSplit Line");
    ArrayList<Line> linearray = new ArrayList<Line>();
    float lastx = -999999;

    List<PointValue> macropoints = macroline.getValues();
    List<PointValue> thesepoints = new ArrayList<PointValue>();

    if (macropoints.size() > 0) {

        final float endmarker = macropoints.get(macropoints.size() - 1).getX();
        for (PointValue thispoint : macropoints) {

            // a jump too far for a line? make it a new one
            if (((lastx != -999999) && (Math.abs(thispoint.getX() - lastx) > jumpthresh))
                    || thispoint.getX() == endmarker) {

                if (thispoint.getX() == endmarker) {
                    thesepoints.add(thispoint);
                }
                Line line = (Line) JoH.cloneObject(macroline); // aieeee
                line.setValues(thesepoints);
                linearray.add(line);
                thesepoints = new ArrayList<PointValue>();
            }

            lastx = thispoint.getX();
            thesepoints.add(thispoint); // grow current line list
        }
    }
 //   if (d) Log.d(TAG, "Exit autoSplit Line");
    return linearray;
}