score:0

well i see some problems here. first try to replace the highchart code with the below mentioned code. as you need to specify data for each series in the series option. and provide with the unique name.

 $('#container').highcharts(
                {

                    chart:
                    {
                        renderto: 'container',
                        defaultseriestype: 'column',
                        plotborderwidth: 1,
                        plotbordercolor: '#3f4044'
                    },
                    credits: { enabled: false },
                    title:
                    {
                        text: 'sales by type and year'
                    },

                    xaxis:
                    {
                        categories: catname
                    },

                    yaxis:
                    {
                        allowdecimals: false,
                        min: 0,
                        title:
                        {
                            text: 'sales'
                        }
                    },

                    tooltip:
                    {
                        formatter: function () {
                            return '<b>' + this.x + '</b><br/>' +
                                this.series.name + ': ' + this.y + '<br/>' +
                                'total: ' + this.point.stacktotal;
                        }
                    },

                    plotoptions:
                    {
                        column:
                        {
                            stacking: 'normal'
                        }
                    },

                   series: [{
                        name: 'clubs',
                        data: []
                    }, {
                        name: 'festivals',
                        data: []
                    }, {
                        name: 'private',
                        data: [],
                    }, {
                        name: 'weddings',
                        data: [],
                    }, {
                        name: 'otherincome',
                        data: [],
                    }]
                });

        });

and your json should be an array consisting only numbers.

score:0

  1. chart initialization should in insie getjson body, because you try to initialize chart, earlier then data is get from url
  2. in json you need to use numbers, not strings. if it is not possbile, you need to parse values in javascript by parsefloat on each data value.
  3. your series data object, should contian only numbers, not names like "fesitvals". if you wuld like to have a few series, and each of them has own name, you need to parse your json and praaper correct array structure.

Related Query

More Query from same tag