Bar Chart Primefaces

Asked

Viewed 175 times

0

Folks someone knows how to leave the primefaces bar chart this way? inserir a descrição da imagem aqui

I tried to do here only that it alternates the colors, it leaves for example instead of three columns blue, 1 blue, 1 red, 1 yellow , 1 green and 1 purple.

Code:

void private createBarModels() {

    testeGrafico = initBarModel2();
    testeGrafico.setTitle("Bar Charts");
    testeGrafico.setAnimate(true);
    testeGrafico.setLegendPosition("ne");

    Axis yAxis = testeGrafico.getAxis(AxisType.Y);
    yAxis.setMin(0);

}

private BarChartModel initBarModel2() {
    BarChartModel model2 = new BarChartModel();

    graficoA = curvaABCDAO.listaClientes();

    graficoB = curvaABCDAO.listaClientesB();

    ChartSeries t1 = new ChartSeries();
    ChartSeries t2 = new ChartSeries();

    for (ChamadosEntity tc : graficoA) {
        t1.setLabel(tc.getAbc());
        t1.set(tc.getSolucao(), tc.getChamados());

    }

    for (ChamadosEntity tb : graficoB) {
        t2.setLabel(tb.getAbc());
        t2.set(tb.getSolucao(), tb.getChamados());

    }

    model2.addSeries(t1);
    model2.addSeries(t2);
    return model2;
}

Image of the test I took:

inserir a descrição da imagem aqui

  • puts your code where you create the chart,

  • Your image is very confusing. The Barchart of Primefaces works with the series concept, and each series (in this case) would be a column of each part of the graph. In this image of you, each part of the graphic is composed by the whole series.

  • Got it, I added where I mount the chart,?

  • I don’t think so.

  • blz, I’ll give you one more search, vlw trout.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.