]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Error management for empty datasets (refs #4237)
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 30 Apr 2013 07:06:44 +0000 (07:06 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 30 Apr 2013 07:06:44 +0000 (07:06 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@27299 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/SensitivityDataset.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/XYDataset.java

index 970185eb2e64cddaa349986e4d1103f5807074a6..e6dc8977dc4c34cf87e3d01d17b650312d3d3668 100644 (file)
@@ -124,6 +124,8 @@ public class SensitivityDataset extends XYDataset {
                     for(int i = 0; i < length; i++) {\r
                         sorter.clear();\r
                         for(int j = 0; j < n; j++) {\r
+                            if(series.get(j).values[1].length == 0)\r
+                                continue; // If there are no values, move on to next dataset\r
                             sorter.add(series.get(j).values[1][i]); // values is a two-dimensional array. 0 dimension == times, 1 == values\r
                         }\r
                         Collections.sort(sorter);\r
index 9eac19cf1c70a8f85f4f970468e049a1282d1fe0..b210f7ec2e6d316656eaa24caf4329ecd187b52f 100644 (file)
@@ -210,9 +210,9 @@ public class XYDataset extends AbstractDataset implements org.simantics.jfreecha
                                         name = label;\r
                                     if(dataset.result != null && !dataset.result.isEmpty())\r
                                         name = name + " : " + dataset.result;\r
-                                    series.add(new TempSeries(name, new double[][] {ta, va}, width, color));\r
-                                    if(ta.length == 0 || va.length == 0)\r
-                                        System.out.println(dataset.name + " : " + dataset.result + ". Sizes: " + va.length + " and " + ta.length);\r
+                                    if(ta.length != 0 && va.length != 0)\r
+                                        series.add(new TempSeries(name, new double[][] {ta, va}, width, color));\r
+                                    \r
                                 }\r
                             }\r
 \r