Skip to content

Commit

Permalink
Added support for mouse zoom in / zoom out to 2D plots, drag-n-drop s…
Browse files Browse the repository at this point in the history
…upport to OL/CL columns selection, ability to save/load filters in LogStats, multiple log file to LogStats
  • Loading branch information
Vlad Imshenetskiy committed Sep 4, 2023
1 parent b76d1ff commit b329e77
Show file tree
Hide file tree
Showing 28 changed files with 369 additions and 118 deletions.
8 changes: 6 additions & 2 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/jcommon-1.0.21.jar"/>
<classpathentry kind="lib" path="lib/jfreechart-1.0.17.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.14.jar"/>
<classpathentry kind="lib" path="lib/jmathplot.jar"/>
<classpathentry kind="lib" path="lib/quicktable-3.0.jar"/>
<classpathentry kind="lib" path="lib/JTattoo-1.6.11.jar"/>
<classpathentry kind="lib" path="lib/CheckBoxTree_1.0.0.jar"/>
<classpathentry kind="lib" path="lib/jmathio.jar"/>
<classpathentry kind="lib" path="lib/commons-math3-3.6.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/jfreechart-1.5.3.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=
org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
org.eclipse.jdt.core.classpath.mainOnlyProjectHasTestOnlyDependency=error
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
Expand Down
1 change: 1 addition & 0 deletions .settings/org.eclipse.jdt.launching.prefs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
eclipse.preferences.version=1
org.eclipse.jdt.launching.PREF_COMPILER_COMPLIANCE_DOES_NOT_MATCH_JRE=warning
org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning
Binary file modified MafScaling.jar
Binary file not shown.
Binary file removed lib/jfreechart-1.0.17.jar
Binary file not shown.
Binary file added lib/jfreechart-1.5.3.jar
Binary file not shown.
12 changes: 9 additions & 3 deletions src/com/vgi/mafscaling/ACompCalc.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@
import org.jfree.chart.renderer.xy.XYDotRenderer;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.chart.title.LegendTitle;
import org.jfree.chart.ui.RectangleEdge;
import org.jfree.data.function.Function2D;
import org.jfree.data.function.LineFunction2D;
import org.jfree.data.statistics.Regression;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.jfree.ui.RectangleEdge;
import org.jfree.util.ShapeUtilities;
import org.math.plot.Plot3DPanel;

Expand Down Expand Up @@ -446,7 +446,13 @@ protected void createChart(JPanel plotPanel, String xAxisName, String yAxisName)

chartPanel = new ChartPanel(chart, true, true, true, true, true);
chartPanel.setAutoscrolls(true);
chartPanel.setMouseZoomable(false);
chartPanel.setMouseWheelEnabled(true);
chartPanel.restoreAutoBounds();
chartPanel.setZoomInFactor(0.8);
chartPanel.setZoomOutFactor(1.2);
chartPanel.setZoomAroundAnchor(true);
chartPanel.setDomainZoomable(true);
chartPanel.setRangeZoomable(true);

GridBagConstraints gbl_chartPanel = new GridBagConstraints();
gbl_chartPanel.anchor = GridBagConstraints.CENTER;
Expand All @@ -465,7 +471,7 @@ protected void createChart(JPanel plotPanel, String xAxisName, String yAxisName)

XYLineAndShapeRenderer lineRenderer = new XYLineAndShapeRenderer();
lineRenderer.setUseFillPaint(true);
lineRenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator(
lineRenderer.setDefaultToolTipGenerator(new StandardXYToolTipGenerator(
StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
new DecimalFormat("0.00"), new DecimalFormat("0.00")));

Expand Down
6 changes: 3 additions & 3 deletions src/com/vgi/mafscaling/AMafScaling.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
import org.jfree.chart.renderer.xy.XYDotRenderer;
import org.jfree.chart.renderer.xy.XYSplineRenderer;
import org.jfree.chart.title.LegendTitle;
import org.jfree.chart.ui.RectangleEdge;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.jfree.ui.RectangleEdge;
import org.jfree.util.ShapeUtilities;

public abstract class AMafScaling extends FCTabbedPane implements IMafChartHolder, ActionListener {
Expand Down Expand Up @@ -96,7 +96,7 @@ public abstract class AMafScaling extends FCTabbedPane implements IMafChartHolde
protected Insets insets1 = new Insets(1, 1, 1, 1);
protected Insets insets2 = new Insets(2, 2, 2, 2);
protected Insets insets3 = new Insets(3, 3, 3, 3);
protected String[] optionButtons = { "Yes", "No", "No to all" };
protected String[] optionButtons = { "Yes", "No" };

public AMafScaling(int tabPlacement, PrimaryOpenLoopFuelingTable table, MafCompare comparer) {
super(tabPlacement);
Expand Down Expand Up @@ -259,7 +259,7 @@ protected void createChart(JPanel plotPanel, String y2AxisName) {

XYSplineRenderer lineRenderer = new XYSplineRenderer(3);
lineRenderer.setUseFillPaint(true);
lineRenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator(
lineRenderer.setDefaultToolTipGenerator(new StandardXYToolTipGenerator(
StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
new DecimalFormat("0.00"), new DecimalFormat("0.00")));

Expand Down
28 changes: 13 additions & 15 deletions src/com/vgi/mafscaling/ClosedLoop.java
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,7 @@ private boolean getColumnsFilters(String[] elements, boolean isPolfTableMap) {

protected void loadLogFile() {
boolean displayDialog = true;
boolean isPolfSet = polfTable.isSet();
boolean isPolfTableMap = polfTable.isMap();
File[] files = fileChooser.getSelectedFiles();
for (File file : files) {
Expand All @@ -1034,26 +1035,23 @@ protected void loadLogFile() {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file.getAbsoluteFile()), Config.getEncoding()));
String line = null;
String [] elements = null;
while ((line = br.readLine()) != null && (elements = line.split(Utils.fileFieldSplitter, -1)) != null && elements.length < 2)
while ((line = br.readLine()) != null && (elements = line.trim().split(Utils.fileFieldSplitter, -1)) != null && elements.length < 2)
continue;
getColumnsFilters(elements, isPolfTableMap);
boolean resetColumns = false;
if (logClOlStatusColIdx >= 0 || logAfLearningColIdx >= 0 || logAfCorrectionColIdx >= 0 || logAfrColIdx >= 0 ||
logRpmColIdx >= 0 || logLoadColIdx >=0 || logTimeColIdx >=0 || logMafvColIdx >= 0 || logIatColIdx >= 0 || logMapColIdx >= 0) {
if (displayDialog) {
int rc = JOptionPane.showOptionDialog(null, "Would you like to reset column names or filter values?", "Columns/Filters Reset", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, optionButtons, optionButtons[0]);
if (rc == 0)
resetColumns = true;
else if (rc == 2)
displayDialog = false;
}
boolean resetColumns = logClOlStatusColIdx < 0 || logAfLearningColIdx < 0 || logAfCorrectionColIdx < 0 || logAfrColIdx < 0 || logRpmColIdx < 0 ||
logLoadColIdx < 0 || logTimeColIdx < 0 || logMafvColIdx < 0 || logIatColIdx < 0 || (isPolfSet && isPolfTableMap && logMapColIdx < 0);
if (false == resetColumns && true == displayDialog) {
if (JOptionPane.NO_OPTION == JOptionPane.showOptionDialog(null, "Would you like to reset column names or filter values?", "Columns/Filters Reset",
JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, optionButtons, optionButtons[1]))
displayDialog = false;
else
resetColumns = true;
}

if (resetColumns || logClOlStatusColIdx < 0 || logAfLearningColIdx < 0 || logAfCorrectionColIdx < 0 || logAfrColIdx < 0 ||
logRpmColIdx < 0 || logLoadColIdx < 0 || logTimeColIdx < 0 || logMafvColIdx < 0 || logIatColIdx < 0 || (isPolfTableMap && logMapColIdx < 0)) {
if (true == resetColumns) {
ColumnsFiltersSelection selectionWindow = new CLColumnsFiltersSelection(isPolfTableMap);
if (!selectionWindow.getUserSettings(elements) || !getColumnsFilters(elements, isPolfTableMap))
return;
displayDialog = false;
}

String[] flds;
Expand All @@ -1072,7 +1070,7 @@ else if (rc == 2)
setCursor(new Cursor(Cursor.WAIT_CURSOR));

while (line != null) {
flds = line.split(Utils.fileFieldSplitter, -1);
flds = line.trim().split(Utils.fileFieldSplitter, -1);
try {
// Calculate dV/dt
prevTime = time;
Expand Down
Loading

0 comments on commit b329e77

Please sign in to comment.