smart cleanup for dynamic plottables

This commit is contained in:
Alexander Nozik 2016-10-15 12:46:00 +03:00
parent 7628386d56
commit 4c8f740d26
2 changed files with 4 additions and 3 deletions

View File

@ -95,7 +95,6 @@ public class PKT8PlotController implements Initializable, MeasurementListener<PK
*/ */
private synchronized void setupPlotFrame(Meta plotFrameMeta) { private synchronized void setupPlotFrame(Meta plotFrameMeta) {
plottables = new TimePlottableGroup(); plottables = new TimePlottableGroup();
plottables.setMaxItems(plotFrameMeta.getInt("maxItems", 3000));
plottables.setMaxAge(Duration.parse(plotFrameMeta.getString("maxAge", "PT2H"))); plottables.setMaxAge(Duration.parse(plotFrameMeta.getString("maxAge", "PT2H")));
plotArea.getChildren().clear(); plotArea.getChildren().clear();
plotFrame = new JFreeChartFrame(plotFrameMeta); plotFrame = new JFreeChartFrame(plotFrameMeta);
@ -126,6 +125,8 @@ public class PKT8PlotController implements Initializable, MeasurementListener<PK
}); });
if (device.meta().hasMeta("plotConfig")) { if (device.meta().hasMeta("plotConfig")) {
plottables.applyConfig(device.meta().getMeta("plotConfig")); plottables.applyConfig(device.meta().getMeta("plotConfig"));
plottables.setMaxItems(1000);
plottables.setPrefItems(400);
} }
// plottables.applyConfig(plotFrame.getConfig()); // plottables.applyConfig(plotFrame.getConfig());
} }

View File

@ -50,7 +50,7 @@ public class PKT8VirtualPort extends VirtualPort implements Annotated {
//TODO convert double value to formatted string //TODO convert double value to formatted string
return letter + "000120000\n"; return letter + "000120000\n";
}, },
Duration.ZERO, Duration.ofSeconds(5), letter, "measurement" Duration.ZERO, Duration.ofMillis(200), letter, "measurement"
); );
} }
return; return;