Skip to content

Instantly share code, notes, and snippets.

@mbejda
Created December 19, 2017 02:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbejda/1a11326151e20173cf1b535e6a5c8cc3 to your computer and use it in GitHub Desktop.
Save mbejda/1a11326151e20173cf1b535e6a5c8cc3 to your computer and use it in GitHub Desktop.
Created with Copy 2 Gist
const exp = require('plotlychartexport');
exports.handler = (event, context, callback) => {
/// define plot.ly data properties
let trace1 = {
x: [1, 2, 3, 4],
y: [10, 15, 13, 17],
type: 'scatter'
};
let trace2 = {
x: [1, 2, 3, 4],
y: [16, 5, 11, 9],
type: 'scatter'
};
/// define plot.ly layout
let layout = {
title: 'Line and Scatter Plot'
};
/// run render command
exp.render([trace1, trace2], layout).then((base) => {
callback(null,base);
}, (error) => {
console.error(error);
callback(error);
})
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment