• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PieModel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: initData

import org.eazegraph.lib.models.PieModel; //导入依赖的package包/类
private void initData() {
    mPieChart.addPieSlice(new PieModel("KitKat", 17.9f,
            Color.parseColor("#df5346")));
    mPieChart.addPieSlice(new PieModel("Jelly Bean", 56.5f,
            Color.parseColor("#6dd621")));
    mPieChart.addPieSlice(new PieModel("Ice Cream Sandwich", 11.4f,
            Color.parseColor("#1f3b83")));
    mPieChart.addPieSlice(new PieModel("Gingerbread", 13.5f,
            Color.parseColor("#34a394")));
    mPieChart.addPieSlice(new PieModel("Froyo", 0.7f,
            Color.parseColor("#22a7d0")));

    mPieChart.setOnItemFocusChangedListener(new IOnItemFocusChangedListener() {
        @Override
        public void onItemFocusChanged(int position) {
            // TODO: To do what you want.
        }
    });
}
 
开发者ID:Phonbopit,项目名称:30-android-libraries-in-30-days,代码行数:20,代码来源:PieChartFragment.java


示例2: 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


示例3: 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


示例4: 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


示例5: onGraphOverlayDraw

import org.eazegraph.lib.models.PieModel; //导入依赖的package包/类
@Override
protected void onGraphOverlayDraw(Canvas _Canvas) {
    super.onGraphOverlayDraw(_Canvas);

    if(!mPieData.isEmpty() && mDrawValueInPie) {
        PieModel model = mPieData.get(mCurrentItem);

        if(!mUseCustomInnerValue) {
            mInnerValueString = Utils.getFloatString(model.getValue(), mShowDecimal);
            if (mInnerValueUnit != null && mInnerValueUnit.length() > 0) {
                mInnerValueString += " " + mInnerValueUnit;
            }
        }

        mValuePaint.getTextBounds(mInnerValueString, 0, mInnerValueString.length(), mValueTextBounds);
        _Canvas.drawText(
                mInnerValueString,
                mInnerBounds.centerX() - (mValueTextBounds.width() / 2),
                mInnerBounds.centerY() + (mValueTextBounds.height() / 2),
                mValuePaint
        );
    }
}
 
开发者ID:blackfizz,项目名称:EazeGraph,代码行数:24,代码来源:PieChart.java


示例6: onCreateView

import org.eazegraph.lib.models.PieModel; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    final View v = inflater.inflate(R.layout.fragment_step_status, container, false);

    //int stepsTaken = 15000;
    //int goalSteps = 20000;
    int numPotatoesBurned = calculatePotatoesBurned(stepsTakenToday);
    //handleGetStepsButton();
    mPieChart = (PieChart) v.findViewById(R.id.graph);
    stepsView = (TextView) v.findViewById(R.id.steps);
    totalPotatoesView = (TextView) v.findViewById(R.id.potatoes);
    Log.d("Steps taken today are: ", "" + stepsTakenToday);
    stepsView.setText(Integer.toString(stepsTakenToday));
    totalPotatoesView.setText(numPotatoesBurned == 1 ? numPotatoesBurned + " potato"
            : numPotatoesBurned + " potatoes");

    mPieChart.clearChart();
    sliceCurrent = new PieModel("", stepsTakenToday, Color.parseColor("#F38630"));
    mPieChart.addPieSlice(sliceCurrent);
    sliceGoal = new PieModel("", getGoalSteps() - stepsTakenToday, Color.parseColor("#E0E4CC"));
    mPieChart.addPieSlice(sliceGoal);

    mPieChart.startAnimation();

    ((TextView) v.findViewById(R.id.unit)).setText(getString(R.string.steps));

    return v;

}
 
开发者ID:parthsatra,项目名称:WalkPotato,代码行数:32,代码来源:StepStatusFragment.java


示例7: onCreateView

import org.eazegraph.lib.models.PieModel; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View v = inflater.inflate(R.layout.fragment_overview, null);
    stepsView = (TextView) v.findViewById(R.id.steps);
    totalView = (TextView) v.findViewById(R.id.total);
    averageView = (TextView) v.findViewById(R.id.average);

    pg = (PieChart) v.findViewById(R.id.graph);

    // slice for the steps taken today
    sliceCurrent = new PieModel("", 0, Color.parseColor("#99CC00"));
    pg.addPieSlice(sliceCurrent);

    // slice for the "missing" steps until reaching the goal
    sliceGoal = new PieModel("", Fragment_Settings.DEFAULT_GOAL, Color.parseColor("#CC0000"));
    pg.addPieSlice(sliceGoal);

    pg.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View view) {
            showSteps = !showSteps;
            stepsDistanceChanged();
        }
    });

    pg.setDrawValueInPie(false);
    pg.setUsePieRotation(true);
    pg.startAnimation();
    return v;
}
 
开发者ID:luinvacc,项目名称:pedometer,代码行数:31,代码来源:Fragment_Overview.java


示例8: loadData

import org.eazegraph.lib.models.PieModel; //导入依赖的package包/类
private void loadData() {
        mPieChart.addPieSlice(new PieModel("Freetime", 15, Color.parseColor("#FE6DA8")));
        mPieChart.addPieSlice(new PieModel("Sleep", 25, Color.parseColor("#56B7F1")));
        mPieChart.addPieSlice(new PieModel("Work", 35, Color.parseColor("#CDA67F")));
        mPieChart.addPieSlice(new PieModel("Eating", 9, Color.parseColor("#FED70E")));

        mPieChart.setOnItemFocusChangedListener(new IOnItemFocusChangedListener() {
            @Override
            public void onItemFocusChanged(int _Position) {
//                Log.d("PieChart", "Position: " + _Position);
            }
        });
    }
 
开发者ID:blackfizz,项目名称:EazeGraph,代码行数:14,代码来源:PieChartFragment.java


示例9: setHighlightStrength

import org.eazegraph.lib.models.PieModel; //导入依赖的package包/类
/**
 * Sets the highlight strength for the InnerPaddingOutline.
 *
 * @param _highlightStrength The highlighting value for the outline.
 */
public void setHighlightStrength(float _highlightStrength) {
    mHighlightStrength = _highlightStrength;
    for (PieModel model : mPieData) {
        highlightSlice(model);
    }
    invalidateGlobal();
}
 
开发者ID:blackfizz,项目名称:EazeGraph,代码行数:13,代码来源:PieChart.java


示例10: addPieSlice

import org.eazegraph.lib.models.PieModel; //导入依赖的package包/类
/**
 * Adds a new Pie Slice to the PieChart. After inserting and calculation of the highlighting color
 * a complete recalculation is initiated.
 *
 * @param _Slice The newly added PieSlice.
 */
public void addPieSlice(PieModel _Slice) {
    highlightSlice(_Slice);
    mPieData.add(_Slice);
    mTotalValue += _Slice.getValue();
    onDataChanged();
}
 
开发者ID:blackfizz,项目名称:EazeGraph,代码行数:13,代码来源:PieChart.java


示例11: update

import org.eazegraph.lib.models.PieModel; //导入依赖的package包/类
/**
 * Resets and clears the data object.
 */
@Override
public void update() {
    mTotalValue = 0;
    for (PieModel slice : mPieData) {
        mTotalValue += slice.getValue();
    }
    onDataChanged();
}
 
开发者ID:blackfizz,项目名称:EazeGraph,代码行数:12,代码来源:PieChart.java


示例12: highlightSlice

import org.eazegraph.lib.models.PieModel; //导入依赖的package包/类
/**
 * Calculate the highlight color. Saturate at 0xff to make sure that high values
 * don't result in aliasing.
 *
 * @param _Slice The Slice which will be highlighted.
 */
private void highlightSlice(PieModel _Slice) {

    int color = _Slice.getColor();
    _Slice.setHighlightedColor(Color.argb(
            0xff,
            Math.min((int) (mHighlightStrength * (float) Color.red(color)), 0xff),
            Math.min((int) (mHighlightStrength * (float) Color.green(color)), 0xff),
            Math.min((int) (mHighlightStrength * (float) Color.blue(color)), 0xff)
    ));
}
 
开发者ID:blackfizz,项目名称:EazeGraph,代码行数:17,代码来源:PieChart.java


示例13: onLegendDraw

import org.eazegraph.lib.models.PieModel; //导入依赖的package包/类
@Override
protected void onLegendDraw(Canvas _Canvas) {
    super.onLegendDraw(_Canvas);

    _Canvas.drawPath(mTriangle, mLegendPaint);

    float height = mMaxFontHeight = Utils.calculateMaxTextHeight(mLegendPaint, null);

    if(!mPieData.isEmpty()) {
        PieModel model = mPieData.get(mCurrentItem);

        // center text in view
        // TODO: move the boundary calculation out of onDraw
        mLegendPaint.getTextBounds(model.getLegendLabel(), 0, model.getLegendLabel().length(), mTextBounds);
        _Canvas.drawText(
                model.getLegendLabel(),
                (mLegendWidth / 2) - (mTextBounds.width() / 2),
                mIndicatorSize * 2 + mIndicatorBottomMargin + mIndicatorTopMargin + height,
                mLegendPaint
        );
    }
    else {

        mLegendPaint.getTextBounds(mEmptyDataText, 0, mEmptyDataText.length(), mTextBounds);
        _Canvas.drawText(
                mEmptyDataText,
                (mLegendWidth / 2) - (mTextBounds.width() / 2),
                mIndicatorSize * 2 + mIndicatorBottomMargin + mIndicatorTopMargin + height,
                mLegendPaint
        );
    }
}
 
开发者ID:blackfizz,项目名称:EazeGraph,代码行数:33,代码来源:PieChart.java


示例14: onCreateView

import org.eazegraph.lib.models.PieModel; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        View today = inflater.inflate(R.layout.today, container, false);

        mUsageStatsManager = (UsageStatsManager) getActivity().getSystemService(Context.USAGE_STATS_SERVICE);
        mInflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        mPm = getActivity().getPackageManager();

        sp = this.getActivity().getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
        getSavedApps.clear();
        int size = sp.getInt("Status_size", 0);
        for (int i = 0; i < size; i++) {
            getSavedApps.add(sp.getString("Status_" + i, null));
        }
        for (int i = 0; i < getSavedApps.size(); i++) {
            System.out.println("******Saved Package LiSt: " + getSavedApps.get(i));
        }

        ListView listView = (ListView) today.findViewById(R.id.TodayList);
        mAdapter = new UsageStatsAdapter();
        listView.setAdapter(mAdapter);

        Random rand = new Random();

        mPieChart = (PieChart) today.findViewById(R.id.piechart);
        mPieChart.startAnimation();

        System.out.println("***mAdapter.mPackageStats.size()***" + mAdapter.mPackageStats.size());

        for (int i = 0; i < mAdapter.mPackageStats.size(); i++) {
            Random rnd = new Random();
            //int color = Color.argb(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
            System.out.println("***pack name**" + mAdapter.mPackageStats.get(i).getPackageName());
            System.out.println("***label name**" + mAdapter.mAppLabelMap.get(mAdapter.mPackageStats.get(i).getPackageName()));


            int duration = (int) mAdapter.mPackageStats.get(i).getTotalTimeInForeground() / 1000;

//            String hms = String.format("%02d:%02d:%02d",
//                    TimeUnit.MILLISECONDS.toHours(duration),
//                    TimeUnit.MILLISECONDS.toMinutes(duration) -
//                            TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration)),
//                    TimeUnit.MILLISECONDS.toSeconds(duration) -
//                            TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration)));
//            float hmsINT = Float.parseFloat(hms);
//            System.out.println("$"+hmsINT);
            mPieChart.addPieSlice(new PieModel(mAdapter.mAppLabelMap.get(mAdapter.mPackageStats.get(i).getPackageName()), duration, Color.rgb(255, rnd.nextInt(), rnd.nextInt())));

            this.mPieChart.setOnFocusChangeListener(new View.OnFocusChangeListener() {
                @Override
                public void onFocusChange(View view, boolean b) {
                    System.out.println("FOCUS CHANGED");
                }
            });

            System.out.println("***color = " + Color.rgb(255, rnd.nextInt(), rnd.nextInt()));
            System.out.println("***duration***" + duration);
        }

        //Starting service on Page Load


        return today;
    }
 
开发者ID:spate141,项目名称:App-Monitor,代码行数:67,代码来源:Today.java


示例15: onCreateView

import org.eazegraph.lib.models.PieModel; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        View all = inflater.inflate(R.layout.sorting, container, false);
        //((TextView) last_month.findViewById(R.id.textView)).setText("Same UI as 'TODAY' tab");
        mUsageStatsManager = (UsageStatsManager) getActivity().getSystemService(Context.USAGE_STATS_SERVICE);
        mInflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        mPm = getActivity().getPackageManager();

        ListView listView = (ListView) all.findViewById(R.id.LastMonthList);
        mAdapter = new UsageStatsAdapter();
        listView.setAdapter(mAdapter);

//        BarChart mBarChart = (BarChart) last_month.findViewById(R.id.barchart);
//
//        mBarChart.addBar(new BarModel("1", 2.3f, 0xFF123456));
//        mBarChart.addBar(new BarModel("2",2.f,  0xFF343456));
//        mBarChart.addBar(new BarModel("3",3.3f, 0xFF563456));
//        mBarChart.addBar(new BarModel("4",1.1f, 0xFF873F56));
//        mBarChart.addBar(new BarModel("5",2.7f, 0xFF56B7F1));
//        mBarChart.addBar(new BarModel("6",2.f,  0xFF343456));
//        mBarChart.addBar(new BarModel("7",0.4f, 0xFF1FF4AC));
//        mBarChart.addBar(new BarModel("8",4.f,  0xFF1BA4E6));
//
//        mBarChart.startAnimation();
        mPieChart = (PieChart) all.findViewById(R.id.piechart);
        mPieChart.startAnimation();
        for (int i = 0; i < mAdapter.mPackageStats.size(); i++) {
            Random rnd = new Random();
            //int color = Color.argb(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
            System.out.println("***pack name**" + mAdapter.mPackageStats.get(i).getPackageName());
            System.out.println("***label name**" + mAdapter.mAppLabelMap.get(mAdapter.mPackageStats.get(i).getPackageName()));


            int duration = (int) mAdapter.mPackageStats.get(i).getTotalTimeInForeground() / 1000;

//            String hms = String.format("%02d:%02d:%02d",
//                    TimeUnit.MILLISECONDS.toHours(duration),
//                    TimeUnit.MILLISECONDS.toMinutes(duration) -
//                            TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration)),
//                    TimeUnit.MILLISECONDS.toSeconds(duration) -
//                            TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration)));
//            float hmsINT = Float.parseFloat(hms);
//            System.out.println("$"+hmsINT);
            mPieChart.addPieSlice(new PieModel(mAdapter.mAppLabelMap.get(mAdapter.mPackageStats.get(i).getPackageName()), duration, Color.rgb(255, rnd.nextInt(), rnd.nextInt())));

            this.mPieChart.setOnFocusChangeListener(new View.OnFocusChangeListener() {
                @Override
                public void onFocusChange(View view, boolean b) {
                    System.out.println("FOCUS CHANGED");
                }
            });

            System.out.println("***color = " + Color.rgb(255, rnd.nextInt(), rnd.nextInt()));
            System.out.println("***duration***" + duration);
        }

        return all;

    }
 
开发者ID:spate141,项目名称:App-Monitor,代码行数:62,代码来源:Sorting.java


示例16: getData

import org.eazegraph.lib.models.PieModel; //导入依赖的package包/类
/**
 * Returns the datasets which are currently inserted.
 * @return the datasets
 */
@Override
public List<PieModel> getData() { return mPieData; }
 
开发者ID:blackfizz,项目名称:EazeGraph,代码行数:7,代码来源:PieChart.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GvrActivity类代码示例发布时间:2022-05-22
下一篇:
Java LeafCollector类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap