Java Code Examples for lecho.lib.hellocharts.model.Line#setPointRadius()
The following examples show how to use
lecho.lib.hellocharts.model.Line#setPointRadius() .
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 AndroidAPS with GNU Affero General Public License v3.0 | 6 votes |
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 2
Source File: BgGraphBuilder.java From xDrip with GNU General Public License v3.0 | 6 votes |
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: IOBCOBLineGraph.java From HAPP with GNU General Public License v3.0 | 6 votes |
public Line iobFutureLine() { List<PointValue> listValues = new ArrayList<>(); for (int c = 0; c < iobFutureValues.length(); c++) { try { if (iobFutureValues.getJSONObject(c).getDouble("iob") > yIOBMax) { listValues.add(new PointValue((float) (iobFutureValues.getJSONObject(c).getDouble("as_of")), (float) fitIOB2COBRange(yIOBMax))); //Do not go above Max IOB } else if (iobFutureValues.getJSONObject(c).getDouble("iob") < yIOBMin) { listValues.add(new PointValue((float) (iobFutureValues.getJSONObject(c).getDouble("as_of")), (float) fitIOB2COBRange(yIOBMin))); //Do not go below Min IOB } 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; }
Example 4
Source File: BgGraphBuilder.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
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 5
Source File: BgGraphBuilder.java From xDrip with GNU General Public License v3.0 | 6 votes |
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 6
Source File: BgGraphBuilder.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
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 7
Source File: BgSparklineBuilder.java From NightWatch with GNU General Public License v3.0 | 5 votes |
Bitmap build() { List<Line> lines = new ArrayList<>(); bgGraphBuilder.defaultLines(); lines.add(bgGraphBuilder.inRangeValuesLine()); lines.add(bgGraphBuilder.lowValuesLine()); lines.add(bgGraphBuilder.highValuesLine()); if (showLowLine) lines.add(bgGraphBuilder.lowLine()); if (showHighLine) lines.add(bgGraphBuilder.highLine()); if (useSmallDots) { for(Line line: lines) line.setPointRadius(1); } LineChartData lineData = new LineChartData(lines); if (showAxes) { lineData.setAxisYLeft(bgGraphBuilder.yAxis()); lineData.setAxisXBottom(bgGraphBuilder.xAxis()); } //lines.add(bgGraphBuilder.rawInterpretedLine()); chart.setLineChartData(lineData); Viewport viewport = chart.getMaximumViewport(); viewport.left = start; viewport.right = end; chart.setViewportCalculationEnabled(false); chart.setInteractive(false); chart.setCurrentViewport(viewport); chart.setPadding(0,0,0,0); chart.setLeft(0); chart.setTop(0); chart.setRight(width); chart.setBottom(height); return getViewBitmap(chart); }
Example 8
Source File: BgGraphBuilder.java From xDrip-Experimental with GNU General Public License v3.0 | 5 votes |
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 9
Source File: BgGraphBuilder.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
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 10
Source File: BgGraphBuilder.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public Line rawInterpretedLine() { Line line = new Line(rawInterpretedValues); line.setHasLines(false); line.setPointRadius(1); line.setHasPoints(true); return line; }
Example 11
Source File: BgSparklineBuilder.java From NightWatch with GNU General Public License v3.0 | 5 votes |
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 12
Source File: BgSparklineBuilder.java From NightWatch with GNU General Public License v3.0 | 5 votes |
Bitmap build() { List<Line> lines = new ArrayList<>(); bgGraphBuilder.defaultLines(); lines.add(bgGraphBuilder.inRangeValuesLine()); lines.add(bgGraphBuilder.lowValuesLine()); lines.add(bgGraphBuilder.highValuesLine()); if (showLowLine) lines.add(bgGraphBuilder.lowLine()); if (showHighLine) lines.add(bgGraphBuilder.highLine()); if (useSmallDots) { for(Line line: lines) line.setPointRadius(1); } LineChartData lineData = new LineChartData(lines); if (showAxes) { lineData.setAxisYLeft(bgGraphBuilder.yAxis()); lineData.setAxisXBottom(bgGraphBuilder.xAxis()); } //lines.add(bgGraphBuilder.rawInterpretedLine()); chart.setLineChartData(lineData); Viewport viewport = chart.getMaximumViewport(); viewport.left = start; viewport.right = end; chart.setViewportCalculationEnabled(false); chart.setInteractive(false); chart.setCurrentViewport(viewport); chart.setPadding(0,0,0,0); chart.setLeft(0); chart.setTop(0); chart.setRight(width); chart.setBottom(height); return getViewBitmap(chart); }
Example 13
Source File: BgGraphBuilder.java From xDrip-Experimental with GNU General Public License v3.0 | 5 votes |
public Line rawInterpretedLine() { Line line = new Line(rawInterpretedValues); line.setHasLines(false); line.setPointRadius(1); line.setHasPoints(true); return line; }
Example 14
Source File: BgGraphBuilder.java From xDrip with GNU General Public License v3.0 | 5 votes |
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 15
Source File: BgGraphBuilder.java From xDrip with GNU General Public License v3.0 | 5 votes |
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 16
Source File: BgGraphBuilder.java From xDrip with GNU General Public License v3.0 | 5 votes |
private Line backFillValuesLine() { final Line line = new Line(backfillValues); line.setColor(Color.parseColor("#55338833")); line.setHasLines(false); line.setPointRadius(pointSize + 3); line.setHasPoints(true); return line; }
Example 17
Source File: BgGraphBuilder.java From xDrip with GNU General Public License v3.0 | 5 votes |
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 18
Source File: CalibrationGraph.java From xDrip with GNU General Public License v3.0 | 4 votes |
@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; }
Example 19
Source File: LibreTrendGraph.java From xDrip with GNU General Public License v3.0 | 4 votes |
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); }
Example 20
Source File: CalibrationGraph.java From xDrip-plus with GNU General Public License v3.0 | 4 votes |
@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; }