GraphView
GraphView copied to clipboard
How to set datapoint label with string value
Hi, is it possible to set the datapoint label with string value? I tried to set it with string but error.
eduGrades = new String[5]; behGrades = new String[5];
eduGrades[0] = getString(R.string.fail);
eduGrades[1] = getString(R.string.pass);
eduGrades[2] = getString(R.string.good);
eduGrades[3] = getString(R.string.very_good);
eduGrades[4] = getString(R.string.excellent);
behGrades[0] = getString(R.string.baad);
behGrades[1] = getString(R.string.accepted);
behGrades[2] = getString(R.string.good);
behGrades[3] = getString(R.string.very_good);
behGrades[4] = getString(R.string.excellent);
DataPoint[] eduDp = new DataPoint[results.size()]; DataPoint[] behDp = new DataPoint[results.size()];
dates = new String[results.size()];
for (int i = 0; i < results.size(); i++) {
dates[i] = results.get(i).getDateOfNote();
eduDp[i] = new DataPoint(i, (double) results.get(i).getEducationEvaluationSign());
behDp[i] = new DataPoint(i, (double) results.get(i).getBehaviorEvaluationSign());
}
LineGraphSeries<DataPoint> eduSeries = new LineGraphSeries<>(eduDp);
educationalGraphView.addSeries(eduSeries);
eduSeries.setDrawBackground(true);
eduSeries.setColor(getResources().getColor(R.color.blue));
eduSeries.setBackgroundColor(getResources().getColor(R.color.blue));
StaticLabelsFormatter staticLabelsFormatter;
staticLabelsFormatter = new StaticLabelsFormatter(educationalGraphView);
staticLabelsFormatter.setVerticalLabels(eduGrades);
staticLabelsFormatter.setHorizontalLabels(dates);
educationalGraphView.getGridLabelRenderer().setHorizontalLabelsColor(getResources().getColor(R.color.colorPrimaryDark));
educationalGraphView.getGridLabelRenderer().setVerticalLabelsColor(getResources().getColor(R.color.colorPrimaryDark));
educationalGraphView.getGridLabelRenderer().setGridColor(getResources().getColor(R.color.white));
educationalGraphView.getGridLabelRenderer().setHorizontalLabelsAngle(145);
educationalGraphView.getGridLabelRenderer().setTextSize(23f);
educationalGraphView.getGridLabelRenderer().setLabelsSpace(20);
educationalGraphView.getGridLabelRenderer().setLabelFormatter(staticLabelsFormatter);