From: lempinen Date: Tue, 30 Apr 2013 07:06:44 +0000 (+0000) Subject: Error management for empty datasets (refs #4237) X-Git-Tag: 1.8.1~317 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=353549cc52e52b33c79b9f6dfa8c2e8dfec81f8e;p=simantics%2Fsysdyn.git Error management for empty datasets (refs #4237) git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@27299 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/SensitivityDataset.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/SensitivityDataset.java index 970185eb..e6dc8977 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/SensitivityDataset.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/SensitivityDataset.java @@ -124,6 +124,8 @@ public class SensitivityDataset extends XYDataset { for(int i = 0; i < length; i++) { sorter.clear(); for(int j = 0; j < n; j++) { + if(series.get(j).values[1].length == 0) + continue; // If there are no values, move on to next dataset sorter.add(series.get(j).values[1][i]); // values is a two-dimensional array. 0 dimension == times, 1 == values } Collections.sort(sorter); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/XYDataset.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/XYDataset.java index 9eac19cf..b210f7ec 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/XYDataset.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/XYDataset.java @@ -210,9 +210,9 @@ public class XYDataset extends AbstractDataset implements org.simantics.jfreecha name = label; if(dataset.result != null && !dataset.result.isEmpty()) name = name + " : " + dataset.result; - series.add(new TempSeries(name, new double[][] {ta, va}, width, color)); - if(ta.length == 0 || va.length == 0) - System.out.println(dataset.name + " : " + dataset.result + ". Sizes: " + va.length + " and " + ta.length); + if(ta.length != 0 && va.length != 0) + series.add(new TempSeries(name, new double[][] {ta, va}, width, color)); + } }