Highcharts jQuery.getJSON

1

I want to build a graph using Highchar, where I get Json, but when I create the graph, for example: "column", the bars are not displayed.

I loop because the data is received from a table with several columns. Here is the code for better understanding:

$(document).ready(function() {
        var options = {
            chart: {
                renderTo: 'container',
                type: 'line',
                marginRight: 130,
                marginBottom: 25
            },
            title: {
                text: 'test',
                x: -20 //center
            },
            subtitle: {
                text: '',
                x: -20
            },
            xAxis: {
                categories: [],
                crosshair: true
            },
            yAxis: {
                title: {
                    text: 'test'
                },
                plotLines: [{
                    value: 0,
                    width: 1,
                    color: '#808080'
                }]
            },
            tooltip: {
                formatter: function() {
                        return '<b>'+ this.series.name +'</b><br/>'+
                        this.x +': '+ this.y;
                }
            },
            plotOptions: {
                column: {
                    pointPadding: 0.2,
                    borderWidth: 0
                }
            },
            legend: {
                layout: 'vertical',
                align: 'right',
                verticalAlign: 'top',
                x: -10,
                y: 100,
                borderWidth: 0
            },
            series: []
        }

        $.getJSON("caminhoDaUrl", function(json) {
            for( var i in json ){
                var u = json[i];
                options.xAxis.categories = json[i]['item'];
                options.series[i] = {};
                options.series[i].name = json[i]['item'];
                options.series[i].data = json[i]['item'];
            }

            chart = new Highcharts.Chart(options);
        });
    });

Thanks for the attention, if anyone can help me!

    
asked by anonymous 08.09.2015 / 04:17

0 answers