update axis min and max to reflect all branches, not just first branch

This commit is contained in:
JoePfeiffer 2024-09-28 06:20:52 -06:00
parent ac8d182b9a
commit c462122a45
2 changed files with 5 additions and 6 deletions

View File

@ -73,7 +73,7 @@ public abstract class Plot<T extends DataType, B extends DataBranch<T>, C extend
protected final List<ModifiedXYItemRenderer> renderers = new ArrayList<>(); protected final List<ModifiedXYItemRenderer> renderers = new ArrayList<>();
protected final LegendItems legendItems; protected final LegendItems legendItems;
protected final XYSeriesCollection[] data; protected final XYSeriesCollection[] data;
protected final C filledConfig; // Configuration after using 'fillAutoAxes' protected final C filledConfig; // Configuration after using 'fillAutoAxes' and 'fitAxes'
protected final JFreeChart chart; protected final JFreeChart chart;
@ -124,9 +124,8 @@ public abstract class Plot<T extends DataType, B extends DataBranch<T>, C extend
int seriesCount = 0; int seriesCount = 0;
// Compute the axes based on the min and max value of all branches // Compute the axes based on the min and max value of all branches
C plotConfig = filledConfig.cloneConfiguration(); filledConfig.fitAxes(allBranches);
plotConfig.fitAxes(allBranches); List<Axis> minMaxAxes = filledConfig.getAllAxes();
List<Axis> minMaxAxes = plotConfig.getAllAxes();
// Create the XYSeries objects from the flight data and store into the collections // Create the XYSeries objects from the flight data and store into the collections
String[] axisLabel = new String[2]; String[] axisLabel = new String[2];

View File

@ -274,10 +274,10 @@ public class SimulationPlot extends Plot<FlightDataType, FlightDataBranch, Simul
double minLeft = minMaxAxes.get(0).getMinValue(); double minLeft = minMaxAxes.get(0).getMinValue();
double maxLeft = minMaxAxes.get(0).getMaxValue(); double maxLeft = minMaxAxes.get(0).getMaxValue();
double minThis = minMaxAxes.get(axisno).getMinValue(); double minThis = minMaxAxes.get(axisno).getMinValue();
double maxThis = minMaxAxes.get(axisno).getMaxValue(); double maxThis = minMaxAxes.get(axisno).getMaxValue();
double slope = (maxLeft - minLeft)/(maxThis - minThis); double slope = (maxLeft - minLeft)/(maxThis - minThis);
double intercept = (maxThis * minLeft - maxLeft * minThis)/(maxThis - minThis); double intercept = (maxThis * minLeft - maxLeft * minThis)/(maxThis - minThis);