Example #1
0
  /**
   * Highlights the value at the given x-index in the given DataSet. Provide -1 as the x-index or
   * dataSetIndex to undo all highlighting.
   *
   * @param xIndex
   * @param dataSetIndex
   */
  public void highlightValue(int xIndex, int dataSetIndex) {

    if (xIndex < 0
        || dataSetIndex < 0
        || xIndex >= mData.getXValCount()
        || dataSetIndex >= mData.getDataSetCount()) {

      highlightValues(null);
    } else {
      highlightValues(new Highlight[] {new Highlight(xIndex, dataSetIndex)});
    }
  }
Example #2
0
  /**
   * calculates the required number of digits for the values that might be drawn in the chart (if
   * enabled), and creates the default-value-formatter
   */
  protected void calculateFormatter(float min, float max) {

    float reference = 0f;

    if (mData == null || mData.getXValCount() < 2) {

      reference = Math.max(Math.abs(min), Math.abs(max));
    } else {
      reference = Math.abs(max - min);
    }

    int digits = Utils.getDecimals(reference);
    mDefaultFormatter = new DefaultValueFormatter(digits);
  }
Example #3
0
 @Override
 public int getXValCount() {
   return mData.getXValCount();
 }
Example #4
0
 /**
  * returns the x-value at the given index
  *
  * @param index
  * @return
  */
 public String getXValue(int index) {
   if (mData == null || mData.getXValCount() <= index) return null;
   else return mData.getXVals().get(index);
 }