當前位置: 首頁>>代碼示例>>Java>>正文


Java Highlight.getX方法代碼示例

本文整理匯總了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());
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:26,代碼來源:BarChart.java

示例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());
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:26,代碼來源:CombinedChart.java

示例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};
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:33,代碼來源:PieChart.java

示例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;
    }
}
 
開發者ID:Protino,項目名稱:CodeWatch,代碼行數:30,代碼來源:ProjectDetailsFragment.java

示例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;
    }
}
 
開發者ID:Protino,項目名稱:CodeWatch,代碼行數:29,代碼來源:DashboardFragment.java


注:本文中的com.github.mikephil.charting.highlight.Highlight.getX方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。