Book Image

Highcharts Essentials

By : Bilal Shahid
Book Image

Highcharts Essentials

By: Bilal Shahid

Overview of this book

Table of Contents (16 chapters)
Highcharts Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Stacking charts with multiple series


By stacking the area charts, one can easily compare the series in a proportional or total format. Stacking can be applied to all or some of the series in the charts.

Consider the following data of the past 4 years showing the production of iron ore by major mining countries:

(function() {
  $( '#chart_container' ).highcharts({
    chart: {
      type: 'area'
    },
    title: {
      text: 'Iron Ore Production'
    },
    xAxis: {
      tickmarkPlacement: 'on',
      categories: [2010, 2011, 2012, 2013]
    },
    yAxis: {
      title: {
        text: 'in million metric tons'
      }
    },
    series: [{
      name: 'China',
      data: [1070, 1330, 1310, 1320]
    }, {
      name: 'Australia',
      data: [433, 488, 521, 530]
    }, {
      name: 'Brazil',
      data: [370, 373, 398, 398]
    }, {
      name: 'India',
      data: [230, 240, 144, 150]
    }, {
      name: 'Russia',
      data: [101, 100, 105, 102]
    }]
  });
})();

This code will produce...