/** * 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)}); } }
/** * 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); }
@Override public int getXValCount() { return mData.getXValCount(); }
/** * 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); }