Skip to content

Commit

Permalink
Merge pull request PhilJay#1143 from danielgindi/highlight-value
Browse files Browse the repository at this point in the history
Moved highlightTouch logic to highlightValue & deprecated highlightTouch
  • Loading branch information
PhilJay committed Oct 23, 2015
2 parents 809b9b4 + b098e59 commit 89cb45d
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions MPChartLib/src/com/github/mikephil/charting/charts/Chart.java
Original file line number Diff line number Diff line change
Expand Up @@ -572,24 +572,23 @@ public void highlightValue(int xIndex, int dataSetIndex) {

/**
* Highlights the values represented by the provided Highlight object
* This DOES NOT generate a callback to the OnChartValueSelectedListener.
*
* @param highlight contains information about which entry should be highlighted
*/
public void highlightValue(Highlight highlight) {
if (highlight == null)
highlightValues(null);
else
highlightValues(new Highlight[]{highlight});
highlightValue(highlight);
}

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

Entry e = null;

Expand All @@ -612,7 +611,7 @@ public void highlightTouch(Highlight high) {
}
}

if (mSelectionListener != null) {
if (callListener && mSelectionListener != null) {

if (!valuesToHighlight())
mSelectionListener.onNothingSelected();
Expand All @@ -625,6 +624,14 @@ public void highlightTouch(Highlight high) {
invalidate();
}

/**
* Deprecated. Calls highlightValue(high, true)
*/
@Deprecated
public void highlightTouch(Highlight high) {
highlightValue(high, true);
}

/**
* Set a new (e.g. custom) ChartTouchListener NOTE: make sure to
* setTouchEnabled(true); if you need touch gestures on the chart
Expand Down

0 comments on commit 89cb45d

Please sign in to comment.