add bar charts

This commit is contained in:
2020-01-19 10:35:07 +01:00
parent 1587046907
commit cf7e5ec968
35 changed files with 539 additions and 212 deletions

View File

@@ -3,6 +3,7 @@ package org.lucares.pdbui;
import org.lucares.pdb.plot.api.Aggregate;
import org.lucares.pdb.plot.api.AggregateHandlerCollection;
import org.lucares.pdb.plot.api.AxisScale;
import org.lucares.pdb.plot.api.BarChartHandler;
import org.lucares.pdb.plot.api.CumulativeDistributionHandler;
import org.lucares.pdb.plot.api.HistogramHandler;
import org.lucares.pdb.plot.api.ParallelRequestsAggregate;
@@ -64,10 +65,10 @@ class PlotSettingsTransformer {
switch (aggregate) {
case CUM_DISTRIBUTION:
aggregateHandlerCollection.add(new CumulativeDistributionHandler());
aggregateHandlerCollection.addAggregateHandler(new CumulativeDistributionHandler());
break;
case PARALLEL:
aggregateHandlerCollection.add(new ParallelRequestsAggregate());
aggregateHandlerCollection.addAggregateHandler(new ParallelRequestsAggregate());
break;
case SCATTER:
if (yRangeUnit == TimeRangeUnitInternal.AUTOMATIC && yAxisScale == AxisScale.LINEAR) {
@@ -76,11 +77,14 @@ class PlotSettingsTransformer {
throw new UnsupportedOperationException(
"linear axis with automatic y range does not work, use logarthmic y-axis, or define a y-axis range");
} else {
aggregateHandlerCollection.add(new ScatterAggregateHandler());
aggregateHandlerCollection.addAggregateHandler(new ScatterAggregateHandler());
}
break;
case HISTOGRAM:
aggregateHandlerCollection.add(new HistogramHandler());
aggregateHandlerCollection.addAggregateHandler(new HistogramHandler());
break;
case BAR:
aggregateHandlerCollection.addAggregateHandler(new BarChartHandler());
break;
default:
throw new IllegalStateException("unhandled enum: " + aggregate);

View File

@@ -153,7 +153,7 @@ public class TcpIngestorTest {
@Test
public void testIngestionThreadDoesNotDieOnErrors() throws Exception {
final OffsetDateTime dateA = OffsetDateTime.ofInstant(Instant.ofEpochMilli(-1), ZoneOffset.UTC);
final OffsetDateTime dateA = OffsetDateTime.now().minusMinutes(1);
final OffsetDateTime dateB = OffsetDateTime.now();
final DateTimeRange dateRange = new DateTimeRange(dateA, dateB);
final String host = "someHost";
@@ -163,7 +163,7 @@ public class TcpIngestorTest {
// has a negative epoch time milli and negative value
final Map<String, Object> entryA = new HashMap<>();
entryA.put("duration", -1);
entryA.put("duration", 1);
entryA.put("@timestamp", dateA.format(DateTimeFormatter.ISO_ZONED_DATE_TIME));
entryA.put("host", host);
entryA.put("tags", Collections.emptyList());
@@ -194,7 +194,7 @@ public class TcpIngestorTest {
Assertions.assertEquals(4, result.size());
Assertions.assertEquals(dateA.toInstant().truncatedTo(ChronoUnit.MILLIS).toEpochMilli(), result.get(0));
Assertions.assertEquals(-1, result.get(1));
Assertions.assertEquals(1, result.get(1));
Assertions.assertEquals(dateB.toInstant().truncatedTo(ChronoUnit.MILLIS).toEpochMilli(), result.get(2));
Assertions.assertEquals(2, result.get(3));