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


Java RadarDataSet类代码示例

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


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

示例1: setData

import com.github.mikephil.charting.data.RadarDataSet; //导入依赖的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: RadarChartCustom

import com.github.mikephil.charting.data.RadarDataSet; //导入依赖的package包/类
public RadarChartCustom(RadarChart graphical, ArrayList<Entry> entries, String entriesLegend, ArrayList<String> labels, String chartDecription)
{
    this.entries = entries;
    this.chart = graphical;
    this.dataset = new RadarDataSet(entries, entriesLegend);
    this.data = new RadarData(labels, this.dataset);
    this.chart.setData(this.data);
    this.colors = new ArrayList<>();
    this.yAxis = chart.getYAxis();
    this.xAxis = chart.getXAxis();
    this.legend = chart.getLegend();
    this.chart.setSkipWebLineCount(1);
    if(chartDecription!= null)
        chart.setDescription(chartDecription);
    else chart.setDescription("");
    setDefaultChart();
    setDefaultLegend();
    setDefaultAxes();
}
 
开发者ID:pfiorentino,项目名称:eCarNet,代码行数:20,代码来源:RadarChartCustom.java

示例3: setData

import com.github.mikephil.charting.data.RadarDataSet; //导入依赖的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

示例4: drawData

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

    RadarData radarData = mChart.getData();

    for (RadarDataSet set : radarData.getDataSets()) {

        if (set.isVisible() && set.getEntryCount() > 0)
            drawDataSet(c, set);
    }
}
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:12,代码来源:RadarChartRenderer.java

示例5: dataSetConfig

import com.github.mikephil.charting.data.RadarDataSet; //导入依赖的package包/类
@Override
void dataSetConfig(IDataSet<Entry> dataSet, ReadableMap config) {
    RadarDataSet radarDataSet = (RadarDataSet) dataSet;

    ChartDataSetConfigUtils.commonConfig(radarDataSet, config);
    ChartDataSetConfigUtils.commonLineScatterCandleRadarConfig(radarDataSet, config);
    ChartDataSetConfigUtils.commonLineRadarConfig(radarDataSet, config);

    // RadarDataSet only config
}
 
开发者ID:mskec,项目名称:react-native-mp-android-chart,代码行数:11,代码来源:RadarChartManager.java

示例6: drawValues

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

    // if values are drawn
    if (mDrawYValues) {

        float sliceangle = getSliceAngle();

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

        PointF c = getCenterOffsets();

        float yoffset = Utils.convertDpToPixel(5f);

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

            RadarDataSet dataSet = mData.getDataSetByIndex(i);
            ArrayList<Entry> entries = dataSet.getYVals();

            for (int j = 0; j < entries.size(); j++) {

                Entry e = entries.get(j);

                PointF p = getPosition(c, e.getVal() * factor, sliceangle * j + mRotationAngle);

                if (mDrawUnitInChart)
                    mDrawCanvas.drawText(mValueFormatter.getFormattedValue(e.getVal()) + mUnit,
                            p.x, p.y - yoffset, mValuePaint);
                else
                    mDrawCanvas.drawText(mValueFormatter.getFormattedValue(e.getVal()),
                            p.x, p.y - yoffset, mValuePaint);
            }
        }
    }
}
 
开发者ID:LINKIWI,项目名称:mobile-manager-for-cloudflare,代码行数:38,代码来源:RadarChart.java

示例7: drawHighlights

import com.github.mikephil.charting.data.RadarDataSet; //导入依赖的package包/类
@Override
protected void drawHighlights() {

    // if there are values to highlight and highlighnting is enabled, do it
    if (mHighlightEnabled && valuesToHighlight()) {

        float sliceangle = getSliceAngle();
        float factor = getFactor();

        PointF c = getCenterOffsets();

        for (int i = 0; i < mIndicesToHightlight.length; i++) {

            RadarDataSet set = mData
                    .getDataSetByIndex(mIndicesToHightlight[i]
                            .getDataSetIndex());

            if (set == null)
                continue;

            mHighlightPaint.setColor(set.getHighLightColor());

            // get the index to highlight
            int xIndex = mIndicesToHightlight[i].getXIndex();

            Entry e = set.getEntryForXIndex(xIndex);
            int j = set.getEntryPosition(e);
            float y = e.getVal();

            PointF p = getPosition(c, y * factor, sliceangle * j + mRotationAngle);

            float[] pts = new float[] {
                    p.x, 0, p.x, getHeight(), 0, p.y, getWidth(), p.y
            };

            mDrawCanvas.drawLines(pts, mHighlightPaint);
        }
    }
}
 
开发者ID:LINKIWI,项目名称:mobile-manager-for-cloudflare,代码行数:40,代码来源:RadarChart.java

示例8: addEntries

import com.github.mikephil.charting.data.RadarDataSet; //导入依赖的package包/类
public void addEntries(ArrayList<Entry> entries)
{
    RadarDataSet addData = new RadarDataSet(entries, "");
    this.data.addDataSet(addData);
    addData.setDrawFilled(true);
    addData.setDrawValues(false);
}
 
开发者ID:pfiorentino,项目名称:eCarNet,代码行数:8,代码来源:RadarChartCustom.java

示例9: drawValues

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

    // if values are drawn
    if (mDrawYValues) {

        float sliceangle = getSliceAngle();

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

        PointF c = getCenterOffsets();

        float yoffset = Utils.convertDpToPixel(5f);

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

            RadarDataSet dataSet = mCurrentData.getDataSetByIndex(i);
            ArrayList<Entry> entries = dataSet.getYVals();

            for (int j = 0; j < entries.size(); j++) {

                Entry e = entries.get(j);

                PointF p = getPosition(c, e.getVal() * factor, sliceangle * j + mRotationAngle);

                if (mDrawUnitInChart)
                    mDrawCanvas.drawText(mValueFormatter.getFormattedValue(e.getVal()) + mUnit,
                            p.x, p.y - yoffset, mValuePaint);
                else
                    mDrawCanvas.drawText(mValueFormatter.getFormattedValue(e.getVal()),
                            p.x, p.y - yoffset, mValuePaint);
            }
        }
    }
}
 
开发者ID:MPieter,项目名称:Notification-Analyser,代码行数:38,代码来源:RadarChart.java

示例10: drawHighlights

import com.github.mikephil.charting.data.RadarDataSet; //导入依赖的package包/类
@Override
protected void drawHighlights() {

    // if there are values to highlight and highlighnting is enabled, do it
    if (mHighlightEnabled && valuesToHighlight()) {

        float sliceangle = getSliceAngle();
        float factor = getFactor();

        PointF c = getCenterOffsets();

        for (int i = 0; i < mIndicesToHightlight.length; i++) {

            RadarDataSet set = mCurrentData
                    .getDataSetByIndex(mIndicesToHightlight[i]
                            .getDataSetIndex());

            if (set == null)
                continue;

            mHighlightPaint.setColor(set.getHighLightColor());

            // get the index to highlight
            int xIndex = mIndicesToHightlight[i].getXIndex();

            Entry e = set.getEntryForXIndex(xIndex);
            int j = set.getEntryPosition(e);
            float y = e.getVal();

            PointF p = getPosition(c, y * factor, sliceangle * j + mRotationAngle);

            float[] pts = new float[] {
                    p.x, 0, p.x, getHeight(), 0, p.y, getWidth(), p.y
            };

            mDrawCanvas.drawLines(pts, mHighlightPaint);
        }
    }
}
 
开发者ID:MPieter,项目名称:Notification-Analyser,代码行数:40,代码来源:RadarChart.java

示例11: setData

import com.github.mikephil.charting.data.RadarDataSet; //导入依赖的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

示例12: setData

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

        float mult = 150;
        int cnt = 9;

        ArrayList<Entry> yVals1 = new ArrayList<Entry>();
        ArrayList<Entry> yVals2 = new ArrayList<Entry>();

        // IMPORTANT: In a PieChart, no values (Entry) should have the same
        // xIndex (even if from different DataSets), since no values can be
        // drawn above each other.
        for (int i = 0; i < cnt; i++) {
            yVals1.add(new Entry((float) (Math.random() * mult) + mult / 2, i));
        }

        for (int i = 0; i < cnt; i++) {
            yVals2.add(new Entry((float) (Math.random() * mult) + mult / 2, i));
        }

        ArrayList<String> xVals = new ArrayList<String>();

        for (int i = 0; i < cnt; i++)
            xVals.add(mParties[i % mParties.length]);

        RadarDataSet set1 = new RadarDataSet(yVals1, "Set 1");
        set1.setColor(ColorTemplate.VORDIPLOM_COLORS[0]);
        set1.setFillColor(ColorTemplate.VORDIPLOM_COLORS[0]);
        set1.setDrawFilled(true);
        set1.setLineWidth(2f);

        RadarDataSet set2 = new RadarDataSet(yVals2, "Set 2");
        set2.setColor(ColorTemplate.VORDIPLOM_COLORS[4]);
        set2.setFillColor(ColorTemplate.VORDIPLOM_COLORS[4]);
        set2.setDrawFilled(true);
        set2.setLineWidth(2f);

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

        RadarData data = new RadarData(xVals, sets);
        data.setValueTypeface(tf);
        data.setValueTextSize(8f);
        data.setDrawValues(false);

        mChart.setData(data);

        mChart.invalidate();
    }
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:50,代码来源:RadarChartActivitry.java

示例13: drawDataSet

import com.github.mikephil.charting.data.RadarDataSet; //导入依赖的package包/类
protected void drawDataSet(Canvas c, RadarDataSet dataSet) {

        float sliceangle = mChart.getSliceAngle();

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

        PointF center = mChart.getCenterOffsets();

        List<Entry> entries = dataSet.getYVals();

        Path surface = new Path();

        boolean hasMovedToPoint = false;

        for (int j = 0; j < entries.size(); j++) {

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

            Entry e = entries.get(j);

            PointF p = Utils.getPosition(center, (e.getVal() - mChart.getYChartMin()) * factor,
                    sliceangle * j + mChart.getRotationAngle());

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

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

        surface.close();

        // draw filled
        if (dataSet.isDrawFilledEnabled()) {
            mRenderPaint.setStyle(Paint.Style.FILL);
            mRenderPaint.setAlpha(dataSet.getFillAlpha());
            c.drawPath(surface, mRenderPaint);
            mRenderPaint.setAlpha(255);
        }

        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);
    }
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:53,代码来源:RadarChartRenderer.java

示例14: drawHighlighted

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

    float sliceangle = mChart.getSliceAngle();
    float factor = mChart.getFactor();

    PointF center = mChart.getCenterOffsets();

    for (int i = 0; i < indices.length; i++) {

        RadarDataSet set = mChart.getData()
                .getDataSetByIndex(indices[i]
                        .getDataSetIndex());

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

        // get the index to highlight
        int xIndex = indices[i].getXIndex();

        Entry e = set.getEntryForXIndex(xIndex);
        if (e == null || e.getXIndex() != xIndex)
            continue;

        int j = set.getEntryPosition(e);
        float y = (e.getVal() - mChart.getYChartMin());

        if (Float.isNaN(y))
            continue;

        PointF p = Utils.getPosition(center, y * factor,
                sliceangle * j + mChart.getRotationAngle());

        float[] pts = new float[]{
                p.x, p.y
        };

        // draw the lines
        drawHighlightLines(c, pts, set);
    }
}
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:42,代码来源:RadarChartRenderer.java

示例15: createDataSet

import com.github.mikephil.charting.data.RadarDataSet; //导入依赖的package包/类
@Override
IDataSet createDataSet(ArrayList<Entry> entries, String label) {
    return new RadarDataSet(entries, label);
}
 
开发者ID:mskec,项目名称:react-native-mp-android-chart,代码行数:5,代码来源:RadarChartManager.java


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