make sure labels for cumulative distribution don't overlap
This commit is contained in:
@@ -38,12 +38,24 @@ public class CumulativeDistributionHandler implements AggregateHandler {
|
|||||||
result.setType(Type.Number);
|
result.setType(Type.Number);
|
||||||
result.setAxis(GnuplotAxis.X2); // TODO determine automatically
|
result.setAxis(GnuplotAxis.X2); // TODO determine automatically
|
||||||
result.setFormat("%.0f%%");
|
result.setFormat("%.0f%%");
|
||||||
result.setTicIncrement(5);
|
result.setTicIncrement(computeTicIncrement(settings));
|
||||||
result.setFrom("0");
|
result.setFrom("0");
|
||||||
result.setTo("100");
|
result.setTo("100");
|
||||||
return result;
|
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
|
@Override
|
||||||
public void addPlot(StringBuilder result, AggregatedData aggregatedData, LineStyle lineStyle, Optional<String> title) {
|
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, \\", //
|
appendfln(result, "'%s' using 1:2 %s with lines axes x2y1 lw 2 %s, \\", //
|
||||||
|
|||||||
Reference in New Issue
Block a user