示例#1
0
  // callbacks everytime the MarkerView is redrawn, can be used to update the
  // content (user-interface)
  @Override
  public void refreshContent(Entry e, int dataSetIndex) {

    if (e instanceof CandleEntry) {

      CandleEntry ce = (CandleEntry) e;

      tvContent.setText("" + Utils.formatNumber(ce.getHigh(), 0, true));
    } else {

      tvContent.setText("" + Utils.formatNumber(e.getVal(), 0, true));
    }
  }
  // callbacks everytime the MarkerView is redrawn, can be used to update the
  // content (user-interface)
  @Override
  public void refreshContent(Entry e, Highlight highlight) {

    if (e instanceof CandleEntry) {

      CandleEntry ce = (CandleEntry) e;

      tvContent.setText("" + Utils.formatNumber(ce.getHigh(), 0, true));
    } else {

      tvContent.setText("" + Utils.formatNumber(e.getY(), 0, true));
    }

    super.refreshContent(e, highlight);
  }
示例#3
0
  /** Draws the y-labels of the RadarChart. */
  private void drawYLabels() {

    if (!mDrawYLabels) return;

    mYLabelPaint.setTypeface(mYLabels.getTypeface());
    mYLabelPaint.setTextSize(mYLabels.getTextSize());
    mYLabelPaint.setColor(mYLabels.getTextColor());

    PointF c = getCenterOffsets();
    float factor = getFactor();

    int labelCount = mYLabels.mEntryCount;

    for (int j = 0; j < labelCount; j++) {

      if (j == labelCount - 1 && mYLabels.isDrawTopYLabelEntryEnabled() == false) break;

      float r = ((mYChartMax / labelCount) * j) * factor;

      PointF p = getPosition(c, r, mRotationAngle);

      float val = r / factor;

      String label =
          Utils.formatNumber(val, mYLabels.mDecimals, mYLabels.isSeparateThousandsEnabled());

      if (mYLabels.isDrawUnitsInYLabelEnabled())
        mDrawCanvas.drawText(label + mUnit, p.x + 10, p.y - 5, mYLabelPaint);
      else {
        mDrawCanvas.drawText(label, p.x + 10, p.y - 5, mYLabelPaint);
      }
    }
  }
  // callbacks everytime the MarkerView is redrawn, can be used to update the
  // content (user-interface)
  @Override
  public void refreshContent(Entry e, int dataSetIndex) {

    if (e instanceof CandleEntry) {

      CandleEntry ce = (CandleEntry) e;

      tvContent.setText("" + Utils.formatNumber(ce.getHigh(), 0, true));
    } else {

      // tvContent.setText("" + Utils.formatNumber(e.getVal(), 0, true));
      // tvContent.setText("" + e.getVal());
      String markerVal = "";
      float value = e.getVal();

      switch (m_Flag) {
        case 0:
          switch (dataSetIndex) {
            case 0:
              markerVal = "心率:|" + (int) (value) + "次/分";
              break;
            case 1:
              markerVal = "收缩压:|" + (int) (value) + "mmHg";
              break;
            case 2:
              markerVal = "舒张压:|" + (int) (value) + "mmHg";
              break;

            default:
              break;
          }
          break;
        case 1:
          markerVal = "体温:|" + value + "℃";
          break;
        case 2:
          markerVal = "卡路里:|" + value + "J";
          break;
        default:
          break;
      }
      tvContent.setText(markerVal.replace("|", "\n"));
    }
  }