Java 类com.github.mikephil.charting.data.RadarDataSet 实例源码

项目:VMAndroid    文件:AnalysisChartFragment.java   
@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();
}
项目:eCarNet    文件:RadarChartCustom.java   
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();
}
项目:VMAndroid    文件:AnalysisFragment.java   
@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();
}
项目:P2P    文件:RadarChartRenderer.java   
@Override
public void drawData(Canvas c) {

    RadarData radarData = mChart.getData();

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

        if (set.isVisible() && set.getEntryCount() > 0)
            drawDataSet(c, set);
    }
}
项目:react-native-mp-android-chart    文件:RadarChartManager.java   
@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
}
项目:mobile-manager-for-cloudflare    文件:RadarChart.java   
@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);
            }
        }
    }
}
项目:mobile-manager-for-cloudflare    文件:RadarChart.java   
@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);
        }
    }
}
项目:eCarNet    文件:RadarChartCustom.java   
public void addEntries(ArrayList<Entry> entries)
{
    RadarDataSet addData = new RadarDataSet(entries, "");
    this.data.addDataSet(addData);
    addData.setDrawFilled(true);
    addData.setDrawValues(false);
}
项目:braingames    文件:RadarChart.java   
@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);
            }
        }
    }
}
项目:braingames    文件:RadarChart.java   
@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);
        }
    }
}
项目:Notification-Analyser    文件:RadarChart.java   
@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);
            }
        }
    }
}
项目:Notification-Analyser    文件:RadarChart.java   
@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);
        }
    }
}
项目:GitHub    文件:RadarChartActivitry.java   
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();
    }
项目:Stayfit    文件:RadarChartActivitry.java   
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();
    }
项目:P2P    文件:RadarChartRenderer.java   
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);
    }
项目:P2P    文件:RadarChartRenderer.java   
@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);
    }
}
项目:react-native-mp-android-chart    文件:RadarChartManager.java   
@Override
IDataSet createDataSet(ArrayList<Entry> entries, String label) {
    return new RadarDataSet(entries, label);
}
项目:xs-android-architecture    文件:RadarChartActivitry.java   
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();
    }
项目:mobile-manager-for-cloudflare    文件:RadarChart.java   
@Override
protected void drawData() {

    ArrayList<RadarDataSet> dataSets = mData.getDataSets();

    float sliceangle = getSliceAngle();

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

    PointF c = getCenterOffsets();

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

        RadarDataSet dataSet = dataSets.get(i);
        ArrayList<Entry> entries = dataSet.getYVals();

        Path surface = new Path();

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

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

            Entry e = entries.get(j);

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

            if (j == 0)
                surface.moveTo(p.x, p.y);
            else
                surface.lineTo(p.x, p.y);
        }

        surface.close();

        // draw filled
        if (dataSet.isDrawFilledEnabled()) {
            mRenderPaint.setStyle(Paint.Style.FILL);
            mRenderPaint.setAlpha(dataSet.getFillAlpha());
            mDrawCanvas.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)
            mDrawCanvas.drawPath(surface, mRenderPaint);
    }
}
项目:MPAndroidChart    文件:RadarChartActivitry.java   
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();
    }
项目:braingames    文件:RadarChart.java   
@Override
protected void drawData() {

    ArrayList<RadarDataSet> dataSets = mData.getDataSets();

    float sliceangle = getSliceAngle();

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

    PointF c = getCenterOffsets();

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

        RadarDataSet dataSet = dataSets.get(i);
        ArrayList<Entry> entries = dataSet.getYVals();

        Path surface = new Path();

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

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

            Entry e = entries.get(j);

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

            if (j == 0)
                surface.moveTo(p.x, p.y);
            else
                surface.lineTo(p.x, p.y);
        }

        surface.close();

        // draw filled
        if (dataSet.isDrawFilledEnabled()) {
            mRenderPaint.setStyle(Paint.Style.FILL);
            mRenderPaint.setAlpha(dataSet.getFillAlpha());
            mDrawCanvas.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)
            mDrawCanvas.drawPath(surface, mRenderPaint);
    }
}
项目:Notification-Analyser    文件:RadarChart.java   
@Override
protected void drawData() {

    ArrayList<RadarDataSet> dataSets = mCurrentData.getDataSets();

    float sliceangle = getSliceAngle();

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

    PointF c = getCenterOffsets();

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

        RadarDataSet dataSet = dataSets.get(i);
        ArrayList<Entry> entries = dataSet.getYVals();

        Path surface = new Path();

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

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

            Entry e = entries.get(j);

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

            if (j == 0)
                surface.moveTo(p.x, p.y);
            else
                surface.lineTo(p.x, p.y);
        }

        surface.close();

        // draw filled
        if (dataSet.isDrawFilledEnabled()) {
            mRenderPaint.setStyle(Paint.Style.FILL);
            mRenderPaint.setAlpha(dataSet.getFillAlpha());
            mDrawCanvas.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)
            mDrawCanvas.drawPath(surface, mRenderPaint);
    }
}
项目:P2P    文件:RadarChartRenderer.java   
@Override
public void drawValues(Canvas c) {

    float sliceangle = mChart.getSliceAngle();

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

    PointF center = mChart.getCenterOffsets();

    float yoffset = Utils.convertDpToPixel(5f);

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

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

        if (!dataSet.isDrawValuesEnabled() || dataSet.getEntryCount() == 0)
            continue;

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

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

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

            Entry entry = entries.get(j);

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

            drawValue(c, dataSet.getValueFormatter(), entry.getVal(), entry, i, p.x, p.y - yoffset);
        }
    }
}