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