make sure labels for cumulative distribution don't overlap

This commit is contained in:
2019-11-23 14:36:32 +01:00
parent 82a961dbaf
commit 8d55ef4e5f

View File

@@ -38,12 +38,24 @@ public class CumulativeDistributionHandler implements AggregateHandler {
result.setType(Type.Number);
result.setAxis(GnuplotAxis.X2); // TODO determine automatically
result.setFormat("%.0f%%");
result.setTicIncrement(5);
result.setTicIncrement(computeTicIncrement(settings));
result.setFrom("0");
result.setTo("100");
return result;
}
private int computeTicIncrement(GnuplotSettings settings) {
int widthByFontSize = settings.getWidth()/GnuplotSettings.TICKS_FONT_SIZE;
if (widthByFontSize < 50) {
return 20;
}
else if (widthByFontSize < 75) {
return 10;
}else {
return 5;
}
}
@Override
public void addPlot(StringBuilder result, AggregatedData aggregatedData, LineStyle lineStyle, Optional<String> title) {
appendfln(result, "'%s' using 1:2 %s with lines axes x2y1 lw 2 %s, \\", //