maxlk
maxlk

Reputation: 1057

background color change in jquery highcharts

Like to know how to change the background color of jquery highcharts. i try the code on highcharts site (http://www.highcharts.com/demo/spline-irregular-time/gray) but couldn't get it to work. this is my highcharts code i have. any help will be appreciated. thank you.

<script type="text/javascript">
            var chart;
$(document).ready(function() {
   chart = new Highcharts.Chart({
      chart: {
         renderTo: 'stats_vmonth',
         type: 'spline'
      },
            title: {
         text: 'Visitor Stats'
      },
      subtitle: {
         text: 'This Month (<?php echo $thismonth;?>)'   
      },
      xAxis: {
         type: 'datetime',
         dateTimeLabelFormats: { // don't display the dummy year
            month: '%e. %b',
            year: '%b'
         }
      },
      yAxis: {
         title: {
            text: 'Visitors'
         },
         min: 0
      },
      tooltip: {
         formatter: function() {
                   return '<b>'+ Highcharts.dateFormat('%e, %b', this.x) +'</b><br/>'+
               this.y +' Visitors';
         }
      },
      series: [{
         name: 'This Year Visitor Stats',
         // Define the data points. All series have a dummy year
         // of 1970/71 in order to be compared on the same x axis. Note
         // that in JavaScript, months start at 0 for January, 1 for February etc.
         data: [
        <?php while($morow = mysql_fetch_array($moresult)){?>
            [Date.UTC(<?php echo $year;?>, <?php echo $month-1;?>, <?php echo $morow['day'];?>),  <?php echo $morow['COUNT(url)'];?>   ],
        <?php }?>

         ]
      }]
   });


});
        </script>

Upvotes: 1

Views: 5823

Answers (1)

anderssonola
anderssonola

Reputation: 2195

Try the theme option

Highcharts.theme = {
  chart: {
      backgroundColor: {
         linearGradient: [0, 0, 500, 500],
         stops: [
            [0, 'rgb(255, 255, 255)'],
            [1, 'rgb(240, 240, 255)']
         ]
      }
}

Upvotes: 4

Related Questions