Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including fusionexport-node-client with all npm packages installed. Try it out:

var fusionexportNodeClient = require("fusionexport-node-client")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

fusionexport-node-client v1.2.0

NodeJS SDK for FusionExport. Enables exporting from FusionExport through NodeJS.

FusionExport Node Client

Node.js SDK for FusionExport. Enables exporting from Node.js using FusionExport.

Installation

To install this module, simply use npm:

npm install --save fusionexport-node-client

Usage

To require the SDK into your project:

const { ExportManager, ExportConfig } = require('fusionexport-node-client');

Getting Started

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.

// Require FusionExport components
const { ExportManager, ExportConfig } = require('fusionexport-node-client');

// Instantiate ExportManager
const exportManager = new ExportManager();

// Instantiate ExportConfig
const exportConfig = new ExportConfig();

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',
      },
    ],
  },
};

exportConfig.set('chartConfig', chartConfig);

// Export the chart by providing the exportConfig to the exportManager
exportManager.export(exportConfig, '.', true).then((exportedFiles) => {
  exportedFiles.forEach(file => console.log(file));
}).catch((err) => {
  console.log(err);
});

API Reference

You can find the full reference here.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free