com.github.mikephil.charting.interfaces.datasets.IRadarDataSet Java Examples
The following examples show how to use
com.github.mikephil.charting.interfaces.datasets.IRadarDataSet.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RealmDatabaseActivityRadar.java From Stayfit with Apache License 2.0 | 6 votes |
private void setData() { RealmResults<RealmDemoData> result = mRealm.allObjects(RealmDemoData.class); //RealmBarDataSet<RealmDemoData> set = new RealmBarDataSet<RealmDemoData>(result, "stackValues", "xIndex"); // normal entries RealmRadarDataSet<RealmDemoData> set = new RealmRadarDataSet<RealmDemoData>(result, "value", "xIndex"); // stacked entries set.setLabel("Realm RadarDataSet"); set.setDrawFilled(true); set.setColor(ColorTemplate.rgb("#009688")); set.setFillColor(ColorTemplate.rgb("#009688")); set.setFillAlpha(130); set.setLineWidth(2f); ArrayList<IRadarDataSet> dataSets = new ArrayList<IRadarDataSet>(); dataSets.add(set); // add the dataset // create a data object with the dataset list RadarData data = new RadarData(new String[] {"2013", "2014", "2015", "2016", "2017", "2018", "2019"}, dataSets); styleData(data); // set data mChart.setData(data); mChart.animateY(1400); }
Example #2
Source File: RadarChartRenderer.java From StockChart-MPAndroidChart with MIT License | 5 votes |
@Override public void drawData(Canvas c) { RadarData radarData = mChart.getData(); int mostEntries = radarData.getMaxEntryCountSet().getEntryCount(); for (IRadarDataSet set : radarData.getDataSets()) { if (set.isVisible()) { drawDataSet(c, set, mostEntries); } } }
Example #3
Source File: RadarChartRenderer.java From android-kline with Apache License 2.0 | 5 votes |
@Override public void drawData(Canvas c) { RadarData radarData = mChart.getData(); int mostEntries = radarData.getMaxEntryCountSet().getEntryCount(); for (IRadarDataSet set : radarData.getDataSets()) { if (set.isVisible()) { drawDataSet(c, set, mostEntries); } } }
Example #4
Source File: RadarChartRenderer.java From Ticket-Analysis with MIT License | 5 votes |
@Override public void drawData(Canvas c) { RadarData radarData = mChart.getData(); int mostEntries = radarData.getMaxEntryCountSet().getEntryCount(); for (IRadarDataSet set : radarData.getDataSets()) { if (set.isVisible()) { drawDataSet(c, set, mostEntries); } } }
Example #5
Source File: RealmRadarData.java From NetKnight with Apache License 2.0 | 4 votes |
public RealmRadarData(RealmResults<? extends RealmObject> result, String xValuesField, List<IRadarDataSet> dataSets) { super(RealmUtils.toXVals(result, xValuesField), dataSets); }
Example #6
Source File: RadarData.java From Stayfit with Apache License 2.0 | 4 votes |
public RadarData(String[] xVals, List<IRadarDataSet> dataSets) { super(xVals, dataSets); }
Example #7
Source File: RadarData.java From Stayfit with Apache License 2.0 | 4 votes |
public RadarData(List<String> xVals, IRadarDataSet dataSet) { super(xVals, toList(dataSet)); }
Example #8
Source File: RadarData.java From Stayfit with Apache License 2.0 | 4 votes |
public RadarData(String[] xVals, IRadarDataSet dataSet) { super(xVals, toList(dataSet)); }
Example #9
Source File: RadarData.java From Stayfit with Apache License 2.0 | 4 votes |
private static List<IRadarDataSet> toList(IRadarDataSet dataSet) { List<IRadarDataSet> sets = new ArrayList<IRadarDataSet>(); sets.add(dataSet); return sets; }
Example #10
Source File: RadarChartRenderer.java From Stayfit with Apache License 2.0 | 4 votes |
/** * 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(); PointF center = mChart.getCenterOffsets(); Path surface = new Path(); boolean hasMovedToPoint = false; for (int j = 0; j < dataSet.getEntryCount(); j++) { mRenderPaint.setColor(dataSet.getColor(j)); Entry e = dataSet.getEntryForIndex(j); PointF p = Utils.getPosition( center, (e.getVal() - mChart.getYChartMin()) * factor * phaseY, sliceangle * j * phaseX + 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); } // if this is the largest set, close it if (dataSet.getEntryCount() >= mostEntries) { surface.close(); } else { // if this is not the largest set, draw a line to the center and then close it 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); // // // draw filled // if (dataSet.isDrawFilledEnabled()) { // mRenderPaint.setStyle(Paint.Style.FILL); // mRenderPaint.setAlpha(dataSet.getFillAlpha()); // c.drawPath(surface, mRenderPaint); // mRenderPaint.setAlpha(255); // } }
Example #11
Source File: RadarChartRenderer.java From Stayfit with Apache License 2.0 | 4 votes |
@Override public void drawHighlighted(Canvas c, Highlight[] indices) { float phaseX = mAnimator.getPhaseX(); float phaseY = mAnimator.getPhaseY(); float sliceangle = mChart.getSliceAngle(); float factor = mChart.getFactor(); PointF center = mChart.getCenterOffsets(); for (int i = 0; i < indices.length; i++) { IRadarDataSet 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.getEntryIndex(e); float y = (e.getVal() - mChart.getYChartMin()); if (Float.isNaN(y)) continue; PointF p = Utils.getPosition( center, y * factor * phaseY, sliceangle * j * phaseX + mChart.getRotationAngle()); float[] pts = new float[]{ p.x, p.y }; // draw the lines drawHighlightLines(c, pts, set); } }
Example #12
Source File: RadarChartActivitry.java From Stayfit with Apache License 2.0 | 4 votes |
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(); }
Example #13
Source File: RealmRadarData.java From Stayfit with Apache License 2.0 | 4 votes |
public RealmRadarData(RealmResults<? extends RealmObject> result, String xValuesField, List<IRadarDataSet> dataSets) { super(RealmUtils.toXVals(result, xValuesField), dataSets); }
Example #14
Source File: RadarData.java From NetKnight with Apache License 2.0 | 4 votes |
public RadarData(List<String> xVals, List<IRadarDataSet> dataSets) { super(xVals, dataSets); }
Example #15
Source File: RadarData.java From NetKnight with Apache License 2.0 | 4 votes |
public RadarData(String[] xVals, List<IRadarDataSet> dataSets) { super(xVals, dataSets); }
Example #16
Source File: RadarData.java From NetKnight with Apache License 2.0 | 4 votes |
public RadarData(List<String> xVals, IRadarDataSet dataSet) { super(xVals, toList(dataSet)); }
Example #17
Source File: RadarData.java From NetKnight with Apache License 2.0 | 4 votes |
public RadarData(String[] xVals, IRadarDataSet dataSet) { super(xVals, toList(dataSet)); }
Example #18
Source File: RadarData.java From NetKnight with Apache License 2.0 | 4 votes |
private static List<IRadarDataSet> toList(IRadarDataSet dataSet) { List<IRadarDataSet> sets = new ArrayList<IRadarDataSet>(); sets.add(dataSet); return sets; }
Example #19
Source File: RadarChartRenderer.java From NetKnight with Apache License 2.0 | 4 votes |
/** * 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(); PointF center = mChart.getCenterOffsets(); Path surface = new Path(); boolean hasMovedToPoint = false; for (int j = 0; j < dataSet.getEntryCount(); j++) { mRenderPaint.setColor(dataSet.getColor(j)); Entry e = dataSet.getEntryForIndex(j); PointF p = Utils.getPosition( center, (e.getVal() - mChart.getYChartMin()) * factor * phaseY, sliceangle * j * phaseX + 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); } 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); // // // draw filled // if (dataSet.isDrawFilledEnabled()) { // mRenderPaint.setStyle(Paint.Style.FILL); // mRenderPaint.setAlpha(dataSet.getFillAlpha()); // c.drawPath(surface, mRenderPaint); // mRenderPaint.setAlpha(255); // } }
Example #20
Source File: RadarChartRenderer.java From NetKnight with Apache License 2.0 | 4 votes |
@Override public void drawHighlighted(Canvas c, Highlight[] indices) { float phaseX = mAnimator.getPhaseX(); float phaseY = mAnimator.getPhaseY(); float sliceangle = mChart.getSliceAngle(); float factor = mChart.getFactor(); PointF center = mChart.getCenterOffsets(); for (int i = 0; i < indices.length; i++) { IRadarDataSet 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.getEntryIndex(e); float y = (e.getVal() - mChart.getYChartMin()); if (Float.isNaN(y)) continue; PointF p = Utils.getPosition( center, y * factor * phaseY, sliceangle * j * phaseX + mChart.getRotationAngle()); float[] pts = new float[]{ p.x, p.y }; // draw the lines drawHighlightLines(c, pts, set); if (set.isDrawHighlightCircleEnabled()) { if (!Float.isNaN(pts[0]) && !Float.isNaN(pts[1])) { 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, p, set.getHighlightCircleInnerRadius(), set.getHighlightCircleOuterRadius(), set.getHighlightCircleFillColor(), strokeColor, set.getHighlightCircleStrokeWidth()); } } } }
Example #21
Source File: RadarChartRenderer.java From Ticket-Analysis with MIT License | 4 votes |
@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); MPPointF pIcon = 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); MPPointF iconsOffset = MPPointF.getInstance(dataSet.getIconsOffset()); iconsOffset.x = Utils.convertDpToPixel(iconsOffset.x); iconsOffset.y = Utils.convertDpToPixel(iconsOffset.y); 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); if (dataSet.isDrawValuesEnabled()) { drawValue(c, dataSet.getValueFormatter(), entry.getY(), entry, i, pOut.x, pOut.y - yoffset, dataSet.getValueTextColor (j)); } if (entry.getIcon() != null && dataSet.isDrawIconsEnabled()) { Drawable icon = entry.getIcon(); Utils.getPosition( center, (entry.getY()) * factor * phaseY + iconsOffset.y, sliceangle * j * phaseX + mChart.getRotationAngle(), pIcon); //noinspection SuspiciousNameCombination pIcon.y += iconsOffset.x; Utils.drawImage( c, icon, (int)pIcon.x, (int)pIcon.y, icon.getIntrinsicWidth(), icon.getIntrinsicHeight()); } } MPPointF.recycleInstance(iconsOffset); } MPPointF.recycleInstance(center); MPPointF.recycleInstance(pOut); MPPointF.recycleInstance(pIcon); }
Example #22
Source File: RadarData.java From StockChart-MPAndroidChart with MIT License | 4 votes |
public RadarData(IRadarDataSet... dataSets) { super(dataSets); }
Example #23
Source File: RadarChartRenderer.java From StockChart-MPAndroidChart with MIT License | 4 votes |
/** * 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); }
Example #24
Source File: RadarChartRenderer.java From StockChart-MPAndroidChart with MIT License | 4 votes |
@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); MPPointF pIcon = 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); ValueFormatter formatter = dataSet.getValueFormatter(); MPPointF iconsOffset = MPPointF.getInstance(dataSet.getIconsOffset()); iconsOffset.x = Utils.convertDpToPixel(iconsOffset.x); iconsOffset.y = Utils.convertDpToPixel(iconsOffset.y); 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); if (dataSet.isDrawValuesEnabled()) { drawValue(c, formatter.getRadarLabel(entry), pOut.x, pOut.y - yoffset, dataSet.getValueTextColor(j)); } if (entry.getIcon() != null && dataSet.isDrawIconsEnabled()) { Drawable icon = entry.getIcon(); Utils.getPosition( center, (entry.getY()) * factor * phaseY + iconsOffset.y, sliceangle * j * phaseX + mChart.getRotationAngle(), pIcon); //noinspection SuspiciousNameCombination pIcon.y += iconsOffset.x; Utils.drawImage( c, icon, (int) pIcon.x, (int) pIcon.y, icon.getIntrinsicWidth(), icon.getIntrinsicHeight()); } } MPPointF.recycleInstance(iconsOffset); } MPPointF.recycleInstance(center); MPPointF.recycleInstance(pOut); MPPointF.recycleInstance(pIcon); }
Example #25
Source File: RadarChartRenderer.java From StockChart-MPAndroidChart with MIT License | 4 votes |
@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); }
Example #26
Source File: RadarChartActivity.java From StockChart-MPAndroidChart with MIT License | 4 votes |
private void setData() { float mul = 80; float min = 20; int cnt = 5; ArrayList<RadarEntry> entries1 = new ArrayList<>(); ArrayList<RadarEntry> entries2 = new ArrayList<>(); // 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() * mul) + min; entries1.add(new RadarEntry(val1)); float val2 = (float) (Math.random() * mul) + 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<>(); sets.add(set1); sets.add(set2); RadarData data = new RadarData(sets); data.setValueTypeface(tfLight); data.setValueTextSize(8f); data.setDrawValues(false); data.setValueTextColor(Color.WHITE); chart.setData(data); chart.invalidate(); }
Example #27
Source File: RadarData.java From Ticket-Analysis with MIT License | 4 votes |
public RadarData(List<IRadarDataSet> dataSets) { super(dataSets); }
Example #28
Source File: RadarData.java From Ticket-Analysis with MIT License | 4 votes |
public RadarData(IRadarDataSet... dataSets) { super(dataSets); }
Example #29
Source File: RadarChartRenderer.java From Ticket-Analysis with MIT License | 4 votes |
/** * 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); }
Example #30
Source File: RadarData.java From Stayfit with Apache License 2.0 | 4 votes |
public RadarData(List<String> xVals, List<IRadarDataSet> dataSets) { super(xVals, dataSets); }