You are previewing Learning Highcharts.
O'Reilly logo
Learning Highcharts

Book Description

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.

  • 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

  • In Detail

    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.

    Table of Contents

    1. Learning Highcharts
      1. Table of Contents
      2. Learning Highcharts
      3. Credits
      4. Foreword
      5. About the Author
      6. About the Reviewers
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      8. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      9. 1. Web Charts
        1. A short history of web charting
          1. HTML image map (server-side technology)
          2. Java applet (client side) and servlet (server side)
          3. Adobe Shockwave Flash (client side)
        2. The uprising of JavaScript and HTML5
          1. HTML5 (SVG and canvas)
            1. SVG (Scalable Vector Graphics)
            2. Canvas
        3. JavaScript charts on the market
          1. jqPlot
          2. amCharts
          3. Ext JS 4 Charts
          4. YUI 3 Charts
          5. FusionCharts
          6. JS Charts
          7. Flot and Flotr
        4. Why Highcharts?
          1. Highcharts and JavaScript frameworks
          2. Presentation
          3. License
          4. Simple API model
          5. Documentations
          6. Openness (feature request with user voice)
        5. Highcharts – a quick tutorial
          1. Directories structure
        6. Summary
      10. 2. Highcharts Configurations
        1. Configuration structure
        2. Understanding Highcharts layouts
          1. Chart margins and spacings
          2. Chart label properties
            1. Title and subtitle alignments
            2. Legend alignment
            3. Axis title alignment
            4. Credits alignment
          3. Experimenting with the automatic layout
          4. Experimenting with the fixed layout
        3. Framing the chart with axes
          1. Accessing the axis data type
          2. Adjusting intervals and background
          3. Using plot lines and plot bands
          4. Extending to multiple axes
        4. Revisiting the series configuration
        5. Exploring PlotOptions
        6. Styling the tooltips
          1. Formatting the tooltips in HTML
          2. Using the callback handler
          3. Applying a multiple series tooltip
        7. Animating charts
        8. Expanding colors with gradients
        9. Summary
      11. 3. Line, Area, and Scatter Charts
        1. Introducing line charts
          1. Extending to multiple series line charts
        2. Sketching an area chart
        3. Mixing line and area series
          1. Simulating a projection chart
          2. Contrasting spline with step line
          3. Extending to a stacked area chart
          4. Plotting charts with missing data
        4. Combining scatter and area series
          1. Polishing a chart with an artistic style
        5. Summary
      12. 4. Bar and Column Charts
        1. Introducing column charts
          1. Overlapped column chart
          2. Stacking and grouping a column chart
            1. Mixing the stacked and single columns
            2. Comparing the columns in stacked percentages
          3. Adjusting column colors and data labels
        2. Introducing bar charts
          1. Giving the bar chart a simpler look
        3. Constructing a mirror chart
          1. Extending to a stacked mirror chart
        4. Converting a single bar chart into a horizontal gauge chart
        5. Sticking the charts together
        6. Summary
      13. 5. Pie Charts
        1. Understanding the relationship of chart, pie, and series
        2. Plotting simple pie charts – single series
          1. Configuring the pie with sliced off sections
          2. Applying a legend to a pie chart
        3. Plotting multiple pies in a chart – multiple series
        4. Preparing a donut chart – multiple series
        5. Building a chart with multiple series types
        6. Summary
      14. 6. Gauge, Polar, and Range Charts
        1. Loading gauge, polar, and range charts
        2. Plotting a speedometer gauge chart
          1. Plotting a twin dials chart – a Fiat 500 speedometer
          2. Plotting a gauge chart pane
            1. Setting pane backgrounds
            2. Managing axes with different scales
            3. Extending to multiple panes
          3. Gauge series – dial and pivot
          4. Polishing the chart with fonts and colors
        3. Converting a spline chart to a polar/radar chart
        4. Plotting range charts with market index data
        5. Using a radial gradient on a gauge chart
        6. Summary
      15. 7. Highcharts APIs
        1. Understanding the Highcharts class model
          1. Highcharts constructor – Highcharts.Chart
          2. Navigating through Highcharts components
            1. Using object hierarchy
            2. Using the Chart.get method
            3. Using the object hierarchy and Chart.get method
        2. Using Highcharts APIs
          1. Chart configurations
          2. Getting data in Ajax and displaying new series with Chart.addSeries
          3. Displaying multiple series with simultaneous Ajax calls
          4. Extracting SVG data with Chart.getSVG
          5. Selecting data points and adding plot lines
            1. Using Axis.getExtremes and Axis.addPlotLine
            2. Using Chart.getSelectedPoints and Chart.renderer methods
          6. Exploring the series update
            1. Continuous series update
          7. Running the experiment
            1. Applying a new set of data with Series.setData
            2. Using Series.remove and Chart.addSeries to reinsert series with new data
            3. Updating data points with Point.update
            4. Removing and adding data points with Point.remove and Series.addPoint
            5. Exploring SVG animations performance on browsers
          8. Comparing Highcharts' performance on large datasets
        3. Summary
      16. 8. Highcharts Events
        1. Introducing Highcharts events
        2. Portfolio history example
          1. Top-level chart
            1. Constructing the series configuration for a top-level chart
            2. Launching an Ajax query with the chart load event
            3. Activating the user interface with the chart redraw event
            4. Selecting and unselecting a data point with the point select and unselect events
            5. Zooming the selected area with the chart selection event
          2. Detail chart
            1. Constructing the series configuration for the detail chart
            2. Hovering over a data point with the mouseOver and mouseOut point events
            3. Applying the chart click event
            4. Changing the mouse cursor over plot lines with mouseover event
            5. Setting up a plot line action with the click event
        3. Stocks' growth chart example
          1. Plot averaging series from displayed stocks series
          2. Launching a dialog with the series click event
          3. Launching a pie chart with the series checkboxClick event
          4. Editing the pie chart's slice with the point click, update, and remove events
        4. Summary
      17. 9. Highcharts and jQuery Mobile
        1. A short introduction of jQuery Mobile
        2. Understanding a mobile page structure
        3. Understanding page initialization
        4. Linking between mobile pages
        5. Highcharts in touch screen environments
        6. Integrating Highcharts and jQuery Mobile using an Olympic medals table application
          1. Loading up the gold medals page
          2. Detecting device properties
          3. Plotting a Highcharts chart on mobile device
          4. Switching graph options with the jQuery Mobile dialog box
          5. Changing the graph presentation with a swipeleft motion event
          6. Switching graph orientation with the orientationchange event
        7. Drilling down for data with the point click event
        8. Building a dynamic content dialog with the point click event
        9. Applying the gesturechange (pinch actions) event to a pie chart
        10. Summary
      18. 10. Highcharts and Ext JS
        1. Short introduction to Sencha Ext JS
        2. A quick tour of Ext JS components
          1. Implementing and loading Ext JS code
          2. Creating and accessing Ext JS components
          3. Using layout and viewport
          4. Panel
            1. GridPanel
            2. FormPanel
            3. TabPanel
          5. Window
          6. Ajax
          7. Store and JsonStore
            1. Example of using JsonStore and GridPanel
        3. The Highcharts extension
          1. Step 1 – removing some of the Highcharts options
          2. Step 2 – converting to Highcharts extension configuration
          3. Step 3 – constructing a series option by mapping the JsonStore data model
          4. Step 4 – creating the Highcharts extension
            1. Passing series specific options in the Highcharts extension
          5. Converting a data model into a Highcharts series
            1. X-axis category data and y-axis numerical values
            2. Numerical values for both x and y axes
            3. Performing pre-processing from store data
          6. Plotting pie charts
            1. Plotting donut charts
          7. Module APIs
            1. addSeries
            2. removeSerie and removeAllSeries
            3. setTitle and setSubTitle
            4. draw
          8. Event handling and export modules
          9. Extending the example with Highcharts
            1. Displaying a context menu by clicking on a data point
        4. A commercially Rich Internet Application with Highcharts – AppQoS
        5. Summary
      19. 11. Running Highcharts on the Server Side
        1. Running Highcharts on the server side
        2. Highcharts on the server side
          1. Using Xvfb and web browsers (Unix solution)
            1. Setting up a Highcharts export example on the client side
            2. Installing Xvfb and a web browser
            3. Starting up the Xvfb server
            4. Applying server-side change
            5. Running the server task
          2. Rhino and Batik (Java solution)
          3. Node.js/Node and Node-Highcharts (JavaScript solution)
            1. Installing Node and modules
            2. Setting up the Node server
            3. Running the Node-Highcharts module
            4. Starting the Node server and issuing a URL query
          4. PhantomJS (headless webkit)
            1. Preparing the series data script
            2. Preparing the PhantomJS script
        3. Comparison between the approaches
        4. Summary
      20. Index