draw labels for x2 axis only if necessary
- added tics every 5 percentage points
This commit is contained in:
@@ -6,11 +6,15 @@ import java.util.Collection;
|
|||||||
import org.lucares.recommind.logs.DataSeries;
|
import org.lucares.recommind.logs.DataSeries;
|
||||||
|
|
||||||
public interface AggregateHandler {
|
public interface AggregateHandler {
|
||||||
|
|
||||||
// TODO handle aggregates as normal DataSeries
|
// TODO handle aggregates as normal DataSeries
|
||||||
|
|
||||||
void addGnuplotDefinitions(StringBuilder result, String separator, Collection<DataSeries> dataSeries);
|
void addGnuplotDefinitions(StringBuilder result, String separator, Collection<DataSeries> dataSeries);
|
||||||
|
|
||||||
|
default void appendln(final StringBuilder builder, final String string) {
|
||||||
|
builder.append(string + "\n");
|
||||||
|
}
|
||||||
|
|
||||||
default void appendfln(final StringBuilder builder, final String format, final Object... args) {
|
default void appendfln(final StringBuilder builder, final String format, final Object... args) {
|
||||||
builder.append(String.format(format + "\n", args));
|
builder.append(String.format(format + "\n", args));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,41 +5,35 @@ import java.util.Collection;
|
|||||||
|
|
||||||
import org.lucares.recommind.logs.DataSeries;
|
import org.lucares.recommind.logs.DataSeries;
|
||||||
|
|
||||||
public class PercentileAggregate implements AggregateHandler{
|
public class PercentileAggregate implements AggregateHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CustomAggregator createCustomAggregator(Path tmpDir) {
|
public CustomAggregator createCustomAggregator(final Path tmpDir) {
|
||||||
return new PercentileCustomAggregator(tmpDir);
|
return new PercentileCustomAggregator(tmpDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public PercentileAggregate() {
|
public PercentileAggregate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addGnuplotDefinitions(StringBuilder result, String separator, Collection<DataSeries> dataSeries) {
|
public void addGnuplotDefinitions(final StringBuilder result, final String separator,
|
||||||
|
final Collection<DataSeries> dataSeries) {
|
||||||
// TODO still neeeded?
|
|
||||||
|
appendln(result, "set x2label \"Percentile\"");
|
||||||
|
appendln(result, "set format x2 \"%.0f%%\"");
|
||||||
|
appendln(result, "set x2tics 5");
|
||||||
|
appendln(result, "set x2range [\"0\":\"100\"]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addPlots(StringBuilder result, Collection<DataSeries> dataSeries) {
|
public void addPlots(final StringBuilder result, final Collection<DataSeries> dataSeries) {
|
||||||
for (DataSeries dataSerie : dataSeries) {
|
for (final DataSeries dataSerie : dataSeries) {
|
||||||
final AggregatedData aggregatedData = dataSerie.getAggregatedData();
|
final AggregatedData aggregatedData = dataSerie.getAggregatedData();
|
||||||
if (aggregatedData != null){
|
if (aggregatedData != null) {
|
||||||
appendfln(
|
appendfln(result, "'%s' using 1:2 notitle with lines axes x2y1 lw 2 %s, \\", //
|
||||||
result,
|
aggregatedData.getDataFile().getAbsolutePath(), //
|
||||||
"'%s' using 1:2 notitle with lines axes x2y1 lw 2 %s, \\", //
|
|
||||||
aggregatedData.getDataFile().getAbsolutePath(),//
|
|
||||||
dataSerie.getStyle()//
|
dataSerie.getStyle()//
|
||||||
);
|
);
|
||||||
|
|
||||||
// appendfln(result, "'%s' using 1:2 title '%s' with lines axes x2y1 %s, \\", //
|
|
||||||
// aggregatedData.getDataFile().getAbsolutePath(),//
|
|
||||||
// dataSerie.getTitle()+" " +aggregatedData.getLabel(), // title
|
|
||||||
// dataSerie.getStyle()//
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,11 +28,6 @@ public class GnuplotFileGenerator {
|
|||||||
appendfln(result, "set xlabel \"%s\"", xAxis.getXlabel());
|
appendfln(result, "set xlabel \"%s\"", xAxis.getXlabel());
|
||||||
appendfln(result, "set xrange [\"%s\":\"%s\"]", xAxis.getFrom(), xAxis.getTo());
|
appendfln(result, "set xrange [\"%s\":\"%s\"]", xAxis.getFrom(), xAxis.getTo());
|
||||||
|
|
||||||
appendfln(result, "set x2label \"Percentile\"");
|
|
||||||
appendln(result, "set format x2 \"%.0f%%\"");
|
|
||||||
appendfln(result, "set x2tics");
|
|
||||||
appendfln(result, "set x2range [\"0\":\"100\"]");
|
|
||||||
|
|
||||||
final long graphOffset = settings.getYAxisScale() == AxisScale.LINEAR ? 0 : 1;
|
final long graphOffset = settings.getYAxisScale() == AxisScale.LINEAR ? 0 : 1;
|
||||||
appendfln(result, "set yrange [\"" + graphOffset + "\":]");
|
appendfln(result, "set yrange [\"" + graphOffset + "\":]");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user