Пример #1
0
  /**
   * Highlights the value selected by touch gesture. Unlike highlightValues(...), this generates a
   * callback to the OnChartValueSelectedListener.
   *
   * @param high - the highlight object
   * @param callListener - call the listener
   */
  public void highlightValue(Highlight high, boolean callListener) {

    Entry e = null;

    if (high == null) mIndicesToHighlight = null;
    else {

      if (mLogEnabled) Log.i(LOG_TAG, "Highlighted: " + high.toString());

      e = mData.getEntryForHighlight(high);
      if (e == null || e.getXIndex() != high.getXIndex()) {
        mIndicesToHighlight = null;
        high = null;
      } else {
        // set the indices to highlight
        mIndicesToHighlight = new Highlight[] {high};
      }
    }

    if (callListener && mSelectionListener != null) {

      if (!valuesToHighlight()) mSelectionListener.onNothingSelected();
      else {
        // notify the listener
        mSelectionListener.onValueSelected(e, high.getDataSetIndex(), high);
      }
    }
    // redraw the chart
    invalidate();
  }