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
NZ$14.99 NZ$57.99
Paperback
NZ$71.99
Subscription
Free Trial

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
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 : 9781849519083
Category :
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

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

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.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
$199.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 NZ$7 each
Feature tick icon Exclusive print discounts
$279.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 NZ$7 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total NZ$ 217.97
Responsive Web Design with HTML5 and CSS3
NZ$64.99
HTML5 Graphing and Data Visualization Cookbook
NZ$80.99
Learning Highcharts
NZ$71.99
Total NZ$ 217.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

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.