2012-03-15 21:18:33 +01:00
|
|
|
<!doctype html>
|
|
|
|
<head>
|
2014-02-02 20:27:55 +01:00
|
|
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
|
|
|
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.2/raphael-min.js"></script>
|
2012-03-15 21:18:33 +01:00
|
|
|
<script src="../morris.js"></script>
|
2014-02-02 21:28:13 +01:00
|
|
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/prettify/r224/prettify.min.js"></script>
|
2012-03-15 21:18:33 +01:00
|
|
|
<script src="lib/example.js"></script>
|
|
|
|
<link rel="stylesheet" href="lib/example.css">
|
2014-02-02 21:28:13 +01:00
|
|
|
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/prettify/r224/prettify.min.css">
|
2012-11-18 20:02:46 +01:00
|
|
|
<link rel="stylesheet" href="../morris.css">
|
2012-03-15 21:18:33 +01:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1>Decimal Data</h1>
|
|
|
|
<div id="graph"></div>
|
|
|
|
<pre id="code" class="prettyprint linenums">
|
|
|
|
var decimal_data = [];
|
|
|
|
for (var x = 0; x <= 360; x += 10) {
|
|
|
|
decimal_data.push({
|
2012-04-04 23:07:09 +02:00
|
|
|
x: x,
|
2013-04-14 10:12:41 +02:00
|
|
|
y: 1.5 + 1.5 * Math.sin(Math.PI * x / 180).toFixed(4)
|
2012-03-15 21:18:33 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
window.m = Morris.Line({
|
|
|
|
element: 'graph',
|
|
|
|
data: decimal_data,
|
|
|
|
xkey: 'x',
|
|
|
|
ykeys: ['y'],
|
2012-03-15 22:06:21 +01:00
|
|
|
labels: ['sin(x)'],
|
2012-12-19 23:23:36 +01:00
|
|
|
parseTime: false,
|
2013-11-09 21:34:48 +01:00
|
|
|
hoverCallback: function (index, options, default_content, row) {
|
2013-04-14 11:25:14 +02:00
|
|
|
return default_content.replace("sin(x)", "1.5 + 1.5 sin(" + row.x + ")");
|
2012-12-20 20:15:33 +01:00
|
|
|
},
|
2013-04-14 11:25:14 +02:00
|
|
|
xLabelMargin: 10,
|
|
|
|
integerYLabels: true
|
2012-03-15 21:18:33 +01:00
|
|
|
});
|
|
|
|
</pre>
|
|
|
|
</body>
|