Move plot axis selection
This commit is contained in:
parent
4203f75128
commit
bbff83e015
@ -549,7 +549,7 @@ public class SimulationPlot {
|
||||
LinearInterpolator rangeInterpolator = new LinearInterpolator(time, range);
|
||||
// Image annotations are not supported on the right-side axis
|
||||
// TODO: LOW: Can this be achieved by JFreeChart?
|
||||
if (filled.getAxis(index) != SimulationPlotPanel.LEFT) {
|
||||
if (filled.getAxis(index) != Util.PlotAxisSelection.LEFT.getValue()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,39 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import info.openrocket.core.document.Simulation;
|
||||
import info.openrocket.core.l10n.Translator;
|
||||
import info.openrocket.core.startup.Application;
|
||||
|
||||
public abstract class Util {
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
|
||||
public enum PlotAxisSelection {
|
||||
AUTO(-1, trans.get("simplotpanel.AUTO_NAME")), // Automatically decide to plot on the left or right y-axis
|
||||
LEFT(0, trans.get("simplotpanel.LEFT_NAME")), // Plot on the left y-axis
|
||||
RIGHT(1, trans.get("simplotpanel.RIGHT_NAME")); // Plot on the right y-axis
|
||||
|
||||
private final int value;
|
||||
private final String name;
|
||||
|
||||
PlotAxisSelection(int value, String name) {
|
||||
this.value = value;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
private static final Color[] PLOT_COLORS = {
|
||||
new Color(0,114,189),
|
||||
new Color(217,83,25),
|
||||
|
@ -57,19 +57,7 @@ public class SimulationPlotPanel extends JPanel {
|
||||
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
private static final SwingPreferences preferences = (SwingPreferences) Application.getPreferences();
|
||||
|
||||
// TODO: LOW: Should these be somewhere else?
|
||||
public static final int AUTO = -1;
|
||||
public static final int LEFT = 0;
|
||||
public static final int RIGHT = 1;
|
||||
|
||||
//// Auto
|
||||
public static final String AUTO_NAME = trans.get("simplotpanel.AUTO_NAME");
|
||||
//// Left
|
||||
public static final String LEFT_NAME = trans.get("simplotpanel.LEFT_NAME");
|
||||
//// Right
|
||||
public static final String RIGHT_NAME = trans.get("simplotpanel.RIGHT_NAME");
|
||||
|
||||
|
||||
//// Custom
|
||||
private static final String CUSTOM = trans.get("simplotpanel.CUSTOM");
|
||||
|
||||
|
@ -9,6 +9,7 @@ import info.openrocket.core.util.Group;
|
||||
import info.openrocket.core.util.Groupable;
|
||||
import info.openrocket.core.util.UnitValue;
|
||||
import info.openrocket.swing.gui.components.UnitSelector;
|
||||
import info.openrocket.swing.gui.plot.Util;
|
||||
import info.openrocket.swing.gui.util.Icons;
|
||||
|
||||
import java.awt.event.ActionListener;
|
||||
@ -26,7 +27,8 @@ public class PlotTypeSelector<G extends Group, T extends Groupable<G> & UnitValu
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
private static final long serialVersionUID = 9056324972817542570L;
|
||||
|
||||
private final String[] POSITIONS = { "Auto", "Left", "Right" };
|
||||
private final String[] POSITIONS = {Util.PlotAxisSelection.AUTO.getName(),
|
||||
Util.PlotAxisSelection.LEFT.getName(), Util.PlotAxisSelection.RIGHT.getName()};
|
||||
|
||||
private final int index;
|
||||
private final GroupableAndSearchableComboBox<G, T> typeSelector;
|
||||
|
Loading…
x
Reference in New Issue
Block a user