private void generateLineData(int color, int range, float textTemple) { // Cancel last animation if not finished. // chartTop.cancelDataAnimation(); // Modify data targets // 修改数据目标 Line line = lineData.getLines().get(0); // For this example there is always only one line. line.setColor(color); line.setFilled(true); line.setHasLabels(true); line.setHasPoints(false); List<PointValue> lineList = line.getValues(); for (int j = 0; j < lineList.size(); j++) { PointValue value = lineList.get(j); if (j == lineList.size() - 1) { value.setTarget(value.getX(), textTemple); } else { PointValue nextValue = lineList.get(j + 1); value.setTarget(value.getX(), nextValue.getY()); } } // Start new data animation with 300ms duration; realeChartTop.startDataAnimation(0); }
public Line lowLine() { List<PointValue> lowLineValues = new ArrayList<PointValue>(); lowLineValues.add(new PointValue((float) start_time, (float) lowMark)); lowLineValues.add(new PointValue((float) end_time, (float) lowMark)); Line lowLine = new Line(lowLineValues); lowLine.setHasPoints(false); lowLine.setAreaTransparency(50); lowLine.setColor(Color.parseColor("#C30909")); lowLine.setStrokeWidth(1); lowLine.setFilled(true); return lowLine; }
public Line lowLine(boolean show, boolean line_only) { List<PointValue> lowLineValues = new ArrayList<PointValue>(); lowLineValues.add(new PointValue((float) start_time / FUZZER, (float) lowMark)); lowLineValues.add(new PointValue((float) end_time / FUZZER, (float) lowMark)); Line lowLine = new Line(lowLineValues); lowLine.setHasPoints(false); if (!line_only) { lowLine.setAreaTransparency(20); lowLine.setFilled(true); } lowLine.setStrokeWidth(1); if (show) { lowLine.setColor(Color.parseColor("#FF0000")); } else { lowLine.setColor(Color.TRANSPARENT); } return lowLine; }