Javascript SDK for FusionExport. Enables exporting from browser using FusionExport.
To install this module, simply use npm:
npm install --save fusionexport-javascript-client
To import the SDK into your project:
import FusionExport from 'fusionexport-javascript-client';
Start with a simple chart export. For exporting a single chart just pass the chart configuration as you would have passed it to the FusionCharts constructor.
// Import FusionExport
import FusionExport from 'fusionexport-javascript-client';
const chartConfig = {
type: 'column2d',
dataFormat: 'json',
dataSource: {
chart: {
caption: 'Number of visitors last week',
theme: 'ocean',
subCaption: 'Bakersfield Central vs Los Angeles Topanga',
},
data: [
{
label: 'Mon',
value: '15123',
},
{
label: 'Tue',
value: '14233',
},
{
label: 'Wed',
value: '25507',
},
],
},
};
// Instantiate FusionExport exporter
const exporter = new FusionExport({
host: 'api.fusionexport.com',
port: 1337,
});
// Call the function to automatically download the exported file
exporter.exportChart({
chartConfig,
});
There is a lot more in this library. You can find the full reference here.