Java Code Examples for com.github.mikephil.charting.components.Description#setTextSize()
The following examples show how to use
com.github.mikephil.charting.components.Description#setTextSize() .
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: 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 3
Source File: ScreenResponseFragment.java From walt with Apache License 2.0 | 5 votes |
private void drawBrightnessChart() { final String brightnessCurveString = brightnessCurveData.toString(); List<Entry> entries = new ArrayList<>(); // "u" marks the start of the brightness curve data int startIndex = brightnessCurveString.indexOf("u") + 1; int endIndex = brightnessCurveString.indexOf("end"); if (endIndex == -1) endIndex = brightnessCurveString.length(); String[] brightnessStrings = brightnessCurveString.substring(startIndex, endIndex).trim().split("\n"); for (String str : brightnessStrings) { String[] arr = str.split(" "); final float timestampMs = Integer.parseInt(arr[0]) / 1000f; final float brightness = Integer.parseInt(arr[1]); entries.add(new Entry(timestampMs, brightness)); } LineDataSet dataSet = new LineDataSet(entries, "Brightness"); dataSet.setColor(Color.BLACK); dataSet.setValueTextColor(Color.BLACK); dataSet.setCircleColor(Color.BLACK); dataSet.setCircleRadius(1.5f); dataSet.setCircleColorHole(Color.DKGRAY); LineData lineData = new LineData(dataSet); brightnessChart.setData(lineData); final Description desc = new Description(); desc.setText("Screen Brightness [digital level 0-1023] vs. Time [ms]"); desc.setTextSize(12f); brightnessChart.setDescription(desc); brightnessChart.getLegend().setEnabled(false); brightnessChart.invalidate(); brightnessChartLayout.setVisibility(View.VISIBLE); }
Example 4
Source File: AudioFragment.java From walt with Apache License 2.0 | 5 votes |
private void drawWaveformChart() { final short[] wave = AudioTest.getRecordedWave(); List<Entry> entries = new ArrayList<>(); int frameRate = audioTest.getOptimalFrameRate(); for (int i = 0; i < wave.length; i++) { float timeStamp = (float) i / frameRate * 1000f; entries.add(new Entry(timeStamp, (float) wave[i])); } LineDataSet dataSet = new LineDataSet(entries, "Waveform"); dataSet.setColor(Color.BLACK); dataSet.setValueTextColor(Color.BLACK); dataSet.setCircleColor(ContextCompat.getColor(getContext(), R.color.DarkGreen)); dataSet.setCircleRadius(1.5f); dataSet.setCircleColorHole(Color.DKGRAY); LineData lineData = new LineData(dataSet); chart.setData(lineData); LimitLine line = new LimitLine(audioTest.getThreshold(), "Threshold"); line.setLineColor(Color.RED); line.setLabelPosition(LimitLine.LimitLabelPosition.LEFT_TOP); line.setLineWidth(2f); line.setTextColor(Color.DKGRAY); line.setTextSize(10f); chart.getAxisLeft().addLimitLine(line); final Description desc = new Description(); desc.setText("Wave [digital level -32768 to +32767] vs. Time [ms]"); desc.setTextSize(12f); chart.setDescription(desc); chart.getLegend().setEnabled(false); chart.invalidate(); chartLayout.setVisibility(View.VISIBLE); }
Example 5
Source File: HistogramChart.java From walt with Apache License 2.0 | 4 votes |
public HistogramChart(Context context, AttributeSet attrs) { super(context, attrs); inflate(getContext(), R.layout.histogram, this); barChart = (BarChart) findViewById(R.id.bar_chart); findViewById(R.id.button_close_bar_chart).setOnClickListener(this); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.HistogramChart); final String descString; final int numDataSets; final float binWidth; try { descString = a.getString(R.styleable.HistogramChart_description); numDataSets = a.getInteger(R.styleable.HistogramChart_numDataSets, 1); binWidth = a.getFloat(R.styleable.HistogramChart_binWidth, 5f); } finally { a.recycle(); } ArrayList<IBarDataSet> dataSets = new ArrayList<>(numDataSets); for (int i = 0; i < numDataSets; i++) { final BarDataSet dataSet = new BarDataSet(new ArrayList<BarEntry>(), ""); dataSet.setColor(ColorTemplate.MATERIAL_COLORS[i]); dataSets.add(dataSet); } BarData barData = new BarData(dataSets); barData.setBarWidth((1f - GROUP_SPACE)/numDataSets); barChart.setData(barData); histogramData = new HistogramData(numDataSets, binWidth); groupBars(barData); final Description desc = new Description(); desc.setText(descString); desc.setTextSize(12f); barChart.setDescription(desc); XAxis xAxis = barChart.getXAxis(); xAxis.setGranularityEnabled(true); xAxis.setGranularity(1); xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); xAxis.setValueFormatter(new IAxisValueFormatter() { DecimalFormat df = new DecimalFormat("#.##"); @Override public String getFormattedValue(float value, AxisBase axis) { return df.format(histogramData.getDisplayValue(value)); } }); barChart.setFitBars(true); barChart.invalidate(); }