Skip to content

Instantly share code, notes, and snippets.

@emackey
Last active August 25, 2016 15:06
Show Gist options
  • Save emackey/84b1e4f7741b23fa24afe58575928771 to your computer and use it in GitHub Desktop.
Save emackey/84b1e4f7741b23fa24afe58575928771 to your computer and use it in GitHub Desktop.
Plotly scatter test
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Plotly sample</title>
<script src="https://cdn.plot.ly/plotly-1.16.3.min.js"></script>
<style>
#myPlot {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="myPlot"></div>
<script>
Plotly.d3.csv('sampleData.csv')
.get(function(error, data) { ready(data); });
function ready(rawData) {
var myPlot = document.getElementById('myPlot');
var plotData = [
{
x: rawData.map(function(d) { return d.Date; }),
y: rawData.map(function(d) { return d.Range; }),
type: 'scatter'
}
];
Plotly.newPlot(myPlot, plotData);
window.addEventListener('resize', function() {
Plotly.Plots.resize(myPlot);
}, false);
}
</script>
</body>
</html>
Date Range
2013-10-04 22:23:00 12
2013-11-04 22:23:00 15
2013-12-04 22:23:00 18
2014-01-04 22:23:00 24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment