Be a little smarter about generating the series names for the plot and
drop down. Extract algorithm into utility class for easier reuse.
This commit is contained in:
parent
aeacbcfd18
commit
106a976655
@ -132,12 +132,13 @@ public class SimulationPlot {
|
||||
int axis = filled.getAxis(i);
|
||||
String name = getLabel(type, unit);
|
||||
|
||||
List<String> seriesNames = Util.generateSeriesLabels(simulation);
|
||||
for( int branchIndex=0; branchIndex<branchCount; branchIndex++ ) {
|
||||
FlightDataBranch thisBranch = simulation.getSimulatedData().getBranch(branchIndex);
|
||||
// Store data in provided units
|
||||
List<Double> plotx = thisBranch.get(domainType);
|
||||
List<Double> ploty = thisBranch.get(type);
|
||||
XYSeries series = new XYSeries(thisBranch.getBranchName() + " (" + branchIndex+"): " + name, false, true);
|
||||
XYSeries series = new XYSeries(seriesNames.get(branchIndex) + ": " + name, false, true);
|
||||
series.setDescription(thisBranch.getBranchName()+": " + name);
|
||||
int pointCount = plotx.size();
|
||||
for (int j = 0; j < pointCount; j++) {
|
||||
|
@ -7,6 +7,7 @@ import java.awt.event.InputEvent;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JButton;
|
||||
@ -111,11 +112,10 @@ public class SimulationPlotDialog extends JDialog {
|
||||
|
||||
//// Add series selection box
|
||||
//// FIXME
|
||||
List<String> stages = new ArrayList<String>();
|
||||
ArrayList<String> stages = new ArrayList<String>();
|
||||
stages.add("All");
|
||||
for (int i = 0; i < simulation.getSimulatedData().getBranchCount(); i++) {
|
||||
stages.add(simulation.getSimulatedData().getBranch(i).getBranchName() + " (" + i + ")");
|
||||
}
|
||||
stages.addAll( Util.generateSeriesLabels(simulation));
|
||||
|
||||
final JComboBox stageSelection = new JComboBox(stages.toArray(new String[0]));
|
||||
stageSelection.addItemListener(new ItemListener() {
|
||||
|
||||
|
@ -32,7 +32,6 @@ import net.sf.openrocket.simulation.FlightDataType;
|
||||
import net.sf.openrocket.simulation.FlightEvent;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.unit.Unit;
|
||||
import net.sf.openrocket.util.ArrayList;
|
||||
import net.sf.openrocket.util.Utils;
|
||||
|
||||
/**
|
||||
@ -314,9 +313,6 @@ public class SimulationPlotPanel extends JPanel {
|
||||
});
|
||||
this.add(button, "right");
|
||||
|
||||
|
||||
// FIXME - add list & check boxes for data branches.
|
||||
|
||||
updatePlots();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user