| 776 |
lars |
1 |
<!doctype html>
|
|
|
2 |
|
|
|
3 |
<head>
|
|
|
4 |
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
|
|
|
5 |
<script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.2/raphael-min.js"></script>
|
|
|
6 |
<script src="../morris.js"></script>
|
|
|
7 |
<script src="http://cdnjs.cloudflare.com/ajax/libs/prettify/r224/prettify.min.js"></script>
|
|
|
8 |
<script src="lib/example.js"></script>
|
|
|
9 |
<link rel="stylesheet" href="lib/example.css">
|
|
|
10 |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/prettify/r224/prettify.min.css">
|
|
|
11 |
<link rel="stylesheet" href="../morris.css"> </head>
|
|
|
12 |
|
|
|
13 |
<body>
|
|
|
14 |
<h1>Decimal Data</h1>
|
|
|
15 |
<div id="graph"></div> <pre id="code" class="prettyprint linenums">
|
|
|
16 |
var decimal_data = [];
|
|
|
17 |
for (var x = 0; x <= 360; x += 10) {
|
|
|
18 |
decimal_data.push({
|
|
|
19 |
x: x,
|
|
|
20 |
y: 1.5 + 1.5 * Math.sin(Math.PI * x / 180).toFixed(4)
|
|
|
21 |
});
|
|
|
22 |
}
|
|
|
23 |
window.m = Morris.Line({
|
|
|
24 |
element: 'graph',
|
|
|
25 |
data: decimal_data,
|
|
|
26 |
xkey: 'x',
|
|
|
27 |
ykeys: ['y'],
|
|
|
28 |
labels: ['sin(x)'],
|
|
|
29 |
parseTime: false,
|
|
|
30 |
hoverCallback: function (index, options, default_content, row) {
|
|
|
31 |
return default_content.replace("sin(x)", "1.5 + 1.5 sin(" + row.x + ")");
|
|
|
32 |
},
|
|
|
33 |
xLabelMargin: 10,
|
|
|
34 |
integerYLabels: true
|
|
|
35 |
});
|
|
|
36 |
</pre> </body>
|