JFreeChartWrapper Default Size(height,width) Change /Resize the chart

I am using jfreechartwrapper addon in my vaadin application …
private static JFreeChart createPieChart(PieDataset dataset) {
JFreeChart chart = ChartFactory.createPieChart(“Total Scanned Vehicles”, // chart
dataset, // data
true, // include legend
true, false);
PiePlot plot = (PiePlot) chart.getPlot();
plot.setLabelFont(new Font(“SansSerif”, Font.PLAIN, 12));
plot.setNoDataMessage(“No data available”);
plot.setCircular(false);
plot.setLabelGap(0.02);
return chart;
}
public static JFreeChartWrapper createPiechartDemo() {
JFreeChart piechart = createPieChart(createPieDataset());

    return new JFreeChartWrapper(piechart);
}

After that adding chart into layout
HorizontalLayout vl = new HorizontalLayout();
vl.setHeight(“50%”);
vl.setWidth(“50%”);
vl.addComponent(createPiechartDemo());

But there is no change in the display
Please let me know how to change the default size(height,width) in the wrapper class.
Thanks in advance…

Hello,

If you check the source code ( https://dev.vaadin.com/svn/incubator/JFreeChartComponent/src/org/vaadin/ui/JFreeChartWrapper.java ) you’ll notice that jfreechartwrapper set a default size in pixels. So it will not adapt to enclosing layout.
Make some setWidth and setHeight directly on jfreechartwrapper object.

Regards
Sebastien

Thank you Sebastien…
I have changed in the object level,Now it’s working…

Regards,
Ramesh

HI Ramesh,
I am looking for a similar solution for a custom graph. Can you please share your solution?
Did you change the width and height by below code?
plot.setHeight(“50%”);
plot .setWidth(“50%”);