Created
June 23, 2019 06:59
-
-
Save jddeep/358724cb209467ffd693bcd0e46fe599 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
graph.setOnChartValueSelectedListener(this); | |
// enable description text | |
graph.getDescription().setEnabled(true); | |
// enable touch gestures | |
graph.setTouchEnabled(true); | |
// enable scaling and dragging | |
graph.setDragEnabled(true); | |
graph.setScaleEnabled(true); | |
graph.setDrawGridBackground(false); | |
// if disabled, scaling can be done on x- and y-axis separately | |
graph.setPinchZoom(true); | |
// set an alternative background color | |
graph.setBackgroundColor(getResources().getColor(R.color.memory_graph_background)); | |
LineData data = new LineData(); | |
data.setValueTextColor(Color.WHITE); | |
// add empty data | |
graph.setData(data); | |
graph.getDescription().setText(getResources().getString(R.string.axis_desc_time)); | |
graph.getDescription().setTextColor(Color.WHITE); | |
// get the legend (only possible after setting data) | |
Legend l = memGraph.getLegend(); | |
// modify the legend ... | |
l.setForm(Legend.LegendForm.LINE); | |
l.setTextColor(Color.WHITE); | |
XAxis xl = memGraph.getXAxis(); | |
xl.setTextColor(Color.WHITE); | |
xl.setDrawGridLines(false); | |
xl.setAvoidFirstLastClipping(true); | |
xl.setEnabled(true); | |
YAxis leftAxis = memGraph.getAxisLeft(); | |
leftAxis.setTextColor(Color.WHITE); | |
leftAxis.setAxisMaximum(100f); | |
leftAxis.setAxisMinimum(0f); | |
leftAxis.setDrawGridLines(true); | |
leftAxis.setGridColor(Color.WHITE); | |
YAxis rightAxis = graph.getAxisRight(); | |
rightAxis.setEnabled(false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment