series.add(l2);
NumberSeries<Integer, Integer> l3 = new NumberSeries<Integer, Integer>();
l3.addEntry(4, 1).addEntry(7, 2).addEntry(1, 3).addEntry(2, 4);
series.add(l3);
JQPlot chart2b =
new JQPlot("chart2b", new ListModel<NumberSeries<Integer, Integer>>(series));
PlotOptions chart2bO = chart2b.getOptions();
chart2bO.getSeriesDefaults().setRenderer(JQPlotBarRenderer.get());
chart2bO.getSeriesDefaults().getPointLabels().setShow(true);
chart2bO.getSeriesDefaults().getPointLabels().setLocation(PlotPointLabelLocation.e);
chart2bO.getSeriesDefaults().getPointLabels().setEdgeTolerance(-15d);
chart2bO.getSeriesDefaults().setShadowAngle(135d);
chart2bO.getSeriesDefaults().setRendererOptions(
new PlotBarRendererOptions().setBarDirection(PlotBarDirection.horizontal));
chart2bO.getAxes().getYaxis().setRenderer(JQPlotCategoryAxisRenderer.get());
add(chart2b);
final WebMarkupContainer info2b = new WebMarkupContainer("info2b");
info2b.setOutputMarkupId(true);
add(info2b);
final WebMarkupContainer info2c = new WebMarkupContainer("info2c");
info2c.setOutputMarkupId(true);
add(info2c);
chart2b.add(new WiQueryEventBehavior(new Event(JQPlotEvent.DATA_HIGHLIGHT)
{
private static final long serialVersionUID = 1L;
@Override
public JsScope callback()
{
return new JsScope("ev", "seriesIndex", "pointIndex", "data")
{
private static final long serialVersionUID = 1L;
@Override
protected void execute(JsScopeContext scopeContext)
{
StringBuilder body = new StringBuilder();
body.append("$('#");
body.append(info2b.getMarkupId());
body.append("').html('series: '+seriesIndex+', point: '+pointIndex+', data: '+data+ ', pageX: '+ev.pageX+', pageY: '+ev.pageY);");
scopeContext.append(body);
}
};
}
}));
chart2b.add(new WiQueryEventBehavior(new Event(JQPlotEvent.DATA_CLICK)
{
private static final long serialVersionUID = 1L;
@Override
public JsScope callback()
{
return new JsScope("ev", "seriesIndex", "pointIndex", "data")
{
private static final long serialVersionUID = 1L;
@Override
protected void execute(JsScopeContext scopeContext)
{
StringBuilder body = new StringBuilder();
body.append("$('#");
body.append(info2c.getMarkupId());
body.append("').html('series: '+seriesIndex+', point: '+pointIndex+', data: '+data+ ', pageX: '+ev.pageX+', pageY: '+ev.pageY);");
scopeContext.append(body);
}
};
}
}));
chart2b.add(new WiQueryEventBehavior(new Event(JQPlotEvent.DATA_UNHIGHLIGHT)
{
private static final long serialVersionUID = 1L;
@Override
public JsScope callback()