put y axis definition into its own object
This commit is contained in:
@@ -38,7 +38,7 @@ public class PlotSettings {
|
||||
|
||||
private int yRangeMin;
|
||||
private int yRangeMax;
|
||||
private TimeRangeUnitInternal yRangeUnit = TimeRangeUnitInternal.AUTOMATIC;
|
||||
private TimeRangeUnit yRangeUnit = TimeRangeUnit.AUTOMATIC;
|
||||
|
||||
private boolean keyOutside;
|
||||
|
||||
@@ -186,11 +186,11 @@ public class PlotSettings {
|
||||
this.yRangeMax = yRangeMax;
|
||||
}
|
||||
|
||||
public TimeRangeUnitInternal getYRangeUnit() {
|
||||
public TimeRangeUnit getYRangeUnit() {
|
||||
return yRangeUnit;
|
||||
}
|
||||
|
||||
public void setYRangeUnit(final TimeRangeUnitInternal yRangeUnit) {
|
||||
public void setYRangeUnit(final TimeRangeUnit yRangeUnit) {
|
||||
this.yRangeUnit = yRangeUnit;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,9 +41,9 @@ public class ScatterAggregator implements CustomAggregator {
|
||||
plotAreaHeightInPx = plotSettings.getHeight() - GnuplotSettings.GNUPLOT_TOP_BOTTOM_MARGIN;
|
||||
epochMillisPerPixel = Math.max(1, (toEpochMilli - fromEpochMilli) / plotAreaWidthInPx);
|
||||
|
||||
minValue = plotSettings.getYRangeUnit() == TimeRangeUnitInternal.AUTOMATIC ? 0
|
||||
minValue = plotSettings.getYRangeUnit() == TimeRangeUnit.AUTOMATIC ? 0
|
||||
: plotSettings.getYRangeUnit().toMilliSeconds(plotSettings.getYRangeMin());
|
||||
maxValue = plotSettings.getYRangeUnit() == TimeRangeUnitInternal.AUTOMATIC ? Long.MAX_VALUE
|
||||
maxValue = plotSettings.getYRangeUnit() == TimeRangeUnit.AUTOMATIC ? Long.MAX_VALUE
|
||||
: plotSettings.getYRangeUnit().toMilliSeconds(plotSettings.getYRangeMax());
|
||||
durationMillisPerPixel = plotSettings.getYAxisScale() == AxisScale.LINEAR
|
||||
? Math.max(1, (maxValue - minValue) / plotAreaHeightInPx)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.lucares.pdb.plot.api;
|
||||
|
||||
public enum TimeRangeUnitInternal {
|
||||
public enum TimeRangeUnit {
|
||||
AUTOMATIC, MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS;
|
||||
|
||||
public int toMilliSeconds(final int value) {
|
||||
@@ -0,0 +1,41 @@
|
||||
package org.lucares.pdb.plot.api;
|
||||
|
||||
public class YAxisDefinition {
|
||||
private AxisScale yAxisScale = AxisScale.LINEAR;
|
||||
|
||||
private int yRangeMin = 0;
|
||||
private int yRangeMax = 300;
|
||||
private TimeRangeUnit yRangeUnit = TimeRangeUnit.AUTOMATIC;
|
||||
|
||||
public AxisScale getAxisScale() {
|
||||
return yAxisScale;
|
||||
}
|
||||
|
||||
public void setAxisScale(final AxisScale yAxis) {
|
||||
this.yAxisScale = yAxis;
|
||||
}
|
||||
|
||||
public int getyRangeMin() {
|
||||
return yRangeMin;
|
||||
}
|
||||
|
||||
public void setyRangeMin(final int yRangeMin) {
|
||||
this.yRangeMin = yRangeMin;
|
||||
}
|
||||
|
||||
public int getyRangeMax() {
|
||||
return yRangeMax;
|
||||
}
|
||||
|
||||
public void setyRangeMax(final int yRangeMax) {
|
||||
this.yRangeMax = yRangeMax;
|
||||
}
|
||||
|
||||
public TimeRangeUnit getyRangeUnit() {
|
||||
return yRangeUnit;
|
||||
}
|
||||
|
||||
public void setyRangeUnit(final TimeRangeUnit yRangeUnit) {
|
||||
this.yRangeUnit = yRangeUnit;
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import org.lucares.pdb.api.Tags;
|
||||
import org.lucares.pdb.plot.api.AggregatorCollection;
|
||||
import org.lucares.pdb.plot.api.Limit;
|
||||
import org.lucares.pdb.plot.api.PlotSettings;
|
||||
import org.lucares.pdb.plot.api.TimeRangeUnitInternal;
|
||||
import org.lucares.pdb.plot.api.TimeRangeUnit;
|
||||
import org.lucares.performance.db.PerformanceDb;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -149,9 +149,9 @@ public class Plotter {
|
||||
}
|
||||
|
||||
private void defineYRange(final GnuplotSettings gnuplotSettings, final int yRangeMin, final int yRangeMax,
|
||||
final TimeRangeUnitInternal yRangeUnit) {
|
||||
final TimeRangeUnit yRangeUnit) {
|
||||
|
||||
if (yRangeUnit != TimeRangeUnitInternal.AUTOMATIC) {
|
||||
if (yRangeUnit != TimeRangeUnit.AUTOMATIC) {
|
||||
final int min = yRangeUnit.toMilliSeconds(yRangeMin);
|
||||
final int max = yRangeUnit.toMilliSeconds(yRangeMax);
|
||||
gnuplotSettings.setYRange(min, max);
|
||||
@@ -169,9 +169,9 @@ public class Plotter {
|
||||
final long toEpochMilli = dateTo.toInstant().toEpochMilli();
|
||||
final boolean useMillis = (toEpochMilli - fromEpochMilli) < TimeUnit.MINUTES.toMillis(5);
|
||||
|
||||
final long minValue = plotSettings.getYRangeUnit() == TimeRangeUnitInternal.AUTOMATIC ? 0
|
||||
final long minValue = plotSettings.getYRangeUnit() == TimeRangeUnit.AUTOMATIC ? 0
|
||||
: plotSettings.getYRangeUnit().toMilliSeconds(plotSettings.getYRangeMin());
|
||||
final long maxValue = plotSettings.getYRangeUnit() == TimeRangeUnitInternal.AUTOMATIC ? Long.MAX_VALUE
|
||||
final long maxValue = plotSettings.getYRangeUnit() == TimeRangeUnit.AUTOMATIC ? Long.MAX_VALUE
|
||||
: plotSettings.getYRangeUnit().toMilliSeconds(plotSettings.getYRangeMax());
|
||||
|
||||
final AggregatorCollection aggregator = plotSettings.getAggregates().createCustomAggregator(tmpDir,
|
||||
|
||||
Reference in New Issue
Block a user