carol1287
carol1287

Reputation: 395

Any ideas on how to create a column chart from this output?

I am having the following query but having a hard time trying to figure out how could I create a chart to include the following query. any ideas? thanks

date    18-24   25-34   35-44   45-54   55-64   65+
01 Apr  0         0      0       0       0       0
02 Apr  0         0      0       0       0       0
03 Apr  0         0      0       0       0       0
04 Apr  0         0      0       0       0       0

I can create a chart for one day easily as follow:

 $('#age').highcharts({
                chart: {
                    height: 204,
                    type: 'column'
                },
                title: {
                    text: '',
                    x: -20 //center
                },
                subtitle: {
                    text: '',
                    x: -20
                },
                xAxis: {
                    categories: ['18-24', '25-34', '35-44', '45-54', '55-64', '65+']
                },
                yAxis: {
                    title: {
                        text: ''
                    },
                    plotLines: [{
                        value: 0,
                        width: 1,
                        color: '#808080'
                    }]
                },
                credits: false,
                title: false,
                exporting: false,
                legend: {
                    layout: 'vertical',
                    align: 'right',
                    verticalAlign: 'middle',
                    borderWidth: 0
                },
                series: [{
                    name: '%',
                    data: [27.50, 33.50, 15.50, 12.50, 5.50, 5.50]
                }]
            });

Upvotes: 0

Views: 39

Answers (1)

jlbriggs
jlbriggs

Reputation: 17791

Just make a different series for each date, and highcharts will group them by default:

Or you can specify stacking and have a stacked column instead, if the more important goal is to compare the totals:

(though if the goal is to compare totals, it's better to simply sum them and display a standard column chart, as the multiple series adds distraction)

Upvotes: 1

Related Questions