editable sample size in default data graph; closes #807

This commit is contained in:
hneemann 2021-08-28 18:23:23 +02:00
parent 53842073f0
commit 8f2918e076
5 changed files with 23 additions and 9 deletions

View File

@ -8,6 +8,8 @@ HEAD, planned as v0.28
- Italian translation was added, special thanks to Luca Cavallari
- adds a external component that is based on a file instead
of storing the code in the component itself.
- Fixed an issue with clicking on tightly placed components.
- Variable sample size in default data graph.
v0.27, released on 9. Apr. 2021
- Added fixed point and floating point number formats.

View File

@ -439,6 +439,15 @@ public final class Keys {
= new Key.KeyInteger("maxStepCount", 25)
.setMin(5);
/**
* the max number of samples in the default data view
*/
public static final Key<Integer> SETTINGS_MAX_STEP_COUNT
= new Key.KeyInteger("maxStepCount", 1000)
.setComboBoxValues(500, 1000, 5000, 10000)
.setMin(500)
.setSecondary();
/**
* flag to enable high z mode at an input
*/

View File

@ -1519,8 +1519,10 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
}
private void showMeasurementGraph(ModelEventType updateEvent) {
List<String> ordering = circuitComponent.getCircuit().getMeasurementOrdering();
windowPosManager.register("dataSet", GraphDialog.createLiveDialog(this, model, updateEvent == ModelEventType.MICROSTEP, ordering)).setVisible(true);
Circuit circuit = circuitComponent.getCircuit();
List<String> ordering = circuit.getMeasurementOrdering();
int sampleSize = circuit.getAttributes().get(Keys.SETTINGS_MAX_STEP_COUNT);
windowPosManager.register("dataSet", GraphDialog.createLiveDialog(this, model, updateEvent == ModelEventType.MICROSTEP, ordering, sampleSize)).setVisible(true);
}
private void showMeasurementDialog(ModelEventType updateEvent) {

View File

@ -82,6 +82,7 @@ public class CircuitComponent extends JComponent implements ChangedListener, Lib
ATTR_LIST.add(Keys.SHOW_DATA_TABLE);
ATTR_LIST.add(Keys.SHOW_DATA_GRAPH);
ATTR_LIST.add(Keys.SHOW_DATA_GRAPH_MICRO);
ATTR_LIST.add(Keys.SETTINGS_MAX_STEP_COUNT);
ATTR_LIST.add(Keys.PRELOAD_PROGRAM);
ATTR_LIST.add(Keys.PROGRAM_TO_PRELOAD);
ATTR_LIST.add(Keys.IS_GENERIC);

View File

@ -34,7 +34,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
* The Dialog which shows the data to plot.
*/
public class GraphDialog extends JDialog implements Observer {
private static final int MAX_SAMPLE_SIZE = 1000;
private final GraphComponent graphComponent;
private final ToolTipAction showTable;
@ -47,13 +46,14 @@ public class GraphDialog extends JDialog implements Observer {
/**
* Creates a instance prepared for "live logging"
*
* @param owner the parent frame
* @param model the model
* @param microStep stepping mode
* @param ordering the ordering to use
* @param owner the parent frame
* @param model the model
* @param microStep stepping mode
* @param ordering the ordering to use
* @param sampleSize the number of samples
* @return the created instance
*/
public static GraphDialog createLiveDialog(JFrame owner, Model model, boolean microStep, List<String> ordering) {
public static GraphDialog createLiveDialog(JFrame owner, Model model, boolean microStep, List<String> ordering, int sampleSize) {
String title;
if (microStep)
title = Lang.get("win_measures_microstep");
@ -70,7 +70,7 @@ public class GraphDialog extends JDialog implements Observer {
}.order(signals);
ValueTableObserver valueTableObserver = new ValueTableObserver(microStep, signals, MAX_SAMPLE_SIZE);
ValueTableObserver valueTableObserver = new ValueTableObserver(microStep, signals, sampleSize);
GraphDialog graphDialog = new GraphDialog(owner, title, valueTableObserver.getLogData(), model, true)
.setColumnInfo(createColumnsInfo(signals));