// 产生数据 记录
    //////////////////////////////////////////////////////////////////////////////////////////////////////
    private void generateDefaultData(int[] recordMsgBuffer) {
      int max = recordMsgBuffer[0];
      int min = recordMsgBuffer[0];
      List<PointValue> values = new ArrayList<PointValue>();

      for (int j = 0; j < recordMsgBuffer.length; j++) {
        values.add(new PointValue(j, (float) recordMsgBuffer[j] / 10f));

        if (recordMsgBuffer[j] > max) {
          max = recordMsgBuffer[j];
        }

        if (recordMsgBuffer[j] < min) {
          min = recordMsgBuffer[j];
        }
      }

      if (max - min < 50) {
        max = max + 25;
        min = min - 25;
      }

      Line line = new Line(values);
      line.setColor(ChartUtils.COLOR_GREEN);
      line.setHasPoints(false); // too many values so don't draw points.
      //            line.setFilled(true);

      List<PointValue> values1 = new ArrayList<PointValue>();
      values1.add(new PointValue(0, (float) max / 10f + 0.2f));
      Line line1 = new Line(values1);
      line1.setHasPoints(false); // too many values so don't draw points.
      line1.setPointRadius(0);

      List<PointValue> values2 = new ArrayList<PointValue>();
      values2.add(new PointValue(0, (float) min / 10f - 0.2f));
      Line line2 = new Line(values2);
      line2.setHasPoints(false); // too many values so don't draw points.
      line2.setPointRadius(0);

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

      data = new LineChartData(lines);
      data.setAxisXBottom(new Axis().setHasLines(true).setTextColor(ChartUtils.COLOR_GREEN));
      data.setAxisYLeft(
          new Axis().setHasLines(true).setMaxLabelChars(4).setTextColor(ChartUtils.COLOR_GREEN));

      // prepare preview data, is better to use separate deep copy for preview recordChart.
      // Set color to grey to make preview area more visible.
      previewData = new LineChartData(data);
      previewData.getLines().get(0).setColor(ChartUtils.DEFAULT_DARKEN_COLOR);
    }
 public Line rawInterpretedLine() {
   Line line = new Line(rawInterpretedValues);
   line.setHasLines(false);
   line.setPointRadius(1);
   line.setHasPoints(true);
   return line;
 }
 public Line inRangeValuesLine() {
   Line inRangeValuesLine = new Line(inRangeValues);
   inRangeValuesLine.setColor(Utils.COLOR_BLUE);
   inRangeValuesLine.setHasLines(false);
   inRangeValuesLine.setPointRadius(pointSize);
   inRangeValuesLine.setHasPoints(true);
   return inRangeValuesLine;
 }
 public Line lowValuesLine() {
   Line lowValuesLine = new Line(lowValues);
   lowValuesLine.setColor(Color.parseColor("#C30909"));
   lowValuesLine.setHasLines(false);
   lowValuesLine.setPointRadius(pointSize);
   lowValuesLine.setHasPoints(true);
   return lowValuesLine;
 }
 public Line highValuesLine() {
   Line highValuesLine = new Line(highValues);
   highValuesLine.setColor(Utils.COLOR_ORANGE);
   highValuesLine.setHasLines(false);
   highValuesLine.setPointRadius(pointSize);
   highValuesLine.setHasPoints(true);
   return highValuesLine;
 }
Ejemplo n.º 6
0
 public Line inRangeValuesLine() {
   Line inRangeValuesLine = new Line(inRangeValues);
   inRangeValuesLine.setColor(Color.parseColor("#00FF00"));
   inRangeValuesLine.setHasLines(false);
   inRangeValuesLine.setPointRadius(pointSize);
   inRangeValuesLine.setHasPoints(true);
   return inRangeValuesLine;
 }
Ejemplo n.º 7
0
 public Line highValuesLine() {
   Line highValuesLine = new Line(highValues);
   highValuesLine.setColor(Color.parseColor("#FFFF00"));
   highValuesLine.setHasLines(false);
   highValuesLine.setPointRadius(pointSize);
   highValuesLine.setHasPoints(true);
   return highValuesLine;
 }