Package nl.topicus.onderwijs.dashboard.plotsources

Source Code of nl.topicus.onderwijs.dashboard.plotsources.NumberOfUsersPerApplicationPlot

package nl.topicus.onderwijs.dashboard.plotsources;

import java.util.List;

import nl.topicus.onderwijs.dashboard.datasources.NumberOfUsers;
import nl.topicus.onderwijs.dashboard.modules.PlotSource;
import nl.topicus.onderwijs.dashboard.modules.plots.DataSourcePlotSeries;
import nl.topicus.onderwijs.dashboard.modules.plots.PlotService;
import nl.topicus.wqplot.components.JQPlot;
import nl.topicus.wqplot.options.PlotOptions;

import org.apache.wicket.model.util.ListModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class NumberOfUsersPerApplicationPlot extends
    AbstractPlotSource<Integer, NumberOfUsers> implements PlotSource {
  private PlotService plotService;

  @Autowired
  public NumberOfUsersPerApplicationPlot(PlotService plotService) {
    this.plotService = plotService;
  }

  @Override
  public JQPlot createPlot(String id) {
    List<DataSourcePlotSeries<Integer, NumberOfUsers>> series = plotService
        .getSeries(NumberOfUsers.class);
    JQPlot ret = new JQPlot(id,
        new ListModel<DataSourcePlotSeries<Integer, NumberOfUsers>>(
            series));
    PlotOptions options = ret.getOptions();
    options.getTitle().setText("Number of users");

    setDefaultOptions(options);
    setSeriesLabels(options, series);
    setAxisMinAndMax(options, series, 200);
    return ret;
  }
}
TOP

Related Classes of nl.topicus.onderwijs.dashboard.plotsources.NumberOfUsersPerApplicationPlot

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.