Creating a multiaxis chart
In many scenarios, you would like to group data by more than one field. In the examples depicted in the earlier recipes, the browser adoption data was grouped by year. Now, this data can be grouped by platform as well. For example, adoption of the Chrome browser in the year 2012 on the Windows platform can be accomplished by adding multiple axes to the chart.
How to do it…
The first step is to define the series
data, which contains information grouped by platforms:
series: [{ name: 'On Windows', data: ['15', '26', '40', '52', '56'], type: 'column', }, { name: 'On Linux', data: ['8', '15', '28', '32', '38'], type: 'column', }, { name: 'On Mac', data: ['12', '20', '33', '40', '45'], type: 'area' }, { name: 'On Others', data: ['2', '8', '15', '18', '22'], type: 'area' }]
Here, the name
attribute specifies the platform and the data
attribute specifies the adoption percentage over the years. Notice that the first two in the...