com.github.mikephil.charting.data.ScatterData Java Examples
The following examples show how to use
com.github.mikephil.charting.data.ScatterData.
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: AccelerometerFragment.java From walt with Apache License 2.0 | 6 votes |
private void drawLatencyChart(List<Entry> phoneEntriesShifted, List<Entry> waltEntries) { final ScatterDataSet dataSetWalt = new ScatterDataSet(waltEntries, "WALT Events"); dataSetWalt.setColor(Color.BLUE); dataSetWalt.setScatterShape(ScatterChart.ScatterShape.CIRCLE); dataSetWalt.setScatterShapeSize(8f); final ScatterDataSet dataSetPhoneShifted = new ScatterDataSet(phoneEntriesShifted, "Phone Events Shifted"); dataSetPhoneShifted.setColor(Color.RED); dataSetPhoneShifted.setScatterShapeSize(10f); dataSetPhoneShifted.setScatterShape(ScatterChart.ScatterShape.X); final ScatterData scatterData = new ScatterData(dataSetWalt, dataSetPhoneShifted); final Description desc = new Description(); desc.setText(""); desc.setTextSize(12f); latencyChart.setDescription(desc); latencyChart.setData(scatterData); latencyChart.invalidate(); latencyChartLayout.setVisibility(View.VISIBLE); }
Example #2
Source File: SimpleFragment.java From StockChart-MPAndroidChart with MIT License | 6 votes |
protected ScatterData generateScatterData(int dataSets, float range, int count) { ArrayList<IScatterDataSet> sets = new ArrayList<>(); ScatterChart.ScatterShape[] shapes = ScatterChart.ScatterShape.getAllDefaultShapes(); for(int i = 0; i < dataSets; i++) { ArrayList<Entry> entries = new ArrayList<>(); for(int j = 0; j < count; j++) { entries.add(new Entry(j, (float) (Math.random() * range) + range / 4)); } ScatterDataSet ds = new ScatterDataSet(entries, getLabel(i)); ds.setScatterShapeSize(12f); ds.setScatterShape(shapes[i % shapes.length]); ds.setColors(ColorTemplate.COLORFUL_COLORS); ds.setScatterShapeSize(9f); sets.add(ds); } ScatterData d = new ScatterData(sets); d.setValueTypeface(tf); return d; }
Example #3
Source File: CombinedChartActivity.java From StockChart-MPAndroidChart with MIT License | 6 votes |
private ScatterData generateScatterData() { ScatterData d = new ScatterData(); ArrayList<Entry> entries = new ArrayList<>(); for (float index = 0; index < count; index += 0.5f) entries.add(new Entry(index + 0.25f, getRandom(10, 55))); ScatterDataSet set = new ScatterDataSet(entries, "Scatter DataSet"); set.setColors(ColorTemplate.MATERIAL_COLORS); set.setScatterShapeSize(7.5f); set.setDrawValues(false); set.setValueTextSize(10f); d.addDataSet(set); return d; }
Example #4
Source File: CombinedChartActivity.java From Stayfit with Apache License 2.0 | 6 votes |
protected ScatterData generateScatterData() { ScatterData d = new ScatterData(); ArrayList<Entry> entries = new ArrayList<Entry>(); for (int index = 0; index < itemcount; index++) entries.add(new Entry(getRandom(20, 15), index)); ScatterDataSet set = new ScatterDataSet(entries, "Scatter DataSet"); set.setColor(Color.GREEN); set.setScatterShapeSize(7.5f); set.setDrawValues(false); set.setValueTextSize(10f); d.addDataSet(set); return d; }
Example #5
Source File: SimpleFragment.java From Stayfit with Apache License 2.0 | 6 votes |
protected ScatterData generateScatterData(int dataSets, float range, int count) { ArrayList<IScatterDataSet> sets = new ArrayList<IScatterDataSet>(); ScatterShape[] shapes = ScatterChart.getAllPossibleShapes(); for(int i = 0; i < dataSets; i++) { ArrayList<Entry> entries = new ArrayList<Entry>(); for(int j = 0; j < count; j++) { entries.add(new Entry((float) (Math.random() * range) + range / 4, j)); } ScatterDataSet ds = new ScatterDataSet(entries, getLabel(i)); ds.setScatterShapeSize(12f); ds.setScatterShape(shapes[i % shapes.length]); ds.setColors(ColorTemplate.COLORFUL_COLORS); ds.setScatterShapeSize(9f); sets.add(ds); } ScatterData d = new ScatterData(ChartData.generateXVals(0, count), sets); d.setValueTypeface(tf); return d; }
Example #6
Source File: CombinedChart.java From StockChart-MPAndroidChart with MIT License | 5 votes |
@Override public ScatterData getScatterData() { if (mData == null) { return null; } return mData.getScatterData(); }
Example #7
Source File: DragLatencyFragment.java From walt with Apache License 2.0 | 5 votes |
private void drawLatencyGraph(double[] ft, double[] fy, double[] lt, double averageBestShift) { final ArrayList<Entry> touchEntries = new ArrayList<>(); final ArrayList<Entry> laserEntries = new ArrayList<>(); final double[] laserT = new double[lt.length]; for (int i = 0; i < ft.length; i++) { touchEntries.add(new Entry((float) ft[i], (float) fy[i])); } for (int i = 0; i < lt.length; i++) { laserT[i] = lt[i] + averageBestShift; } final double[] laserY = Utils.interp(laserT, ft, fy); for (int i = 0; i < laserY.length; i++) { laserEntries.add(new Entry((float) laserT[i], (float) laserY[i])); } final ScatterDataSet dataSetTouch = new ScatterDataSet(touchEntries, "Touch Events"); dataSetTouch.setScatterShape(ScatterChart.ScatterShape.CIRCLE); dataSetTouch.setScatterShapeSize(8f); final ScatterDataSet dataSetLaser = new ScatterDataSet(laserEntries, String.format(Locale.US, "Laser Events Latency=%.1f ms", averageBestShift)); dataSetLaser.setColor(Color.RED); dataSetLaser.setScatterShapeSize(10f); dataSetLaser.setScatterShape(ScatterChart.ScatterShape.X); final ScatterData scatterData = new ScatterData(dataSetTouch, dataSetLaser); final Description desc = new Description(); desc.setText("Y-Position [pixels] vs. Time [ms]"); desc.setTextSize(12f); latencyChart.setDescription(desc); latencyChart.setData(scatterData); latencyChartLayout.setVisibility(View.VISIBLE); }
Example #8
Source File: ScatterChartRenderer.java From NetKnight with Apache License 2.0 | 5 votes |
@Override public void drawData(Canvas c) { ScatterData scatterData = mChart.getScatterData(); for (IScatterDataSet set : scatterData.getDataSets()) { if (set.isVisible()) drawDataSet(c, set); } }
Example #9
Source File: ScatterChartRenderer.java From NetKnight with Apache License 2.0 | 5 votes |
@Override public void initBuffers() { ScatterData scatterData = mChart.getScatterData(); mScatterBuffers = new ScatterBuffer[scatterData.getDataSetCount()]; for (int i = 0; i < mScatterBuffers.length; i++) { IScatterDataSet set = scatterData.getDataSetByIndex(i); mScatterBuffers[i] = new ScatterBuffer(set.getEntryCount() * 2); } }
Example #10
Source File: ScatterChartRenderer.java From Stayfit with Apache License 2.0 | 5 votes |
@Override public void drawData(Canvas c) { ScatterData scatterData = mChart.getScatterData(); for (IScatterDataSet set : scatterData.getDataSets()) { if (set.isVisible()) drawDataSet(c, set); } }
Example #11
Source File: ScatterChartRenderer.java From Stayfit with Apache License 2.0 | 5 votes |
@Override public void initBuffers() { ScatterData scatterData = mChart.getScatterData(); mScatterBuffers = new ScatterBuffer[scatterData.getDataSetCount()]; for (int i = 0; i < mScatterBuffers.length; i++) { IScatterDataSet set = scatterData.getDataSetByIndex(i); mScatterBuffers[i] = new ScatterBuffer(set.getEntryCount() * 2); } }
Example #12
Source File: ScatterChartRenderer.java From iMoney with Apache License 2.0 | 5 votes |
@Override public void drawData(Canvas c) { ScatterData scatterData = mChart.getScatterData(); for (ScatterDataSet set : scatterData.getDataSets()) { if (set.isVisible()) drawDataSet(c, set); } }
Example #13
Source File: ScatterChartRenderer.java From iMoney with Apache License 2.0 | 5 votes |
@Override public void initBuffers() { ScatterData scatterData = mChart.getScatterData(); mScatterBuffers = new ScatterBuffer[scatterData.getDataSetCount()]; for (int i = 0; i < mScatterBuffers.length; i++) { ScatterDataSet set = scatterData.getDataSetByIndex(i); mScatterBuffers[i] = new ScatterBuffer(set.getEntryCount() * 2); } }
Example #14
Source File: ScatterChartRenderer.java From android-kline with Apache License 2.0 | 5 votes |
@Override public void drawData(Canvas c) { ScatterData scatterData = mChart.getScatterData(); for (IScatterDataSet set : scatterData.getDataSets()) { if (set.isVisible()) drawDataSet(c, set); } }
Example #15
Source File: ScatterChartRenderer.java From android-kline with Apache License 2.0 | 5 votes |
@Override public void drawData(Canvas c) { ScatterData scatterData = mChart.getScatterData(); for (IScatterDataSet set : scatterData.getDataSets()) { if (set.isVisible()) drawDataSet(c, set); } }
Example #16
Source File: ScatterChartRenderer.java From StockChart-MPAndroidChart with MIT License | 5 votes |
@Override public void drawData(Canvas c) { ScatterData scatterData = mChart.getScatterData(); for (IScatterDataSet set : scatterData.getDataSets()) { if (set.isVisible()) drawDataSet(c, set); } }
Example #17
Source File: ScatterChartRenderer.java From Ticket-Analysis with MIT License | 5 votes |
@Override public void drawData(Canvas c) { ScatterData scatterData = mChart.getScatterData(); for (IScatterDataSet set : scatterData.getDataSets()) { if (set.isVisible()) drawDataSet(c, set); } }
Example #18
Source File: ScatterChart.java From StockChart-MPAndroidChart with MIT License | 4 votes |
@Override public ScatterData getScatterData() { return mData; }
Example #19
Source File: ScatterChartManager.java From react-native-mp-android-chart with MIT License | 4 votes |
@Override ChartData createData(String[] xValues) { return new ScatterData(xValues); }
Example #20
Source File: ScatterChartRenderer.java From NetKnight with Apache License 2.0 | 4 votes |
@Override public void drawHighlighted(Canvas c, Highlight[] indices) { ScatterData scatterData = mChart.getScatterData(); for (Highlight high : indices) { final int minDataSetIndex = high.getDataSetIndex() == -1 ? 0 : high.getDataSetIndex(); final int maxDataSetIndex = high.getDataSetIndex() == -1 ? scatterData.getDataSetCount() : (high.getDataSetIndex() + 1); if (maxDataSetIndex - minDataSetIndex < 1) continue; for (int dataSetIndex = minDataSetIndex; dataSetIndex < maxDataSetIndex; dataSetIndex++) { IScatterDataSet set = scatterData.getDataSetByIndex(dataSetIndex); if (set == null || !set.isHighlightEnabled()) continue; int xIndex = high.getXIndex(); // get the // x-position if (xIndex > mChart.getXChartMax() * mAnimator.getPhaseX()) continue; final float yVal = set.getYValForXIndex(xIndex); if (Float.isNaN(yVal)) continue; float y = yVal * mAnimator.getPhaseY(); float[] pts = new float[]{ xIndex, y }; mChart.getTransformer(set.getAxisDependency()).pointValuesToPixel(pts); // draw the lines drawHighlightLines(c, pts, set); } } }
Example #21
Source File: ScatterChartRenderer.java From StockChart-MPAndroidChart with MIT License | 4 votes |
@Override public void drawHighlighted(Canvas c, Highlight[] indices) { ScatterData scatterData = mChart.getScatterData(); for (Highlight high : indices) { IScatterDataSet set = scatterData.getDataSetByIndex(high.getDataSetIndex()); if (set == null || !set.isHighlightEnabled()) continue; final Entry e = set.getEntryForXValue(high.getX(), high.getY()); if (!isInBoundsX(e, set)) continue; MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(e.getX(), e.getY() * mAnimator .getPhaseY()); high.setDraw((float) pix.x, (float) pix.y); // draw the lines drawHighlightLines(c, (float) pix.x, (float) pix.y, set); } }
Example #22
Source File: CombinedChart.java From NetKnight with Apache License 2.0 | 4 votes |
@Override public ScatterData getScatterData() { if (mData == null) return null; return mData.getScatterData(); }
Example #23
Source File: ScatterChart.java From NetKnight with Apache License 2.0 | 4 votes |
@Override public ScatterData getScatterData() { return mData; }
Example #24
Source File: ScatterChart.java From Ticket-Analysis with MIT License | 4 votes |
@Override public ScatterData getScatterData() { return mData; }
Example #25
Source File: CombinedChart.java From Ticket-Analysis with MIT License | 4 votes |
@Override public ScatterData getScatterData() { if (mData == null) return null; return mData.getScatterData(); }
Example #26
Source File: ScatterChartRenderer.java From Ticket-Analysis with MIT License | 4 votes |
@Override public void drawHighlighted(Canvas c, Highlight[] indices) { ScatterData scatterData = mChart.getScatterData(); for (Highlight high : indices) { IScatterDataSet set = scatterData.getDataSetByIndex(high.getDataSetIndex()); if (set == null || !set.isHighlightEnabled()) continue; final Entry e = set.getEntryForXValue(high.getX(), high.getY()); if (!isInBoundsX(e, set)) continue; MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(e.getX(), e.getY() * mAnimator .getPhaseY()); high.setDraw((float) pix.x, (float) pix.y); // draw the lines drawHighlightLines(c, (float) pix.x, (float) pix.y, set); } }
Example #27
Source File: CombinedChart.java From Stayfit with Apache License 2.0 | 4 votes |
@Override public ScatterData getScatterData() { if (mData == null) return null; return mData.getScatterData(); }
Example #28
Source File: ScatterChart.java From Stayfit with Apache License 2.0 | 4 votes |
public ScatterData getScatterData() { return mData; }
Example #29
Source File: ScatterChart.java From android-kline with Apache License 2.0 | 4 votes |
@Override public ScatterData getScatterData() { return mData; }
Example #30
Source File: CombinedChart.java From iMoney with Apache License 2.0 | 4 votes |
@Override public ScatterData getScatterData() { if (mData == null) return null; return mData.getScatterData(); }