Beispiel #1
0
 public void removeAllSeries() {
   for (GraphViewSeries s : graphSeries) {
     s.removeGraphView(this);
   }
   while (!graphSeries.isEmpty()) {
     graphSeries.remove(0);
   }
   redrawAll();
 }
  protected void readHR() {
    if (hrProvider != null) {
      long age = hrProvider.getHRValueTimestamp();
      int hrValue = hrProvider.getHRValue();
      tvHR.setText(Integer.toString(hrValue));

      if (age != lastTimestamp) {
        if (graphViewSeries == null) {
          timerStartTime = System.currentTimeMillis();
          GraphViewData empty[] = {};
          graphViewSeries = new GraphViewSeries(empty);
          graphView.addSeries(graphViewSeries);
        }

        graphViewListData.add(new GraphViewData((age - timerStartTime) / 1000, hrValue));
        while (graphViewListData.size() > GRAPH_HISTORY_SECONDS) {
          graphViewListData.remove(0);
        }
        graphViewArrayData = graphViewListData.toArray(graphViewArrayData);
        graphViewSeries.resetData(graphViewArrayData);
        lastTimestamp = age;
      }
    }
  }
Beispiel #3
0
 public void removeSeries(GraphViewSeries series) {
   series.removeGraphView(this);
   graphSeries.remove(series);
   redrawAll();
 }
Beispiel #4
0
 public void addSeries(GraphViewSeries series) {
   series.addGraphView(this);
   graphSeries.add(series);
   redrawAll();
 }