var trace1 = {
x: [1, 2, 3, 4],
y: [10, 15, 13, 17],
mode: 'markers'
};
var trace2 = {
x: [2, 3, 4, 5],
y: [16, 5, 11, 10],
mode: 'lines'
};
var trace3 = {
x: [1, 2, 3, 4],
y: [12, 9, 15, 12],
mode: 'lines+markers'
};
var data = [trace1, trace2, trace3];
var layout = {
title: 'Line and Scatter Plot'
};
Plotly.newPlot('myDiv', data, layout).then(
function(gd) {
Plotly.toImage(gd, {
height: 600,
width: 800
})
.then(
function(url) {
console.log(url); // this is what i really need!! I dont want it to be ploted~!
Plotly.purge('myDiv');
}
)
});;
#myDiv {
display: none;
}
<head>
<!-- Plotly.js -->
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
<div id="myDiv">
<!-- Plotly chart will be drawn inside this DIV -->
</div>
<script>
<!-- JAVASCRIPT CODE GOES HERE -->
</script>
</body>