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

Java RadarEntry类代码示例

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

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



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

示例1: setData

import com.github.mikephil.charting.data.RadarEntry; //导入依赖的package包/类
@Override
public void setData(float[] data) {

    ArrayList<RadarEntry> entries1 = new ArrayList<>();

    for (float aData : data) {
        entries1.add(new RadarEntry(aData));
    }

    RadarDataSet set1 = new RadarDataSet(entries1, getString(R.string.app_name));
    set1.setColor(Color.rgb(121, 162, 175));
    set1.setFillColor(Color.rgb(121, 162, 175));
    set1.setDrawFilled(true);
    set1.setFillAlpha(180);
    set1.setLineWidth(2f);
    set1.setDrawHighlightCircleEnabled(true);
    set1.setDrawHighlightIndicators(false);

    RadarData radarData = new RadarData(set1);
    radarData.setValueTextSize(8f);
    radarData.setDrawValues(false);
    radarData.setValueTextColor(Color.WHITE);

    mRadarChart.setData(radarData);
    mRadarChart.invalidate();
}
 
开发者ID:Alex-ZHOU,项目名称:VMAndroid,代码行数:27,代码来源:AnalysisChartFragment.java


示例2: setData

import com.github.mikephil.charting.data.RadarEntry; //导入依赖的package包/类
@Override
public void setData(float[] data) {


    ArrayList<RadarEntry> entries1 = new ArrayList<>();

    for (float aData : data) {
        entries1.add(new RadarEntry(aData));
    }

    RadarDataSet set1 = new RadarDataSet(entries1, getString(R.string.app_name));
    set1.setColor(Color.rgb(121, 162, 175));
    set1.setFillColor(Color.rgb(121, 162, 175));
    set1.setDrawFilled(true);
    set1.setFillAlpha(180);
    set1.setLineWidth(2f);
    set1.setDrawHighlightCircleEnabled(true);
    set1.setDrawHighlightIndicators(false);

    RadarData radarData = new RadarData(set1);
    radarData.setValueTextSize(8f);
    radarData.setDrawValues(false);
    radarData.setValueTextColor(Color.WHITE);

    mRadarChart.setData(radarData);
    mRadarChart.invalidate();
}
 
开发者ID:Alex-ZHOU,项目名称:VMAndroid,代码行数:28,代码来源:AnalysisFragment.java


示例3: drawDataSet

import com.github.mikephil.charting.data.RadarEntry; //导入依赖的package包/类
/**
 * Draws the RadarDataSet
 *
 * @param c
 * @param dataSet
 * @param mostEntries the entry count of the dataset with the most entries
 */
protected void drawDataSet(Canvas c, IRadarDataSet dataSet, int mostEntries) {

    float phaseX = mAnimator.getPhaseX();
    float phaseY = mAnimator.getPhaseY();

    float sliceangle = mChart.getSliceAngle();

    // calculate the factor that is needed for transforming the value to
    // pixels
    float factor = mChart.getFactor();

    MPPointF center = mChart.getCenterOffsets();
    MPPointF pOut = MPPointF.getInstance(0,0);
    Path surface = mDrawDataSetSurfacePathBuffer;
    surface.reset();

    boolean hasMovedToPoint = false;

    for (int j = 0; j < dataSet.getEntryCount(); j++) {

        mRenderPaint.setColor(dataSet.getColor(j));

        RadarEntry e = dataSet.getEntryForIndex(j);

        Utils.getPosition(
                center,
                (e.getY() - mChart.getYChartMin()) * factor * phaseY,
                sliceangle * j * phaseX + mChart.getRotationAngle(), pOut);

        if (Float.isNaN(pOut.x))
            continue;

        if (!hasMovedToPoint) {
            surface.moveTo(pOut.x, pOut.y);
            hasMovedToPoint = true;
        } else
            surface.lineTo(pOut.x, pOut.y);
    }

    if (dataSet.getEntryCount() > mostEntries) {
        // if this is not the largest set, draw a line to the center before closing
        surface.lineTo(center.x, center.y);
    }

    surface.close();

    if (dataSet.isDrawFilledEnabled()) {

        final Drawable drawable = dataSet.getFillDrawable();
        if (drawable != null) {

            drawFilledPath(c, surface, drawable);
        } else {

            drawFilledPath(c, surface, dataSet.getFillColor(), dataSet.getFillAlpha());
        }
    }

    mRenderPaint.setStrokeWidth(dataSet.getLineWidth());
    mRenderPaint.setStyle(Paint.Style.STROKE);

    // draw the line (only if filled is disabled or alpha is below 255)
    if (!dataSet.isDrawFilledEnabled() || dataSet.getFillAlpha() < 255)
        c.drawPath(surface, mRenderPaint);

    MPPointF.recycleInstance(center);
    MPPointF.recycleInstance(pOut);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:76,代码来源:RadarChartRenderer.java


示例4: drawHighlighted

import com.github.mikephil.charting.data.RadarEntry; //导入依赖的package包/类
@Override
public void drawHighlighted(Canvas c, Highlight[] indices) {

    float sliceangle = mChart.getSliceAngle();

    // calculate the factor that is needed for transforming the value to
    // pixels
    float factor = mChart.getFactor();

    MPPointF center = mChart.getCenterOffsets();
    MPPointF pOut = MPPointF.getInstance(0,0);

    RadarData radarData = mChart.getData();

    for (Highlight high : indices) {

        IRadarDataSet set = radarData.getDataSetByIndex(high.getDataSetIndex());

        if (set == null || !set.isHighlightEnabled())
            continue;

        RadarEntry e = set.getEntryForIndex((int) high.getX());

        if (!isInBoundsX(e, set))
            continue;

        float y = (e.getY() - mChart.getYChartMin());

        Utils.getPosition(center,
                y * factor * mAnimator.getPhaseY(),
                sliceangle * high.getX() * mAnimator.getPhaseX() + mChart.getRotationAngle(),
                pOut);

        high.setDraw(pOut.x, pOut.y);

        // draw the lines
        drawHighlightLines(c, pOut.x, pOut.y, set);

        if (set.isDrawHighlightCircleEnabled()) {

            if (!Float.isNaN(pOut.x) && !Float.isNaN(pOut.y)) {

                int strokeColor = set.getHighlightCircleStrokeColor();
                if (strokeColor == ColorTemplate.COLOR_NONE) {
                    strokeColor = set.getColor(0);
                }

                if (set.getHighlightCircleStrokeAlpha() < 255) {
                    strokeColor = ColorTemplate.colorWithAlpha(strokeColor, set.getHighlightCircleStrokeAlpha());
                }

                drawHighlightCircle(c,
                        pOut,
                        set.getHighlightCircleInnerRadius(),
                        set.getHighlightCircleOuterRadius(),
                        set.getHighlightCircleFillColor(),
                        strokeColor,
                        set.getHighlightCircleStrokeWidth());
            }
        }
    }

    MPPointF.recycleInstance(center);
    MPPointF.recycleInstance(pOut);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:66,代码来源:RadarChartRenderer.java


示例5: setData

import com.github.mikephil.charting.data.RadarEntry; //导入依赖的package包/类
public void setData() {

        float mult = 80;
        float min = 20;
        int cnt = 5;

        ArrayList<RadarEntry> entries1 = new ArrayList<RadarEntry>();
        ArrayList<RadarEntry> entries2 = new ArrayList<RadarEntry>();

        // NOTE: The order of the entries when being added to the entries array determines their position around the center of
        // the chart.
        for (int i = 0; i < cnt; i++) {
            float val1 = (float) (Math.random() * mult) + min;
            entries1.add(new RadarEntry(val1));

            float val2 = (float) (Math.random() * mult) + min;
            entries2.add(new RadarEntry(val2));
        }

        RadarDataSet set1 = new RadarDataSet(entries1, "Last Week");
        set1.setColor(Color.rgb(103, 110, 129));
        set1.setFillColor(Color.rgb(103, 110, 129));
        set1.setDrawFilled(true);
        set1.setFillAlpha(180);
        set1.setLineWidth(2f);
        set1.setDrawHighlightCircleEnabled(true);
        set1.setDrawHighlightIndicators(false);

        RadarDataSet set2 = new RadarDataSet(entries2, "This Week");
        set2.setColor(Color.rgb(121, 162, 175));
        set2.setFillColor(Color.rgb(121, 162, 175));
        set2.setDrawFilled(true);
        set2.setFillAlpha(180);
        set2.setLineWidth(2f);
        set2.setDrawHighlightCircleEnabled(true);
        set2.setDrawHighlightIndicators(false);

        ArrayList<IRadarDataSet> sets = new ArrayList<IRadarDataSet>();
        sets.add(set1);
        sets.add(set2);

        RadarData data = new RadarData(sets);
        data.setValueTypeface(mTfLight);
        data.setValueTextSize(8f);
        data.setDrawValues(false);
        data.setValueTextColor(Color.WHITE);

        mChart.setData(data);
        mChart.invalidate();
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:51,代码来源:RadarChartActivitry.java


示例6: drawValues

import com.github.mikephil.charting.data.RadarEntry; //导入依赖的package包/类
@Override
public void drawValues(Canvas c) {

    float phaseX = mAnimator.getPhaseX();
    float phaseY = mAnimator.getPhaseY();

    float sliceangle = mChart.getSliceAngle();

    // calculate the factor that is needed for transforming the value to
    // pixels
    float factor = mChart.getFactor();

    MPPointF center = mChart.getCenterOffsets();
    MPPointF pOut = MPPointF.getInstance(0,0);

    float yoffset = Utils.convertDpToPixel(5f);

    for (int i = 0; i < mChart.getData().getDataSetCount(); i++) {

        IRadarDataSet dataSet = mChart.getData().getDataSetByIndex(i);

        if (!shouldDrawValues(dataSet))
            continue;

        // apply the text-styling defined by the DataSet
        applyValueTextStyle(dataSet);

        for (int j = 0; j < dataSet.getEntryCount(); j++) {

            RadarEntry entry = dataSet.getEntryForIndex(j);

             Utils.getPosition(
                     center,
                     (entry.getY() - mChart.getYChartMin()) * factor * phaseY,
                     sliceangle * j * phaseX + mChart.getRotationAngle(),
                     pOut);

            drawValue(c, dataSet.getValueFormatter(), entry.getY(), entry, i, pOut.x, pOut.y - yoffset, dataSet.getValueTextColor
                    (j));
        }
    }

    MPPointF.recycleInstance(center);
    MPPointF.recycleInstance(pOut);
}
 
开发者ID:xsingHu,项目名称:xs-android-architecture,代码行数:46,代码来源:RadarChartRenderer.java


示例7: drawHighlighted

import com.github.mikephil.charting.data.RadarEntry; //导入依赖的package包/类
@Override
public void drawHighlighted(Canvas c, Highlight[] indices) {

    float sliceangle = mChart.getSliceAngle();

    // calculate the factor that is needed for transforming the value to
    // pixels
    float factor = mChart.getFactor();

    MPPointF center = mChart.getCenterOffsets();
    MPPointF pOut = MPPointF.getInstance(0,0);

    RadarData radarData = mChart.getData();

    for (Highlight high : indices) {

        IRadarDataSet set = radarData.getDataSetByIndex(high.getDataSetIndex());

        if (set == null || !set.isHighlightEnabled())
            continue;

        RadarEntry e = set.getEntryForIndex((int) high.getX());

        if (!isInBoundsX(e, set))
            continue;

        float y = (e.getY() - mChart.getYChartMin());

        Utils.getPosition(center,
                y * factor * mAnimator.getPhaseY(),
                sliceangle * high.getX() * mAnimator.getPhaseX() + mChart.getRotationAngle(),
                pOut);

        high.setDraw(pOut.x, pOut.y);

        // draw the lines
        drawHighlightLines(c, pOut.x, pOut.y, set);

        if (set.isDrawHighlightCircleEnabled()) {

            if (!Float.isNaN(pOut.x) && !Float.isNaN(pOut.y)) {

                int strokeColor = set.getHighlightCircleStrokeColor();
                if (strokeColor == ColorTemplate.COLOR_NONE) {
                    strokeColor = set.getColor(0);
                }

                if (set.getHighlightCircleStrokeAlpha() < 255) {
                    strokeColor = ColorTemplate.getColorWithAlphaComponent(strokeColor, set.getHighlightCircleStrokeAlpha());
                }

                drawHighlightCircle(c,
                        pOut,
                        set.getHighlightCircleInnerRadius(),
                        set.getHighlightCircleOuterRadius(),
                        set.getHighlightCircleFillColor(),
                        strokeColor,
                        set.getHighlightCircleStrokeWidth());
            }
        }
    }

    MPPointF.recycleInstance(center);
    MPPointF.recycleInstance(pOut);
}
 
开发者ID:letolab,项目名称:LETO-Toggl_Android,代码行数:66,代码来源:RadarChartRenderer.java


示例8: buildEntryFromResultObject

import com.github.mikephil.charting.data.RadarEntry; //导入依赖的package包/类
@Override
public RadarEntry buildEntryFromResultObject(T realmObject, float x) {
    DynamicRealmObject dynamicObject = new DynamicRealmObject(realmObject);
    return new RadarEntry(dynamicObject.getFloat(mYValuesField));
}
 
开发者ID:PhilJay,项目名称:MPAndroidChart-Realm,代码行数:6,代码来源:RealmRadarDataSet.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java DWithin类代码示例发布时间:2022-05-22
下一篇:
Java SedaEndpoint类代码示例发布时间: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