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

Introducing scatter charts


Scatter charts are different from line and area charts in the way that they don't require sorting. This means that data can be provided in the series with each data point as an array of coordinates, including the values of the x and y axes in any order.

Consider the following scatter showing the relation between magnitude and depth of earthquakes in Calexico, California during the year 2010:

$( '#chart_container' ).highcharts({
  chart: {
    type: 'scatter'
  },
  title: {
    text: 'Earthquake Statistics'
  },
  subtitle: {
    text: 'Data Source: <a href="http://www.scsn.org/2010sierraelmayor.html">SCSN</a>'
  },
  xAxis: {
    title: {
      text: 'Depth'
    }
  },
  yAxis: {
    title: {
      text: 'Magnitude'
    },
    min: 3
  },
  tooltip: {
    pointFormat: 'Depth: <strong>{point.x} Km</strong> <br/>Magnitude: <strong>{point.y}</strong>'
  },
  series: [{
    name: 'Calexico',
    data: [[10, 4.8], [22.6, 4.2...