Preface
Learning Highcharts aims to be the missing manual for Highcharts from every angle. It is written for web developers who would like to learn about Highcharts using the following features included in the book:
A step-by-step guide on building presentable charts from basic looking ones
Plenty of examples with real data covering all the Highcharts series types—line/spline, column, pie, scatter, area range, column range, gauge, and polar
Subject areas that haven't yet been covered in online reference manuals and demos such as chart layout structure, color shading, series update performance, and so on
Applications demonstrating how to create dynamic and interactive charts using Highcharts' APIs and events handling
Applications demonstrating how to integrate Highcharts with a mobile framework such as jQuery Mobile and a Rich Internet Application framework such as Ext JS
Applications demonstrating how to run Highcharts on the server side for automating charts generation and export their graphical outputs
This book is not a reference manual as the Highcharts team has already done an excellent job in providing a comprehensive online reference, and each configuration is coupled with jsFiddle demos. This book is also not aiming to be a chart design guide or not tutorial for programming design with Highcharts.
In short, this book shows you what you can do with Highcharts.
What this book covers
Chapter 1, Web Charts, describes how web charts have been done since the birth of HTML to the latest HTML 5 standard with SVG and canvas technologies. This chapter also gives a short survey of charting software on the market using the HTML 5 standard and discusses why Highcharts is a better product.
Chapter 2, Highcharts Configurations, covers the common configuration options in chart components with plenty of examples and explains how the chart layout works.
Chapter 3, Line, Area, and Scatter Charts, demonstrates from plotting a simple line, area, and scatter charts to a poster-like chart including all three series types.
Chapter 4, Bar and Column Charts, demonstrates bar and column charts as well as various derived charts such as stacked chart, percentage chart, mirror chart, group chart, overlap chart, mirror stacked chart, and horizontal gauge chart.
Chapter 5, Pie Charts, demonstrates how to build various charts, from a simple pie chart to a multiseries chart, such as multiple pies in a chart and a concentric rings pie chart, that is, a donut chart.
Chapter 6, Gauge, Polar, and Range Charts, gives a step-by-step guide on constructing a twin dial speedometer and demonstrates polar chart characteristics and its similarity to a cartesian chart. It also illustrates the use of range data on area and column range charts.
Chapter 7, Highcharts APIs, explains the usage of Highcharts APIs and illustrates this by using a stock market demo to draw dynamic charts. The chapter discusses the use of different methods to update the series and analyses the performance of each method on various browsers, as well as the scalability of Highcharts.
Chapter 8, Highcharts Events, explains Highcharts events and demonstrates them through various user interactions with the charts from the portfolio application demos.
Chapter 9, Highcharts and jQuery Mobile, gives a short tutorial on the jQuery Mobile framework and demonstrates how to integrate it with Highcharts by creating a mobile web application browsing an Olympic medals table. The chapter also covers the use of touch-based and rotate events with Highcharts.
Chapter 10, Highcharts and Ext JS, gives a short introduction on Sencha's Ext JS and describes the components likely to be used in an application with Highcharts. It also shows how to use a module, Highcharts extension, in order to plot Highcharts graphs within an Ext JS application.
Chapter 11, Running Highcharts on the Server Side, describes different approaches for running Highcharts on the server side for automating chart generation and exporting the charts into SVG or image files.
What you need for this book
Readers are expected to have basic knowledge of web development in the following areas:
Structure of HTML document and its syntax
Ajax
As this book is all about Highcharts which is developed in JavaScript, readers should be comfortable with the language at an intermediate level. Highcharts is developed as an adapter plugin to support several popular JavaScript frameworks such as jQuery, Mootools, and Prototype. By default, Highcharts uses jQuery library, which is the most popular amongst them. This book not only follows such choice so that all the examples are implemented in jQuery, but also uses a very moderate way. Hence, a basic knowledge of jQuery should be sufficient and preferably some knowledge of jQuery UI would be an advantage, as it is lightly used in Chapter 7 and Chapter 8.
Who this book is for
This book is written for web developers who:
Would like to learn how to incorporate graphical charts into their web applications
Would like to migrate their Adobe Flash charts for an HTML 5 JavaScript solution
Want to learn more about Highcharts through examples
Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: "The renderTo
option instructs Highcharts to display the graph onto the HTML <div>
element with 'container'
as the ID value, which is defined in the HTML <body>
section."
A block of code is set as follows:
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"> <path id="curveAB" d="M 100 350 q 150 -300 300 0" stroke="blue" stroke-width="5" fill="none" /> <!-- Mark relevant points --> <g stroke="black" stroke-width="3" fill="black"> <circle id="pointA" cx="100" cy="350" r="3" /> <circle id="pointB" cx="400" cy="350" r="3" /> </g> <!-- Label the points --> <g font-size="30" font="sans-serif" fill="black" stroke="none" text-anchor="middle"> <text x="100" y="350" dx="-30">A</text> <text x="400" y="350" dx="30">B</text> </g> </svg>
Any command-line input or output is written as follows:
java -jar batik-rasterizer.jar /tmp/chart.svg
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "The first four series—UK, Germany, S. Korea, and Japan are stacked together as a single column and US is displayed as a separate column."
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <feedback@packtpub.com>
, and mention the book title via the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code
You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <copyright@packtpub.com>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
Questions
You can contact us at <questions@packtpub.com>
if you are having a problem with any aspect of the book, and we will do our best to address it.