image = series.renderGraphGroupImage(width,height,gg);
-
- Image singleimage = image.get(1);
-
-
- BufferedImage bimage = ImageTools.toBufferedImage(singleimage);
-
- XStream xStream = new XStream(new DomDriver());
-
- String xmlimage = xStream.toXML(singleimage);
-
- System.out.println(xmlimage);
-
- File outputfile = new File("saved.png");
-
- ImageIO.write(bimage, "png", outputfile);
- */
-
- }catch(Exception e){
-
- e.printStackTrace();
-
- }
-
-
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleLines.java b/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleLines.java
deleted file mode 100644
index b50ba7f..0000000
--- a/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleLines.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.gcube.contentmanagement.graphtools.examples.graphsTypes;
-
-import org.gcube.contentmanagement.graphtools.core.StatisticsGenerator;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.LineGraph;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphGroups;
-
-public class ExampleLines {
-
-
- public static void main(String[] args) throws Exception{
- String table = "ts_161efa00_2c32_11df_b8b3_aa10916debe6";
- String xDimension = "field5";
- String yDimension = "field6";
- String groupDimension = "field1";
- String speciesColumn = "field3";
- String filter1 = "Brown seaweeds";
- String filter2 = "River eels";
-// String filter2 = "Osteichthyes";
-
-
-
-
- StatisticsGenerator stg = new StatisticsGenerator();
-
- stg.init("./cfg/");
-
- GraphGroups gg = stg.generateGraphs(200, table, xDimension, yDimension, groupDimension, speciesColumn, filter1, filter2);
-
- LineGraph series = new LineGraph("");
- series.renderGraphGroup(gg);
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleNormalDistribution.java b/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleNormalDistribution.java
deleted file mode 100644
index b14455a..0000000
--- a/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleNormalDistribution.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.gcube.contentmanagement.graphtools.examples.graphsTypes;
-
-import org.gcube.contentmanagement.graphtools.core.StatisticsGenerator;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.GaussianDistributionGraph;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphGroups;
-
-public class ExampleNormalDistribution {
-
-
- public static void main(String[] args) throws Exception{
- String table = "ts_161efa00_2c32_11df_b8b3_aa10916debe6";
- String xDimension = "field5";
- String yDimension = "field6";
- String groupDimension = "field1";
- String speciesColumn = "field3";
- String filter2 = "Brown seaweeds";
- String filter1 = "River eels";
-// String filter2 = "Osteichthyes";
- StatisticsGenerator stg = new StatisticsGenerator();
-
-
-
-
- stg.init("./cfg/");
-
- GraphGroups gg = stg.generateGraphs(200, table, xDimension, yDimension, groupDimension, speciesColumn, filter1);
-
- GaussianDistributionGraph pie = new GaussianDistributionGraph("");
- pie.renderGraphGroup(gg);
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleNumericSeries.java b/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleNumericSeries.java
deleted file mode 100644
index 420db2d..0000000
--- a/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleNumericSeries.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.gcube.contentmanagement.graphtools.examples.graphsTypes;
-
-import org.gcube.contentmanagement.graphtools.core.StatisticsGenerator;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.NumericSeriesGraph;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphGroups;
-
-public class ExampleNumericSeries {
-
-
- public static void main(String[] args) throws Exception{
- String table = "ts_161efa00_2c32_11df_b8b3_aa10916debe6";
- String xDimension = "field5";
- String yDimension = "field6";
- String groupDimension = "field1";
- String speciesColumn = "field3";
- String filter1 = "Brown seaweeds";
- String filter2 = "River eels";
-// String filter2 = "Osteichthyes";
- StatisticsGenerator stg = new StatisticsGenerator();
-
-
-
-
- stg.init("./cfg/");
-
- GraphGroups gg = stg.generateGraphs(200, table, xDimension, yDimension, groupDimension, speciesColumn, filter1, filter2);
-
- NumericSeriesGraph series = new NumericSeriesGraph("");
- series.renderGraphGroup(gg);
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExamplePie.java b/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExamplePie.java
deleted file mode 100644
index 142430b..0000000
--- a/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExamplePie.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.gcube.contentmanagement.graphtools.examples.graphsTypes;
-
-import org.gcube.contentmanagement.graphtools.core.StatisticsGenerator;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.PieGraph;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphGroups;
-
-public class ExamplePie {
-
-
- public static void main(String[] args) throws Exception{
- String table = "ts_161efa00_2c32_11df_b8b3_aa10916debe6";
- String xDimension = "field5";
- String yDimension = "field6";
- String groupDimension = "field1";
- String speciesColumn = "field3";
- String filter1 = "Brown seaweeds";
- String filter2 = "River eels";
-// String filter2 = "Osteichthyes";
- StatisticsGenerator stg = new StatisticsGenerator();
-
-
-
-
- stg.init("./cfg/");
-
- GraphGroups gg = stg.generateGraphs(200, table, xDimension, yDimension, groupDimension, speciesColumn, filter1, filter2);
-
- PieGraph pie = new PieGraph("");
- pie.renderGraphGroup(gg);
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleRadar.java b/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleRadar.java
deleted file mode 100644
index b67dbf7..0000000
--- a/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleRadar.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.gcube.contentmanagement.graphtools.examples.graphsTypes;
-
-import org.gcube.contentmanagement.graphtools.core.StatisticsGenerator;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.RadarGraph;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphGroups;
-
-public class ExampleRadar {
-
-
- public static void main(String[] args) throws Exception{
- String table = "ts_161efa00_2c32_11df_b8b3_aa10916debe6";
- String xDimension = "field5";
- String yDimension = "field6";
- String groupDimension = "field1";
- String speciesColumn = "field3";
- String filter1 = "Brown seaweeds";
- String filter2 = "River eels";
-// String filter2 = "Osteichthyes";
- StatisticsGenerator stg = new StatisticsGenerator();
-
-
-
-
- stg.init("./cfg/");
-
- GraphGroups gg = stg.generateGraphs(200, table, xDimension, yDimension, groupDimension, speciesColumn, filter2);
-
- RadarGraph radar = new RadarGraph("");
- radar.renderGraphGroup(gg);
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleScatter.java b/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleScatter.java
deleted file mode 100644
index 5f98357..0000000
--- a/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleScatter.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.gcube.contentmanagement.graphtools.examples.graphsTypes;
-
-import org.gcube.contentmanagement.graphtools.core.StatisticsGenerator;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.ScatterGraphNumeric;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphGroups;
-
-public class ExampleScatter {
-
-
- public static void main(String[] args) throws Exception{
- String table = "ts_161efa00_2c32_11df_b8b3_aa10916debe6";
- String xDimension = "field5";
- String yDimension = "field6";
- String groupDimension = "field1";
- String speciesColumn = "field3";
- String filter1 = "Brown seaweeds";
- String filter2 = "River eels";
-// String filter2 = "Osteichthyes";
- StatisticsGenerator stg = new StatisticsGenerator();
-
- stg.init("./cfg/");
-
- GraphGroups gg = stg.generateGraphs(200, table, xDimension, yDimension, groupDimension, speciesColumn, filter1);
-
-// ScatterGraphGeneric series = new ScatterGraphGeneric("");
- ScatterGraphNumeric series = new ScatterGraphNumeric("");
- series.renderGraphGroup(gg);
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleTimeSeries.java b/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleTimeSeries.java
deleted file mode 100644
index 034ce69..0000000
--- a/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleTimeSeries.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.gcube.contentmanagement.graphtools.examples.graphsTypes;
-
-import org.gcube.contentmanagement.graphtools.core.StatisticsGenerator;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.TimeSeriesGraph;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphGroups;
-
-public class ExampleTimeSeries {
-
-
- public static void main(String[] args) throws Exception{
- String table = "ts_161efa00_2c32_11df_b8b3_aa10916debe6";
- String xDimension = "field5";
- String yDimension = "field6";
- String groupDimension = "field1";
- String speciesColumn = "field3";
- String filter1 = "Brown seaweeds";
- String filter2 = "River eels";
-// String filter2 = "Osteichthyes";
- StatisticsGenerator stg = new StatisticsGenerator();
-
-
-
-
- stg.init("./cfg/");
-
- GraphGroups gg = stg.generateGraphs(200, table, xDimension, yDimension, groupDimension, speciesColumn, filter1);
-
- TimeSeriesGraph series = new TimeSeriesGraph("");
- series.renderGraphGroup(gg);
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleTimeSeries2.java b/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleTimeSeries2.java
deleted file mode 100644
index 307ff2c..0000000
--- a/src/org/gcube/contentmanagement/graphtools/examples/graphsTypes/ExampleTimeSeries2.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.gcube.contentmanagement.graphtools.examples.graphsTypes;
-
-import org.gcube.contentmanagement.graphtools.core.StatisticsGenerator;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.TimeSeriesGraph;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphGroups;
-
-public class ExampleTimeSeries2 {
-
-
- public static void main(String[] args) throws Exception{
- String table = "ts_a904da30_b4fc_11df_800d_bcef80d51986";
- String xDimension = "field1";
- String yDimension = "field4";
- String groupDimension = "field2";
- String speciesColumn = "field3";
- String filter1 = "Toluene";
- String filter2 = "River eels";
-// String filter2 = "Osteichthyes";
- StatisticsGenerator stg = new StatisticsGenerator();
-
-
-
-
- stg.init("./cfg/");
-
- GraphGroups gg = stg.generateGraphs(200, table, xDimension, yDimension, groupDimension, speciesColumn, filter1);
-
- TimeSeriesGraph series = new TimeSeriesGraph("");
- series.renderGraphGroup(gg);
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/plotting/demo/PieChartDemo1.java b/src/org/gcube/contentmanagement/graphtools/plotting/demo/PieChartDemo1.java
deleted file mode 100644
index e7132b8..0000000
--- a/src/org/gcube/contentmanagement/graphtools/plotting/demo/PieChartDemo1.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/* ===========================================================
- * JFreeChart : a free chart library for the Java(tm) platform
- * ===========================================================
- *
- * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors.
- *
- * Project Info: http://www.jfree.org/jfreechart/index.html
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
- * in the United States and other countries.]
- *
- * ------------------
- * PieGraph.java
- * ------------------
- * (C) Copyright 2003-2007, by Object Refinery Limited and Contributors.
- *
- * Original Author: David Gilbert (for Object Refinery Limited);
- * Contributor(s): ;
- *
- * Changes
- * -------
- * 09-Mar-2005 : Version 1, copied from the demo collection that ships with
- * the JFreeChart Developer Guide (DG);
- *
- */
-
-package org.gcube.contentmanagement.graphtools.plotting.demo;
-
-import javax.swing.JPanel;
-
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.ChartPanel;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.plot.PiePlot;
-import org.jfree.data.general.DefaultPieDataset;
-import org.jfree.data.general.PieDataset;
-import org.jfree.ui.ApplicationFrame;
-import org.jfree.ui.RefineryUtilities;
-
-/**
- * A simple demonstration application showing how to create a pie chart using
- * data from a {@link DefaultPieDataset}.
- */
-public class PieChartDemo1 extends ApplicationFrame {
-
- /**
- * Default constructor.
- *
- * @param title the frame title.
- */
- public PieChartDemo1(String title) {
- super(title);
- setContentPane(createDemoPanel());
- }
-
- /**
- * Creates a sample dataset.
- *
- * @return A sample dataset.
- */
- private static PieDataset createDataset() {
- DefaultPieDataset dataset = new DefaultPieDataset();
- dataset.setValue("One", new Double(43.2));
- dataset.setValue("Two", new Double(10.0));
- dataset.setValue("Three", new Double(27.5));
- dataset.setValue("Four", new Double(17.5));
- dataset.setValue("Five", new Double(11.0));
- dataset.setValue("Six", new Double(19.4));
- return dataset;
- }
-
- /**
- * Creates a chart.
- *
- * @param dataset the dataset.
- *
- * @return A chart.
- */
- private static JFreeChart createChart(PieDataset dataset) {
-
- JFreeChart chart = ChartFactory.createPieChart(
- "Pie Chart Demo 1", // chart title
- dataset, // data
- true, // include legend
- true,
- false
- );
-
- PiePlot plot = (PiePlot) chart.getPlot();
- plot.setSectionOutlinesVisible(false);
- plot.setNoDataMessage("No data available");
-
- return chart;
-
- }
-
- /**
- * Creates a panel for the demo (used by SuperDemo.java).
- *
- * @return A panel.
- */
- public static JPanel createDemoPanel() {
- JFreeChart chart = createChart(createDataset());
- return new ChartPanel(chart);
- }
-
- /**
- * Starting point for the demonstration application.
- *
- * @param args ignored.
- */
- public static void main(String[] args) {
-
- // ******************************************************************
- // More than 150 demo applications are included with the JFreeChart
- // Developer Guide...for more information, see:
- //
- // > http://www.object-refinery.com/jfreechart/guide.html
- //
- // ******************************************************************
-
- PieChartDemo1 demo = new PieChartDemo1("Pie Chart Demo 1");
- demo.pack();
- RefineryUtilities.centerFrameOnScreen(demo);
- demo.setVisible(true);
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/plotting/demo/SpiderWebDemo1.java b/src/org/gcube/contentmanagement/graphtools/plotting/demo/SpiderWebDemo1.java
deleted file mode 100644
index d613427..0000000
--- a/src/org/gcube/contentmanagement/graphtools/plotting/demo/SpiderWebDemo1.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/* ===========================================================
- * JFreeChart : a free chart library for the Java(tm) platform
- * ===========================================================
- *
- * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors.
- *
- * Project Info: http://www.jfree.org/jfreechart/index.html
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
- * in the United States and other countries.]
- *
- * ------------------
- * PieGraph.java
- * ------------------
- * (C) Copyright 2003-2007, by Object Refinery Limited and Contributors.
- *
- * Original Author: David Gilbert (for Object Refinery Limited);
- * Contributor(s): ;
- *
- * Changes
- * -------
- * 09-Mar-2005 : Version 1, copied from the demo collection that ships with
- * the JFreeChart Developer Guide (DG);
- *
- */
-
-package org.gcube.contentmanagement.graphtools.plotting.demo;
-
-import java.awt.Graphics2D;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.BufferedImage;
-
-import javax.swing.JPanel;
-
-import org.jfree.chart.ChartPanel;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.plot.SpiderWebPlot;
-import org.jfree.data.category.DefaultCategoryDataset;
-import org.jfree.data.general.Dataset;
-import org.jfree.data.general.DefaultPieDataset;
-import org.jfree.ui.ApplicationFrame;
-import org.jfree.ui.RefineryUtilities;
-
-/**
- * A simple demonstration application showing how to create a pie chart using
- * data from a {@link DefaultPieDataset}.
- */
-public class SpiderWebDemo1 extends ApplicationFrame {
-
- /**
- * Default constructor.
- *
- * @param title the frame title.
- */
- public SpiderWebDemo1(String title) {
- super(title);
- setContentPane(createDemoPanel());
- }
-
- /**
- * Creates a sample dataset.
- *
- * @return A sample dataset.
- */
- private static Dataset createDataset() {
- DefaultCategoryDataset dataset = new DefaultCategoryDataset();
- dataset.addValue(35.0, "S1", "C1");
- dataset.addValue(45.0, "S1", "C2");
- dataset.addValue(55.0, "S1", "C3");
- dataset.addValue(15.0, "S1", "C4");
- dataset.addValue(25.0, "S1", "C5");
- dataset.addValue(39.0, "S2", "C1");
- dataset.addValue(20.0, "S2", "C2");
- dataset.addValue(34.0, "S2", "C3");
- dataset.addValue(30.0, "S2", "C4");
- dataset.addValue(13.0, "S2", "C5");
- return dataset;
- }
-
- /**
- * Creates a chart.
- *
- * @param dataset the dataset.
- *
- * @return A chart.
- */
- private static JFreeChart createChart(Dataset dataset) {
-
- SpiderWebPlot plot = new SpiderWebPlot((DefaultCategoryDataset)dataset);
- JFreeChart chart = new JFreeChart(plot);
- return chart;
-
- }
-
- /**
- * Creates a panel for the demo (used by SuperDemo.java).
- *
- * @return A panel.
- */
- public static JPanel createDemoPanel() {
- JFreeChart chart = createChart(createDataset());
- JPanel jp = new ChartPanel(chart);
- return jp;
- }
-
- /**
- * Starting point for the demonstration application.
- *
- * @param args ignored.
- */
- public static void main(String[] args) {
-
- // ******************************************************************
- // More than 150 demo applications are included with the JFreeChart
- // Developer Guide...for more information, see:
- //
- // > http://www.object-refinery.com/jfreechart/guide.html
- //
- // ******************************************************************
-
- SpiderWebDemo1 demo = new SpiderWebDemo1("Web Chart Demo 1");
- demo.pack();
- RefineryUtilities.centerFrameOnScreen(demo);
-
- demo.setVisible(true);
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/plotting/demo/SpiderWebPlot.java b/src/org/gcube/contentmanagement/graphtools/plotting/demo/SpiderWebPlot.java
deleted file mode 100644
index b6207fe..0000000
--- a/src/org/gcube/contentmanagement/graphtools/plotting/demo/SpiderWebPlot.java
+++ /dev/null
@@ -1,1668 +0,0 @@
-/* ===========================================================
- * JFreeChart : a free chart library for the Java(tm) platform
- * ===========================================================
- *
- * (C) Copyright 2000-2008, by Object Refinery Limited and Contributors.
- *
- * Project Info: http://www.jfree.org/jfreechart/index.html
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
- * in the United States and other countries.]
- *
- * ------------------
- * SpiderWebPlot.java
- * ------------------
- * (C) Copyright 2005-2008, by Heaps of Flavour Pty Ltd and Contributors.
- *
- * Company Info: http://www.i4-talent.com
- *
- * Original Author: Don Elliott;
- * Contributor(s): David Gilbert (for Object Refinery Limited);
- * Nina Jeliazkova;
- *
- * Changes
- * -------
- * 28-Jan-2005 : First cut - missing a few features - still to do:
- * - needs tooltips/URL/label generator functions
- * - ticks on axes / background grid?
- * 31-Jan-2005 : Renamed SpiderWebPlot, added label generator support, and
- * reformatted for consistency with other source files in
- * JFreeChart (DG);
- * 20-Apr-2005 : Renamed CategoryLabelGenerator
- * --> CategoryItemLabelGenerator (DG);
- * 05-May-2005 : Updated draw() method parameters (DG);
- * 10-Jun-2005 : Added equals() method and fixed serialization (DG);
- * 16-Jun-2005 : Added default constructor and get/setDataset()
- * methods (DG);
- * ------------- JFREECHART 1.0.x ---------------------------------------------
- * 05-Apr-2006 : Fixed bug preventing the display of zero values - see patch
- * 1462727 (DG);
- * 05-Apr-2006 : Added support for mouse clicks, tool tips and URLs - see patch
- * 1463455 (DG);
- * 01-Jun-2006 : Fix bug 1493199, NullPointerException when drawing with null
- * info (DG);
- * 05-Feb-2007 : Added attributes for axis stroke and paint, while fixing
- * bug 1651277, and implemented clone() properly (DG);
- * 06-Feb-2007 : Changed getPlotValue() to protected, as suggested in bug
- * 1605202 (DG);
- * 05-Mar-2007 : Restore clip region correctly (see bug 1667750) (DG);
- * 18-May-2007 : Set dataset for LegendItem (DG);
- * 02-Jun-2008 : Fixed bug with chart entities using TableOrder.BY_COLUMN (DG);
- * 02-Jun-2008 : Fixed bug with null dataset (DG);
- *
- */
-
-package org.gcube.contentmanagement.graphtools.plotting.demo;
-
-import java.awt.AlphaComposite;
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Composite;
-import java.awt.Font;
-import java.awt.Graphics2D;
-import java.awt.Paint;
-import java.awt.Polygon;
-import java.awt.Rectangle;
-import java.awt.Shape;
-import java.awt.Stroke;
-import java.awt.font.FontRenderContext;
-import java.awt.font.LineMetrics;
-import java.awt.geom.Arc2D;
-import java.awt.geom.Ellipse2D;
-import java.awt.geom.Line2D;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.Iterator;
-import java.util.List;
-
-import org.jfree.chart.LegendItem;
-import org.jfree.chart.LegendItemCollection;
-import org.jfree.chart.entity.CategoryItemEntity;
-import org.jfree.chart.entity.EntityCollection;
-import org.jfree.chart.event.PlotChangeEvent;
-import org.jfree.chart.labels.CategoryItemLabelGenerator;
-import org.jfree.chart.labels.CategoryToolTipGenerator;
-import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;
-import org.jfree.chart.plot.DrawingSupplier;
-import org.jfree.chart.plot.Plot;
-import org.jfree.chart.plot.PlotRenderingInfo;
-import org.jfree.chart.plot.PlotState;
-import org.jfree.chart.urls.CategoryURLGenerator;
-import org.jfree.data.category.CategoryDataset;
-import org.jfree.data.general.DatasetChangeEvent;
-import org.jfree.data.general.DatasetUtilities;
-import org.jfree.io.SerialUtilities;
-import org.jfree.ui.RectangleInsets;
-import org.jfree.util.ObjectUtilities;
-import org.jfree.util.PaintList;
-import org.jfree.util.PaintUtilities;
-import org.jfree.util.Rotation;
-import org.jfree.util.ShapeUtilities;
-import org.jfree.util.StrokeList;
-import org.jfree.util.TableOrder;
-
-/**
- * A plot that displays data from a {@link CategoryDataset} in the form of a
- * "spider web". Multiple series can be plotted on the same axis to allow
- * easy comparison. This plot doesn't support negative values at present.
- */
-public class SpiderWebPlot extends Plot implements Cloneable, Serializable {
-
- /** For serialization. */
- private static final long serialVersionUID = -5376340422031599463L;
-
- /** The default head radius percent (currently 1%). */
- public static final double DEFAULT_HEAD = 0.01;
-
- /** The default axis label gap (currently 10%). */
- public static final double DEFAULT_AXIS_LABEL_GAP = 0.10;
-
- /** The default interior gap. */
- public static final double DEFAULT_INTERIOR_GAP = 0.25;
-
- /** The maximum interior gap (currently 40%). */
- public static final double MAX_INTERIOR_GAP = 0.40;
-
- /** The default starting angle for the radar chart axes. */
- public static final double DEFAULT_START_ANGLE = 90.0;
-
- /** The default series label font. */
- public static final Font DEFAULT_LABEL_FONT = new Font("SansSerif",
- Font.PLAIN, 10);
-
- /** The default series label paint. */
- public static final Paint DEFAULT_LABEL_PAINT = Color.black;
-
- /** The default series label background paint. */
- public static final Paint DEFAULT_LABEL_BACKGROUND_PAINT
- = new Color(255, 255, 192);
-
- /** The default series label outline paint. */
- public static final Paint DEFAULT_LABEL_OUTLINE_PAINT = Color.black;
-
- /** The default series label outline stroke. */
- public static final Stroke DEFAULT_LABEL_OUTLINE_STROKE
- = new BasicStroke(0.5f);
-
- /** The default series label shadow paint. */
- public static final Paint DEFAULT_LABEL_SHADOW_PAINT = Color.lightGray;
-
- /**
- * The default maximum value plotted - forces the plot to evaluate
- * the maximum from the data passed in
- */
- public static final double DEFAULT_MAX_VALUE = -1.0;
-
- /** The head radius as a percentage of the available drawing area. */
- protected double headPercent;
-
- /** The space left around the outside of the plot as a percentage. */
- private double interiorGap;
-
- /** The gap between the labels and the axes as a %age of the radius. */
- private double axisLabelGap;
-
- /**
- * The paint used to draw the axis lines.
- *
- * @since 1.0.4
- */
- private transient Paint axisLinePaint;
-
- /**
- * The stroke used to draw the axis lines.
- *
- * @since 1.0.4
- */
- private transient Stroke axisLineStroke;
-
- /** The dataset. */
- private CategoryDataset dataset;
-
- /** The maximum value we are plotting against on each category axis */
- private double maxValue;
-
- /**
- * The data extract order (BY_ROW or BY_COLUMN). This denotes whether
- * the data series are stored in rows (in which case the category names are
- * derived from the column keys) or in columns (in which case the category
- * names are derived from the row keys).
- */
- private TableOrder dataExtractOrder;
-
- /** The starting angle. */
- private double startAngle;
-
- /** The direction for drawing the radar axis & plots. */
- private Rotation direction;
-
- /** The legend item shape. */
- private transient Shape legendItemShape;
-
- /** The paint for ALL series (overrides list). */
- private transient Paint seriesPaint;
-
- /** The series paint list. */
- private PaintList seriesPaintList;
-
- /** The base series paint (fallback). */
- private transient Paint baseSeriesPaint;
-
- /** The outline paint for ALL series (overrides list). */
- private transient Paint seriesOutlinePaint;
-
- /** The series outline paint list. */
- private PaintList seriesOutlinePaintList;
-
- /** The base series outline paint (fallback). */
- private transient Paint baseSeriesOutlinePaint;
-
- /** The outline stroke for ALL series (overrides list). */
- private transient Stroke seriesOutlineStroke;
-
- /** The series outline stroke list. */
- private StrokeList seriesOutlineStrokeList;
-
- /** The base series outline stroke (fallback). */
- private transient Stroke baseSeriesOutlineStroke;
-
- /** The font used to display the category labels. */
- private Font labelFont;
-
- /** The color used to draw the category labels. */
- private transient Paint labelPaint;
-
- /** The label generator. */
- private CategoryItemLabelGenerator labelGenerator;
-
- /** controls if the web polygons are filled or not */
- private boolean webFilled = true;
-
- /** A tooltip generator for the plot (null
permitted). */
- private CategoryToolTipGenerator toolTipGenerator;
-
- /** A URL generator for the plot (null
permitted). */
- private CategoryURLGenerator urlGenerator;
-
- /**
- * Creates a default plot with no dataset.
- */
- public SpiderWebPlot() {
- this(null);
- }
-
- /**
- * Creates a new spider web plot with the given dataset, with each row
- * representing a series.
- *
- * @param dataset the dataset (null
permitted).
- */
- public SpiderWebPlot(CategoryDataset dataset) {
- this(dataset, TableOrder.BY_ROW);
- }
-
- /**
- * Creates a new spider web plot with the given dataset.
- *
- * @param dataset the dataset.
- * @param extract controls how data is extracted ({@link TableOrder#BY_ROW}
- * or {@link TableOrder#BY_COLUMN}).
- */
- public SpiderWebPlot(CategoryDataset dataset, TableOrder extract) {
- super();
- if (extract == null) {
- throw new IllegalArgumentException("Null 'extract' argument.");
- }
- this.dataset = dataset;
- if (dataset != null) {
- dataset.addChangeListener(this);
- }
-
- this.dataExtractOrder = extract;
- this.headPercent = DEFAULT_HEAD;
- this.axisLabelGap = DEFAULT_AXIS_LABEL_GAP;
- this.axisLinePaint = Color.black;
- this.axisLineStroke = new BasicStroke(1.0f);
-
- this.interiorGap = DEFAULT_INTERIOR_GAP;
- this.startAngle = DEFAULT_START_ANGLE;
- this.direction = Rotation.CLOCKWISE;
- this.maxValue = DEFAULT_MAX_VALUE;
-
- this.seriesPaint = null;
- this.seriesPaintList = new PaintList();
- this.baseSeriesPaint = null;
-
- this.seriesOutlinePaint = null;
- this.seriesOutlinePaintList = new PaintList();
- this.baseSeriesOutlinePaint = DEFAULT_OUTLINE_PAINT;
-
- this.seriesOutlineStroke = null;
- this.seriesOutlineStrokeList = new StrokeList();
- this.baseSeriesOutlineStroke = DEFAULT_OUTLINE_STROKE;
-
- this.labelFont = DEFAULT_LABEL_FONT;
- this.labelPaint = DEFAULT_LABEL_PAINT;
- this.labelGenerator = new StandardCategoryItemLabelGenerator();
-
- this.legendItemShape = DEFAULT_LEGEND_ITEM_CIRCLE;
- }
-
- /**
- * Returns a short string describing the type of plot.
- *
- * @return The plot type.
- */
- public String getPlotType() {
- // return localizationResources.getString("Radar_Plot");
- return ("Spider Web Plot");
- }
-
- /**
- * Returns the dataset.
- *
- * @return The dataset (possibly null
).
- *
- * @see #setDataset(CategoryDataset)
- */
- public CategoryDataset getDataset() {
- return this.dataset;
- }
-
- /**
- * Sets the dataset used by the plot and sends a {@link PlotChangeEvent}
- * to all registered listeners.
- *
- * @param dataset the dataset (null
permitted).
- *
- * @see #getDataset()
- */
- public void setDataset(CategoryDataset dataset) {
- // if there is an existing dataset, remove the plot from the list of
- // change listeners...
- if (this.dataset != null) {
- this.dataset.removeChangeListener(this);
- }
-
- // set the new dataset, and register the chart as a change listener...
- this.dataset = dataset;
- if (dataset != null) {
- setDatasetGroup(dataset.getGroup());
- dataset.addChangeListener(this);
- }
-
- // send a dataset change event to self to trigger plot change event
- datasetChanged(new DatasetChangeEvent(this, dataset));
- }
-
- /**
- * Method to determine if the web chart is to be filled.
- *
- * @return A boolean.
- *
- * @see #setWebFilled(boolean)
- */
- public boolean isWebFilled() {
- return this.webFilled;
- }
-
- /**
- * Sets the webFilled flag and sends a {@link PlotChangeEvent} to all
- * registered listeners.
- *
- * @param flag the flag.
- *
- * @see #isWebFilled()
- */
- public void setWebFilled(boolean flag) {
- this.webFilled = flag;
- fireChangeEvent();
- }
-
- /**
- * Returns the data extract order (by row or by column).
- *
- * @return The data extract order (never null
).
- *
- * @see #setDataExtractOrder(TableOrder)
- */
- public TableOrder getDataExtractOrder() {
- return this.dataExtractOrder;
- }
-
- /**
- * Sets the data extract order (by row or by column) and sends a
- * {@link PlotChangeEvent}to all registered listeners.
- *
- * @param order the order (null
not permitted).
- *
- * @throws IllegalArgumentException if order
is
- * null
.
- *
- * @see #getDataExtractOrder()
- */
- public void setDataExtractOrder(TableOrder order) {
- if (order == null) {
- throw new IllegalArgumentException("Null 'order' argument");
- }
- this.dataExtractOrder = order;
- fireChangeEvent();
- }
-
- /**
- * Returns the head percent.
- *
- * @return The head percent.
- *
- * @see #setHeadPercent(double)
- */
- public double getHeadPercent() {
- return this.headPercent;
- }
-
- /**
- * Sets the head percent and sends a {@link PlotChangeEvent} to all
- * registered listeners.
- *
- * @param percent the percent.
- *
- * @see #getHeadPercent()
- */
- public void setHeadPercent(double percent) {
- this.headPercent = percent;
- fireChangeEvent();
- }
-
- /**
- * Returns the start angle for the first radar axis.
- *
- * This is measured in degrees starting from 3 o'clock (Java Arc2D default)
- * and measuring anti-clockwise.
- *
- * @return The start angle.
- *
- * @see #setStartAngle(double)
- */
- public double getStartAngle() {
- return this.startAngle;
- }
-
- /**
- * Sets the starting angle and sends a {@link PlotChangeEvent} to all
- * registered listeners.
- *
- * The initial default value is 90 degrees, which corresponds to 12 o'clock.
- * A value of zero corresponds to 3 o'clock... this is the encoding used by
- * Java's Arc2D class.
- *
- * @param angle the angle (in degrees).
- *
- * @see #getStartAngle()
- */
- public void setStartAngle(double angle) {
- this.startAngle = angle;
- fireChangeEvent();
- }
-
- /**
- * Returns the maximum value any category axis can take.
- *
- * @return The maximum value.
- *
- * @see #setMaxValue(double)
- */
- public double getMaxValue() {
- return this.maxValue;
- }
-
- /**
- * Sets the maximum value any category axis can take and sends
- * a {@link PlotChangeEvent} to all registered listeners.
- *
- * @param value the maximum value.
- *
- * @see #getMaxValue()
- */
- public void setMaxValue(double value) {
- this.maxValue = value;
- fireChangeEvent();
- }
-
- /**
- * Returns the direction in which the radar axes are drawn
- * (clockwise or anti-clockwise).
- *
- * @return The direction (never null
).
- *
- * @see #setDirection(Rotation)
- */
- public Rotation getDirection() {
- return this.direction;
- }
-
- /**
- * Sets the direction in which the radar axes are drawn and sends a
- * {@link PlotChangeEvent} to all registered listeners.
- *
- * @param direction the direction (null
not permitted).
- *
- * @see #getDirection()
- */
- public void setDirection(Rotation direction) {
- if (direction == null) {
- throw new IllegalArgumentException("Null 'direction' argument.");
- }
- this.direction = direction;
- fireChangeEvent();
- }
-
- /**
- * Returns the interior gap, measured as a percentage of the available
- * drawing space.
- *
- * @return The gap (as a percentage of the available drawing space).
- *
- * @see #setInteriorGap(double)
- */
- public double getInteriorGap() {
- return this.interiorGap;
- }
-
- /**
- * Sets the interior gap and sends a {@link PlotChangeEvent} to all
- * registered listeners. This controls the space between the edges of the
- * plot and the plot area itself (the region where the axis labels appear).
- *
- * @param percent the gap (as a percentage of the available drawing space).
- *
- * @see #getInteriorGap()
- */
- public void setInteriorGap(double percent) {
- if ((percent < 0.0) || (percent > MAX_INTERIOR_GAP)) {
- throw new IllegalArgumentException(
- "Percentage outside valid range.");
- }
- if (this.interiorGap != percent) {
- this.interiorGap = percent;
- fireChangeEvent();
- }
- }
-
- /**
- * Returns the axis label gap.
- *
- * @return The axis label gap.
- *
- * @see #setAxisLabelGap(double)
- */
- public double getAxisLabelGap() {
- return this.axisLabelGap;
- }
-
- /**
- * Sets the axis label gap and sends a {@link PlotChangeEvent} to all
- * registered listeners.
- *
- * @param gap the gap.
- *
- * @see #getAxisLabelGap()
- */
- public void setAxisLabelGap(double gap) {
- this.axisLabelGap = gap;
- fireChangeEvent();
- }
-
- /**
- * Returns the paint used to draw the axis lines.
- *
- * @return The paint used to draw the axis lines (never null
).
- *
- * @see #setAxisLinePaint(Paint)
- * @see #getAxisLineStroke()
- * @since 1.0.4
- */
- public Paint getAxisLinePaint() {
- return this.axisLinePaint;
- }
-
- /**
- * Sets the paint used to draw the axis lines and sends a
- * {@link PlotChangeEvent} to all registered listeners.
- *
- * @param paint the paint (null
not permitted).
- *
- * @see #getAxisLinePaint()
- * @since 1.0.4
- */
- public void setAxisLinePaint(Paint paint) {
- if (paint == null) {
- throw new IllegalArgumentException("Null 'paint' argument.");
- }
- this.axisLinePaint = paint;
- fireChangeEvent();
- }
-
- /**
- * Returns the stroke used to draw the axis lines.
- *
- * @return The stroke used to draw the axis lines (never null
).
- *
- * @see #setAxisLineStroke(Stroke)
- * @see #getAxisLinePaint()
- * @since 1.0.4
- */
- public Stroke getAxisLineStroke() {
- return this.axisLineStroke;
- }
-
- /**
- * Sets the stroke used to draw the axis lines and sends a
- * {@link PlotChangeEvent} to all registered listeners.
- *
- * @param stroke the stroke (null
not permitted).
- *
- * @see #getAxisLineStroke()
- * @since 1.0.4
- */
- public void setAxisLineStroke(Stroke stroke) {
- if (stroke == null) {
- throw new IllegalArgumentException("Null 'stroke' argument.");
- }
- this.axisLineStroke = stroke;
- fireChangeEvent();
- }
-
- //// SERIES PAINT /////////////////////////
-
- /**
- * Returns the paint for ALL series in the plot.
- *
- * @return The paint (possibly null
).
- *
- * @see #setSeriesPaint(Paint)
- */
- public Paint getSeriesPaint() {
- return this.seriesPaint;
- }
-
- /**
- * Sets the paint for ALL series in the plot. If this is set to null
- * , then a list of paints is used instead (to allow different colors
- * to be used for each series of the radar group).
- *
- * @param paint the paint (null
permitted).
- *
- * @see #getSeriesPaint()
- */
- public void setSeriesPaint(Paint paint) {
- this.seriesPaint = paint;
- fireChangeEvent();
- }
-
- /**
- * Returns the paint for the specified series.
- *
- * @param series the series index (zero-based).
- *
- * @return The paint (never null
).
- *
- * @see #setSeriesPaint(int, Paint)
- */
- public Paint getSeriesPaint(int series) {
-
- // return the override, if there is one...
- if (this.seriesPaint != null) {
- return this.seriesPaint;
- }
-
- // otherwise look up the paint list
- Paint result = this.seriesPaintList.getPaint(series);
- if (result == null) {
- DrawingSupplier supplier = getDrawingSupplier();
- if (supplier != null) {
- Paint p = supplier.getNextPaint();
- this.seriesPaintList.setPaint(series, p);
- result = p;
- }
- else {
- result = this.baseSeriesPaint;
- }
- }
- return result;
-
- }
-
- /**
- * Sets the paint used to fill a series of the radar and sends a
- * {@link PlotChangeEvent} to all registered listeners.
- *
- * @param series the series index (zero-based).
- * @param paint the paint (null
permitted).
- *
- * @see #getSeriesPaint(int)
- */
- public void setSeriesPaint(int series, Paint paint) {
- this.seriesPaintList.setPaint(series, paint);
- fireChangeEvent();
- }
-
- /**
- * Returns the base series paint. This is used when no other paint is
- * available.
- *
- * @return The paint (never null
).
- *
- * @see #setBaseSeriesPaint(Paint)
- */
- public Paint getBaseSeriesPaint() {
- return this.baseSeriesPaint;
- }
-
- /**
- * Sets the base series paint.
- *
- * @param paint the paint (null
not permitted).
- *
- * @see #getBaseSeriesPaint()
- */
- public void setBaseSeriesPaint(Paint paint) {
- if (paint == null) {
- throw new IllegalArgumentException("Null 'paint' argument.");
- }
- this.baseSeriesPaint = paint;
- fireChangeEvent();
- }
-
- //// SERIES OUTLINE PAINT ////////////////////////////
-
- /**
- * Returns the outline paint for ALL series in the plot.
- *
- * @return The paint (possibly null
).
- */
- public Paint getSeriesOutlinePaint() {
- return this.seriesOutlinePaint;
- }
-
- /**
- * Sets the outline paint for ALL series in the plot. If this is set to
- * null, then a list of paints is used instead (to allow
- * different colors to be used for each series).
- *
- * @param paint the paint (null
permitted).
- */
- public void setSeriesOutlinePaint(Paint paint) {
- this.seriesOutlinePaint = paint;
- fireChangeEvent();
- }
-
- /**
- * Returns the paint for the specified series.
- *
- * @param series the series index (zero-based).
- *
- * @return The paint (never null
).
- */
- public Paint getSeriesOutlinePaint(int series) {
- // return the override, if there is one...
- if (this.seriesOutlinePaint != null) {
- return this.seriesOutlinePaint;
- }
- // otherwise look up the paint list
- Paint result = this.seriesOutlinePaintList.getPaint(series);
- if (result == null) {
- result = this.baseSeriesOutlinePaint;
- }
- return result;
- }
-
- /**
- * Sets the paint used to fill a series of the radar and sends a
- * {@link PlotChangeEvent} to all registered listeners.
- *
- * @param series the series index (zero-based).
- * @param paint the paint (null
permitted).
- */
- public void setSeriesOutlinePaint(int series, Paint paint) {
- this.seriesOutlinePaintList.setPaint(series, paint);
- fireChangeEvent();
- }
-
- /**
- * Returns the base series paint. This is used when no other paint is
- * available.
- *
- * @return The paint (never null
).
- */
- public Paint getBaseSeriesOutlinePaint() {
- return this.baseSeriesOutlinePaint;
- }
-
- /**
- * Sets the base series paint.
- *
- * @param paint the paint (null
not permitted).
- */
- public void setBaseSeriesOutlinePaint(Paint paint) {
- if (paint == null) {
- throw new IllegalArgumentException("Null 'paint' argument.");
- }
- this.baseSeriesOutlinePaint = paint;
- fireChangeEvent();
- }
-
- //// SERIES OUTLINE STROKE /////////////////////
-
- /**
- * Returns the outline stroke for ALL series in the plot.
- *
- * @return The stroke (possibly null
).
- */
- public Stroke getSeriesOutlineStroke() {
- return this.seriesOutlineStroke;
- }
-
- /**
- * Sets the outline stroke for ALL series in the plot. If this is set to
- * null, then a list of paints is used instead (to allow
- * different colors to be used for each series).
- *
- * @param stroke the stroke (null
permitted).
- */
- public void setSeriesOutlineStroke(Stroke stroke) {
- this.seriesOutlineStroke = stroke;
- fireChangeEvent();
- }
-
- /**
- * Returns the stroke for the specified series.
- *
- * @param series the series index (zero-based).
- *
- * @return The stroke (never null
).
- */
- public Stroke getSeriesOutlineStroke(int series) {
-
- // return the override, if there is one...
- if (this.seriesOutlineStroke != null) {
- return this.seriesOutlineStroke;
- }
-
- // otherwise look up the paint list
- Stroke result = this.seriesOutlineStrokeList.getStroke(series);
- if (result == null) {
- result = this.baseSeriesOutlineStroke;
- }
- return result;
-
- }
-
- /**
- * Sets the stroke used to fill a series of the radar and sends a
- * {@link PlotChangeEvent} to all registered listeners.
- *
- * @param series the series index (zero-based).
- * @param stroke the stroke (null
permitted).
- */
- public void setSeriesOutlineStroke(int series, Stroke stroke) {
- this.seriesOutlineStrokeList.setStroke(series, stroke);
- fireChangeEvent();
- }
-
- /**
- * Returns the base series stroke. This is used when no other stroke is
- * available.
- *
- * @return The stroke (never null
).
- */
- public Stroke getBaseSeriesOutlineStroke() {
- return this.baseSeriesOutlineStroke;
- }
-
- /**
- * Sets the base series stroke.
- *
- * @param stroke the stroke (null
not permitted).
- */
- public void setBaseSeriesOutlineStroke(Stroke stroke) {
- if (stroke == null) {
- throw new IllegalArgumentException("Null 'stroke' argument.");
- }
- this.baseSeriesOutlineStroke = stroke;
- fireChangeEvent();
- }
-
- /**
- * Returns the shape used for legend items.
- *
- * @return The shape (never null
).
- *
- * @see #setLegendItemShape(Shape)
- */
- public Shape getLegendItemShape() {
- return this.legendItemShape;
- }
-
- /**
- * Sets the shape used for legend items and sends a {@link PlotChangeEvent}
- * to all registered listeners.
- *
- * @param shape the shape (null
not permitted).
- *
- * @see #getLegendItemShape()
- */
- public void setLegendItemShape(Shape shape) {
- if (shape == null) {
- throw new IllegalArgumentException("Null 'shape' argument.");
- }
- this.legendItemShape = shape;
- fireChangeEvent();
- }
-
- /**
- * Returns the series label font.
- *
- * @return The font (never null
).
- *
- * @see #setLabelFont(Font)
- */
- public Font getLabelFont() {
- return this.labelFont;
- }
-
- /**
- * Sets the series label font and sends a {@link PlotChangeEvent} to all
- * registered listeners.
- *
- * @param font the font (null
not permitted).
- *
- * @see #getLabelFont()
- */
- public void setLabelFont(Font font) {
- if (font == null) {
- throw new IllegalArgumentException("Null 'font' argument.");
- }
- this.labelFont = font;
- fireChangeEvent();
- }
-
- /**
- * Returns the series label paint.
- *
- * @return The paint (never null
).
- *
- * @see #setLabelPaint(Paint)
- */
- public Paint getLabelPaint() {
- return this.labelPaint;
- }
-
- /**
- * Sets the series label paint and sends a {@link PlotChangeEvent} to all
- * registered listeners.
- *
- * @param paint the paint (null
not permitted).
- *
- * @see #getLabelPaint()
- */
- public void setLabelPaint(Paint paint) {
- if (paint == null) {
- throw new IllegalArgumentException("Null 'paint' argument.");
- }
- this.labelPaint = paint;
- fireChangeEvent();
- }
-
- /**
- * Returns the label generator.
- *
- * @return The label generator (never null
).
- *
- * @see #setLabelGenerator(CategoryItemLabelGenerator)
- */
- public CategoryItemLabelGenerator getLabelGenerator() {
- return this.labelGenerator;
- }
-
- /**
- * Sets the label generator and sends a {@link PlotChangeEvent} to all
- * registered listeners.
- *
- * @param generator the generator (null
not permitted).
- *
- * @see #getLabelGenerator()
- */
- public void setLabelGenerator(CategoryItemLabelGenerator generator) {
- if (generator == null) {
- throw new IllegalArgumentException("Null 'generator' argument.");
- }
- this.labelGenerator = generator;
- }
-
- /**
- * Returns the tool tip generator for the plot.
- *
- * @return The tool tip generator (possibly null
).
- *
- * @see #setToolTipGenerator(CategoryToolTipGenerator)
- *
- * @since 1.0.2
- */
- public CategoryToolTipGenerator getToolTipGenerator() {
- return this.toolTipGenerator;
- }
-
- /**
- * Sets the tool tip generator for the plot and sends a
- * {@link PlotChangeEvent} to all registered listeners.
- *
- * @param generator the generator (null
permitted).
- *
- * @see #getToolTipGenerator()
- *
- * @since 1.0.2
- */
- public void setToolTipGenerator(CategoryToolTipGenerator generator) {
- this.toolTipGenerator = generator;
- fireChangeEvent();
- }
-
- /**
- * Returns the URL generator for the plot.
- *
- * @return The URL generator (possibly null
).
- *
- * @see #setURLGenerator(CategoryURLGenerator)
- *
- * @since 1.0.2
- */
- public CategoryURLGenerator getURLGenerator() {
- return this.urlGenerator;
- }
-
- /**
- * Sets the URL generator for the plot and sends a
- * {@link PlotChangeEvent} to all registered listeners.
- *
- * @param generator the generator (null
permitted).
- *
- * @see #getURLGenerator()
- *
- * @since 1.0.2
- */
- public void setURLGenerator(CategoryURLGenerator generator) {
- this.urlGenerator = generator;
- fireChangeEvent();
- }
-
- /**
- * Returns a collection of legend items for the radar chart.
- *
- * @return The legend items.
- */
- public LegendItemCollection getLegendItems() {
- LegendItemCollection result = new LegendItemCollection();
- if (getDataset() == null) {
- return result;
- }
-
- List keys = null;
- if (this.dataExtractOrder == TableOrder.BY_ROW) {
- keys = this.dataset.getRowKeys();
- }
- else if (this.dataExtractOrder == TableOrder.BY_COLUMN) {
- keys = this.dataset.getColumnKeys();
- }
-
- if (keys != null) {
- int series = 0;
- Iterator iterator = keys.iterator();
- Shape shape = getLegendItemShape();
-
- while (iterator.hasNext()) {
- String label = iterator.next().toString();
- String description = label;
-
- Paint paint = getSeriesPaint(series);
- Paint outlinePaint = getSeriesOutlinePaint(series);
- Stroke stroke = getSeriesOutlineStroke(series);
- LegendItem item = new LegendItem(label, description,
- null, null, shape, paint, stroke, outlinePaint);
- item.setDataset(getDataset());
- result.add(item);
- series++;
- }
- }
-
- return result;
- }
-
- /**
- * Returns a cartesian point from a polar angle, length and bounding box
- *
- * @param bounds the area inside which the point needs to be.
- * @param angle the polar angle, in degrees.
- * @param length the relative length. Given in percent of maximum extend.
- *
- * @return The cartesian point.
- */
- protected Point2D getWebPoint(Rectangle2D bounds,
- double angle, double length) {
-
- double angrad = Math.toRadians(angle);
- double x = Math.cos(angrad) * length * bounds.getWidth() / 2;
- double y = -Math.sin(angrad) * length * bounds.getHeight() / 2;
-
- return new Point2D.Double(bounds.getX() + x + bounds.getWidth() / 2,
- bounds.getY() + y + bounds.getHeight() / 2);
- }
-
- /**
- * Draws the plot on a Java 2D graphics device (such as the screen or a
- * printer).
- *
- * @param g2 the graphics device.
- * @param area the area within which the plot should be drawn.
- * @param anchor the anchor point (null
permitted).
- * @param parentState the state from the parent plot, if there is one.
- * @param info collects info about the drawing.
- */
- public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
- PlotState parentState, PlotRenderingInfo info) {
-
- // adjust for insets...
- RectangleInsets insets = getInsets();
- insets.trim(area);
-
- if (info != null) {
- info.setPlotArea(area);
- info.setDataArea(area);
- }
-
- drawBackground(g2, area);
- drawOutline(g2, area);
-
- Shape savedClip = g2.getClip();
-
- g2.clip(area);
- Composite originalComposite = g2.getComposite();
- g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
- getForegroundAlpha()));
-
- if (!DatasetUtilities.isEmptyOrNull(this.dataset)) {
- int seriesCount = 0, catCount = 0;
-
- if (this.dataExtractOrder == TableOrder.BY_ROW) {
- seriesCount = this.dataset.getRowCount();
- catCount = this.dataset.getColumnCount();
- }
- else {
- seriesCount = this.dataset.getColumnCount();
- catCount = this.dataset.getRowCount();
- }
-
- // ensure we have a maximum value to use on the axes
- if (this.maxValue == DEFAULT_MAX_VALUE)
- calculateMaxValue(seriesCount, catCount);
-
- // Next, setup the plot area
-
- // adjust the plot area by the interior spacing value
-
- double gapHorizontal = area.getWidth() * getInteriorGap();
- double gapVertical = area.getHeight() * getInteriorGap();
-
- double X = area.getX() + gapHorizontal / 2;
- double Y = area.getY() + gapVertical / 2;
- double W = area.getWidth() - gapHorizontal;
- double H = area.getHeight() - gapVertical;
-
- double headW = area.getWidth() * this.headPercent;
- double headH = area.getHeight() * this.headPercent;
-
- // make the chart area a square
- double min = Math.min(W, H) / 2;
- X = (X + X + W) / 2 - min;
- Y = (Y + Y + H) / 2 - min;
- W = 2 * min;
- H = 2 * min;
-
- Point2D centre = new Point2D.Double(X + W / 2, Y + H / 2);
- Rectangle2D radarArea = new Rectangle2D.Double(X, Y, W, H);
-
- // draw the axis and category label
- for (int cat = 0; cat < catCount; cat++) {
- double angle = getStartAngle()
- + (getDirection().getFactor() * cat * 360 / catCount);
-
- Point2D endPoint = getWebPoint(radarArea, angle, 1);
- // 1 = end of axis
- Line2D line = new Line2D.Double(centre, endPoint);
- g2.setPaint(this.axisLinePaint);
- g2.setStroke(this.axisLineStroke);
- g2.draw(line);
- drawLabel(g2, radarArea, 0.0, cat, angle, 360.0 / catCount);
- }
-
- // Now actually plot each of the series polygons..
- for (int series = 0; series < seriesCount; series++) {
- drawRadarPoly(g2, radarArea, centre, info, series, catCount,
- headH, headW);
- }
- }
- else {
- drawNoDataMessage(g2, area);
- }
- g2.setClip(savedClip);
- g2.setComposite(originalComposite);
- drawOutline(g2, area);
- }
-
- /**
- * loop through each of the series to get the maximum value
- * on each category axis
- *
- * @param seriesCount the number of series
- * @param catCount the number of categories
- */
- private void calculateMaxValue(int seriesCount, int catCount) {
- double v = 0;
- Number nV = null;
-
- for (int seriesIndex = 0; seriesIndex < seriesCount; seriesIndex++) {
- for (int catIndex = 0; catIndex < catCount; catIndex++) {
- nV = getPlotValue(seriesIndex, catIndex);
- if (nV != null) {
- v = nV.doubleValue();
- if (v > this.maxValue) {
- this.maxValue = v;
- }
- }
- }
- }
- }
-
- /**
- * Draws a radar plot polygon.
- *
- * @param g2 the graphics device.
- * @param plotArea the area we are plotting in (already adjusted).
- * @param centre the centre point of the radar axes
- * @param info chart rendering info.
- * @param series the series within the dataset we are plotting
- * @param catCount the number of categories per radar plot
- * @param headH the data point height
- * @param headW the data point width
- */
- protected void drawRadarPoly(Graphics2D g2,
- Rectangle2D plotArea,
- Point2D centre,
- PlotRenderingInfo info,
- int series, int catCount,
- double headH, double headW) {
-
- Polygon polygon = new Polygon();
-
- EntityCollection entities = null;
- if (info != null) {
- entities = info.getOwner().getEntityCollection();
- }
-
- // plot the data...
- for (int cat = 0; cat < catCount; cat++) {
-
- Number dataValue = getPlotValue(series, cat);
-
- if (dataValue != null) {
- double value = dataValue.doubleValue();
-
- if (value >= 0) { // draw the polygon series...
-
- // Finds our starting angle from the centre for this axis
-
- double angle = getStartAngle()
- + (getDirection().getFactor() * cat * 360 / catCount);
-
- // The following angle calc will ensure there isn't a top
- // vertical axis - this may be useful if you don't want any
- // given criteria to 'appear' move important than the
- // others..
- // + (getDirection().getFactor()
- // * (cat + 0.5) * 360 / catCount);
-
- // find the point at the appropriate distance end point
- // along the axis/angle identified above and add it to the
- // polygon
-
- Point2D point = getWebPoint(plotArea, angle,
- value / this.maxValue);
- polygon.addPoint((int) point.getX(), (int) point.getY());
-
- // put an elipse at the point being plotted..
-
- Paint paint = getSeriesPaint(series);
- Paint outlinePaint = getSeriesOutlinePaint(series);
- Stroke outlineStroke = getSeriesOutlineStroke(series);
-
- Ellipse2D head = new Ellipse2D.Double(point.getX()
- - headW / 2, point.getY() - headH / 2, headW,
- headH);
- g2.setPaint(paint);
- g2.fill(head);
- g2.setStroke(outlineStroke);
- g2.setPaint(outlinePaint);
- g2.draw(head);
-
- if (entities != null) {
- int row = 0; int col = 0;
- if (this.dataExtractOrder == TableOrder.BY_ROW) {
- row = series;
- col = cat;
- }
- else {
- row = cat;
- col = series;
- }
- String tip = null;
- if (this.toolTipGenerator != null) {
- tip = this.toolTipGenerator.generateToolTip(
- this.dataset, row, col);
- }
-
- String url = null;
- if (this.urlGenerator != null) {
- url = this.urlGenerator.generateURL(this.dataset,
- row, col);
- }
-
- Shape area = new Rectangle(
- (int) (point.getX() - headW),
- (int) (point.getY() - headH),
- (int) (headW * 2), (int) (headH * 2));
- CategoryItemEntity entity = new CategoryItemEntity(
- area, tip, url, this.dataset,
- this.dataset.getRowKey(row),
- this.dataset.getColumnKey(col));
- entities.add(entity);
- }
-
- }
- }
- }
- // Plot the polygon
-
- Paint paint = getSeriesPaint(series);
- g2.setPaint(paint);
- g2.setStroke(getSeriesOutlineStroke(series));
- g2.draw(polygon);
-
- // Lastly, fill the web polygon if this is required
-
- if (this.webFilled) {
- g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
- 0.1f));
- g2.fill(polygon);
- g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
- getForegroundAlpha()));
- }
- }
-
- /**
- * Returns the value to be plotted at the interseries of the
- * series and the category. This allows us to plot
- * BY_ROW
or BY_COLUMN
which basically is just
- * reversing the definition of the categories and data series being
- * plotted.
- *
- * @param series the series to be plotted.
- * @param cat the category within the series to be plotted.
- *
- * @return The value to be plotted (possibly null
).
- *
- * @see #getDataExtractOrder()
- */
- protected Number getPlotValue(int series, int cat) {
- Number value = null;
- if (this.dataExtractOrder == TableOrder.BY_ROW) {
- value = this.dataset.getValue(series, cat);
- }
- else if (this.dataExtractOrder == TableOrder.BY_COLUMN) {
- value = this.dataset.getValue(cat, series);
- }
- return value;
- }
-
- /**
- * Draws the label for one axis.
- *
- * @param g2 the graphics device.
- * @param plotArea the plot area
- * @param value the value of the label (ignored).
- * @param cat the category (zero-based index).
- * @param startAngle the starting angle.
- * @param extent the extent of the arc.
- */
- protected void drawLabel(Graphics2D g2, Rectangle2D plotArea, double value,
- int cat, double startAngle, double extent) {
- FontRenderContext frc = g2.getFontRenderContext();
-
- String label = null;
- if (this.dataExtractOrder == TableOrder.BY_ROW) {
- // if series are in rows, then the categories are the column keys
- label = this.labelGenerator.generateColumnLabel(this.dataset, cat);
- }
- else {
- // if series are in columns, then the categories are the row keys
- label = this.labelGenerator.generateRowLabel(this.dataset, cat);
- }
-
- Rectangle2D labelBounds = getLabelFont().getStringBounds(label, frc);
- LineMetrics lm = getLabelFont().getLineMetrics(label, frc);
- double ascent = lm.getAscent();
-
- Point2D labelLocation = calculateLabelLocation(labelBounds, ascent,
- plotArea, startAngle);
-
- Composite saveComposite = g2.getComposite();
-
- g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
- 1.0f));
- g2.setPaint(getLabelPaint());
- g2.setFont(getLabelFont());
- g2.drawString(label, (float) labelLocation.getX(),
- (float) labelLocation.getY());
- g2.setComposite(saveComposite);
- }
-
- /**
- * Returns the location for a label
- *
- * @param labelBounds the label bounds.
- * @param ascent the ascent (height of font).
- * @param plotArea the plot area
- * @param startAngle the start angle for the pie series.
- *
- * @return The location for a label.
- */
- protected Point2D calculateLabelLocation(Rectangle2D labelBounds,
- double ascent,
- Rectangle2D plotArea,
- double startAngle)
- {
- Arc2D arc1 = new Arc2D.Double(plotArea, startAngle, 0, Arc2D.OPEN);
- Point2D point1 = arc1.getEndPoint();
-
- double deltaX = -(point1.getX() - plotArea.getCenterX())
- * this.axisLabelGap;
- double deltaY = -(point1.getY() - plotArea.getCenterY())
- * this.axisLabelGap;
-
- double labelX = point1.getX() - deltaX;
- double labelY = point1.getY() - deltaY;
-
- if (labelX < plotArea.getCenterX()) {
- labelX -= labelBounds.getWidth();
- }
-
- if (labelX == plotArea.getCenterX()) {
- labelX -= labelBounds.getWidth() / 2;
- }
-
- if (labelY > plotArea.getCenterY()) {
- labelY += ascent;
- }
-
- return new Point2D.Double(labelX, labelY);
- }
-
- /**
- * Tests this plot for equality with an arbitrary object.
- *
- * @param obj the object (null
permitted).
- *
- * @return A boolean.
- */
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof SpiderWebPlot)) {
- return false;
- }
- if (!super.equals(obj)) {
- return false;
- }
- SpiderWebPlot that = (SpiderWebPlot) obj;
- if (!this.dataExtractOrder.equals(that.dataExtractOrder)) {
- return false;
- }
- if (this.headPercent != that.headPercent) {
- return false;
- }
- if (this.interiorGap != that.interiorGap) {
- return false;
- }
- if (this.startAngle != that.startAngle) {
- return false;
- }
- if (!this.direction.equals(that.direction)) {
- return false;
- }
- if (this.maxValue != that.maxValue) {
- return false;
- }
- if (this.webFilled != that.webFilled) {
- return false;
- }
- if (this.axisLabelGap != that.axisLabelGap) {
- return false;
- }
- if (!PaintUtilities.equal(this.axisLinePaint, that.axisLinePaint)) {
- return false;
- }
- if (!this.axisLineStroke.equals(that.axisLineStroke)) {
- return false;
- }
- if (!ShapeUtilities.equal(this.legendItemShape, that.legendItemShape)) {
- return false;
- }
- if (!PaintUtilities.equal(this.seriesPaint, that.seriesPaint)) {
- return false;
- }
- if (!this.seriesPaintList.equals(that.seriesPaintList)) {
- return false;
- }
- if (!PaintUtilities.equal(this.baseSeriesPaint, that.baseSeriesPaint)) {
- return false;
- }
- if (!PaintUtilities.equal(this.seriesOutlinePaint,
- that.seriesOutlinePaint)) {
- return false;
- }
- if (!this.seriesOutlinePaintList.equals(that.seriesOutlinePaintList)) {
- return false;
- }
- if (!PaintUtilities.equal(this.baseSeriesOutlinePaint,
- that.baseSeriesOutlinePaint)) {
- return false;
- }
- if (!ObjectUtilities.equal(this.seriesOutlineStroke,
- that.seriesOutlineStroke)) {
- return false;
- }
- if (!this.seriesOutlineStrokeList.equals(
- that.seriesOutlineStrokeList)) {
- return false;
- }
- if (!this.baseSeriesOutlineStroke.equals(
- that.baseSeriesOutlineStroke)) {
- return false;
- }
- if (!this.labelFont.equals(that.labelFont)) {
- return false;
- }
- if (!PaintUtilities.equal(this.labelPaint, that.labelPaint)) {
- return false;
- }
- if (!this.labelGenerator.equals(that.labelGenerator)) {
- return false;
- }
- if (!ObjectUtilities.equal(this.toolTipGenerator,
- that.toolTipGenerator)) {
- return false;
- }
- if (!ObjectUtilities.equal(this.urlGenerator,
- that.urlGenerator)) {
- return false;
- }
- return true;
- }
-
- /**
- * Returns a clone of this plot.
- *
- * @return A clone of this plot.
- *
- * @throws CloneNotSupportedException if the plot cannot be cloned for
- * any reason.
- */
- public Object clone() throws CloneNotSupportedException {
- SpiderWebPlot clone = (SpiderWebPlot) super.clone();
- clone.legendItemShape = ShapeUtilities.clone(this.legendItemShape);
- clone.seriesPaintList = (PaintList) this.seriesPaintList.clone();
- clone.seriesOutlinePaintList
- = (PaintList) this.seriesOutlinePaintList.clone();
- clone.seriesOutlineStrokeList
- = (StrokeList) this.seriesOutlineStrokeList.clone();
- return clone;
- }
-
- /**
- * Provides serialization support.
- *
- * @param stream the output stream.
- *
- * @throws IOException if there is an I/O error.
- */
- private void writeObject(ObjectOutputStream stream) throws IOException {
- stream.defaultWriteObject();
-
- SerialUtilities.writeShape(this.legendItemShape, stream);
- SerialUtilities.writePaint(this.seriesPaint, stream);
- SerialUtilities.writePaint(this.baseSeriesPaint, stream);
- SerialUtilities.writePaint(this.seriesOutlinePaint, stream);
- SerialUtilities.writePaint(this.baseSeriesOutlinePaint, stream);
- SerialUtilities.writeStroke(this.seriesOutlineStroke, stream);
- SerialUtilities.writeStroke(this.baseSeriesOutlineStroke, stream);
- SerialUtilities.writePaint(this.labelPaint, stream);
- SerialUtilities.writePaint(this.axisLinePaint, stream);
- SerialUtilities.writeStroke(this.axisLineStroke, stream);
- }
-
- /**
- * Provides serialization support.
- *
- * @param stream the input stream.
- *
- * @throws IOException if there is an I/O error.
- * @throws ClassNotFoundException if there is a classpath problem.
- */
- private void readObject(ObjectInputStream stream) throws IOException,
- ClassNotFoundException {
- stream.defaultReadObject();
-
- this.legendItemShape = SerialUtilities.readShape(stream);
- this.seriesPaint = SerialUtilities.readPaint(stream);
- this.baseSeriesPaint = SerialUtilities.readPaint(stream);
- this.seriesOutlinePaint = SerialUtilities.readPaint(stream);
- this.baseSeriesOutlinePaint = SerialUtilities.readPaint(stream);
- this.seriesOutlineStroke = SerialUtilities.readStroke(stream);
- this.baseSeriesOutlineStroke = SerialUtilities.readStroke(stream);
- this.labelPaint = SerialUtilities.readPaint(stream);
- this.axisLinePaint = SerialUtilities.readPaint(stream);
- this.axisLineStroke = SerialUtilities.readStroke(stream);
- if (this.dataset != null) {
- this.dataset.addChangeListener(this);
- }
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/plotting/demo/SpiderWebPlotTests.jav b/src/org/gcube/contentmanagement/graphtools/plotting/demo/SpiderWebPlotTests.jav
deleted file mode 100644
index 3408d58..0000000
--- a/src/org/gcube/contentmanagement/graphtools/plotting/demo/SpiderWebPlotTests.jav
+++ /dev/null
@@ -1,372 +0,0 @@
-/* ===========================================================
- * JFreeChart : a free chart library for the Java(tm) platform
- * ===========================================================
- *
- * (C) Copyright 2000-2008, by Object Refinery Limited and Contributors.
- *
- * Project Info: http://www.jfree.org/jfreechart/index.html
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
- * in the United States and other countries.]
- *
- * -----------------------
- * SpiderWebPlotTests.java
- * -----------------------
- * (C) Copyright 2005-2008, by Object Refinery Limited and Contributors.
- *
- * Original Author: David Gilbert (for Object Refinery Limited);
- * Contributor(s): -;
- *
- * Changes
- * -------
- * 10-Jun-2005 : Version 1 (DG);
- * 01-Jun-2006 : Added testDrawWithNullInfo() method (DG);
- * 05-Feb-2007 : Added more checks to testCloning (DG);
- *
- */
-
-package org.gcube.portlets.user.timeseriesportlets.rapidminer.plotting;
-
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.GradientPaint;
-import java.awt.Graphics2D;
-import java.awt.Rectangle;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInput;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-import java.text.DecimalFormat;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;
-import org.jfree.chart.labels.StandardCategoryToolTipGenerator;
-import org.jfree.chart.plot.SpiderWebPlot;
-import org.jfree.chart.urls.StandardCategoryURLGenerator;
-import org.jfree.data.category.DefaultCategoryDataset;
-import org.jfree.util.Rotation;
-import org.jfree.util.TableOrder;
-
-/**
- * Tests for the {@link SpiderWebPlot} class.
- */
-public class SpiderWebPlotTests extends TestCase {
-
- /**
- * Returns the tests as a test suite.
- *
- * @return The test suite.
- */
- public static Test suite() {
- return new TestSuite(SpiderWebPlotTests.class);
- }
-
- /**
- * Constructs a new set of tests.
- *
- * @param name the name of the tests.
- */
- public SpiderWebPlotTests(String name) {
- super(name);
- }
-
- /**
- * Some checks for the equals() method.
- */
- public void testEquals() {
- SpiderWebPlot p1 = new SpiderWebPlot(new DefaultCategoryDataset());
- SpiderWebPlot p2 = new SpiderWebPlot(new DefaultCategoryDataset());
- assertTrue(p1.equals(p2));
- assertTrue(p2.equals(p1));
-
- // dataExtractOrder
- p1.setDataExtractOrder(TableOrder.BY_COLUMN);
- assertFalse(p1.equals(p2));
- p2.setDataExtractOrder(TableOrder.BY_COLUMN);
- assertTrue(p1.equals(p2));
-
- // headPercent
- p1.setHeadPercent(0.321);
- assertFalse(p1.equals(p2));
- p2.setHeadPercent(0.321);
- assertTrue(p1.equals(p2));
-
- // interiorGap
- p1.setInteriorGap(0.123);
- assertFalse(p1.equals(p2));
- p2.setInteriorGap(0.123);
- assertTrue(p1.equals(p2));
-
- // startAngle
- p1.setStartAngle(0.456);
- assertFalse(p1.equals(p2));
- p2.setStartAngle(0.456);
- assertTrue(p1.equals(p2));
-
- // direction
- p1.setDirection(Rotation.ANTICLOCKWISE);
- assertFalse(p1.equals(p2));
- p2.setDirection(Rotation.ANTICLOCKWISE);
- assertTrue(p1.equals(p2));
-
- // maxValue
- p1.setMaxValue(123.4);
- assertFalse(p1.equals(p2));
- p2.setMaxValue(123.4);
- assertTrue(p1.equals(p2));
-
- // legendItemShape
- p1.setLegendItemShape(new Rectangle(1, 2, 3, 4));
- assertFalse(p1.equals(p2));
- p2.setLegendItemShape(new Rectangle(1, 2, 3, 4));
- assertTrue(p1.equals(p2));
-
- // seriesPaint
- p1.setSeriesPaint(new GradientPaint(1.0f, 2.0f, Color.red,
- 3.0f, 4.0f, Color.white));
- assertFalse(p1.equals(p2));
- p2.setSeriesPaint(new GradientPaint(1.0f, 2.0f, Color.red,
- 3.0f, 4.0f, Color.white));
- assertTrue(p1.equals(p2));
-
- // seriesPaintList
- p1.setSeriesPaint(1, new GradientPaint(1.0f, 2.0f, Color.yellow,
- 3.0f, 4.0f, Color.white));
- assertFalse(p1.equals(p2));
- p2.setSeriesPaint(1, new GradientPaint(1.0f, 2.0f, Color.yellow,
- 3.0f, 4.0f, Color.white));
- assertTrue(p1.equals(p2));
-
- // baseSeriesPaint
- p1.setBaseSeriesPaint(new GradientPaint(1.0f, 2.0f, Color.red,
- 3.0f, 4.0f, Color.black));
- assertFalse(p1.equals(p2));
- p2.setBaseSeriesPaint(new GradientPaint(1.0f, 2.0f, Color.red,
- 3.0f, 4.0f, Color.black));
- assertTrue(p1.equals(p2));
-
- // seriesOutlinePaint
- p1.setSeriesOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.blue,
- 3.0f, 4.0f, Color.black));
- assertFalse(p1.equals(p2));
- p2.setSeriesOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.blue,
- 3.0f, 4.0f, Color.black));
- assertTrue(p1.equals(p2));
-
- // seriesOutlinePaintList
- p1.setSeriesOutlinePaint(1, new GradientPaint(1.0f, 2.0f, Color.blue,
- 3.0f, 4.0f, Color.green));
- assertFalse(p1.equals(p2));
- p2.setSeriesOutlinePaint(1, new GradientPaint(1.0f, 2.0f, Color.blue,
- 3.0f, 4.0f, Color.green));
- assertTrue(p1.equals(p2));
-
- // baseSeriesOutlinePaint
- p1.setBaseSeriesOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.cyan,
- 3.0f, 4.0f, Color.green));
- assertFalse(p1.equals(p2));
- p2.setBaseSeriesOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.cyan,
- 3.0f, 4.0f, Color.green));
- assertTrue(p1.equals(p2));
-
- // seriesOutlineStroke
- BasicStroke s = new BasicStroke(1.23f);
- p1.setSeriesOutlineStroke(s);
- assertFalse(p1.equals(p2));
- p2.setSeriesOutlineStroke(s);
- assertTrue(p1.equals(p2));
-
- // seriesOutlineStrokeList
- p1.setSeriesOutlineStroke(1, s);
- assertFalse(p1.equals(p2));
- p2.setSeriesOutlineStroke(1, s);
- assertTrue(p1.equals(p2));
-
- // baseSeriesOutlineStroke
- p1.setBaseSeriesOutlineStroke(s);
- assertFalse(p1.equals(p2));
- p2.setBaseSeriesOutlineStroke(s);
- assertTrue(p1.equals(p2));
-
- // webFilled
- p1.setWebFilled(false);
- assertFalse(p1.equals(p2));
- p2.setWebFilled(false);
- assertTrue(p1.equals(p2));
-
- // axisLabelGap
- p1.setAxisLabelGap(0.11);
- assertFalse(p1.equals(p2));
- p2.setAxisLabelGap(0.11);
- assertTrue(p1.equals(p2));
-
- // labelFont
- p1.setLabelFont(new Font("Serif", Font.PLAIN, 9));
- assertFalse(p1.equals(p2));
- p2.setLabelFont(new Font("Serif", Font.PLAIN, 9));
- assertTrue(p1.equals(p2));
-
- // labelPaint
- p1.setLabelPaint(new GradientPaint(1.0f, 2.0f, Color.red,
- 3.0f, 4.0f, Color.blue));
- assertFalse(p1.equals(p2));
- p2.setLabelPaint(new GradientPaint(1.0f, 2.0f, Color.red,
- 3.0f, 4.0f, Color.blue));
- assertTrue(p1.equals(p2));
-
- // labelGenerator
- p1.setLabelGenerator(new StandardCategoryItemLabelGenerator("XYZ: {0}",
- new DecimalFormat("0.000")));
- assertFalse(p1.equals(p2));
- p2.setLabelGenerator(new StandardCategoryItemLabelGenerator("XYZ: {0}",
- new DecimalFormat("0.000")));
- assertTrue(p1.equals(p2));
-
- // toolTipGenerator
- p1.setToolTipGenerator(new StandardCategoryToolTipGenerator());
- assertFalse(p1.equals(p2));
- p2.setToolTipGenerator(new StandardCategoryToolTipGenerator());
- assertTrue(p1.equals(p2));
-
- // urlGenerator
- p1.setURLGenerator(new StandardCategoryURLGenerator());
- assertFalse(p1.equals(p2));
- p2.setURLGenerator(new StandardCategoryURLGenerator());
- assertTrue(p1.equals(p2));
-
- // axisLinePaint
- p1.setAxisLinePaint(Color.red);
- assertFalse(p1.equals(p2));
- p2.setAxisLinePaint(Color.red);
- assertTrue(p1.equals(p2));
-
- // axisLineStroke
- p1.setAxisLineStroke(new BasicStroke(1.1f));
- assertFalse(p1.equals(p2));
- p2.setAxisLineStroke(new BasicStroke(1.1f));
- assertTrue(p1.equals(p2));
- }
-
- /**
- * Confirm that cloning works.
- */
- public void testCloning() {
- SpiderWebPlot p1 = new SpiderWebPlot(new DefaultCategoryDataset());
- Rectangle2D legendShape = new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0);
- p1.setLegendItemShape(legendShape);
- SpiderWebPlot p2 = null;
- try {
- p2 = (SpiderWebPlot) p1.clone();
- }
- catch (CloneNotSupportedException e) {
- e.printStackTrace();
- }
- assertTrue(p1 != p2);
- assertTrue(p1.getClass() == p2.getClass());
- assertTrue(p1.equals(p2));
-
- // change the legendItemShape
- legendShape.setRect(4.0, 3.0, 2.0, 1.0);
- assertFalse(p1.equals(p2));
- p2.setLegendItemShape(legendShape);
- assertTrue(p1.equals(p2));
-
- // change a series paint
- p1.setSeriesPaint(1, Color.black);
- assertFalse(p1.equals(p2));
- p2.setSeriesPaint(1, Color.black);
- assertTrue(p1.equals(p2));
-
- // change a series outline paint
- p1.setSeriesOutlinePaint(0, Color.red);
- assertFalse(p1.equals(p2));
- p2.setSeriesOutlinePaint(0, Color.red);
- assertTrue(p1.equals(p2));
-
- // change a series outline stroke
- p1.setSeriesOutlineStroke(0, new BasicStroke(1.1f));
- assertFalse(p1.equals(p2));
- p2.setSeriesOutlineStroke(0, new BasicStroke(1.1f));
- assertTrue(p1.equals(p2));
-
- }
-
- /**
- * Serialize an instance, restore it, and check for equality.
- */
- public void testSerialization() {
-
- SpiderWebPlot p1 = new SpiderWebPlot(new DefaultCategoryDataset());
- SpiderWebPlot p2 = null;
-
- try {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ObjectOutput out = new ObjectOutputStream(buffer);
- out.writeObject(p1);
- out.close();
-
- ObjectInput in = new ObjectInputStream(
- new ByteArrayInputStream(buffer.toByteArray()));
- p2 = (SpiderWebPlot) in.readObject();
- in.close();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- assertEquals(p1, p2);
-
- }
-
- /**
- * Draws the chart with a null info object to make sure that no exceptions
- * are thrown.
- */
- public void testDrawWithNullInfo() {
- DefaultCategoryDataset dataset = new DefaultCategoryDataset();
- dataset.addValue(35.0, "S1", "C1");
- dataset.addValue(45.0, "S1", "C2");
- dataset.addValue(55.0, "S1", "C3");
- dataset.addValue(15.0, "S1", "C4");
- dataset.addValue(25.0, "S1", "C5");
- SpiderWebPlot plot = new SpiderWebPlot(dataset);
- JFreeChart chart = new JFreeChart(plot);
- boolean success = false;
- try {
- BufferedImage image = new BufferedImage(200 , 100,
- BufferedImage.TYPE_INT_RGB);
- Graphics2D g2 = image.createGraphics();
- chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
-// g2.dispose();
- success = true;
- }
- catch (Exception e) {
- success = false;
- }
- assertTrue(success);
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/plotting/demo/TestWeb.java b/src/org/gcube/contentmanagement/graphtools/plotting/demo/TestWeb.java
deleted file mode 100644
index ce6b085..0000000
--- a/src/org/gcube/contentmanagement/graphtools/plotting/demo/TestWeb.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.gcube.contentmanagement.graphtools.plotting.demo;
-
-import java.awt.Graphics2D;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.BufferedImage;
-
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.plot.SpiderWebPlot;
-import org.jfree.data.category.DefaultCategoryDataset;
-
-public class TestWeb {
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- testDrawWithNullInfo();
- }
- public static void testDrawWithNullInfo() {
- DefaultCategoryDataset dataset = new DefaultCategoryDataset();
- dataset.addValue(35.0, "S1", "C1");
- dataset.addValue(45.0, "S1", "C2");
- dataset.addValue(55.0, "S1", "C3");
- dataset.addValue(15.0, "S1", "C4");
- dataset.addValue(25.0, "S1", "C5");
- SpiderWebPlot plot = new SpiderWebPlot(dataset);
- JFreeChart chart = new JFreeChart(plot);
- boolean success = false;
- try {
- BufferedImage image = new BufferedImage(200 , 100,
- BufferedImage.TYPE_INT_RGB);
- Graphics2D g2 = image.createGraphics();
- chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
-// g2.dispose();
-
- success = true;
- }
- catch (Exception e) {
- success = false;
- }
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/plotting/demo/TimeSeriesChartDemo1.java b/src/org/gcube/contentmanagement/graphtools/plotting/demo/TimeSeriesChartDemo1.java
deleted file mode 100644
index 9cf28c3..0000000
--- a/src/org/gcube/contentmanagement/graphtools/plotting/demo/TimeSeriesChartDemo1.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/* ===========================================================
- * JFreeChart : a free chart library for the Java(tm) platform
- * ===========================================================
- *
- * (C) Copyright 2000-2009, by Object Refinery Limited and Contributors.
- *
- * Project Info: http://www.jfree.org/jfreechart/index.html
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
- * in the United States and other countries.]
- *
- * -------------------------
- * TimeSeriesChartDemo1.java
- * -------------------------
- * (C) Copyright 2003-2009, by Object Refinery Limited and Contributors.
- *
- * Original Author: David Gilbert (for Object Refinery Limited);
- * Contributor(s): ;
- *
- * Changes
- * -------
- * 09-Mar-2005 : Version 1, copied from the demo collection that ships with
- * the JFreeChart Developer Guide (DG);
- *
- */
-
-package org.gcube.contentmanagement.graphtools.plotting.demo;
-
-import java.awt.Color;
-import java.text.SimpleDateFormat;
-
-import javax.swing.JPanel;
-
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.ChartPanel;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.DateAxis;
-import org.jfree.chart.plot.XYPlot;
-import org.jfree.chart.renderer.xy.XYItemRenderer;
-import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
-import org.jfree.data.time.Month;
-import org.jfree.data.time.TimeSeries;
-import org.jfree.data.time.TimeSeriesCollection;
-import org.jfree.data.xy.XYDataset;
-import org.jfree.ui.ApplicationFrame;
-import org.jfree.ui.RectangleInsets;
-import org.jfree.ui.RefineryUtilities;
-
-/**
- * An example of a time series chart. For the most part, default settings are
- * used, except that the renderer is modified to show filled shapes (as well as
- * lines) at each data point.
- */
-public class TimeSeriesChartDemo1 extends ApplicationFrame {
-
- /**
- * A demonstration application showing how to create a simple time series
- * chart. This example uses monthly data.
- *
- * @param title the frame title.
- */
- public TimeSeriesChartDemo1(String title) {
- super(title);
- ChartPanel chartPanel = (ChartPanel) createDemoPanel();
- chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
- setContentPane(chartPanel);
- }
-
- /**
- * Creates a chart.
- *
- * @param dataset a dataset.
- *
- * @return A chart.
- */
- private static JFreeChart createChart(XYDataset dataset) {
-
- JFreeChart chart = ChartFactory.createTimeSeriesChart(
- "Legal & General Unit Trust Prices", // title
- "Date", // x-axis label
- "Price Per Unit", // y-axis label
- dataset, // data
- true, // create legend?
- true, // generate tooltips?
- false // generate URLs?
- );
-
- chart.setBackgroundPaint(Color.white);
-
- XYPlot plot = (XYPlot) chart.getPlot();
- plot.setBackgroundPaint(Color.lightGray);
- plot.setDomainGridlinePaint(Color.white);
- plot.setRangeGridlinePaint(Color.white);
- plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
- plot.setDomainCrosshairVisible(true);
- plot.setRangeCrosshairVisible(true);
-
- XYItemRenderer r = plot.getRenderer();
- if (r instanceof XYLineAndShapeRenderer) {
- XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
- renderer.setBaseShapesVisible(true);
- renderer.setBaseShapesFilled(true);
- renderer.setDrawSeriesLineAsPath(true);
- }
-
- DateAxis axis = (DateAxis) plot.getDomainAxis();
- axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy"));
-
- return chart;
-
- }
-
- /**
- * Creates a dataset, consisting of two series of monthly data.
- *
- * @return The dataset.
- */
- private static XYDataset createDataset() {
-
- TimeSeries s1 = new TimeSeries("L&G European Index Trust");
- s1.add(new Month(2, 2001), 181.8);
- s1.add(new Month(3, 2001), 167.3);
- s1.add(new Month(4, 2001), 153.8);
- s1.add(new Month(5, 2001), 167.6);
- s1.add(new Month(6, 2001), 158.8);
- s1.add(new Month(7, 2001), 148.3);
- s1.add(new Month(8, 2001), 153.9);
- s1.add(new Month(9, 2001), 142.7);
- s1.add(new Month(10, 2001), 123.2);
- s1.add(new Month(11, 2001), 131.8);
- s1.add(new Month(12, 2001), 139.6);
- s1.add(new Month(1, 2002), 142.9);
- s1.add(new Month(2, 2002), 138.7);
- s1.add(new Month(3, 2002), 137.3);
- s1.add(new Month(4, 2002), 143.9);
- s1.add(new Month(5, 2002), 139.8);
- s1.add(new Month(6, 2002), 137.0);
- s1.add(new Month(7, 2002), 132.8);
-
- TimeSeries s2 = new TimeSeries("L&G UK Index Trust");
- s2.add(new Month(2, 2001), 129.6);
- s2.add(new Month(3, 2001), 123.2);
- s2.add(new Month(4, 2001), 117.2);
- s2.add(new Month(5, 2001), 124.1);
- s2.add(new Month(6, 2001), 122.6);
- s2.add(new Month(7, 2001), 119.2);
- s2.add(new Month(8, 2001), 116.5);
- s2.add(new Month(9, 2001), 112.7);
- s2.add(new Month(10, 2001), 101.5);
- s2.add(new Month(11, 2001), 106.1);
- s2.add(new Month(12, 2001), 110.3);
- s2.add(new Month(1, 2002), 111.7);
- s2.add(new Month(2, 2002), 111.0);
- s2.add(new Month(3, 2002), 109.6);
- s2.add(new Month(4, 2002), 113.2);
- s2.add(new Month(5, 2002), 111.6);
- s2.add(new Month(6, 2002), 108.8);
- s2.add(new Month(7, 2002), 101.6);
-
- // ******************************************************************
- // More than 150 demo applications are included with the JFreeChart
- // Developer Guide...for more information, see:
- //
- // > http://www.object-refinery.com/jfreechart/guide.html
- //
- // ******************************************************************
-
- TimeSeriesCollection dataset = new TimeSeriesCollection();
- dataset.addSeries(s1);
- dataset.addSeries(s2);
-
- return dataset;
-
- }
-
- /**
- * Creates a panel for the demo (used by SuperDemo.java).
- *
- * @return A panel.
- */
- public static JPanel createDemoPanel() {
- JFreeChart chart = createChart(createDataset());
- ChartPanel panel = new ChartPanel(chart);
- panel.setFillZoomRectangle(true);
- panel.setMouseWheelEnabled(true);
- return panel;
- }
-
- /**
- * Starting point for the demonstration application.
- *
- * @param args ignored.
- */
- public static void main(String[] args) {
-
- TimeSeriesChartDemo1 demo = new TimeSeriesChartDemo1(
- "Time Series Chart Demo 1");
- demo.pack();
- RefineryUtilities.centerFrameOnScreen(demo);
- demo.setVisible(true);
-
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/GaussianDistributionGraph.java b/src/org/gcube/contentmanagement/graphtools/plotting/graphs/GaussianDistributionGraph.java
deleted file mode 100644
index bce4ed2..0000000
--- a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/GaussianDistributionGraph.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/* ===========================================================
- * JFreeChart : a free chart library for the Java(tm) platform
- * ===========================================================
- *
- * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors.
- *
- * Project Info: http://www.jfree.org/jfreechart/index.html
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
- * in the United States and other countries.]
- *
- * ------------------
- * PieGraph.java
- * ------------------
- * (C) Copyright 2003-2007, by Object Refinery Limited and Contributors.
- *
- * Original Author: David Gilbert (for Object Refinery Limited);
- * Contributor(s): ;
- *
- * Changes
- * -------
- * 09-Mar-2005 : Version 1, copied from the demo collection that ships with
- * the JFreeChart Developer Guide (DG);
- *
- */
-
-package org.gcube.contentmanagement.graphtools.plotting.graphs;
-
-import java.awt.BasicStroke;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.gcube.contentmanagement.graphtools.abstracts.GenericStandaloneGraph;
-import org.gcube.contentmanagement.graphtools.utils.MathFunctions;
-import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphData;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphGroups;
-import org.gcube.portlets.user.timeseries.charts.support.types.Point;
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.ValueAxis;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.plot.XYPlot;
-import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
-import org.jfree.data.function.NormalDistributionFunction2D;
-import org.jfree.data.general.Dataset;
-import org.jfree.data.general.DatasetUtilities;
-import org.jfree.data.xy.XYSeriesCollection;
-
-import com.thoughtworks.xstream.XStream;
-import com.thoughtworks.xstream.io.xml.DomDriver;
-
-public class GaussianDistributionGraph extends GenericStandaloneGraph {
-
- private static final long serialVersionUID = 1L;
-
- public GaussianDistributionGraph(String title) {
- super(title);
- }
-
- protected Dataset generateDataset() {
- XYSeriesCollection xyseriescollection = new XYSeriesCollection();
- NormalDistributionFunction2D normaldistributionfunction2d = new NormalDistributionFunction2D(0.0D, 1.0D);
- org.jfree.data.xy.XYSeries xyseries = DatasetUtilities.sampleFunction2DToSeries(normaldistributionfunction2d, -5.0999999999999996D, 5.0999999999999996D, 121, "N1");
- xyseriescollection.addSeries(xyseries);
- NormalDistributionFunction2D normaldistributionfunction2d1 = new NormalDistributionFunction2D(0.0D, Math.sqrt(0.20000000000000001D));
- org.jfree.data.xy.XYSeries xyseries1 = DatasetUtilities.sampleFunction2DToSeries(normaldistributionfunction2d1, -5.0999999999999996D, 5.0999999999999996D, 121, "N2");
- xyseriescollection.addSeries(xyseries1);
- NormalDistributionFunction2D normaldistributionfunction2d2 = new NormalDistributionFunction2D(0.0D, Math.sqrt(5D));
- org.jfree.data.xy.XYSeries xyseries2 = DatasetUtilities.sampleFunction2DToSeries(normaldistributionfunction2d2, -5.0999999999999996D, 5.0999999999999996D, 121, "N3");
- xyseriescollection.addSeries(xyseries2);
- NormalDistributionFunction2D normaldistributionfunction2d3 = new NormalDistributionFunction2D(-2D, Math.sqrt(0.5D));
- org.jfree.data.xy.XYSeries xyseries3 = DatasetUtilities.sampleFunction2DToSeries(normaldistributionfunction2d3, -5.0999999999999996D, 5.0999999999999996D, 121, "N4");
- xyseriescollection.addSeries(xyseries3);
- return xyseriescollection;
- }
-
- protected JFreeChart createChart(Dataset dataset) {
-
- String label = "mean:"+mean+" variance:"+variance;
- if (label.length()>30)
- label = label.substring(0,30)+"...";
-
- JFreeChart jfreechart = ChartFactory.createXYLineChart("", label, "", (XYSeriesCollection)dataset, PlotOrientation.VERTICAL, true, true, false);
- XYPlot xyplot = (XYPlot)jfreechart.getPlot();
- xyplot.setDomainZeroBaselineVisible(true);
- xyplot.setRangeZeroBaselineVisible(true);
- xyplot.setDomainPannable(true);
- xyplot.setRangePannable(true);
- ValueAxis valueaxis = xyplot.getDomainAxis();
- valueaxis.setLowerMargin(0.0D);
- valueaxis.setUpperMargin(0.0D);
- XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer)xyplot.getRenderer();
- xylineandshaperenderer.setDrawSeriesLineAsPath(true);
- xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(1.5F));
-
- return jfreechart;
- }
-
- @Override
- protected GenericStandaloneGraph getInstance(String title) {
- return new GaussianDistributionGraph(title);
- }
-
-
- double mean;
- double variance;
- @Override
- protected Dataset convert2Dataset(GraphData st) {
-
- List> pointslist = st.getData();
-
- // NOTE: after the graph generation graphs are inverted in x and y
- int numbOfSeries = pointslist.size();
- XYSeriesCollection xyseriescollection = new XYSeriesCollection();
-
- if (numbOfSeries > 0) {
- int numbOfPoints = pointslist.get(0).getEntries().size();
- //for each series
- for (int s = 0; s < numbOfSeries; s++) {
- //get label
- String serieslabel = pointslist.get(s).getLabel();
- double maxRange = st.getMaxY().doubleValue();
- double minRange = st.getMinY().doubleValue();
-
- //get doubles vector for performing mean and variance calculation
- double [] points = MathFunctions.points2Double(pointslist,s,numbOfPoints);
- mean = MathFunctions.mean(points);
- variance = com.rapidminer.tools.math.MathFunctions.variance(points, Double.NEGATIVE_INFINITY);
-
- mean = Math.round(mean);
- variance = Math.round(variance);
-
- if (variance==0)
- variance = 0.1;
-
- AnalysisLogger.getLogger().debug("mean "+mean+" variance "+variance);
- //build up normal distribution and add to the series
- NormalDistributionFunction2D normaldistributionfunction2d = new NormalDistributionFunction2D(mean, variance);
- //make the representation a bit longer
- maxRange = maxRange*2;
- org.jfree.data.xy.XYSeries xyseries = DatasetUtilities.sampleFunction2DToSeries(normaldistributionfunction2d, minRange, maxRange, 121, serieslabel);
-
-
-
- xyseriescollection.addSeries(xyseries);
- }
- }
- return xyseriescollection;
- }
-
- public static Map> graphs2Normals(GraphGroups gg){
-
- Map> normalsMap = new HashMap>();
- for (String key:gg.getGraphs().keySet())
- {
-
- GraphData st = gg.getGraphs().get(key);
- List> pointslist = st.getData();
- List normalsList = new ArrayList();
-
- // NOTE: after the graph generation graphs are inverted in x and y
- int numbOfSeries = pointslist.size();
-
- if (numbOfSeries > 0) {
- int numbOfPoints = pointslist.get(0).getEntries().size();
- //for each series
- for (int s = 0; s < numbOfSeries; s++) {
- //get doubles vector for performing mean and variance calculation
- double [] points = MathFunctions.points2Double(pointslist,s,numbOfPoints);
- double mean = MathFunctions.mean(points);
- double variance = com.rapidminer.tools.math.MathFunctions.variance(points, Double.NEGATIVE_INFINITY);
-
- if (variance==0)
- variance = 0.1;
-
- AnalysisLogger.getLogger().debug("mean "+mean+" variance "+variance);
- //build up normal distribution and add to the series
- NormalDistributionFunction2D normaldistributionfunction2d = new NormalDistributionFunction2D(mean, variance);
- normalsList.add(normaldistributionfunction2d);
- }
- }
-
- normalsMap.put(key, normalsList);
- }
-
- return normalsMap;
- }
-
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/HistogramGraph.java b/src/org/gcube/contentmanagement/graphtools/plotting/graphs/HistogramGraph.java
deleted file mode 100644
index 547f7d8..0000000
--- a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/HistogramGraph.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/* ===========================================================
- * JFreeChart : a free chart library for the Java(tm) platform
- * ===========================================================
- *
- * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors.
- *
- * Project Info: http://www.jfree.org/jfreechart/index.html
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
- * in the United States and other countries.]
- *
- * ------------------
- * PieGraph.java
- * ------------------
- * (C) Copyright 2003-2007, by Object Refinery Limited and Contributors.
- *
- * Original Author: David Gilbert (for Object Refinery Limited);
- * Contributor(s): ;
- *
- * Changes
- * -------
- * 09-Mar-2005 : Version 1, copied from the demo collection that ships with
- * the JFreeChart Developer Guide (DG);
- *
- */
-
-package org.gcube.contentmanagement.graphtools.plotting.graphs;
-
-import java.awt.Color;
-
-import org.gcube.contentmanagement.graphtools.abstracts.GenericStandaloneGraph;
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.AxisLocation;
-import org.jfree.chart.axis.CategoryAxis;
-import org.jfree.chart.axis.CategoryLabelPositions;
-import org.jfree.chart.plot.CategoryPlot;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.title.LegendTitle;
-import org.jfree.data.category.DefaultCategoryDataset;
-import org.jfree.data.general.Dataset;
-import org.jfree.ui.RectangleInsets;
-
-public class HistogramGraph extends GenericStandaloneGraph {
-
- private static final long serialVersionUID = 1L;
-
- public HistogramGraph(String title) {
- super(title);
- }
-
- protected Dataset generateDataset() {
- String s = "S1";
- String s1 = "S2";
- String s2 = "S3";
- String s3 = "Category 1";
- String s4 = "Category 2";
- String s5 = "Category 3";
- String s6 = "Category 4";
- String s7 = "Category 5";
- String s8 = "Category 6";
- String s9 = "Category 7";
- String s10 = "Category 8";
- DefaultCategoryDataset defaultcategorydataset = new DefaultCategoryDataset();
- defaultcategorydataset.addValue(1.0D, s, s3);
- defaultcategorydataset.addValue(4D, s, s4);
- defaultcategorydataset.addValue(3D, s, s5);
- defaultcategorydataset.addValue(5D, s, s6);
- defaultcategorydataset.addValue(5D, s, s7);
- defaultcategorydataset.addValue(7D, s, s8);
- defaultcategorydataset.addValue(7D, s, s9);
- defaultcategorydataset.addValue(8D, s, s10);
- defaultcategorydataset.addValue(5D, s1, s3);
- defaultcategorydataset.addValue(7D, s1, s4);
- defaultcategorydataset.addValue(6D, s1, s5);
- defaultcategorydataset.addValue(8D, s1, s6);
- defaultcategorydataset.addValue(4D, s1, s7);
- defaultcategorydataset.addValue(4D, s1, s8);
- defaultcategorydataset.addValue(2D, s1, s9);
- defaultcategorydataset.addValue(1.0D, s1, s10);
- defaultcategorydataset.addValue(4D, s2, s3);
- defaultcategorydataset.addValue(3D, s2, s4);
- defaultcategorydataset.addValue(2D, s2, s5);
- defaultcategorydataset.addValue(3D, s2, s6);
- defaultcategorydataset.addValue(6D, s2, s7);
- defaultcategorydataset.addValue(3D, s2, s8);
- defaultcategorydataset.addValue(4D, s2, s9);
- defaultcategorydataset.addValue(3D, s2, s10);
- return defaultcategorydataset;
-
- }
-
- protected JFreeChart createChart(Dataset dataset) {
-
- JFreeChart chart = ChartFactory.createBarChart("Histogram Chart", "", "", (DefaultCategoryDataset) dataset, PlotOrientation.VERTICAL, true, true, false);
- chart.setBackgroundPaint(Color.white);
- CategoryPlot categoryplot = (CategoryPlot) chart.getPlot();
- categoryplot.setBackgroundPaint(new Color(238, 238, 255));
- categoryplot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
-
- CategoryAxis categoryaxis = categoryplot.getDomainAxis();
- categoryaxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_45);
-
- LegendTitle legendtitle = new LegendTitle(categoryplot.getRenderer(0));
- legendtitle.setMargin(new RectangleInsets(2D, 2D, 2D, 2D));
-
-
- return chart;
- }
-
- @Override
- protected GenericStandaloneGraph getInstance(String title) {
- return new HistogramGraph(title);
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/LineGraph.java b/src/org/gcube/contentmanagement/graphtools/plotting/graphs/LineGraph.java
deleted file mode 100644
index b234dc0..0000000
--- a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/LineGraph.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/* ===========================================================
- * JFreeChart : a free chart library for the Java(tm) platform
- * ===========================================================
- *
- * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors.
- *
- * Project Info: http://www.jfree.org/jfreechart/index.html
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
- * in the United States and other countries.]
- *
- * ------------------
- * PieGraph.java
- * ------------------
- * (C) Copyright 2003-2007, by Object Refinery Limited and Contributors.
- *
- * Original Author: David Gilbert (for Object Refinery Limited);
- * Contributor(s): ;
- *
- * Changes
- * -------
- * 09-Mar-2005 : Version 1, copied from the demo collection that ships with
- * the JFreeChart Developer Guide (DG);
- *
- */
-
-package org.gcube.contentmanagement.graphtools.plotting.graphs;
-
-import java.awt.Color;
-
-import org.gcube.contentmanagement.graphtools.abstracts.GenericStandaloneGraph;
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.plot.CategoryPlot;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.renderer.category.LineAndShapeRenderer;
-import org.jfree.data.category.DefaultCategoryDataset;
-import org.jfree.data.general.Dataset;
-
-public class LineGraph extends GenericStandaloneGraph {
-
- private static final long serialVersionUID = 1L;
-
- public LineGraph(String title) {
- super(title);
- }
-
- protected Dataset generateDataset() {
- // row keys...
- String series1 = "First";
- String series2 = "Second";
- String series3 = "Third";
-
- // column keys...
- String type1 = "Type 1";
- String type2 = "Type 2";
- String type3 = "Type 3";
- String type4 = "Type 4";
- String type5 = "Type 5";
- String type6 = "Type 6";
- String type7 = "Type 7";
- String type8 = "Type 8";
-
- // create the dataset...
- DefaultCategoryDataset dataset = new DefaultCategoryDataset();
-
- dataset.addValue(1.0, series1, type1);
- dataset.addValue(4.0, series1, type2);
- dataset.addValue(3.0, series1, type3);
- dataset.addValue(5.0, series1, type4);
- dataset.addValue(5.0, series1, type5);
- dataset.addValue(7.0, series1, type6);
- dataset.addValue(7.0, series1, type7);
- dataset.addValue(8.0, series1, type8);
-
- dataset.addValue(5.0, series2, type1);
- dataset.addValue(7.0, series2, type2);
- dataset.addValue(6.0, series2, type3);
- dataset.addValue(8.0, series2, type4);
- dataset.addValue(4.0, series2, type5);
- dataset.addValue(4.0, series2, type6);
- dataset.addValue(2.0, series2, type7);
- dataset.addValue(1.0, series2, type8);
-
- dataset.addValue(4.0, series3, type1);
- dataset.addValue(3.0, series3, type2);
- dataset.addValue(2.0, series3, type3);
- dataset.addValue(3.0, series3, type4);
- dataset.addValue(6.0, series3, type5);
- dataset.addValue(3.0, series3, type6);
- dataset.addValue(4.0, series3, type7);
- dataset.addValue(3.0, series3, type8);
- return dataset;
- }
-
- protected JFreeChart createChart(Dataset dataset) {
-
- // create the chart...
- JFreeChart chart = ChartFactory.createLineChart(
- this.getTitle(), // chart title
- "", // domain axis label
- "", // range axis label
- (DefaultCategoryDataset)dataset, // data
- PlotOrientation.VERTICAL, // orientation
- true, // include legend
- true, // tooltips
- false // urls
- );
- chart.setBackgroundPaint(Color.white);
- CategoryPlot plot = chart.getCategoryPlot();
-// plot.setBackgroundPaint(Color.white);
- plot.setRangeGridlinePaint(Color.white);
- plot.setDomainCrosshairVisible(true);
- plot.setDomainGridlinesVisible(true);
- plot.setRangeCrosshairVisible(true);
- plot.setRenderer(new LineAndShapeRenderer(true,true));
-
- //deprecated
- /*
- LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
- renderer.setShapesVisible(true);
- renderer.setDrawOutlines(true);
- renderer.setUseFillPaint(true);
- renderer.setFillPaint(Color.white);
-*/
-
-
-
-
- return chart;
- }
-
- @Override
- protected GenericStandaloneGraph getInstance(String title) {
- return new LineGraph(title);
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/NumericSeriesGraph.java b/src/org/gcube/contentmanagement/graphtools/plotting/graphs/NumericSeriesGraph.java
deleted file mode 100644
index 6177e38..0000000
--- a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/NumericSeriesGraph.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/* ===========================================================
- * JFreeChart : a free chart library for the Java(tm) platform
- * ===========================================================
- *
- * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors.
- *
- * Project Info: http://www.jfree.org/jfreechart/index.html
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
- * in the United States and other countries.]
- *
- * ------------------
- * PieGraph.java
- * ------------------
- * (C) Copyright 2003-2007, by Object Refinery Limited and Contributors.
- *
- * Original Author: David Gilbert (for Object Refinery Limited);
- * Contributor(s): ;
- *
- * Changes
- * -------
- * 09-Mar-2005 : Version 1, copied from the demo collection that ships with
- * the JFreeChart Developer Guide (DG);
- *
- */
-
-package org.gcube.contentmanagement.graphtools.plotting.graphs;
-
-import java.awt.Color;
-import java.util.List;
-
-import org.gcube.contentmanagement.graphtools.abstracts.GenericStandaloneGraph;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphData;
-import org.gcube.portlets.user.timeseries.charts.support.types.Point;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.plot.XYPlot;
-import org.jfree.chart.renderer.xy.XYSplineRenderer;
-import org.jfree.data.general.Dataset;
-import org.jfree.data.xy.XYDataset;
-import org.jfree.data.xy.XYSeries;
-import org.jfree.data.xy.XYSeriesCollection;
-import org.jfree.ui.RectangleInsets;
-
-public class NumericSeriesGraph extends GenericStandaloneGraph {
-
- private static final long serialVersionUID = 1L;
-
- public NumericSeriesGraph(String title) {
- super(title);
- }
-
- protected Dataset generateDataset() {
- XYSeries xyseries = new XYSeries("Series 1");
- xyseries.add(2D, 56.270000000000003D);
- xyseries.add(3D, 41.32D);
- xyseries.add(4D, 31.449999999999999D);
- xyseries.add(5D, 30.050000000000001D);
- xyseries.add(6D, 24.690000000000001D);
- xyseries.add(7D, 19.780000000000001D);
- xyseries.add(8D, 20.940000000000001D);
- xyseries.add(9D, 16.73D);
- xyseries.add(10D, 14.210000000000001D);
- xyseries.add(11D, 12.44D);
- XYSeriesCollection xyseriescollection = new XYSeriesCollection(xyseries);
- XYSeries xyseries1 = new XYSeries("Series 2");
- xyseries1.add(11D, 56.270000000000003D);
- xyseries1.add(10D, 41.32D);
- xyseries1.add(9D, 31.449999999999999D);
- xyseries1.add(8D, 30.050000000000001D);
- xyseries1.add(7D, 24.690000000000001D);
- xyseries1.add(6D, 19.780000000000001D);
- xyseries1.add(5D, 20.940000000000001D);
- xyseries1.add(4D, 16.73D);
- xyseries1.add(3D, 14.210000000000001D);
- xyseries1.add(2D, 12.44D);
- xyseriescollection.addSeries(xyseries1);
-
- return xyseriescollection;
- }
-
- protected JFreeChart createChart(Dataset dataset) {
-
- NumberAxis numberaxis = new NumberAxis("X");
- numberaxis.setAutoRangeIncludesZero(true);
- NumberAxis numberaxis1 = new NumberAxis("Y");
- numberaxis1.setAutoRangeIncludesZero(true);
- XYSplineRenderer xysplinerenderer = new XYSplineRenderer();
- XYPlot xyplot = new XYPlot((XYDataset) dataset, numberaxis, numberaxis1, xysplinerenderer);
- xyplot.setBackgroundPaint(Color.lightGray);
- xyplot.setDomainGridlinePaint(Color.white);
- xyplot.setRangeGridlinePaint(Color.white);
- xyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));
- JFreeChart chart = new JFreeChart("Numeric Series", JFreeChart.DEFAULT_TITLE_FONT, xyplot, true);
-
- return chart;
- }
-
- @Override
- protected Dataset convert2Dataset(GraphData st) {
-
- List> pointslist = st.getData();
-
- // NOTE: after the graph generation graphs are inverted in x and y
- int numbOfRows = pointslist.size();
- XYSeriesCollection xyseriescollection = new XYSeriesCollection();
-
- if (numbOfRows > 0) {
- int numbOfCols = pointslist.get(0).getEntries().size();
- // calclulation will be made only for the first series
-
- for (int x = 0; x < numbOfRows; x++) {
-
- String serieslabel = pointslist.get(x).getLabel();
- XYSeries xyseries = new XYSeries(serieslabel);
-
- for (int y = 0; y < numbOfCols; y++) {
-// String xlabel = pointslist.get(x).getEntries().get(y).getLabel();
- double value = pointslist.get(x).getEntries().get(y).getValue().doubleValue();
- xyseries.add(y + 1, value);
- }
-
- xyseriescollection.addSeries(xyseries);
- }
- }
- return xyseriescollection;
- }
-
- @Override
- protected GenericStandaloneGraph getInstance(String title) {
- return new NumericSeriesGraph(title);
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/PieGraph.java b/src/org/gcube/contentmanagement/graphtools/plotting/graphs/PieGraph.java
deleted file mode 100644
index 167f765..0000000
--- a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/PieGraph.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/* ===========================================================
- * JFreeChart : a free chart library for the Java(tm) platform
- * ===========================================================
- *
- * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors.
- *
- * Project Info: http://www.jfree.org/jfreechart/index.html
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
- * in the United States and other countries.]
- *
- * ------------------
- * PieGraph.java
- * ------------------
- * (C) Copyright 2003-2007, by Object Refinery Limited and Contributors.
- *
- * Original Author: David Gilbert (for Object Refinery Limited);
- * Contributor(s): ;
- *
- * Changes
- * -------
- * 09-Mar-2005 : Version 1, copied from the demo collection that ships with
- * the JFreeChart Developer Guide (DG);
- *
- */
-
-package org.gcube.contentmanagement.graphtools.plotting.graphs;
-
-import java.util.List;
-
-import org.gcube.contentmanagement.graphtools.abstracts.GenericStandaloneGraph;
-import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphData;
-import org.gcube.portlets.user.timeseries.charts.support.types.Point;
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.JFreeChart;
-import org.jfree.data.category.DefaultCategoryDataset;
-import org.jfree.data.general.Dataset;
-import org.jfree.data.general.DefaultPieDataset;
-import org.jfree.util.TableOrder;
-
-public class PieGraph extends GenericStandaloneGraph {
-
- private static final long serialVersionUID = 1L;
-
- public PieGraph(String title) {
- super(title);
- }
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-
- protected Dataset generateDataset() {
- DefaultPieDataset dataset = new DefaultPieDataset();
- dataset.setValue("One", Double.valueOf(43.2));
- dataset.setValue("Two", Double.valueOf(10.0));
- dataset.setValue("Three", Double.valueOf(27.5));
- dataset.setValue("Four", Double.valueOf(17.5));
- dataset.setValue("Five", Double.valueOf(11.0));
- dataset.setValue("Six", Double.valueOf(19.4));
-
- return dataset;
- }
-/*
- protected JFreeChart createChart(Dataset dataset) {
-
- PiePlot plot = new PiePlot((DefaultPieDataset) dataset);
- JFreeChart chart = new JFreeChart(plot);
-
- return chart;
- }
-*/
- protected JFreeChart createChart(Dataset dataset) {
- JFreeChart chart = ChartFactory.createMultiplePieChart(
- "Multiple Pie Chart", // chart title
- (DefaultCategoryDataset)dataset, // dataset
- TableOrder.BY_ROW,
- true, // include legend
- true,
- false
- );
- return chart;
- }
-
-
- protected Dataset convert2DatasetOld(GraphData st) {
-
- DefaultPieDataset dataset = new DefaultPieDataset();
- List> pointslist = st.getData();
-
- // NOTE: after the graph generation graphs are inverted in x and y
- int numbOfRows = pointslist.size();
- if (numbOfRows > 0) {
- int numbOfCols = pointslist.get(0).getEntries().size();
- // calclulation will be made only for the first series
- int x = 0;
-
- String xlabel = pointslist.get(x).getLabel();
-
- //calculate maximum
- double max = 0;
- for (int y = 0; y < numbOfCols; y++) {
- double value = pointslist.get(x).getEntries().get(y).getValue().doubleValue();
- if (value>max){
- max = value;
- }
- }
-
-
- for (int y = 0; y < numbOfCols; y++) {
- double value = pointslist.get(x).getEntries().get(y).getValue().doubleValue();
- value = (value/max)*100;
- String ylabel = pointslist.get(x).getEntries().get(y).getLabel();
- AnalysisLogger.getLogger().info(xlabel + ":" + ylabel +"->" + value);
- dataset.setValue(xlabel + ":" + ylabel, value);
- }
-
- }
- return dataset;
- }
-
- @Override
- protected GenericStandaloneGraph getInstance(String title) {
- return new PieGraph(title);
- }
-
-
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/RadarGraph.java b/src/org/gcube/contentmanagement/graphtools/plotting/graphs/RadarGraph.java
deleted file mode 100644
index a070ea0..0000000
--- a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/RadarGraph.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.gcube.contentmanagement.graphtools.plotting.graphs;
-
-
-import org.gcube.contentmanagement.graphtools.abstracts.GenericStandaloneGraph;
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.plot.SpiderWebPlot;
-import org.jfree.data.category.DefaultCategoryDataset;
-import org.jfree.data.general.Dataset;
-
-public class RadarGraph extends GenericStandaloneGraph{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public RadarGraph(String title) {
- super(title);
- }
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- protected Dataset generateDataset() {
- DefaultCategoryDataset dataset = new DefaultCategoryDataset();
- dataset.addValue(35.0, "S1", "C1");
- dataset.addValue(45.0, "S1", "C2");
- dataset.addValue(55.0, "S1", "C3");
- dataset.addValue(15.0, "S1", "C4");
- dataset.addValue(25.0, "S1", "C5");
- dataset.addValue(39.0, "S2", "C1");
- dataset.addValue(20.0, "S2", "C2");
- dataset.addValue(34.0, "S2", "C3");
- dataset.addValue(30.0, "S2", "C4");
- dataset.addValue(13.0, "S2", "C5");
- return dataset;
- }
-
-
- @Override
- protected JFreeChart createChart(Dataset dataset) {
-
- SpiderWebPlot plot = new SpiderWebPlot((DefaultCategoryDataset)dataset);
- JFreeChart chart = new JFreeChart(plot);
-
- return chart;
- }
-
-
- @Override
- protected GenericStandaloneGraph getInstance(String title) {
- return new RadarGraph(title);
- }
-
-
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/ScatterGraphGeneric.java b/src/org/gcube/contentmanagement/graphtools/plotting/graphs/ScatterGraphGeneric.java
deleted file mode 100644
index 4049fe2..0000000
--- a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/ScatterGraphGeneric.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/* ===========================================================
- * JFreeChart : a free chart library for the Java(tm) platform
- * ===========================================================
- *
- * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors.
- *
- * Project Info: http://www.jfree.org/jfreechart/index.html
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
- * in the United States and other countries.]
- *
- * ------------------
- * PieGraph.java
- * ------------------
- * (C) Copyright 2003-2007, by Object Refinery Limited and Contributors.
- *
- * Original Author: David Gilbert (for Object Refinery Limited);
- * Contributor(s): ;
- *
- * Changes
- * -------
- * 09-Mar-2005 : Version 1, copied from the demo collection that ships with
- * the JFreeChart Developer Guide (DG);
- *
- */
-
-package org.gcube.contentmanagement.graphtools.plotting.graphs;
-
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.util.List;
-
-import org.gcube.contentmanagement.graphtools.abstracts.GenericStandaloneGraph;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphData;
-import org.gcube.portlets.user.timeseries.charts.support.types.Point;
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.plot.CategoryPlot;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.plot.XYPlot;
-import org.jfree.chart.renderer.category.LineAndShapeRenderer;
-import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
-import org.jfree.data.category.DefaultCategoryDataset;
-import org.jfree.data.general.Dataset;
-import org.jfree.data.xy.XYDataset;
-import org.jfree.data.xy.XYSeries;
-import org.jfree.data.xy.XYSeriesCollection;
-
-public class ScatterGraphGeneric extends GenericStandaloneGraph {
-
- private static final long serialVersionUID = 1L;
-
- public ScatterGraphGeneric(String title) {
- super(title);
- }
-
- protected Dataset generateDataset() {
- return null;
- }
-
- protected JFreeChart createChart(Dataset dataset) {
-
- // create the chart...
- JFreeChart chart = ChartFactory.createLineChart(
- "", // chart title
- "", // domain axis label
- "", // range axis label
- (DefaultCategoryDataset)dataset, // data
- PlotOrientation.VERTICAL, // orientation
- true, // include legend
- true, // tooltips
- false // urls
- );
- chart.setBackgroundPaint(Color.white);
- CategoryPlot plot = chart.getCategoryPlot();
- /*
- plot.setDomainGridlineStroke(new BasicStroke(0.0F));
- plot.setDomainGridlinePaint(Color.blue);
- plot.setRangeGridlineStroke(new BasicStroke(0.0F));
- plot.setRangeMinorGridlineStroke(new BasicStroke(0.0F));
- plot.setRangeGridlinePaint(Color.blue);
- plot.setRangeMinorGridlinesVisible(true);
- plot.setNoDataMessage("NO DATA");
- plot.setRangePannable(true);
- plot.setRangeZeroBaselineVisible(true);
- */
- plot.setBackgroundPaint(Color.white);
- plot.setRangeGridlinePaint(Color.white);
- plot.setRangeGridlinePaint(Color.white);
- plot.setDomainCrosshairVisible(true);
- plot.setDomainGridlinesVisible(false);
- plot.setRangeCrosshairVisible(true);
- plot.setRenderer(new LineAndShapeRenderer(false,true));
-
- //deprecated
- /*
- LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
- renderer.setShapesVisible(true);
- renderer.setDrawOutlines(true);
- renderer.setUseFillPaint(true);
- renderer.setFillPaint(Color.white);
-*/
-
-
-
-
- return chart;
- }
-
- @Override
- protected GenericStandaloneGraph getInstance(String title) {
- return new ScatterGraphGeneric(title);
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/ScatterGraphNumeric.java b/src/org/gcube/contentmanagement/graphtools/plotting/graphs/ScatterGraphNumeric.java
deleted file mode 100644
index 49dd47d..0000000
--- a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/ScatterGraphNumeric.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/* ===========================================================
- * JFreeChart : a free chart library for the Java(tm) platform
- * ===========================================================
- *
- * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors.
- *
- * Project Info: http://www.jfree.org/jfreechart/index.html
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
- * in the United States and other countries.]
- *
- * ------------------
- * PieGraph.java
- * ------------------
- * (C) Copyright 2003-2007, by Object Refinery Limited and Contributors.
- *
- * Original Author: David Gilbert (for Object Refinery Limited);
- * Contributor(s): ;
- *
- * Changes
- * -------
- * 09-Mar-2005 : Version 1, copied from the demo collection that ships with
- * the JFreeChart Developer Guide (DG);
- *
- */
-
-package org.gcube.contentmanagement.graphtools.plotting.graphs;
-
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.util.List;
-
-import org.gcube.contentmanagement.graphtools.abstracts.GenericStandaloneGraph;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphData;
-import org.gcube.portlets.user.timeseries.charts.support.types.Point;
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.plot.XYPlot;
-import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
-import org.jfree.data.category.DefaultCategoryDataset;
-import org.jfree.data.general.Dataset;
-import org.jfree.data.xy.XYDataset;
-import org.jfree.data.xy.XYSeries;
-import org.jfree.data.xy.XYSeriesCollection;
-
-public class ScatterGraphNumeric extends GenericStandaloneGraph {
-
- private static final long serialVersionUID = 1L;
-
- public ScatterGraphNumeric(String title) {
- super(title);
- }
-
- protected Dataset generateDataset() {
- return null;
- }
-
- protected JFreeChart createChart(Dataset dataset) {
-
- JFreeChart jfreechart = ChartFactory.createScatterPlot("", "", "", (XYDataset)dataset, PlotOrientation.VERTICAL, true, true, false);
- XYPlot xyplot = (XYPlot)jfreechart.getPlot();
- xyplot.setNoDataMessage("NO DATA");
- xyplot.setDomainPannable(true);
- xyplot.setRangePannable(true);
- xyplot.setDomainZeroBaselineVisible(true);
- xyplot.setRangeZeroBaselineVisible(true);
- xyplot.setDomainGridlineStroke(new BasicStroke(0.0F));
- xyplot.setDomainMinorGridlineStroke(new BasicStroke(0.0F));
- xyplot.setDomainGridlinePaint(Color.blue);
- xyplot.setRangeGridlineStroke(new BasicStroke(0.0F));
- xyplot.setRangeMinorGridlineStroke(new BasicStroke(0.0F));
- xyplot.setRangeGridlinePaint(Color.blue);
- xyplot.setDomainMinorGridlinesVisible(true);
- xyplot.setRangeMinorGridlinesVisible(true);
- XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer)xyplot.getRenderer();
- xylineandshaperenderer.setSeriesOutlinePaint(0, Color.black);
- xylineandshaperenderer.setUseOutlinePaint(true);
- NumberAxis numberaxis = (NumberAxis)xyplot.getDomainAxis();
- numberaxis.setAutoRangeIncludesZero(false);
- numberaxis.setTickMarkInsideLength(2.0F);
- numberaxis.setTickMarkOutsideLength(2.0F);
- numberaxis.setMinorTickCount(2);
- numberaxis.setMinorTickMarksVisible(true);
- NumberAxis numberaxis1 = (NumberAxis)xyplot.getRangeAxis();
- numberaxis1.setTickMarkInsideLength(2.0F);
- numberaxis1.setTickMarkOutsideLength(2.0F);
- numberaxis1.setMinorTickCount(2);
- numberaxis1.setMinorTickMarksVisible(true);
- return jfreechart;
- }
-
- @Override
- protected Dataset convert2Dataset(GraphData st) {
-
- List> pointslist = st.getData();
-
- // NOTE: after the graph generation graphs are inverted in x and y
- int numbOfRows = pointslist.size();
- XYSeriesCollection xyseriescollection = new XYSeriesCollection();
-
- if (numbOfRows > 0) {
- int numbOfCols = pointslist.get(0).getEntries().size();
- // calculation will be made only for the first series
-
- for (int x = 0; x < numbOfRows; x++) {
-
- String serieslabel = pointslist.get(x).getLabel();
- XYSeries xyseries = new XYSeries(serieslabel);
-
- for (int y = 0; y < numbOfCols; y++) {
-// String xlabel = pointslist.get(x).getEntries().get(y).getLabel();
- double value = pointslist.get(x).getEntries().get(y).getValue().doubleValue();
- xyseries.add(y + 1, value);
- }
-
- xyseriescollection.addSeries(xyseries);
- }
- }
- return xyseriescollection;
- }
-
- @Override
- protected GenericStandaloneGraph getInstance(String title) {
- return new ScatterGraphNumeric(title);
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/TimeSeriesGraph.java b/src/org/gcube/contentmanagement/graphtools/plotting/graphs/TimeSeriesGraph.java
deleted file mode 100644
index db47b0e..0000000
--- a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/TimeSeriesGraph.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/* ===========================================================
- * JFreeChart : a free chart library for the Java(tm) platform
- * ===========================================================
- *
- * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors.
- *
- * Project Info: http://www.jfree.org/jfreechart/index.html
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
- * in the United States and other countries.]
- *
- * ------------------
- * PieGraph.java
- * ------------------
- * (C) Copyright 2003-2007, by Object Refinery Limited and Contributors.
- *
- * Original Author: David Gilbert (for Object Refinery Limited);
- * Contributor(s): ;
- *
- * Changes
- * -------
- * 09-Mar-2005 : Version 1, copied from the demo collection that ships with
- * the JFreeChart Developer Guide (DG);
- *
- */
-
-package org.gcube.contentmanagement.graphtools.plotting.graphs;
-
-import java.awt.Color;
-import java.sql.Date;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.List;
-
-import org.gcube.contentmanagement.graphtools.abstracts.GenericStandaloneGraph;
-import org.gcube.contentmanagement.graphtools.utils.DateGuesser;
-import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphData;
-import org.gcube.portlets.user.timeseries.charts.support.types.Point;
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.DateAxis;
-import org.jfree.chart.plot.XYPlot;
-import org.jfree.chart.renderer.xy.XYItemRenderer;
-import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
-import org.jfree.data.general.Dataset;
-import org.jfree.data.time.Day;
-import org.jfree.data.time.Minute;
-import org.jfree.data.time.TimeSeries;
-import org.jfree.data.time.TimeSeriesCollection;
-import org.jfree.data.xy.XYDataset;
-import org.jfree.ui.RectangleInsets;
-
-public class TimeSeriesGraph extends GenericStandaloneGraph {
-
- private static final long serialVersionUID = 1L;
- private static final String formatYear= "yyyy";
- private static final String formatMonth= "MM-yyyy";
- private static final String formatDay= "MM-dd-yyyy";
- private String timeseriesformat;
-
-
- public TimeSeriesGraph(String title) {
- super(title);
- }
-
- protected Dataset generateDataset() {
- TimeSeriesCollection dataset = new TimeSeriesCollection();
-
- final TimeSeries s1 = new TimeSeries("Series 1");
- s1.add(new Minute(0, 0, 7, 12, 2003), 1.2);
- s1.add(new Minute(30, 12, 7, 12, 2003), 3.0);
- s1.add(new Minute(15, 14, 7, 12, 2003), 8.0);
-
- final TimeSeries s2 = new TimeSeries("Series 2");
- s2.add(new Minute(0, 3, 7, 12, 2003), 0.0);
- s2.add(new Minute(30, 9, 7, 12, 2003), 0.0);
- s2.add(new Minute(15, 10, 7, 12, 2003), 0.0);
-
- dataset.addSeries(s1);
- dataset.addSeries(s2);
-
- return dataset;
- }
-
- protected JFreeChart createChart(Dataset dataset) {
-
-
- JFreeChart chart = ChartFactory.createTimeSeriesChart(
- "Time Series", // title
- "", // x-axis label
- "", // y-axis label
- (XYDataset)dataset, // data
- true, // create legend?
- true, // generate tooltips?
- false // generate URLs?
- );
-
- chart.setBackgroundPaint(Color.white);
-
- XYPlot plot = (XYPlot) chart.getPlot();
- plot.setBackgroundPaint(Color.lightGray);
- plot.setDomainGridlinePaint(Color.white);
- plot.setRangeGridlinePaint(Color.white);
- plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
- plot.setDomainCrosshairVisible(true);
- plot.setRangeCrosshairVisible(true);
-
- XYItemRenderer r = plot.getRenderer();
- if (r instanceof XYLineAndShapeRenderer) {
- XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
- renderer.setBaseShapesVisible(true);
- renderer.setBaseShapesFilled(true);
- renderer.setDrawSeriesLineAsPath(true);
- }
-
- DateAxis axis = (DateAxis) plot.getDomainAxis();
-
- axis.setDateFormatOverride(new SimpleDateFormat(timeseriesformat));
-
- return chart;
- }
-
- @Override
- protected Dataset convert2Dataset(GraphData st) {
-
- List> pointslist = st.getData();
-
- // NOTE: after the graph generation graphs are inverted in x and y
- int numbOfRows = pointslist.size();
- TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
-
- if (numbOfRows > 0) {
- int numbOfCols = pointslist.get(0).getEntries().size();
- // calclulation will be made only for the first series
-
- for (int x = 0; x < numbOfRows; x++) {
-
- String serieslabel = pointslist.get(x).getLabel();
- TimeSeries xyseries = new TimeSeries(serieslabel);
-
- for (int y = 0; y < numbOfCols; y++) {
- String xlabel = pointslist.get(x).getEntries().get(y).getLabel();
- double value = pointslist.get(x).getEntries().get(y).getValue().doubleValue();
- Calendar cal = DateGuesser.convertDate(xlabel);
- String granularity = DateGuesser.granularity(xlabel);
-
- if (granularity.equals(DateGuesser.YEAR)) timeseriesformat = formatYear;
- else if (granularity.equals(DateGuesser.MONTH)) timeseriesformat = formatMonth;
- else if (granularity.equals(DateGuesser.DAY)) timeseriesformat = formatDay;
-
- AnalysisLogger.getLogger().debug("TimeSeriesGraph-> granularity "+granularity+" format "+timeseriesformat);
-
- xyseries.add(new Day(new Date(cal.getTimeInMillis())),value);
-
- }
-
- timeseriescollection.addSeries(xyseries);
- }
- }
- return timeseriescollection;
- }
-
- @Override
- protected GenericStandaloneGraph getInstance(String title) {
- TimeSeriesGraph tsg = new TimeSeriesGraph(title);
- tsg.timeseriesformat = timeseriesformat;
- return tsg;
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/TransectLineGraph.java b/src/org/gcube/contentmanagement/graphtools/plotting/graphs/TransectLineGraph.java
deleted file mode 100644
index fc74931..0000000
--- a/src/org/gcube/contentmanagement/graphtools/plotting/graphs/TransectLineGraph.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/* ===========================================================
- * JFreeChart : a free chart library for the Java(tm) platform
- * ===========================================================
- *
- * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors.
- *
- * Project Info: http://www.jfree.org/jfreechart/index.html
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
- * in the United States and other countries.]
- *
- * ------------------
- * PieGraph.java
- * ------------------
- * (C) Copyright 2003-2007, by Object Refinery Limited and Contributors.
- *
- * Original Author: David Gilbert (for Object Refinery Limited);
- * Contributor(s): ;
- *
- * Changes
- * -------
- * 09-Mar-2005 : Version 1, copied from the demo collection that ships with
- * the JFreeChart Developer Guide (DG);
- *
- */
-
-package org.gcube.contentmanagement.graphtools.plotting.graphs;
-
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.Graphics2D;
-import java.awt.geom.Rectangle2D;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.gcube.contentmanagement.graphtools.abstracts.GenericStandaloneGraph;
-import org.gcube.contentmanagement.graphtools.utils.MathFunctions;
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.AxisLocation;
-import org.jfree.chart.axis.AxisState;
-import org.jfree.chart.axis.CategoryAxis;
-import org.jfree.chart.axis.CategoryLabelPositions;
-import org.jfree.chart.axis.CategoryTick;
-import org.jfree.chart.plot.CategoryPlot;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.renderer.category.LineAndShapeRenderer;
-import org.jfree.chart.title.TextTitle;
-import org.jfree.data.category.DefaultCategoryDataset;
-import org.jfree.data.general.Dataset;
-import org.jfree.text.TextBlock;
-import org.jfree.text.TextBlockAnchor;
-import org.jfree.text.TextLine;
-import org.jfree.ui.RectangleEdge;
-import org.jfree.ui.RectangleInsets;
-import org.jfree.ui.TextAnchor;
-
-public class TransectLineGraph extends GenericStandaloneGraph {
-
- private static final long serialVersionUID = 1L;
-
- public TransectLineGraph(String title) {
- super(title);
- }
-
- protected Dataset generateDataset() {
- // row keys...
- String series1 = "First";
- String series2 = "Second";
- String series3 = "Third";
-
- // column keys...
- String type1 = "Type 1";
- String type2 = "Type 2";
- String type3 = "Type 3";
- String type4 = "Type 4";
- String type5 = "Type 5";
- String type6 = "Type 6";
- String type7 = "Type 7";
- String type8 = "Type 8";
-
- // create the dataset...
- DefaultCategoryDataset dataset = new DefaultCategoryDataset();
-
- dataset.addValue(1.0, series1, type1);
- dataset.addValue(4.0, series1, type2);
- dataset.addValue(3.0, series1, type3);
- dataset.addValue(5.0, series1, type4);
- dataset.addValue(5.0, series1, type5);
- dataset.addValue(7.0, series1, type6);
- dataset.addValue(7.0, series1, type7);
- dataset.addValue(8.0, series1, type8);
-
- dataset.addValue(5.0, series2, type1);
- dataset.addValue(7.0, series2, type2);
- dataset.addValue(6.0, series2, type3);
- dataset.addValue(8.0, series2, type4);
- dataset.addValue(4.0, series2, type5);
- dataset.addValue(4.0, series2, type6);
- dataset.addValue(2.0, series2, type7);
- dataset.addValue(1.0, series2, type8);
-
- dataset.addValue(4.0, series3, type1);
- dataset.addValue(3.0, series3, type2);
- dataset.addValue(2.0, series3, type3);
- dataset.addValue(3.0, series3, type4);
- dataset.addValue(6.0, series3, type5);
- dataset.addValue(3.0, series3, type6);
- dataset.addValue(4.0, series3, type7);
- dataset.addValue(3.0, series3, type8);
- return dataset;
- }
-
- protected JFreeChart createChart(Dataset dataset) {
-
- DefaultCategoryDataset dataset1 = new DefaultCategoryDataset();
- DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();
- DefaultCategoryDataset dataset0 = (DefaultCategoryDataset)dataset;
- ArrayList relevantindexes = new ArrayList();
-
- for (Object row:dataset0.getRowKeys()){
- int spikescounter=0;
- int pointscounter=0;
- int allcounter=0;
- int mincolumns = 0;
- int maxcolumns = dataset0.getColumnCount()-1;
- int medcolumns = (maxcolumns)/2;
- for (Object column:dataset0.getColumnKeys()){
-// System.out.println("row "+row+" column "+column );
- double value = dataset0.getValue((String)row, (String)column).doubleValue();
- String xlab = (String) column;
- String annotation ="";
-
- String x1lab = xlab;
- int commaindex = xlab.indexOf(";");
- if (commaindex>0){
- annotation = xlab.substring(commaindex+1);
- x1lab = xlab.substring(0,commaindex);
- dataset2.addValue(value, (String)row, ""+(allcounter+1)+": "+annotation);
- spikescounter++;
- relevantindexes.add(allcounter);
- }
-
- else{
- if ((allcounter==mincolumns)||(allcounter==maxcolumns)||(allcounter==medcolumns))
- relevantindexes.add(allcounter);
-
- dataset2.addValue(value, (String)row, ""+(allcounter+1)+"");
- pointscounter++;
- }
- allcounter++;
- dataset1.addValue(value, (String)row, x1lab);
- }
- }
-
-
-
- // create the chart...
-
- JFreeChart chart = ChartFactory.createLineChart(
- " ", // chart title
- "", // domain axis label
- "", // range axis label
- (DefaultCategoryDataset)dataset1, // data
- PlotOrientation.VERTICAL, // orientation
- false, // include legend
- true, // tooltips
- false // urls
- );
-
- chart.setTitle(new TextTitle(" ", new Font("sansserif", Font.BOLD, 60)));
-
- chart.setBackgroundPaint(Color.white);
-
- CategoryPlot plot = chart.getCategoryPlot();
- plot.setBackgroundPaint(Color.white);
- plot.setRangeGridlinePaint(Color.white);
-
- plot.setDomainCrosshairVisible(true);
- plot.setDomainGridlinesVisible(true);
- plot.setRangeCrosshairVisible(true);
-// plot.setRenderer(new LineAndShapeRenderer(true,true));
- plot.setRenderer(new LineAndShapeRenderer(true,false));
- plot.setAxisOffset(new RectangleInsets(1D, 1D, 1D, 1D));
-
-
- plot.setDomainAxis(0,new CustomXAxis("",dataset1,relevantindexes));
- CategoryAxis categoryaxis1 = plot.getDomainAxis(0);
- categoryaxis1.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
- plot.mapDatasetToDomainAxis(0, 0);
-
- plot.setDataset(1, (DefaultCategoryDataset)dataset2);
- plot.setDomainAxis(1,new CustomXAxis("",dataset2,relevantindexes));
- CategoryAxis categoryaxis2 = plot.getDomainAxis(1);
- categoryaxis2.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
- plot.mapDatasetToDomainAxis(1, 1);
- plot.setDomainAxisLocation(1, AxisLocation.TOP_OR_LEFT);
-
-
-// categoryaxis2.setLabelInsets(new RectangleInsets(100, 100, 100, 100));
-
-// categoryaxis2.setLowerMargin(0.05D);
-// categoryaxis2.setUpperMargin(1D);
-
-// plot.mapDatasetToRangeAxis(1, 1);
- //deprecated
- /*
- LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
- renderer.setShapesVisible(true);
- renderer.setDrawOutlines(true);
- renderer.setUseFillPaint(true);
- renderer.setFillPaint(Color.white);
-*/
-
-
-// rangeAxis.setStandardTickUnits(ValueAxis);
-// rangeAxis.setAutoRangeIncludesZero(false);
-// rangeAxis.setUpperMargin(0.12);
-
- chart.setPadding(new RectangleInsets(30, 30, 90, 90));
-
- big=true;
- chart.getPlot().setBackgroundPaint(Color.white);
-
- return chart;
- }
-
- @Override
- protected GenericStandaloneGraph getInstance(String title) {
-
- return new TransectLineGraph(title);
- }
-
-
-
- static class CustomXAxis extends CategoryAxis
- {
-
- DefaultCategoryDataset dataset;
- List samplingindexes;
- public java.util.List refreshTicks(Graphics2D graphics2d, AxisState axisstate, Rectangle2D rectangle2d, RectangleEdge rectangleedge)
- {
- ArrayList arraylist = new ArrayList();
- int size = dataset.getColumnCount();
-
-
-
- for (int i=0;i indexes)
- {
- super(s);
- dataset = d;
- samplingindexes = indexes;
- }
- }
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/tests/RegressionTestAllGraphs.java b/src/org/gcube/contentmanagement/graphtools/tests/RegressionTestAllGraphs.java
deleted file mode 100644
index 8dcaf1f..0000000
--- a/src/org/gcube/contentmanagement/graphtools/tests/RegressionTestAllGraphs.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.gcube.contentmanagement.graphtools.tests;
-
-import org.gcube.contentmanagement.graphtools.core.StatisticsGenerator;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.GaussianDistributionGraph;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.HistogramGraph;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.LineGraph;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.PieGraph;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.RadarGraph;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.ScatterGraphGeneric;
-import org.gcube.contentmanagement.lexicalmatcher.analysis.core.LexicalEngineConfiguration;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphGroups;
-
-
-public class RegressionTestAllGraphs {
-
-
- public static void main(String[] args) throws Exception{
-
- String table = "rdm7d053300d89e11e087918065b36ddd05";
- String xDimension = "field3";
- String yDimension = "field5";
- String groupDimension = "field2";
- String linesColumn = "field4";
- String filter1 = "Perciformes";
- String filter2 = "Osteichthyes";
- StatisticsGenerator stg = new StatisticsGenerator();
-
-
- LexicalEngineConfiguration conf = new LexicalEngineConfiguration();
-
- //database Parameters
- conf.setDatabaseURL("jdbc:postgresql://localhost/testdb");
- conf.setDatabaseUserName("gcube");
- conf.setDatabasePassword("d4science2");
- conf.setDatabaseDriver("org.postgresql.Driver");
- conf.setDatabaseDialect("org.hibernate.dialect.PostgreSQLDialect");
-
- stg.init("./cfg/",conf);
-
-// stg.addColumnFilter("field4", "F","=");
-
- //String generation
- GraphGroups gg = stg.generateGraphs(100, table, xDimension, yDimension, groupDimension, linesColumn, filter1, filter2);
- //graph plot
- RadarGraph series = new RadarGraph("");
- series.renderGraphGroup(gg);
-
- HistogramGraph series2 = new HistogramGraph("");
- series2.renderGraphGroup(gg);
-
- LineGraph series3 = new LineGraph("");
- series3.renderGraphGroup(gg);
-
- PieGraph series4 = new PieGraph("");
- series4.renderGraphGroup(gg);
-
- GaussianDistributionGraph series5 = new GaussianDistributionGraph("");
- series5.renderGraphGroup(gg);
-
- ScatterGraphGeneric series6 = new ScatterGraphGeneric("");
- series6.renderGraphGroup(gg);
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/tests/old/ExampleDerivative.java b/src/org/gcube/contentmanagement/graphtools/tests/old/ExampleDerivative.java
deleted file mode 100644
index d2695b9..0000000
--- a/src/org/gcube/contentmanagement/graphtools/tests/old/ExampleDerivative.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.gcube.contentmanagement.graphtools.tests.old;
-
-
-import org.gcube.contentmanagement.graphtools.core.StatisticsGenerator;
-import org.gcube.contentmanagement.graphtools.data.BigSamplesTable;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.TimeSeriesGraph;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphGroups;
-
-import com.rapidminer.RapidMiner;
-import com.rapidminer.example.ExampleSet;
-import com.rapidminer.operator.preprocessing.sampling.AbsoluteSampling;
-import com.rapidminer.tools.OperatorService;
-import com.rapidminer.tools.math.MathFunctions;
-
-public class ExampleDerivative {
-
-
- public static void main(String[] args) throws Exception{
-
- String table = "ts_a904da30_b4fc_11df_800d_bcef80d51986";
- String xDimension = "field1";
- String yDimension = "field4";
- String groupDimension = "field2";
- String speciesColumn = "field3";
- String filter1 = "Toluene";
-// String filter2 = "Osteichthyes";
- StatisticsGenerator stg = new StatisticsGenerator();
-
- stg.init("./cfg/");
-
- GraphGroups gg = stg.generateGraphs(200, table, xDimension, yDimension, groupDimension, speciesColumn, filter1);
-
- TimeSeriesGraph series = new TimeSeriesGraph("");
- series.renderGraphGroup(gg);
-
- }
-
-
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/tests/old/ExampleMathFunctions.java b/src/org/gcube/contentmanagement/graphtools/tests/old/ExampleMathFunctions.java
deleted file mode 100644
index 2643b1b..0000000
--- a/src/org/gcube/contentmanagement/graphtools/tests/old/ExampleMathFunctions.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.gcube.contentmanagement.graphtools.tests.old;
-
-
-import org.gcube.contentmanagement.graphtools.data.BigSamplesTable;
-
-import com.rapidminer.RapidMiner;
-import com.rapidminer.example.ExampleSet;
-import com.rapidminer.operator.preprocessing.sampling.AbsoluteSampling;
-import com.rapidminer.tools.OperatorService;
-import com.rapidminer.tools.math.MathFunctions;
-
-public class ExampleMathFunctions {
-
-
- public static void main(String[] args) throws Exception{
-
- double variance = MathFunctions.variance(new double[] { 0.1, 0.1, 0.0, -0.1 }, Double.NEGATIVE_INFINITY);
- double covariance = MathFunctions.correlation(new double[] { 0.1, 0.2, -0.3, 0.0 }, new double[] { 0.0, 0.1, 0.1, -0.1 });
- double meanc = mean(new double[] { 0.1, 0.1, 0.0, -0.1 });
-
-// String pluginDirString = new File("C:/Users/coro/Desktop/WorkFolder/Workspace/RapidMinerPlugins/TextProcessing/Vega/lib/").getAbsolutePath();
-// System.setProperty(RapidMiner.PROPERTY_RAPIDMINER_INIT_PLUGINS_LOCATION, pluginDirString);
- System.setProperty("rapidminer.init.operators","C:/Users/coro/Desktop/WorkFolder/Workspace/RapidMiner_Wasat/resources/operators.xml");
-
- RapidMiner.init ();
-
- BigSamplesTable bst = new BigSamplesTable();
- bst.addSampleRow("prova 1", 10, 12,13,14,15);
- bst.addSampleRow("prova 2", 20, 15,14,15);
- bst.addSampleRow("prova 3", 30, 11,110,150);
- System.out.println(bst.toString());
-
-// OperatorService.createOperator(ExampleSource.class);
-// as.apply(bst.generateExampleSet());
-
-// OperatorChain wvtoolOperator = (OperatorChain) OperatorService.createOperator(SingleTextInput.class);
-
-
-// Learner learner = (Learner)OperatorService .createOperator("J48");
-
- AbsoluteSampling as = (AbsoluteSampling)OperatorService .createOperator("AbsoluteSampling");
-// SimpleSampling ss = (SimpleSampling)OperatorService .createOperator("Sampling");
-// ss.setParameter("sample_ratio", "0.8");
- as.setParameter("sample_size", "2");
- as.setParameter("local_random_seed", "-1");
-
- ExampleSet exampleSet = bst.generateExampleSet();
- System.out.println(exampleSet.toResultString());
-
-
-// ExampleSet exampleSetOut = ss.apply(exampleSet);
- ExampleSet exampleSetOut = as.apply(exampleSet);
- System.out.println(exampleSetOut.toResultString());
-
- BigSamplesTable bstOut = new BigSamplesTable();
- bstOut.generateSampleTable(exampleSetOut);
- System.out.println(bstOut.toString());
-
-// as.apply(es);
-
-
- System.out.println("variance "+variance+" covariance "+covariance+" mean "+meanc);
-
-
-
- }
-
-
- //================================================= mean
- public static double mean(double[] p) {
- double sum = 0; // sum of all the elements
- for (int i=0; i attributes = new LinkedList();
- for (int a = 0; a < getMyNumOfAttributes(); a++) {
- attributes.add(AttributeFactory.createAttribute("att" + a, Ontology.REAL));
- }
- Attribute label = AttributeFactory.createAttribute(" label ", Ontology.NOMINAL);
- attributes.add(label);
- // create table
- MemoryExampleTable table = new MemoryExampleTable(attributes);
- // ll table (here : only real values )
- for (int d = 0; d < getMyNumOfDataRows(); d++) {
- double[] data = new double[attributes.size()];
- for (int a = 0; a < getMyNumOfAttributes(); a++) {
- // all with proper data here
- data[a] = getMyValue(d, a);
- }
- // maps the nominal classi cation to a double value
- data[data.length - 1] = label.getMapping().mapString(getMyClassification(d));
- // add data row
- table.addDataRow(new DoubleArrayDataRow(data));
- }
- // create example set
- ExampleSet exampleSet = table.createExampleSet(label);
- }
-
-
- //to be defined in future applications
- private static int getMyNumOfAttributes() {
- return 3;
- }
-
- private static int getMyNumOfDataRows() {
- return 10;
- }
-
- private static double getMyValue(int d, int a) {
- return 10;
- }
-
- private static String getMyClassification(int d) {
- return "ciao";
- }
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/tests/old/TestConverters.java b/src/org/gcube/contentmanagement/graphtools/tests/old/TestConverters.java
deleted file mode 100644
index 9d4550f..0000000
--- a/src/org/gcube/contentmanagement/graphtools/tests/old/TestConverters.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.gcube.contentmanagement.graphtools.tests.old;
-
-import java.util.List;
-
-import org.gcube.contentmanagement.graphtools.data.BigSamplesTable;
-import org.gcube.contentmanagement.graphtools.data.conversions.GraphConverter2D;
-import org.gcube.portlets.user.timeseries.charts.support.types.Point;
-
-
-public class TestConverters {
-
-
- public static void main1(String[] args) throws Exception{
- BigSamplesTable bst = new BigSamplesTable();
-
- bst.addSampleRow("prova 1", 10, 15);
- bst.addSampleRow("prova 2", 10, 12);
- bst.addSampleRow("prova 3", 30, 11);
- bst.addSampleRow("prova 1", 10, 15);
- bst.addSampleRow("prova 2", 10, 12);
- bst.addSampleRow("prova 3", 30, 11);
- bst.addSampleRow("prova 1", 10, 15);
- bst.addSampleRow("prova 2", 10, 12);
- bst.addSampleRow("prova 3", 30, 11);
- bst.addSampleRow("prova 1", 10, 15);
- bst.addSampleRow("prova 2", 10, 12);
- bst.addSampleRow("prova 3", 30, 11);
- bst.addSampleRow("prova 1", 10, 15);
- bst.addSampleRow("prova 2", 10, 12);
- bst.addSampleRow("prova 3", 30, 11);
- bst.addSampleRow("prova 1", 10, 15);
- bst.addSampleRow("prova 2", 10, 12);
- bst.addSampleRow("prova 3", 30, 11);
- bst.addSampleRow("prova 1", 10, 15);
- bst.addSampleRow("prova 2", 10, 12);
- bst.addSampleRow("prova 3", 30, 11);
-
-
- System.out.println(bst.toString());
-
-
- List> graphicus = GraphConverter2D.convert(bst);
- graphicus = GraphConverter2D.reduceDimension(graphicus);
-
-
- System.out.println("finished!");
-
- }
-
-
- public static void main(String[] args) throws Exception{
- BigSamplesTable bst = new BigSamplesTable();
-
- bst.addSampleRow("1;prova y1", 0, 0);
- bst.addSampleRow("1;prova y2", 0, 0);
- bst.addSampleRow("1;prova y3", 0, 0);
- bst.addSampleRow("prova 1;prova y1", 10, 15);
- bst.addSampleRow("prova 2;prova y2", 10, 12);
- bst.addSampleRow("prova 3;prova y2", 30, 11);
- bst.addSampleRow("prova 3;prova y1", 30, 10);
-
- System.out.println(bst.toString());
-
- List> graphicus = GraphConverter2D.convert(bst);
- graphicus = GraphConverter2D.reduceDimension(graphicus);
-
- System.out.println("finished!");
-
- }
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/tests/old/TestDBExtractor.java b/src/org/gcube/contentmanagement/graphtools/tests/old/TestDBExtractor.java
deleted file mode 100644
index f36ba0e..0000000
--- a/src/org/gcube/contentmanagement/graphtools/tests/old/TestDBExtractor.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.gcube.contentmanagement.graphtools.tests.old;
-
-import java.util.List;
-import java.util.Map;
-
-import org.gcube.contentmanagement.graphtools.abstracts.SamplesTable;
-import org.gcube.contentmanagement.graphtools.data.conversions.GraphConverter2D;
-import org.gcube.contentmanagement.graphtools.data.databases.CommonDBExtractor;
-import org.gcube.contentmanagement.lexicalmatcher.utils.DatabaseFactory;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphData;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphGroups;
-import org.gcube.portlets.user.timeseries.charts.support.types.Point;
-import org.hibernate.SessionFactory;
-
-
-public class TestDBExtractor {
-
-
-
- public static void main(String[] args) throws Exception{
-
-
- SessionFactory referenceDBSession = DatabaseFactory.initDBConnection("./hibernate.cfg.xml");
-
- CommonDBExtractor extractor = new CommonDBExtractor(referenceDBSession);
-
- String table = "ts_161efa00_2c32_11df_b8b3_aa10916debe6";
- String xDimension = "field5";
- String groupDimension = "field1";
- String yValue = "field6";
- String speciesColumn = "field3";
- String filter1 = "Brown seaweeds";
- String filter2 = "River eels";
-
- Map samplesMap = extractor.getMultiDimTemporalTables(table, xDimension, groupDimension, yValue, speciesColumn, filter1, filter2);
-
- System.out.println("MAP EXTRACTED : \n"+samplesMap.toString());
-
- GraphGroups graphgroups = new GraphGroups();
-
-
- for (String key:samplesMap.keySet()){
-
- SamplesTable stable = samplesMap.get(key);
- List> singlegraph = GraphConverter2D.transformTable(stable);
-
- GraphData grd = new GraphData(singlegraph,true);
- graphgroups.addGraph("Distribution for "+key, grd);
-
- }
-
- System.out.println("finished!");
-
- }
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/tests/old/TextTest.java b/src/org/gcube/contentmanagement/graphtools/tests/old/TextTest.java
deleted file mode 100644
index 80dbeb4..0000000
--- a/src/org/gcube/contentmanagement/graphtools/tests/old/TextTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.gcube.contentmanagement.graphtools.tests.old;
-
-import java.io.File;
-
-import com.rapidminer.RapidMiner;
-import com.rapidminer.operator.IOContainer;
-import com.rapidminer.operator.Model;
-import com.rapidminer.operator.ModelApplier;
-import com.rapidminer.operator.Operator;
-import com.rapidminer.operator.OperatorChain;
-import com.rapidminer.operator.io.ModelLoader;
-import com.rapidminer.tools.OperatorService;
-
-public class TextTest {
-
- public static void main(String[] argv) throws Exception {
-
- String pluginDirString = new File("C:\\Dokumente und Einstellungen\\Mierswa\\Eigene Dateien\\workspace\\RMTextTest\\lib").getAbsolutePath();
- System.setProperty(RapidMiner.PROPERTY_RAPIDMINER_INIT_PLUGINS_LOCATION, pluginDirString);
-
- File wordListFile = new File(".");
- File modelFile = new File(".");
-
- RapidMiner.init();
- /*
- OperatorChain wvtoolOperator = (OperatorChain) OperatorService.createOperator(SingleTextInput.class);
- wvtoolOperator.setParameter("input_word_list", wordListFile.getAbsolutePath());
-
- wvtoolOperator.addOperator(OperatorService.createOperator(SimpleTokenizer.class));
- wvtoolOperator.addOperator(OperatorService.createOperator(PorterStemmer.class));
-
- Operator modelApplier = OperatorService.createOperator(ModelApplier.class);
- Operator modelLoader = OperatorService.createOperator(ModelLoader.class);
- modelLoader.setParameter(ModelLoader.PARAMETER_MODEL_FILE, modelFile.getAbsolutePath());
- IOContainer container = modelLoader.apply(new IOContainer());
-
- Model model = container.get(Model.class);
- */
- }
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/tests/show/ExampleStringGraphData.java b/src/org/gcube/contentmanagement/graphtools/tests/show/ExampleStringGraphData.java
deleted file mode 100644
index eb8e0ff..0000000
--- a/src/org/gcube/contentmanagement/graphtools/tests/show/ExampleStringGraphData.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.gcube.contentmanagement.graphtools.tests.show;
-
-import org.gcube.contentmanagement.graphtools.core.StatisticsGenerator;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.GaussianDistributionGraph;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.HistogramGraph;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.LineGraph;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.PieGraph;
-import org.gcube.contentmanagement.graphtools.plotting.graphs.RadarGraph;
-import org.gcube.contentmanagement.lexicalmatcher.analysis.core.LexicalEngineConfiguration;
-import org.gcube.portlets.user.timeseries.charts.support.types.GraphGroups;
-
-
-public class ExampleStringGraphData {
-
-
- public static void main(String[] args) throws Exception{
- String table = "ts_3637f670_430c_11df_a0a2_909e7d074592";
- String xDimension = "field5";
- String yDimension = "field6";
- String groupDimension = "field1";
- String speciesColumn = "field3";
- String filter1 = "Crabs, sea-spiders";
- String filter2 = "Marine fishes not identified";
- StatisticsGenerator stg = new StatisticsGenerator();
-
-
- LexicalEngineConfiguration conf = new LexicalEngineConfiguration();
- //database Parameters
- conf.setDatabaseUserName("root");
-// conf.setDatabasePassword("password");
- conf.setDatabaseDriver("com.mysql.jdbc.Driver");
- conf.setDatabaseURL("jdbc:mysql://localhost/timeseries");
- conf.setDatabaseDialect("org.hibernate.dialect.MySQLDialect");
- conf.setDatabaseAutomaticTestTable("connectiontesttable");
- conf.setDatabaseIdleConnectionTestPeriod("3600");
-
-
- stg.init("./cfg/",conf);
-
- stg.addColumnFilter("field4", "F","=");
-
- //String generation
- GraphGroups gg = stg.generateGraphs(100, table, xDimension, yDimension, groupDimension, speciesColumn, filter1, filter2);
- //graph plot
- RadarGraph series = new RadarGraph("");
- series.renderGraphGroup(gg);
-
- HistogramGraph series2 = new HistogramGraph("");
- series2.renderGraphGroup(gg);
-
- LineGraph series3 = new LineGraph("");
- series3.renderGraphGroup(gg);
-
- PieGraph series4 = new PieGraph("");
- series4.renderGraphGroup(gg);
-
- GaussianDistributionGraph series5 = new GaussianDistributionGraph("");
- series5.renderGraphGroup(gg);
- }
-
-}
diff --git a/src/org/gcube/contentmanagement/graphtools/tests/testConnections.java b/src/org/gcube/contentmanagement/graphtools/tests/testConnections.java
deleted file mode 100644
index 47c8aa4..0000000
--- a/src/org/gcube/contentmanagement/graphtools/tests/testConnections.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.gcube.contentmanagement.graphtools.tests;
-
-import java.util.List;
-
-import org.gcube.contentmanagement.lexicalmatcher.analysis.core.LexicalEngineConfiguration;
-import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
-import org.gcube.contentmanagement.lexicalmatcher.utils.DatabaseFactory;
-import org.hibernate.SessionFactory;
-
-public class testConnections {
-
-
- public static void main(String args[]) throws Exception{
-
- LexicalEngineConfiguration conf = new LexicalEngineConfiguration();
-
- conf.setDatabaseURL("jdbc:postgresql://localhost/testdb");
- conf.setDatabaseUserName("gcube");
- conf.setDatabasePassword("d4science2");
- conf.setDatabaseDriver("org.postgresql.Driver");
- conf.setDatabaseDialect("org.hibernate.dialect.PostgreSQLDialect");
- String hibernateDefaultFile = "hibernate.cfg.xml";
- String loggerDefaultFile = "ALog.properties";
-
- String configPath = "./cfg/";
-
- AnalysisLogger.setLogger(configPath+loggerDefaultFile);
-
- SessionFactory session = DatabaseFactory.initDBConnection(configPath+hibernateDefaultFile,conf);
- List