reduce size of x-axis labels
This commit is contained in:
@@ -10,23 +10,23 @@ public class GnuplotSettings {
|
|||||||
private int width = 1600;
|
private int width = 1600;
|
||||||
private String timefmt = "%Y-%m-%dT%H:%M:%S";
|
private String timefmt = "%Y-%m-%dT%H:%M:%S";
|
||||||
|
|
||||||
// set format x "%m-%d\n%H:%M"
|
// set format for x-axis
|
||||||
private String formatX = "%Y-%m-%d %H:%M:%S";
|
private String formatX = "%Y-%m-%d %H:%M:%S";
|
||||||
|
|
||||||
// set datafile separator ","
|
// set datafile separator
|
||||||
private String datafileSeparator = ",";
|
private String datafileSeparator = ",";
|
||||||
|
|
||||||
// set xlabel "Time"
|
// set xlabel
|
||||||
private String xlabel = "Time";
|
private String xlabel = "Time";
|
||||||
|
|
||||||
// set ylabel "Traffic"
|
// set ylabel
|
||||||
private String ylabel = "Duration in ms";
|
private String ylabel = "Duration in ms";
|
||||||
|
|
||||||
// set output "datausage.png"
|
// set output "datausage.png"
|
||||||
private final Path output;
|
private final Path output;
|
||||||
|
|
||||||
// set xtics rotate by 80
|
// set xtics rotate by 10 degree
|
||||||
private int rotateXAxisLabel = -80;
|
private int rotateXAxisLabel = -10;
|
||||||
private AxisScale yAxisScale;
|
private AxisScale yAxisScale;
|
||||||
|
|
||||||
public GnuplotSettings(final Path output) {
|
public GnuplotSettings(final Path output) {
|
||||||
|
|||||||
@@ -109,7 +109,8 @@ public class Plotter {
|
|||||||
final GnuplotSettings gnuplotSettings = new GnuplotSettings(outputFile);
|
final GnuplotSettings gnuplotSettings = new GnuplotSettings(outputFile);
|
||||||
gnuplotSettings.setHeight(height);
|
gnuplotSettings.setHeight(height);
|
||||||
gnuplotSettings.setWidth(width);
|
gnuplotSettings.setWidth(width);
|
||||||
gnuplotSettings.setFormatX(getFormatX(minDate, maxDate));
|
defineXAxis(gnuplotSettings, minDate, maxDate);
|
||||||
|
|
||||||
gnuplotSettings.setYAxisScale(plotSettings.getYAxisScale());
|
gnuplotSettings.setYAxisScale(plotSettings.getYAxisScale());
|
||||||
gnuplot.plot(gnuplotSettings, dataSeries);
|
gnuplot.plot(gnuplotSettings, dataSeries);
|
||||||
|
|
||||||
@@ -125,20 +126,29 @@ public class Plotter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void defineXAxis(final GnuplotSettings gnuplotSettings, final OffsetDateTime minDate,
|
||||||
|
final OffsetDateTime maxDate) {
|
||||||
|
|
||||||
|
String formatX;
|
||||||
|
int rotateX;
|
||||||
|
if (minDate.until(maxDate, ChronoUnit.WEEKS) > 1) {
|
||||||
|
formatX = "%Y-%m-%d";
|
||||||
|
rotateX = 0;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
formatX = "%Y-%m-%d %H:%M:%S";
|
||||||
|
rotateX = gnuplotSettings.getRotateXAxisLabel();
|
||||||
|
}
|
||||||
|
|
||||||
|
gnuplotSettings.setFormatX(formatX);
|
||||||
|
gnuplotSettings.setRotateXAxisLabel(rotateX);
|
||||||
|
}
|
||||||
|
|
||||||
private String uniqueDirectoryName() {
|
private String uniqueDirectoryName() {
|
||||||
return OffsetDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd_HH_mm_ss")) + "_"
|
return OffsetDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd_HH_mm_ss")) + "_"
|
||||||
+ UUID.randomUUID().toString();
|
+ UUID.randomUUID().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getFormatX(final OffsetDateTime minDate, final OffsetDateTime maxDate) {
|
|
||||||
|
|
||||||
if (minDate.until(maxDate, ChronoUnit.WEEKS) > 1) {
|
|
||||||
return "%Y-%m-%d";
|
|
||||||
}
|
|
||||||
|
|
||||||
return "%Y-%m-%d %H:%M:%S";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sortAndLimit(final List<DataSeries> dataSeries, final PlotSettings plotSettings) {
|
private void sortAndLimit(final List<DataSeries> dataSeries, final PlotSettings plotSettings) {
|
||||||
|
|
||||||
final Limit limitBy = plotSettings.getLimitBy();
|
final Limit limitBy = plotSettings.getLimitBy();
|
||||||
|
|||||||
Reference in New Issue
Block a user