Chapter 14. Server-side Highcharts

The first edition of Learning Highcharts covered a number of approaches to run Highcharts on the server side. Since then, there has been significant development in this area. It turns out that Highcharts adopts PhantomJS (the headless webkit) for the server solution and PhantomJS/Batik for the server implementation in Java. We will also explore how we can create our own Highcharts server process using PhantomJS and how to use the official server-side script released by Highcharts.

In this chapter, we will cover the following topics:

  • Why we want to run Highcharts on the server side
  • Why PhantomJS and Batik are adopted by Highcharts
  • The basics of PhantomJS and Batik
  • Creating our own PhantomJS script to export charts
  • How to use the Highcharts server-side script in both command-line and server modes

Running Highcharts on the server side

The main reason for running Highcharts on the server side is to allow the client-based graphing application to be automated and accessible on the server side. In some cases, it is desirable to produce graphs at the frontend as well as delivering automated reports with graphs at the backend. For the sake of consistency and development costs, we would like to produce the same style of graphs at both ends. Here are other scenarios where we may want to generate graphs on the server side:

  • The application is required to run a scheduled task on the server side. It generates a regular summary report with graphs (for example, the Service Level Agreement report) and automatically e-mails the report to clients or users with a managerial role.
  • The nature of the data means it requires a long time to compute for a graph. Instead, users send the parameters over to the server to generate a graph. Once it is finished, the chart setup is saved, then the users are notified to see a live Highcharts chart from the precomputed JSON setup.
  • The application involves a vast amount of recurring data that is only kept for a certain period, such as data trend graphs that are automatically produced and stored in an image format for your records.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.160.181