Search in sources :

Example 1 with BarChart

use of br.com.digilabs.jqplot.chart.BarChart in project openmeetings by apache.

the class PollResultsDialog method renderHead.

@Override
public void renderHead(IHeaderResponse response) {
    super.renderHead(response);
    response.render(JavaScriptHeaderItem.forReference(JqPlotJavascriptResourceReference.get()));
    response.render(CssHeaderItem.forReference(JqPlotCssResourceReference.get()));
    Chart<?> c1 = new PieChart<>(null);
    c1.getChartConfiguration().setHighlighter(new Highlighter());
    for (Chart<?> chart : new Chart<?>[] { c1, new BarChart<Integer>(null) }) {
        for (String resource : JqPlotUtils.retriveJavaScriptResources(chart)) {
            response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(JqPlotBehavior.class, removeMinified(resource))));
        }
    }
}
Also used : PieChart(br.com.digilabs.jqplot.chart.PieChart) JavaScriptResourceReference(org.apache.wicket.request.resource.JavaScriptResourceReference) BarChart(br.com.digilabs.jqplot.chart.BarChart) PieChart(br.com.digilabs.jqplot.chart.PieChart) BarChart(br.com.digilabs.jqplot.chart.BarChart) Chart(br.com.digilabs.jqplot.Chart) Highlighter(br.com.digilabs.jqplot.elements.Highlighter)

Example 2 with BarChart

use of br.com.digilabs.jqplot.chart.BarChart in project openmeetings by apache.

the class PollResultsDialog method barChart.

private BarChart<Integer> barChart(RoomPoll p) {
    String[] ticks = getTicks(p);
    BarChart<Integer> barChart = new BarChart<>(null);
    barChart.addValue(Arrays.asList(getValues(p)));
    barChart.getSeriesDefaults().setRendererOptions(new RendererOptions().setHighlightMouseDown(true).setShowDataLabels(true).setFill(false).setSliceMargin(4).setLineWidth(5).setBarDirection("horizontal"));
    Highlighter h = new Highlighter();
    h.setShow(true);
    h.setFormatString("%s, %P");
    h.setTooltipLocation(Location.ne);
    h.setShowTooltip(true);
    h.setUseAxesFormatters(false);
    ChartConfiguration<Long> cfg = barChart.getChartConfiguration();
    cfg.setLegend(null).setHighlighter(h);
    cfg.axesInstance().setXaxis(null);
    cfg.axesInstance().yAxisInstance().setTicks(ticks).setRenderer(JqPlotResources.CategoryAxisRenderer);
    return barChart;
}
Also used : RendererOptions(br.com.digilabs.jqplot.elements.RendererOptions) BarChart(br.com.digilabs.jqplot.chart.BarChart) Highlighter(br.com.digilabs.jqplot.elements.Highlighter)

Aggregations

BarChart (br.com.digilabs.jqplot.chart.BarChart)2 Highlighter (br.com.digilabs.jqplot.elements.Highlighter)2 Chart (br.com.digilabs.jqplot.Chart)1 PieChart (br.com.digilabs.jqplot.chart.PieChart)1 RendererOptions (br.com.digilabs.jqplot.elements.RendererOptions)1 JavaScriptResourceReference (org.apache.wicket.request.resource.JavaScriptResourceReference)1