-
Notifications
You must be signed in to change notification settings - Fork 0
/
per-person.html
90 lines (85 loc) · 2.58 KB
/
per-person.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!doctype html>
<html>
<!-- must include MIT license; source: http://www.chartjs.org/docs/latest/getting-started/ -->
<head>
<title>Per-Person Black Friday Spending</title>
<script src="./utils.js"></script>
<style>
canvas{
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.bundle.min.js"></script>
</head>
<body>
<div style="width:75%;">
<canvas id="canvas"></canvas>
</div>
<br>
<script>
var MONTHS = ["2010", "2011", "2012", "2013", "2014", "2015"];
var config = {
type: 'line',
data: {
labels: ["2010", "2011", "2012", "2013", "2014", "2015"],
datasets: [{
label: "Per-Person Spending",
backgroundColor: window.chartColors.red,
borderColor: window.chartColors.red,
data: [
365,
398,
423,
407.23,
380.95,
403.35
],
fill: false,
}]
},
options: {
responsive: true,
title:{
display:true,
text: 'Black Friday Shopping'
},
tooltips: {
mode: 'index',
intersect: false,
},
hover: {
mode: 'nearest',
intersect: true
},
scales: {
xAxes: [{
display: true,
scaleLabel: {
display: true,
labelString: 'Year'
}
}],
yAxes: [{
display: true,
scaleLabel: {
display: true,
labelString: 'Dollars'
},
ticks: {
beginAtZero: true,
min: 360,
max: 440,
}
}]
}
}
};
window.onload = function() {
var ctx = document.getElementById("canvas").getContext("2d");
window.myLine = new Chart(ctx, config);
};
</script>
</body>
</html>