There may be occasions where we don't want an entire server running to render a few charts. In this case, we can opt for a slightly simpler solution and render to specific image formats at the same time.
To set up and run PhantomJS, refer to the Getting ready section of the Rendering charts on the server side recipe given earlier in this chapter.
To get started, perform the following steps:
Create a file called
options.json
in Highcharts/exporting-server/phantomjs, and include all of our chart options there. Note that this file must be JSON data (that is, no Javascript). The following is an example:{ "chart": {"type": "bar"}, "title": {"text": "Creating your first chart"}, "series": [{ "name": "Bar #1", "data": [1, 2, 3, 4] }] }
Change directories to
Highcharts/exporting-server/phantomjs
.Run the following command to generate a chart from
options.json
:phantomjs highcharts-convert.js -infile options...