Skip to content

Commit

Permalink
Merge pull request #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 ed8720f + 9a3d2ad commit fd3b2a1
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);

This comment has been minimized.

Copy link
@danielgindi

danielgindi Oct 23, 2015

Collaborator

@PhilJay I forgot to add the , false in here. Would you make a quick fix? Otherwise the highlightValue will go into recursion loop...

}

/**
* 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

1 comment on commit fd3b2a1

@PhilJay
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah 😊
cant right now im on my way to munich. its not that bad most people dont clone

Please sign in to comment.