Creates a dataset from double[] of data. @param xPoints the x points @param yPoints the y points @param xName the name of the x column @param yName the name of the y column @param columnID the column ID @param source the Data source providing the ID and colors @return the dataset
(double[] xPoints, double[] yPoints, String xName, String yName, int columnID, Data source)
| 2001 | * @return the dataset |
| 2002 | */ |
| 2003 | private static Dataset createDataset(double[] xPoints, double[] yPoints, String xName, String yName, int columnID, |
| 2004 | Data source) { |
| 2005 | if (yPoints == null) { |
| 2006 | return null; |
| 2007 | } |
| 2008 | Dataset dataset = new Dataset(); |
| 2009 | dataset.setXYColumnNames(xName, yName); |
| 2010 | dataset.setConnected(true); |
| 2011 | Color[] lineColors = source.getLineColors(); |
| 2012 | if ((lineColors != null) && (lineColors[columnID] != null)) { |
| 2013 | dataset.setLineColor(lineColors[columnID]); |
| 2014 | } else { |
| 2015 | dataset.setLineColor(DisplayColors.getLineColor(columnID)); |
| 2016 | } |
| 2017 | dataset.setMarkerShape(Dataset.SQUARE); |
| 2018 | Color[] fillColors = source.getFillColors(); |
| 2019 | if ((lineColors != null) && (lineColors[columnID] != null) && (fillColors != null) |
| 2020 | && (fillColors[columnID] != null)) { |
| 2021 | dataset.setMarkerColor(fillColors[columnID], lineColors[columnID]); |
| 2022 | } else { |
| 2023 | dataset.setMarkerColor(DisplayColors.getMarkerColor(columnID), DisplayColors.getLineColor(columnID)); |
| 2024 | } |
| 2025 | dataset.setID(source.getID()); |
| 2026 | dataset.append(xPoints, yPoints); |
| 2027 | return dataset; |
| 2028 | } |
| 2029 | |
| 2030 | /** |
| 2031 | * Copies a dataset. If includeDataAndID is false, only the name and display |
no test coverage detected