Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Learning Highcharts
Learning Highcharts

Learning Highcharts: Whether you're a novice or an advanced web developer, this practical tutorial will enable you to produce stunning interactive charts using Highcharts. With a foreword by the creator, it's the only guide you'll need to get started.

eBook
€8.99 €28.99
Paperback
€37.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Learning Highcharts

Chapter 2. Highcharts Configurations

All Highcharts graphs share the same configuration structure and it is crucial for us to get familiar with the core components. However, it is not possible to go through all the configurations in this book. In this chapter, we will explore the properties that are mostly used from a functional point of view and demonstrate them with ongoing examples. We will learn the concept of how Highcharts manages layout, and then explore how to configure axes, specify single series and multiple series data, followed by formatting and styling tooltips in both JavaScript and HTML. Finally, we will get to know how to polish our charts with various types of animations and to apply color gradients. In this chapter we will cover the following:

  • Understanding Highcharts layouts

  • Framing the chart with axes

  • Revisiting the series configuration

  • Styling the tooltips

  • Animating charts

  • Expanding colors with gradients

Configuration structure


In the Highcharts configuration object, the components at the top level represent the skeleton structure of a chart. The following is a list of the major components that are covered in this chapter. For the references of all the configurations, go to http://api.highcharts.com/highcharts.

The following is a list of the major components:

  • chart: Configurations for the top-level chart properties such as layouts, dimensions, events, animations, and user interactions

  • series: Array of series objects (consisting of data and specific options) for single and multiple series, where the series data can be specified in a number of ways

  • xAxis/yAxis: Configurations for all the axis properties such as labels, styles, intervals, plotlines, plot bands, and backgrounds

  • tooltip: Layout and format style configurations for the series data tooltips

  • title/subtitle: Layout and style configurations for the chart title and subtitle

  • legend: Layout and format style configurations for the chart...

Understanding Highcharts layouts


Before we start to learn how Highcharts layouts work, it is imperative that we understand some basic concepts first. To do that, let us first recall the chart example used in Chapter 1, Web Charts, and set a couple of borders to be visible. First, set a border around the plot area; to do that we can set the options of plotBorderWidth and plotBorderColor in the chart section, as follows:

        chart: {
                renderTo: 'container',
                type: 'spline',
                plotBorderWidth: 1,
                plotBorderColor: '#3F4044'
        },

The second border is set around the Highcharts container. Next, we extend the preceding chart section with additional settings:

        chart: {
                renderTo: 'container',
                ....
                borderColor: '#a1a1a1',
                borderWidth: 2,
                borderRadius: 3
        },

Basically, this sets the container border color with the width of 2 pixels and the...

Framing the chart with axes


In this section, we are going to look into Highcharts axis configuration in terms of their functional area. Throughout this section, we will start off with a plain line graph and gradually apply more options to the chart to demonstrate the effects.

Accessing the axis data type

There are two ways to specify data for a chart—categories and series data. For displaying intervals with specific names, we should use the categories field that expects an array of strings. Each entry in the categories array is then associated with the series data array. Alternatively, the axis interval values are embedded inside the series data array. Then Highcharts extracts the series data for both axes, interprets the data type, and formats and labels the values appropriately.

The following is a straightforward example showing the usage of categories:

    chart: {
        renderTo: 'container',
        height: 250,
        spacingRight: 20 
    },
    title: {
        text: 'Market Data...

Revisiting the series configuration


By now, we should have an idea of what series properties do. In this section we are going to examine it in more detail.

The series property is an array of series configuration objects that contain data- and series-specific options. It allows us to specify single series data and multiple series data. The purpose of series objects is to inform Highcharts of the format of the data and how the data is presented in the chart.

All the data values in the chart are specified through the data field. The data field is highly flexible, and it can take an array in a number of forms, as follows:

  • Numerical values

  • An array with x and y values

  • Point object with properties describing the data point

The first two options have already been examined in the Accessing axis data type section. In this section we will explore the third option. Let's use the single series Nasdaq example and we will specify the series data through a mixture of numerical values and objects:

         series...

Exploring PlotOptions


plotOptions is a wrapper object for config objects for each series type, which are area, areaspline, bar, column, pie, scatter, spline gauge, and range. These configurations have properties such as plotOptions.line.lineWidth, common to other series types, as well as other configurations such as plotOptions.pie.center, which is only specific to the pie series type. Among the specific series, there is plotOptions.series, which is used for common plotting options shared by the whole series.

The preceding plotOptions can form a chain of precedence between plotOptions.series, plotOptions.{series-type}, and the series configuration. For example, series[x].shadow (where series[x].type is 'pie') has a higher precedence than plotOptions.pie.shadow, which in turn has a higher precedence than plotOptions.series.shadow.

The purpose of this is the chart composed of multiple different series types. For example, a chart with multiple series of columns and a single line series, so...

Styling the tooltips


Tooltips in Highcharts are enabled by the boolean option tooltip.enabled, which is true by default. Their content formats are flexible, which can be defined via a callback handler or in HTML style. We will continue from the example in the previous section. As the chart is packed with multiple lines and columns, first we can enable the crosshair tooltip for helping us align the data points onto the axes. The crosshairs configuration can take either a Boolean value to activate the feature or an object style for the crosshair line style. The following is the code snippet to set up crosshairs with an array of x- and y-axis configurations for the gray color and dash line styles.

            tooltip : {
                crosshairs: [{
                     color: '#5D5D5D',
                     dashStyle: 'dash',
                     width: 2
                }, {
                     color: '#5D5D5D',
                     dashStyle: 'dash',
                     width: 2
  ...

Animating charts


There are two types of animations in Highcharts—initial and update animations. Initial animation is the animation when series data is ready and the chart is displayed; update animation is after the initial animation and when the series data or any parts of the chart anatomy have been changed.

The initial animation configurations can be specified through plotOptions.series.animation or plotOptions.{series-type}.animation, whereas the update animation is configured via the chart.animation property.

All the Highcharts animations use jQuery implementation. The animation property can be a boolean value or a set of animation options. Highcharts uses jQuery swing animation. The following are the options:

  • duration: The time, in milliseconds, to complete the animation.

  • easing: The type of animation jQuery provided. The variety of animations can be extended by importing the jQuery UI plugin. A good source of reference can be found at .

Here, we continue the example from the previous...

Expanding colors with gradients


Highcharts not only supports single color values, but also allows complex color gradient definitions. Highcharts supports linear gradient, which is a directional color shading as well as radial (or circular) gradient. In this section, we will experiment with linear gradient, and the radial gradient will be explored in Chapter 6, Gauge, Polar, and Range Charts. In Highcharts, the color gradient is based on the SVG linear color gradient standard, which is composed of two sets of information, as follows:

  • linearGradient: This gives a gradient direction for the color spectrum made up of two sets of x and y coordinates; ratio values are between 0 and 1, or in percentages

  • stops: This gives a sequence of colors to be filled in the spectrum and their ratio positions within the gradient direction

We use the previous stock market example with only the Volume series, and redefine yAxis.alternateGridColor as follows:

       yAxis: [{
            title: { text: 'Nasdaq index...

Summary


In this chapter, major configuration components were discussed and experimented with examples shown. By now, we should be comfortable and ready to plot some of the basic graphs with more elaborate styles. In the next chapter, we will explore line, area, and scatter graphs supported by Highcharts. We will apply configurations that we have learned in this chapter and explore the series-specific style options to plot charts in an artistic style.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Step-by-step instructions with real-live data to create bar charts, column charts and pie charts, to easily create artistic and professional quality charts
  • Learn tips and tricks to create a variety of charts such as horizontal gauge charts, projection charts, and circular ratio charts
  • Use and integrate Highcharts with jQuery Mobile and ExtJS 4, and understand how to run Highcharts on the server-side
  • Add advanced reporting capabilities and understand how to select the right chart for your data

Description

Highcharts is a popular web charting software that produces stunning and smooth animated JavaScript and HTML5 SVG graphs. It is among the leading web charting software in the market and has been used in many different sectors ó from financial to social websites. Although it is built on top of jQuery, it is so simple to construct that you need little programming skill to create a simple web chart. Highcharts works on all modern browsers and is solely based on native browser technologies and doesn't require client side plugins like Flash or Java."Learning Highcharts" is a comprehensive tutorial with clear and practical examples. This book follows a step by step approach towards making artistic, presentable, or professional style charts and other types of charts that you won't find elsewhere. It also shows you how to integrate Highcharts with other popular frameworks, such as jQuery, jQuery Mobile, and ExtJS and even how to run it on the server side.The book starts off with an introduction to Highcharts and demonstrates usage of its rich set of options. This is followed by an introduction to each type of basic chart, beginning with simple illustrations and ending with more artistic and productive additions to the charts. The book then guides you how to use the Highcharts API and events handling which are important to build interactive applications. It then goes on to show you how to apply Highcharts onto a popular AJAX Framework or even jQuery, jQuery Mobile and Ext JS. Finally the book shows readers how to set up Highcharts running on server side. "Learning Highcharts" aims to teach you everything you need to know about Highcharts, and take the advanced leap from Flash to JavaScript, with this extremely productive and effective Charting software available, thus helping you build basic charts and even multiple series and axes charts. The book also shows you the flexibility of Highcharts and how to create other special charts. The programming side of APIs and event handling will benefit the readers in building advanced web applications with Highcharts. The book also guides readers on how to integrate Highcharts with popular frameworks such as jQuery Mobile and Ext JS. By the end of the book, you should be able to use Highcharts to suit your web page or application needs.

Who is this book for?

This book is both for beginners and advanced web developers who need to create interactive charts for their web applications. It primarily targets JavaScript Web developers who want to use the Highcharts library to prepare interactive and professional-quality charts and graphs for their applications quickly and easily. Prior experience with JavaScript is assumed.

What you will learn

  • Learning the basicsóline, column, and pie charts and getting to grips with the latest features of Highcharts
  • Producing artistic, professional and funky charts with examples
  • Using the Highcharts APIs to produce interactive charts
  • Creating horizontal gauge chart and projection charts
  • Using Highcharts event handlers
  • Using Highcharts with jQuery Mobile
  • Using Highcharts with Ext JS 4
  • Running Highcharts on the server side

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 25, 2012
Length: 362 pages
Edition : 1st
Language : English
ISBN-13 : 9781849519090
Category :
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Dec 25, 2012
Length: 362 pages
Edition : 1st
Language : English
ISBN-13 : 9781849519090
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 112.97
Responsive Web Design with HTML5 and CSS3
€32.99
HTML5 Graphing and Data Visualization Cookbook
€41.99
Learning Highcharts
€37.99
Total 112.97 Stars icon
Banner background image

Table of Contents

11 Chapters
Web Charts Chevron down icon Chevron up icon
Highcharts Configurations Chevron down icon Chevron up icon
Line, Area, and Scatter Charts Chevron down icon Chevron up icon
Bar and Column Charts Chevron down icon Chevron up icon
Pie Charts Chevron down icon Chevron up icon
Gauge, Polar, and Range Charts Chevron down icon Chevron up icon
Highcharts APIs Chevron down icon Chevron up icon
Highcharts Events Chevron down icon Chevron up icon
Highcharts and jQuery Mobile Chevron down icon Chevron up icon
Highcharts and Ext JS Chevron down icon Chevron up icon
Running Highcharts on the Server Side Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.6
(9 Ratings)
5 star 77.8%
4 star 0%
3 star 22.2%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Juanjo Fernandez Feb 10, 2013
Full star icon Full star icon Full star icon Full star icon Full star icon 5
You may probably have used, or will know at least, some library to create charts, because is the most pleasant way to display numerical data information, something that is very common.If so, It's quite probably that you know Highcharts, but if anyone is confused I'll say that it's a JavaScript library to create (almost) any chart type. It's so huge that a 332 pages book can be completed, a book that I'll write some lines.As usual I'll do a summary of each chapter and finally, I'll give my opinion:Chapter 1 - Web Charts: To start you'll see a short summary of the HTML elements used for chart generation (SVG and canvas) and other JS libraries like jqPlot, amCharts, Ext JS 4 Charts, YUI 3 Charts, FusionCharts, etc.Chapter 2 - Highcharts Configurations: A huge library as Highcharts has many configuration options. There's a whole chapter to this in which you will find, among other things: how to implement a particular layout, tooltips customization, gradients, and animations.Chapter 3 - Line, Area, and Scatter Charts: Here you'll start with the chart generation. In this case you'll see how to create line, area and scatter charts, as well as combinations to show different chart types in the same area.Chapter 4 - Bar and Column Charts: More about chart generation but this time bar and column charts. You'll see how to show this chart type in different ways: with grouped columns, vertically or horizontally, mirror, etc.Chapter 5 - Pie Charts: This chapter is entirely dedicated to pie and donut charts. Like the previous chapters: how to create and display them in different ways.Chapter 6 - Gauge, Polar, and Range Charts: Creation of other types of pie charts. Highlights the tutorial that explains how to create a Fiat 500 speedometer formed by several types of pie charts.Chapter 7 - Highcharts API: This is one of the largest chapters of the book. It makes a complete review of all the objects you can find in Highcharts and their properties and methods. You'll also find very useful examples that go further than simple chart generation: adding dynamic data with AJAX, integrating Highcharts with a frontend that allows a user to receive a chart by email, etc.Chapter 8 - Highcharts Events: In Highcharts you have many events available. You'll see in this chapter through different examples. In one of them you'll create a chart that zoom in on the selected area on another smaller chart.Chapter 9 - Highcharts and jQuery Mobile: Highcharts also display correctly on mobile devices, and you'll check in this chapter. Don't worry if you have not used jQuery Mobile before, as there is a tutorial at the beginning of the chapter that explains its basic operation.Chapter 10 - Highcharts and Ext JS: This time you'll see an introductory tutorial about Ext JS (a library specialized in RIA's creation) and then you'll create an application with different panels, tabs, etc, showing different types of charts on each tab.Chapter 11 - Running Highcharts on the Server Side: Sometimes you may need to generate charts from the server, for instance to send emails automatically with a chart from Highcharts. In this cases you have several possibilities as you'll see in this chapter, from using Xvfb and some browser to node.js or Phantom.js.As usual in the PacktPub books that I've reviewed - and there are several - it's a very practical book, with many examples which you can follow step by step and a lot of code that goes beyond the basic issues.On the downside I must say that the images in the printed version aren't in color. In other subject books this wouldn't have great importance, but in this case it would be useful to see the charts colors. In the digital version of the book, the images are colored.If you plan to use Highcharts in any of your projects, clearly will be a successful purchase, since it covers to a greater o lesser extent every aspect you can imagine related to this great library. Accordingly, it's obvious that Joe Kuan has wide experience using Highcharts in his daily work.
Amazon Verified review Amazon
hiro Jan 28, 2013
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I like that the book written step-by-step, this makes the reader really understand.There are many graphic explanation in this book. It's easy understand for beginner.I had used Google Chart Tools until this book was published. The book help me to using Highcahrts.I think it is not satisfied for beginner only by the document of the Highcharts official website. Because there is not graphic illustration. It's a reference.
Amazon Verified review Amazon
G P Crawshaw May 11, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is going to really come in handy at work, can’t wait to get started using the examples in reality
Amazon Verified review Amazon
John Spencer Feb 28, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
As many of the previous reviews have posted, Highcharts has very good document and examples on their web site. I purchased this book after reading the reviews. The reviews were positive and I was looking for a book that provided me with another way to learn how to use Highcharts. This book has met and exceeded my expectations in this area. I like the fact that it explains the how and why things are done when programming Highcharts.If you are looking for a book to help you learn how to use Highcharts that goes beyond Highcharts documentation and examples, then this book is for you.
Amazon Verified review Amazon
PaulArt Oct 20, 2013
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I found Highcharts and this book fantastic! I am using it everyday at work! I have searched high and low for charting applications and this is the best out there. I have also tried rGraph and Raphael and I can tell you that Highcharts is the quickest way to go if you are developing an application that requires charts.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.