Created
August 15, 2014 20:11
-
-
Save bpostlethwaite/6c9008a15593b0d1d12d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
'use strict'; | |
var payload; | |
function getPlotlyGraphData() { | |
return [{x:[1,2,3],y:[2,4,3]},{x:[1,2,3],y:[9,7,8]}]; | |
} | |
function getPlotlyGraphLayout() { | |
return {}; | |
} | |
function postCallback (body) { | |
var res = JSON.parse(body); | |
if ('url' in res) window.open(res.url); | |
} | |
payload = { | |
data: getPlotlyGraphData(), | |
layout: getPlotlyGraphLayout() | |
}; | |
$('#plotly-graph-export').click( function () { | |
$.post( | |
'https://stage.plot.ly/datacache/', | |
{payload: JSON.stringify(payload)}, | |
postCallback | |
); | |
}); | |
return; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment