Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved highlightTouch logic to highlightValue & deprecated highlightTouch #1143

Merged
merged 1 commit into from
Oct 23, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@PhilJay Oh man I forgot to add a , false in there! Could you do a quick fix?

}

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