-
Notifications
You must be signed in to change notification settings - Fork 260
Samples
If you are looking for samples for all available export methods, you can find them in the ./samples
folder. They are divided into five categories (Batch, CLI, HTTP, Node.js Module, and Resources), each in a separate folder. Below is a list of commands to run all the samples for quick usage:
The batch example allows exporting more than one chart using the CLI. To make this work, files must be separated as shown below.
-
batch_{1-3}.json:
highcharts-export-server --batch "./samples/batch/batch_1.json=./samples/batch/batch_1.png;./samples/batch/batch_2.json=./samples/batch/batch_2.png;./samples/batch/batch_3.json=./samples/batch/batch_3.png;"
The CLI examples use the --infile
and --loadConfig
options to load chart JSON configuration or SVG representation.
-
custom_options.json:
highcharts-export-server --loadConfig ./samples/cli/custom_options.json --outfile ./samples/cli/custom_options.png
-
infile_json.json:
highcharts-export-server --infile ./samples/cli/infile_json.json --outfile ./samples/cli/infile_json.png
-
infile_not_json.json:
highcharts-export-server --infile ./samples/cli/infile_not_json.json --outfile ./samples/cli/infile_not_json.png
-
svg_basic.svg:
highcharts-export-server --infile ./samples/cli/svg_basic.svg --outfile ./samples/cli/svg_basic.png
-
svg_bigger.svg:
highcharts-export-server --infile ./samples/cli/svg_bigger.svg --outfile ./samples/cli/svg_bigger.png
-
svg_foreign_object.svg:
highcharts-export-server --infile ./samples/cli/svg_foreign_object.svg --outfile ./samples/cli/svg_foreign_object.png
The HTTP request examples require the server to be enabled. This can be done with the highcharts-export-server --enableServer true
command. Below examples use Curl as a method to send the request.
-
request_infile.json:
curl -H "Content-Type: application/json" -X POST --data-binary "@samples/http/request_infile.json" 127.0.0.1:7801 -o samples/http/request_infile.png
-
request_svg.json:
curl -H "Content-Type: application/json" -X POST --data-binary "@samples/http/request_svg.json" 127.0.0.1:7801 -o samples/http/request_svg.png
The Node.js module examples show how to export charts using the available API.
-
options_phantomjs.js:
node ./samples/module/options_phantomjs.js
-
options_puppeteer.js:
node ./samples/module/options_puppeteer.js
-
promises.js:
node ./samples/module/promises.js
-
svg.js:
node ./samples/module/svg.js
The Resources category contains resources such as callbacks, custom code, options, etc., which are used throughout all samples and tests.