Commit 525bddad authored by Louis's avatar Louis
Browse files

TODO : Use chart.js

parent 5473979c
......@@ -3,6 +3,7 @@
- [ ] - Connection to http://localhost:PORT/foo: render DIR1/foo.yaml as an html page (or DIR2/foo.yaml if not found)
- [ ] - Connection to http://localhost:PORT: same action as now, using pkg=, usr=, and row= arguments. The array is limited to some pypi-only cells
- [ ] Change default port
- [ ] Use chart.js (see TODO/chart.html)
- [ ] Utiliser l'API json qui n'est pas sensible à la casse
- json.loads(requests.get("http://pypi.python.org/pypi/pdfautonup/json").text)
- [ ] Display "Listening to http://localhost:PORT"
......
<!doctype html>
<html>
<head>
<title>Line Chart</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.0.1/Chart.bundle.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
<body>
<div style="width:95%;">
<canvas id="canvas"></canvas>
</div>
<script>
var config = {
type: 'line',
data: {
datasets: [{
label: "argdispatch",
fill: false,
borderColor: "#F7464A",
pointBackgroundColor: "#F7464A",
backgroundColor: "rgba(0,0,0,0)",
data: [{
x: "2015-02-03 23:33:51",
y: 2,
version: "0.1.0",
}, {
x: "2015-02-04 23:33:51",
y: 3,
version: "0.2.0",
}, {
x: "2015-02-05 13:33:51",
y: 2,
version: "0.3.0",
}, {
x: "2015-02-06 13:33:51",
y: 4,
}],
}, {
label: "papersize",
fill: false,
borderColor: "#4AF746",
pointBackgroundColor: "#4AF746",
backgroundColor: "rgba(0,0,0,0)",
fill: true,
data: [{
x: "2015-02-03 13:33:51",
y: 3,
version: "0.1.0",
}, {
x: "2015-02-04 13:33:51",
y: 4,
version: "0.1.1",
}, {
x: "2015-02-06 13:33:51",
y: 3,
}],
}]
},
options: {
responsive: true,
defaultColor: "rgba(0, 0, 0, 0)",
title:{
display:true,
text:'Download counts'
},
tooltips: {
mode: 'label',
callbacks: {
label: function(tooltipItem, data) {
var version = data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index]['version'];
if (typeof version == "undefined") {
return tooltipItem.xLabel + ": " + tooltipItem.yLabel;
} else {
return tooltipItem.xLabel + " (version " + version + "): " + tooltipItem.yLabel;
}
},
}
},
hover: {
mode: 'label'
},
scales: {
xAxes: [{
type: "time",
display: true,
}, ],
yAxes: [{
display: true,
scaleLabel: {
display: true,
labelString: 'Downloads'
}
}]
}
}
};
window.onload = function() {
var ctx = document.getElementById("canvas").getContext("2d");
window.myLine = new Chart.Scatter(ctx, config);
};
</script>
</body>
</html>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment