I am going to draw a jfreechart on the page, the project gets compiled successfully but the src of the chart is set to null. so no chart is drawn.
Here is the source code:
package sh2.ebs.mavenproject1;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.annotations.Widgetset;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import javax.servlet.annotation.WebServlet;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.vaadin.addon.JFreeChartWrapper;
/**
*
*/
@Theme("mytheme")
@Widgetset("sh2.ebs.mavenproject1.MyAppWidgetset")
public class MyUI extends UI {
@Override
protected void init(VaadinRequest vaadinRequest) {
final VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
setContent(layout);
XYSeries series = new XYSeries("Sprint 1");
series.add(0, 165);
series.add(1, 150);
series.add(2, 130);
XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(series);
// Generate the graph
JFreeChart chart = ChartFactory.createXYLineChart("Burn Down Chart", // Title
"days", // x-axis Label
"Esimated Effort", // y-axis Label
dataset, // Dataset
PlotOrientation.VERTICAL, // Plot Orientation
true, // Show Legend
true, // Use tooltips
false // Configure chart to generate URLs?
);
JFreeChartWrapper wrapper = new JFreeChartWrapper(chart, JFreeChartWrapper.RenderingMode.PNG);
layout.addComponent(wrapper);
}
@WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = MyUI.class, productionMode = false)
public static class MyUIServlet extends VaadinServlet {
}
}
It does not work with JFreeChartWrapper.RenderingMode.SVG either.