Table of Contents
YOUR_PATH/fusionexportIf the server runs successfully, you’ll see the following messages:
npm install fusionexport-node-client --save
[
{
"type": "timeseries",
"renderAt": "chart-container",
"width": "100%",
"height": "100%",
"creditLabel": false,
"dataSource": {
"data": {
"schema": [
{
"name": "Time",
"type": "date",
"format": "%d-%b-%y"
},
{
"name": "Grocery Sales Value",
"type": "number"
}
],
"data":"https://s3.eu-central-1.amazonaws.com/fusion.store/ft/data/line-chart-with-time-axis-data.json"
},
"caption": {
"text": "Sales Analysis"
},
"subCaption": {
"text": "Grocery"
},
"yAxis": [
{
"plot": {
"value": "Grocery Sales Value"
},
"format": {
"prefix": "$"
},
"title": "Sale Value"
}
]
}
}
] Let’s take a look at the JSON text for the configuration of FusionTime chart. It requires a dataSource.data key, which again has two nested keys, i.e., schema and data. The schema is the meta description of data and specifies the formats for X and Y-axis data. The dataSource.data.data specifies the actual data array of points for plotting. We’ve used a URL for this tutorial, however, you can replace this with your own data. <html>
<head>
<style>
.myDiv {
padding: 0px 12px;
width: 1600px;
height: 800px;
}
</style>
</head>
<body>
<h2>FusionExport For Exporting FusionTime Charts</h2>
<div class="myDiv" id = "chart-container">
</div>
<p>Powered by FusionTime</p>
</body>
</html> const fs = require('fs');
const path = require('path');
const {ExportManager, ExportConfig} = require('fusionexport-node-client');
// Instantiate ExportManager and ExportConfig
const exportManager = new ExportManager();
const exportConfig = new ExportConfig();
//Read the configuration from JSON
let jsonStr = fs.readFileSync("resources/time-series-config.json", "utf8");
let chartConfig = JSON.parse(jsonStr);
//Set the options for exportConfig
exportConfig.set("chartConfig", chartConfig);
exportConfig.set('templateFilePath', path.join('resources', 'time-series-template.html'));
exportConfig.set('type', 'png');
exportConfig.set('quality', 'best');
// Export the chart
exportManager.export(exportConfig, outputDir = '.', unzip = true).then((exportedFiles) => {
exportedFiles.forEach(file => console.log(file));
}).catch((err) => {
console.log(err);
}); node export-timeseries.jsThis program will create a file called export.png that contains an image of your FusionTime chart. That’s it! We just exported an awesome FusionTime time series chart via FusionExport in 5 easy steps. You can download the source code for this app from here and try it out. Happy coding!
To create pie charts and generate statistical data, you’ll find this list of the best…
To implement FusionCharts in a dynamically resizing flexbox layout, ensure that the chart's dimensions are…
At FusionCharts, we believe in empowering developers and businesses with cutting-edge data visualization tools that…
Ever had a data set that seemed more complicated than a Rubik's cube? You’re not…
We’ve all seen them in textbooks or presentations—those overlapping circles that simplify complex information into…
We’re excited to announce the upcoming release of FusionCharts v4.1—a groundbreaking step forward in the…