Add demo
authorpyeongsoo.kim <pyeongsoo.kim@samsung.com>
Mon, 31 Oct 2011 06:57:40 +0000 (15:57 +0900)
committerpyeongsoo.kim <pyeongsoo.kim@samsung.com>
Mon, 31 Oct 2011 06:57:40 +0000 (15:57 +0900)
Add Jfreechart lib

com.samsung.dynamicanalyzer/.classpath
com.samsung.dynamicanalyzer/META-INF/MANIFEST.MF
com.samsung.dynamicanalyzer/build.properties
com.samsung.dynamicanalyzer/lib/jcommon-1.0.16.jar [new file with mode: 0644]
com.samsung.dynamicanalyzer/lib/jfreechart-1.0.13-experimental.jar [new file with mode: 0644]
com.samsung.dynamicanalyzer/lib/jfreechart-1.0.13-swt.jar [new file with mode: 0644]
com.samsung.dynamicanalyzer/lib/jfreechart-1.0.13.jar [new file with mode: 0644]
com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/ui/views/TimelineView.java

index 6ca3ead..c5a4756 100644 (file)
@@ -1,8 +1,12 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
-       <classpathentry exported="true" kind="lib" path="lib/sqlitejdbc-v056.jar"/>\r
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
-       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
-       <classpathentry kind="src" path="src"/>\r
-       <classpathentry kind="output" path="bin"/>\r
-</classpath>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry exported="true" kind="lib" path="lib/jcommon-1.0.16.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/jfreechart-1.0.13-experimental.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/jfreechart-1.0.13-swt.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/jfreechart-1.0.13.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/sqlitejdbc-v056.jar"/>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
index b5eb0ba..40798ef 100644 (file)
@@ -15,4 +15,8 @@ Export-Package: com.samsung.dynamicanalyzer;uses:="org.eclipse.ui.plugin,org.osg
  com.samsung.dynamicanalyzer.nl,
  com.samsung.dynamicanalyzer.ui.views;uses:="org.eclipse.ui.part,org.eclipse.swt.widgets"
 Bundle-ClassPath: lib/sqlitejdbc-v056.jar,
- .
+ .,
+ lib/jcommon-1.0.16.jar,
+ lib/jfreechart-1.0.13-experimental.jar,
+ lib/jfreechart-1.0.13-swt.jar,
+ lib/jfreechart-1.0.13.jar
index d792453..25c3b69 100644 (file)
@@ -5,5 +5,9 @@ bin.includes = plugin.xml,\
                .,\\r
                plugin.properties,\\r
                icons/,\\r
-               lib/sqlitejdbc-v056.jar\r
+               lib/sqlitejdbc-v056.jar,\\r
+               lib/jcommon-1.0.16.jar,\\r
+               lib/jfreechart-1.0.13-experimental.jar,\\r
+               lib/jfreechart-1.0.13-swt.jar,\\r
+               lib/jfreechart-1.0.13.jar\r
 \r
diff --git a/com.samsung.dynamicanalyzer/lib/jcommon-1.0.16.jar b/com.samsung.dynamicanalyzer/lib/jcommon-1.0.16.jar
new file mode 100644 (file)
index 0000000..4cd6807
Binary files /dev/null and b/com.samsung.dynamicanalyzer/lib/jcommon-1.0.16.jar differ
diff --git a/com.samsung.dynamicanalyzer/lib/jfreechart-1.0.13-experimental.jar b/com.samsung.dynamicanalyzer/lib/jfreechart-1.0.13-experimental.jar
new file mode 100644 (file)
index 0000000..3de3560
Binary files /dev/null and b/com.samsung.dynamicanalyzer/lib/jfreechart-1.0.13-experimental.jar differ
diff --git a/com.samsung.dynamicanalyzer/lib/jfreechart-1.0.13-swt.jar b/com.samsung.dynamicanalyzer/lib/jfreechart-1.0.13-swt.jar
new file mode 100644 (file)
index 0000000..8193fc9
Binary files /dev/null and b/com.samsung.dynamicanalyzer/lib/jfreechart-1.0.13-swt.jar differ
diff --git a/com.samsung.dynamicanalyzer/lib/jfreechart-1.0.13.jar b/com.samsung.dynamicanalyzer/lib/jfreechart-1.0.13.jar
new file mode 100644 (file)
index 0000000..83c6993
Binary files /dev/null and b/com.samsung.dynamicanalyzer/lib/jfreechart-1.0.13.jar differ
index 1459d23..cb17c93 100644 (file)
 package com.samsung.dynamicanalyzer.ui.views;\r
 \r
+import org.eclipse.swt.SWT;\r
 import org.eclipse.swt.widgets.Composite;\r
 import org.eclipse.ui.part.ViewPart;\r
+import org.jfree.chart.ChartFactory;\r
+import org.jfree.chart.JFreeChart;\r
+import org.jfree.chart.axis.CategoryAxis;\r
+import org.jfree.chart.axis.CategoryLabelPositions;\r
+import org.jfree.chart.plot.CategoryPlot;\r
+import org.jfree.chart.plot.PlotOrientation;\r
+import org.jfree.chart.renderer.category.BarRenderer3D;\r
+import org.jfree.data.category.CategoryDataset;\r
+import org.jfree.data.category.DefaultCategoryDataset;\r
+import org.jfree.experimental.chart.swt.ChartComposite;\r
 \r
 public class TimelineView extends ViewPart {\r
 \r
        public TimelineView() {\r
+\r
        }\r
 \r
        @Override\r
        public void createPartControl(Composite parent) {\r
+               JFreeChart chart = createChart(createDataset());\r
+               new ChartComposite(parent, SWT.NONE, chart, true);\r
        }\r
 \r
        @Override\r
        public void setFocus() {\r
+\r
+       }\r
+\r
+       /**\r
+        * Creates the Dataset for the Pie chart\r
+        */\r
+\r
+    private static CategoryDataset createDataset()\r
+    {\r
+        DefaultCategoryDataset defaultcategorydataset = new DefaultCategoryDataset();\r
+        defaultcategorydataset.addValue(10D, "Series 1", "Category 1");\r
+        defaultcategorydataset.addValue(4D, "Series 1", "Category 2");\r
+        defaultcategorydataset.addValue(15D, "Series 1", "Category 3");\r
+        defaultcategorydataset.addValue(14D, "Series 1", "Category 4");\r
+        defaultcategorydataset.addValue(-5D, "Series 2", "Category 1");\r
+        defaultcategorydataset.addValue(-7D, "Series 2", "Category 2");\r
+        defaultcategorydataset.addValue(14D, "Series 2", "Category 3");\r
+        defaultcategorydataset.addValue(-3D, "Series 2", "Category 4");\r
+        defaultcategorydataset.addValue(6D, "Series 3", "Category 1");\r
+        defaultcategorydataset.addValue(17D, "Series 3", "Category 2");\r
+        defaultcategorydataset.addValue(-12D, "Series 3", "Category 3");\r
+        defaultcategorydataset.addValue(7D, "Series 3", "Category 4");\r
+        defaultcategorydataset.addValue(7D, "Series 4", "Category 1");\r
+        defaultcategorydataset.addValue(15D, "Series 4", "Category 2");\r
+        defaultcategorydataset.addValue(11D, "Series 4", "Category 3");\r
+        defaultcategorydataset.addValue(0.0D, "Series 4", "Category 4");\r
+        defaultcategorydataset.addValue(-8D, "Series 5", "Category 1");\r
+        defaultcategorydataset.addValue(-6D, "Series 5", "Category 2");\r
+        defaultcategorydataset.addValue(10D, "Series 5", "Category 3");\r
+        defaultcategorydataset.addValue(-9D, "Series 5", "Category 4");\r
+        defaultcategorydataset.addValue(9D, "Series 6", "Category 1");\r
+        defaultcategorydataset.addValue(8D, "Series 6", "Category 2");\r
+        defaultcategorydataset.addValue(0.0D, "Series 6", "Category 3");\r
+        defaultcategorydataset.addValue(6D, "Series 6", "Category 4");\r
+        defaultcategorydataset.addValue(-10D, "Series 7", "Category 1");\r
+        defaultcategorydataset.addValue(9D, "Series 7", "Category 2");\r
+        defaultcategorydataset.addValue(7D, "Series 7", "Category 3");\r
+        defaultcategorydataset.addValue(7D, "Series 7", "Category 4");\r
+        defaultcategorydataset.addValue(11D, "Series 8", "Category 1");\r
+        defaultcategorydataset.addValue(13D, "Series 8", "Category 2");\r
+        defaultcategorydataset.addValue(9D, "Series 8", "Category 3");\r
+        defaultcategorydataset.addValue(9D, "Series 8", "Category 4");\r
+        defaultcategorydataset.addValue(-3D, "Series 9", "Category 1");\r
+        defaultcategorydataset.addValue(7D, "Series 9", "Category 2");\r
+        defaultcategorydataset.addValue(11D, "Series 9", "Category 3");\r
+        defaultcategorydataset.addValue(-10D, "Series 9", "Category 4");\r
+        return defaultcategorydataset;\r
+    }\r
+\r
+       /**\r
+        * Creates the Chart based on a dataset\r
+        */\r
+\r
+       private JFreeChart createChart(CategoryDataset categorydataset) {\r
+\r
+//             JFreeChart chart = ChartFactory.createPieChart("Pie Chart Demo 1", // chart\r
+//                             // title\r
+//                             dataset, // data\r
+//                             true, // include legend\r
+//                             true, false);\r
+//\r
+//             PiePlot plot = (PiePlot) chart.getPlot();\r
+//             plot.setSectionOutlinesVisible(false);\r
+//             // plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));\r
+//             plot.setNoDataMessage("No data available");\r
+//             plot.setCircular(false);\r
+//             plot.setLabelGap(0.02);\r
+               \r
+                JFreeChart jfreechart = ChartFactory.createBarChart3D("3D Bar Chart Demo", "Category", "Value", categorydataset, PlotOrientation.VERTICAL, true, true, false);\r
+               CategoryPlot categoryplot = (CategoryPlot)jfreechart.getPlot();\r
+               categoryplot.setDomainGridlinesVisible(true);\r
+               CategoryAxis categoryaxis = categoryplot.getDomainAxis();\r
+               categoryaxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(0.39269908169872414D));\r
+               categoryaxis.setCategoryMargin(0.0D);\r
+               BarRenderer3D barrenderer3d = (BarRenderer3D)categoryplot.getRenderer();\r
+               barrenderer3d.setDrawBarOutline(false);\r
+               \r
+               return jfreechart;\r
+\r
        }\r
 \r
-}\r
+}
\ No newline at end of file