legend.setRendererOptions(new LegendRenderer().setNumberRows(1));
legend.setLocation(Location.s);
legend.setMarginTop("15px");
pieChart.setLegend(legend);
final JqPlotChart jqPlotChart = new JqPlotChart("areaChartWithImage", pieChart);
final WebMarkupContainer jqPlotImage = new WebMarkupContainer("image");
jqPlotImage.setOutputMarkupId(true);
AjaxLink<Void> ajaxLink = new AjaxLink<Void>("plotImage") {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
StringBuilder jsBuilder = new StringBuilder();
jsBuilder//.append("$(document).ready(function(){\r\n")
.append("var imgData = $('#").append(jqPlotChart.getMarkupId())
.append("').jqplotToImageStr({});\r\n")
.append("var imgElem = $('<img/>').attr('src',imgData);\r\n")
.append("$('#").append(jqPlotImage.getMarkupId())
.append("').append(imgElem);\r\n");
target.appendJavaScript(jsBuilder);