当前位置: 首页>>代码示例>>Java>>正文


Java PieModel.getEndAngle方法代码示例

本文整理汇总了Java中org.eazegraph.lib.models.PieModel.getEndAngle方法的典型用法代码示例。如果您正苦于以下问题:Java PieModel.getEndAngle方法的具体用法?Java PieModel.getEndAngle怎么用?Java PieModel.getEndAngle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eazegraph.lib.models.PieModel的用法示例。


在下文中一共展示了PieModel.getEndAngle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDataChanged

import org.eazegraph.lib.models.PieModel; //导入方法依赖的package包/类
/**
 * Should be called after new data is inserted. Will be automatically called, when the view dimensions
 * has changed.
 *
 * Calculates the start- and end-angles for every PieSlice.
 */
@Override
protected void onDataChanged() {
    super.onDataChanged();

    int currentAngle = 0;
    int index = 0;
    int size = mPieData.size();

    for (PieModel model : mPieData) {
        int endAngle = (int) (currentAngle + model.getValue() * 360.f / mTotalValue);
        if(index == size-1) {
            endAngle = 360;
        }

        model.setStartAngle(currentAngle);
        model.setEndAngle(endAngle);
        currentAngle = model.getEndAngle();
        index++;
    }
    calcCurrentItem();
    onScrollFinished();
}
 
开发者ID:blackfizz,项目名称:EazeGraph,代码行数:29,代码来源:PieChart.java

示例2: calcCurrentItem

import org.eazegraph.lib.models.PieModel; //导入方法依赖的package包/类
/**
 * Calculate which pie slice is under the pointer, and set the current item
 * field accordingly.
 */
private void calcCurrentItem() {
    int pointerAngle;

    // calculate the correct pointer angle, depending on clockwise drawing or not
    if(mOpenClockwise) {
        pointerAngle = (mIndicatorAngle + 360 - mPieRotation) % 360;
    }
    else {
        pointerAngle = (mIndicatorAngle + 180 + mPieRotation) % 360;
    }

    for (int i = 0; i < mPieData.size(); ++i) {
        PieModel model = mPieData.get(i);
        if (model.getStartAngle() <= pointerAngle && pointerAngle <= model.getEndAngle()) {
            if (i != mCurrentItem) {
                setCurrentItem(i, false);
            }
            break;
        }
    }
}
 
开发者ID:blackfizz,项目名称:EazeGraph,代码行数:26,代码来源:PieChart.java

示例3: centerOnCurrentItem

import org.eazegraph.lib.models.PieModel; //导入方法依赖的package包/类
/**
 * Kicks off an animation that will result in the pointer being centered in the
 * pie slice of the currently selected item.
 */
private void centerOnCurrentItem() {
    if(!mPieData.isEmpty()) {
        PieModel current = mPieData.get(getCurrentItem());
        int targetAngle;

        if(mOpenClockwise) {
            targetAngle = (mIndicatorAngle - current.getStartAngle()) - ((current.getEndAngle() - current.getStartAngle()) / 2);
            if (targetAngle < 0 && mPieRotation > 0) targetAngle += 360;
        }
        else {
            targetAngle = current.getStartAngle() + (current.getEndAngle() - current.getStartAngle()) / 2;
            targetAngle += mIndicatorAngle;
            if (targetAngle > 270 && mPieRotation < 90) targetAngle -= 360;
        }

        mAutoCenterAnimator.setIntValues(targetAngle);
        mAutoCenterAnimator.setDuration(AUTOCENTER_ANIM_DURATION).start();

    }
}
 
开发者ID:blackfizz,项目名称:EazeGraph,代码行数:25,代码来源:PieChart.java


注:本文中的org.eazegraph.lib.models.PieModel.getEndAngle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。