-
Notifications
You must be signed in to change notification settings - Fork 113
Description
As mentioned in issue #4 , it appears the hex code used in the readme file does not work.
Collection values = new ArrayList<>();
values.add(new FitChartValue(30f, 0x2d4302));
values.add(new FitChartValue(20f, 0x75a80d));
values.add(new FitChartValue(15f, 0x8fc026));
values.add(new FitChartValue(10f, 0xB5CC84));
final FitChart fitChart = (FitChart)findViewById(R.id.fitChart);
fitChart.setValues(values);
The above code does not print anything in the fit-chart circle and leaves the circle empty.
After some poking around, I discovered that changing the hex code and referencing android.R.color instead of using the hex codes made the fit-chart work as expected. Here was the code that worked:
final FitChart fitChart = (FitChart)findViewById(R.id.fitChart);
fitChart.setMinValue(0f);
fitChart.setMaxValue(100f);
ArrayList<FitChartValue> values = new ArrayList<>();
values.add(new FitChartValue(30f, getResources().getColor(android.R.color.black)));
values.add(new FitChartValue(20f, getResources().getColor(android.R.color.holo_red_dark)));
values.add(new FitChartValue(15f, getResources().getColor(android.R.color.holo_green_dark)));
values.add(new FitChartValue(10f, getResources().getColor(android.R.color.holo_purple)));
fitChart.setValues(values);
I'm not sure if this is a bug or simply a documentation error.
compileSdkVersion 28
minSdkVersion 23
targetSdkVersion 28