Skip to content

Commit

Permalink
Merge pull request #25 from purrprogramming/fix-graph-background
Browse files Browse the repository at this point in the history
fix(graph) fixed wrong pitch ranges in graph background after library…
  • Loading branch information
LilithWittmann authored Jan 22, 2017
2 parents 89bde5f + 0de0989 commit 0781a65
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ public static BarLineChartBase FormatChart(BarLineChartBase chart)
chart.setDrawBorders(false);

// set min/max values etc. for axes
chart.getAxisLeft().setStartAtZero(false);
chart.getAxisRight().setStartAtZero(false);
chart.getAxisLeft().setAxisMinValue(PitchCalculator.minMalePitch.floatValue());
chart.getAxisRight().setAxisMinValue(PitchCalculator.minMalePitch.floatValue());
// chart.getAxisRight().setStartAtZero(false);

chart.setHardwareAccelerationEnabled(true);
// chart.getLegend().setEnabled(false);
Expand All @@ -80,12 +81,13 @@ public static BarDataSet getOverallRange(Context context, int amount)
{
BarDataSet set = new BarDataSet(GraphLayout.getRangeEntries(amount), "");
set.setDrawValues(false);
set.setColors(new int[]{context.getResources().getColor(R.color.female_range),
set.setColors(new int[]{context.getResources().getColor(R.color.male_range),
context.getResources().getColor(R.color.androgynous_range),
context.getResources().getColor(R.color.male_range)});
set.setStackLabels(new String[]{context.getResources().getString(R.string.female_range),
context.getResources().getColor(R.color.female_range)});
set.setStackLabels(new String[]{context.getResources().getString(R.string.male_range),
context.getResources().getString(R.string.androgynous_range),
context.getResources().getString(R.string.male_range)});
context.getResources().getString(R.string.female_range)
});

// List<BarDataSet> setList = new ArrayList<BarDataSet>();
// setList.add(set);
Expand All @@ -106,12 +108,10 @@ private static List<BarEntry> getRangeEntries(int amount)
for (int i = 0; i < amount; i++)
{
result.add(new BarEntry(new float[]{
PitchCalculator.maxFemalePitch.floatValue() - PitchCalculator.maxMalePitch.floatValue(),
PitchCalculator.minMalePitch.floatValue()*2,
PitchCalculator.maxMalePitch.floatValue() - PitchCalculator.minFemalePitch.floatValue(),
PitchCalculator.minFemalePitch.floatValue()// - PitchCalculator.minPitch.floatValue(),
}, i));

// result.add(new BarEntry(new float[]{25, 50, 100, 200}, i));
PitchCalculator.maxFemalePitch.floatValue() - PitchCalculator.maxMalePitch.floatValue(),
}, i));
}

return result;
Expand Down

0 comments on commit 0781a65

Please sign in to comment.