Highcharts JSP AND JAVASCRIPT

1

Good morning I'm doing a chart using the Highcharts library, I implemented it statically to run the tests, but now I need to pass the database information to it. I have read and saw that there are several ways, by XML, by Json. I wanted to know if anyone has already used this library and what would be the best way to do this implementation.

I'm using JSP with servelt I've already listed the list that I'll use in the chart as a parameter.

<!-- SCRIPT GRAFICO -->
    <script type="text/javascript">
    var chart = Highcharts.chart('grafico', {
        chart : {
            type : 'column'
        },
        title : {
            text : ' '
        },
        xAxis : {
            categories : [ '06/2016', '07/2016', '08/2016', '09/2016',
                    '10/2016', '11/2016', '12/2016', '01/2017', '02/2017',
                    '03/2017', '04/2017', '05/2017' ],
            labels : {
                x : -10
            }
        },
        yAxis : {
            allowDecimals : false,
            title : {
                text : 'Valor em Reais'
            }
        },
        series : [ {
            name : 'Meses',
            data : [ 113.56, 240.22, 132.22, 215, 326.33, 214.89, 223.45,
                    134.12, 99.23, 119.89, 221.34, 226.12 ]
        } ],
        responsive : {
            rules : [ {
                condition : {
                    maxWidth : 500
                },
                chartOptions : {
                    legend : {
                        align : 'center',
                        verticalAlign : 'bottom',
                        layout : 'horizontal'
                    },
                    yAxis : {
                        labels : {
                            align : 'left',
                            x : 0,
                            y : -5
                        },
                        title : {
                            text : null
                        }
                    },
                    subtitle : {
                        text : null
                    },
                    credits : {
                        enabled : false
                    }
                }
            } ]
        }
    });
</script>




<!--Método Servelt -->
    List<Registros_leitura_medicao> lista_leitura = new Registros_leitura_medicaoDao()
                        .findAll(resp.getCliente().getCodigo().doubleValue(), resp.getBloco(), resp.getUnidade());
                request.setAttribute("lista_leitura", lista_leitura);

                RequestDispatcher dispatcher = request.getRequestDispatcher("principal.jsp");
                dispatcher.forward(request, response);
    
asked by anonymous 03.08.2017 / 15:10

0 answers