skrite
skrite

Reputation: 327

trouble with categories on highcharts column chart

I am having some difficulty getting my x-axis labels correct. i am using highcharts to draw a column chart, but instead of useing my catagories as labels, it uses numbers from 1 - however many plots points there are.

here is the code:

$('#bar').highcharts({

       chart: { 
               borderColor: "#FFFFFF",
               borderRadius: 2,
               backgroundColor: "#D8D8D8",
               renderTo: 'chartdiv3', 
               type: 'column'
       },
       title: { text: 'one year rain' },

       xAxis: [{
         type: "catagory",
         catagories: [

            '09/19',

            '09/12',

            '09/05',

            '08/29',

            '08/22',

            '08/15',

            '08/08',

            '08/01',

            '07/25',

            '07/18',

            '07/11',

            '07/04',

          '10/12'
         ],
         labels: {
           rotation: -45,
           style: {
                fontSize: '13px',
                fontFamily: 'Verdana, sans-serif'
           }
         },
         title: {
           text: 'week ending'
         }
       }],

       yAxis: {
         title: { text: 'inches'}
       },


       plotOptions: {
         column: {
          pointPadding: 0.2,
          borderWidth: 0
         }
       },

       // must move the month ahead because javascript indexes a month as a number between 0 and 11
       series: [{
         name: 'rain',
         color: "#2E64FE",
         type: "column",
         data: [

              0.0,      

              0.05,      

              0.2,      

              0.02,      

              1.48,      

              0.38,      

              1.75,      

              2.74,      

              1.07,      

              0.36,      

              2.72,      

              0.1,      

             0.0
         ]
       }]

     }); 

the plots look fine, but the labels both in the tooltip and at the bottom for the x-axis just show numbers 1-12.

i appreciate any tips here. I have searched everywhere.

Upvotes: 0

Views: 36

Answers (1)

jjk
jjk

Reputation: 526

You spelled "categories" incorrectly.

Something like this should work:

 categories: ['Apples', 'Bananas', 'Oranges']

Upvotes: 1

Related Questions