本文整理匯總了Java中com.github.mikephil.charting.highlight.Highlight.getX方法的典型用法代碼示例。如果您正苦於以下問題:Java Highlight.getX方法的具體用法?Java Highlight.getX怎麽用?Java Highlight.getX使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.github.mikephil.charting.highlight.Highlight
的用法示例。
在下文中一共展示了Highlight.getX方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getHighlightByTouchPoint
import com.github.mikephil.charting.highlight.Highlight; //導入方法依賴的package包/類
/**
* Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
* point
* inside the BarChart.
*
* @param x
* @param y
* @return
*/
@Override
public Highlight getHighlightByTouchPoint(float x, float y) {
if (mData == null) {
Log.e(LOG_TAG, "Can't select by touch. No data set.");
return null;
} else {
Highlight h = getHighlighter().getHighlight(x, y);
if (h == null || !isHighlightFullBarEnabled()) return h;
// For isHighlightFullBarEnabled, remove stackIndex
return new Highlight(h.getX(), h.getY(),
h.getXPx(), h.getYPx(),
h.getDataSetIndex(), -1, h.getAxis());
}
}
示例2: getHighlightByTouchPoint
import com.github.mikephil.charting.highlight.Highlight; //導入方法依賴的package包/類
/**
* Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
* point
* inside the CombinedChart.
*
* @param x
* @param y
* @return
*/
@Override
public Highlight getHighlightByTouchPoint(float x, float y) {
if (mData == null) {
Log.e(LOG_TAG, "Can't select by touch. No data set.");
return null;
} else {
Highlight h = getHighlighter().getHighlight(x, y);
if (h == null || !isHighlightFullBarEnabled()) return h;
// For isHighlightFullBarEnabled, remove stackIndex
return new Highlight(h.getX(), h.getY(),
h.getXPx(), h.getYPx(),
h.getDataSetIndex(), -1, h.getAxis());
}
}
示例3: getMarkerPosition
import com.github.mikephil.charting.highlight.Highlight; //導入方法依賴的package包/類
@Override
protected float[] getMarkerPosition(Highlight highlight) {
MPPointF center = getCenterCircleBox();
float r = getRadius();
float off = r / 10f * 3.6f;
if (isDrawHoleEnabled()) {
off = (r - (r / 100f * getHoleRadius())) / 2f;
}
r -= off; // offset to keep things inside the chart
float rotationAngle = getRotationAngle();
int entryIndex = (int) highlight.getX();
// offset needed to center the drawn text in the slice
float offset = mDrawAngles[entryIndex] / 2;
// calculate the text position
float x = (float) (r
* Math.cos(Math.toRadians((rotationAngle + mAbsoluteAngles[entryIndex] - offset)
* mAnimator.getPhaseY())) + center.x);
float y = (float) (r
* Math.sin(Math.toRadians((rotationAngle + mAbsoluteAngles[entryIndex] - offset)
* mAnimator.getPhaseY())) + center.y);
MPPointF.recycleInstance(center);
return new float[]{x, y};
}
示例4: onValueSelected
import com.github.mikephil.charting.highlight.Highlight; //導入方法依賴的package包/類
@Override
public void onValueSelected(Entry e, Highlight h) {
Timber.d(e.toString());
switch (CHART_ID) {
case LANGUAGE_CHART_ID:
if (!isExpandedMap.get(expandLanguages.getId())) {
onExpand(expandLanguages);
}
languageHighlightedEntryX = h.getX();
resetAdapter(languagesListview, languageListAdapter, ((PieEntry) e).getLabel());
break;
case OS_CHART_ID:
if (!isExpandedMap.get(expandOs.getId())) {
onExpand(expandOs);
}
osHighlightedEntryX = h.getX();
resetAdapter(osListview, osListAdapter, ((PieEntry) e).getLabel());
break;
case EDITORS_CHART_ID:
if (!isExpandedMap.get(expandEditors.getId())) {
onExpand(expandEditors);
}
editorHighlightedEntryX = h.getX();
resetAdapter(editorsListView, editorsListAdapter, ((PieEntry) e).getLabel());
break;
default: //common code
break;
}
}
示例5: onValueSelected
import com.github.mikephil.charting.highlight.Highlight; //導入方法依賴的package包/類
@Override
public void onValueSelected(Entry e, Highlight h) {
switch (CHART_ID) {
case LANGUAGE_CHART_ID:
if (!isExpandedMap.get(expandLanguages.getId())) {
onExpand(expandLanguages);
}
languageHighlightedEntryX = h.getX();
resetAdapter(languagesListview, languageListAdapter, ((PieEntry) e).getLabel());
break;
case OS_CHART_ID:
if (!isExpandedMap.get(expandOs.getId())) {
onExpand(expandOs);
}
osHighlightedEntryX = h.getX();
resetAdapter(osListview, osListAdapter, ((PieEntry) e).getLabel());
break;
case EDITORS_CHART_ID:
if (!isExpandedMap.get(expandEditors.getId())) {
onExpand(expandEditors);
}
editorHighlightedEntryX = h.getX();
resetAdapter(editorsListView, editorsListAdapter, ((PieEntry) e).getLabel());
break;
default: //common code
break;
}
}