Charts Primefaces

0

I am having the following problem I have the following class which receives the values of the information graph collected in real time from the bank

@ManagedBean
public class ChartView implements Serializable {

private BarChartModel barModel;

@PostConstruct
public void init() {
    createBarModels();
}

public BarChartModel getBarModel() {
    return barModel;
}

private BarChartModel initBarModel() {
    BarChartModel model = new BarChartModel();
    SQL_ServerControle qtdusers = new SQL_ServerControle();

    try {
        ChartSeries quantidadeDeUsuarios = new ChartSeries();
        quantidadeDeUsuarios.setLabel("Quantidade de Usuarios");
        quantidadeDeUsuarios.set("Qtd Usuarios", qtdusers.qtdUsuariosI());
        ChartSeries transacoes_ativas = new ChartSeries();
        transacoes_ativas.setLabel("Transações Ativas");
        transacoes_ativas.set("Trans Ativas", qtdusers.trasacoesAtivasI());
        ChartSeries transacoes_alocadas = new ChartSeries();
        transacoes_alocadas.setLabel("Transações Alocadas");
        transacoes_alocadas.set("Trans Alocadas", qtdusers.trasacoesAlocadasI());
        ChartSeries quantidadeUsuariosP = new ChartSeries();
        quantidadeUsuariosP.setLabel("Quantidade Usuários Progress");
        quantidadeUsuariosP.set("Qtd Usuarios Progress", qtdusers.qtdUsuariospI());
        ChartSeries quantidadeUsuariosApp = new ChartSeries();
        quantidadeUsuariosApp.setLabel("Usuarios APP Server");
        quantidadeUsuariosApp.set("Qtd Usuarios App Server", qtdusers.usuariosAppQtdI());
        ChartSeries quantidadeSqlClient = new ChartSeries();
        quantidadeSqlClient.setLabel("SQL Client");
        quantidadeSqlClient.set("Qtd SQL Client", qtdusers.QtlSQLClientI());

        model.addSeries(quantidadeDeUsuarios);
        model.addSeries(transacoes_ativas);
        model.addSeries(transacoes_alocadas);
        model.addSeries(quantidadeUsuariosP);
        model.addSeries(quantidadeUsuariosApp);
        model.addSeries(quantidadeSqlClient);

    } catch (SQLException ex) {
        Logger.getLogger(ChartView.class.getName()).log(Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
        Logger.getLogger(ChartView.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
        Logger.getLogger(ChartView.class.getName()).log(Level.SEVERE, null, ex);
    } catch (ClassNotFoundException ex) {
        Logger.getLogger(ChartView.class.getName()).log(Level.SEVERE, null, ex);
    }

    return model;
}

private void createBarModels() {
    createBarModel();
}

public void createBarModel() {
    barModel = initBarModel();
    barModel.setLegendPosition("ne");

    Axis yAxis = barModel.getAxis(AxisType.Y);

    yAxis.setMin(0);
    yAxis.setMax(100);

}

I have the following chart on my jsf screen:

What happens is that when loading the graph the names underneath each graph do not appear, only the first "Qtd Users" appears and centralized in the middle I need the name that I specified for each one to appear, and that each one has a different color, if anyone can help me I'm grateful.

    
asked by anonymous 17.10.2016 / 16:05

1 answer

0

chartSeries.set gets 2 parameters:

ChartSeries chartSeries = new ChartSeries;

chartSeries.set("Qtd usuarios", valor);
chartSeries.set("Trans Ativas", valor);
chartSeries.set("Trans Alocadas", valor);
chartSeries.set("Qtd Usuarios Progress", valor);

there the first parameter will appear as the subtitle of the value.

    
07.11.2016 / 20:17