extract constants for gnuplot margins in px

This commit is contained in:
2019-09-08 08:34:14 +02:00
parent 162ef1626c
commit 242c83e590
2 changed files with 9 additions and 7 deletions

View File

@@ -197,17 +197,12 @@ public class GnuplotFileGenerator {
final StringBuilder result = new StringBuilder();
appendfln(result, "set ylabel \"%s\"", "Duration");
final long plotHeight = height - 133; // sum of top/bottom margin, see marker (1)
final long plotHeight = height - GnuplotSettings.GNUPLOT_TOP_BOTTOM_MARGIN; // sum of top/bottom margin, see
// marker (1)
final long maxLabels = plotHeight / (TICKS_FONT_SIZE * 5);
System.out.println("labels: " + maxLabels);
final long range = yRangeMax - yRangeMin;
final long msPerLabel = roundToLinearLabelSteps(range / maxLabels);
final long digits = (long) Math.ceil(Math.log10(msPerLabel));
System.out.println("range: " + range);
System.out.println("msPerLabel: " + msPerLabel);
System.out.println("digits: " + digits);
final List<String> ticsLabels = new ArrayList<>();
for (long i = yRangeMin; i <= yRangeMax; i += msPerLabel) {

View File

@@ -6,6 +6,13 @@ import org.lucares.pdb.plot.api.AggregateHandler;
import org.lucares.pdb.plot.api.AxisScale;
public class GnuplotSettings {
public final static int GNUPLOT_LEFT_MARGIN = 110; // The left margin configured for gnuplot
public final static int GNUPLOT_RIGHT_MARGIN = 110; // The right margin configured for gnuplot
public final static int GNUPLOT_TOP_MARGIN = 57; // The top margin configured for gnuplot
public final static int GNUPLOT_BOTTOM_MARGIN = 76; // The bottom margin configured for gnuplot
public final static int GNUPLOT_TOP_BOTTOM_MARGIN = GNUPLOT_TOP_MARGIN + GNUPLOT_BOTTOM_MARGIN;
private String terminal = "png";
private int height = 1200;
private int width = 1600;