private void setData(int start, int count, float range) { ArrayList<String> xVals = new ArrayList<String>(); for (int i = 0; i < count; i++) { xVals.add((start + i) + "日"); } ArrayList<Entry> vals1 = new ArrayList<Entry>(); for (int i = 0; i < count; i++) { vals1.add(new Entry(TurnControl.PunchPerDay[9 - i], i)); } // create a dataset and give it a type LineDataSet set1 = new LineDataSet(vals1, "近期打卡情况"); set1.setDrawCubic(true); set1.setCubicIntensity(0.2f); set1.setDrawFilled(true); set1.setDrawCircles(true); set1.setLineWidth(2f); set1.setCircleSize(5f); set1.setHighLightColor(Color.rgb(244, 117, 117)); set1.setColor(Color.rgb(104, 241, 175)); set1.setFillColor(ColorTemplate.getHoloBlue()); // create a data object with the datasets LineData data = new LineData(xVals, set1); data.setValueTypeface(tf); data.setValueTextSize(9f); data.setDrawValues(false); // set data mChart.setData(data); }
private LineDataSet createSet() { LineDataSet set = new LineDataSet(null, "Realtime Beschleunigungskraefte"); set.setDrawCubic(true); set.setCubicIntensity(0.2f); set.setAxisDependency(YAxis.AxisDependency.LEFT); set.setColor(ColorTemplate.getHoloBlue()); set.setCircleColor(Color.BLACK); set.setLineWidth(2f); set.setCircleSize(4f); set.setFillAlpha(65); set.setFillColor(ColorTemplate.getHoloBlue()); set.setHighLightColor(Color.rgb(244, 117, 117)); set.setValueTextColor(Color.BLACK); set.setValueTextSize(10f); return set; }