morris.js/examples/decimal.html

33 lines
919 B
HTML
Raw Normal View History

2012-03-15 21:18:33 +01:00
<!doctype html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="https://raw.github.com/DmitryBaranovskiy/raphael/300aa589f5a0ba7fce667cd62c7cdda0bd5ad904/raphael-min.js"></script>
<script src="../morris.js"></script>
<script src="lib/prettify.js"></script>
<script src="lib/example.js"></script>
<link rel="stylesheet" href="lib/example.css">
<link rel="stylesheet" href="lib/prettify.css">
<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({
x: x,
2012-03-15 21:18:33 +01:00
y: Math.sin(Math.PI * x / 180).toFixed(4)
});
}
window.m = Morris.Line({
element: 'graph',
data: decimal_data,
xkey: 'x',
ykeys: ['y'],
2012-03-15 22:06:21 +01:00
labels: ['sin(x)'],
parseTime: false
2012-03-15 21:18:33 +01:00
});
</pre>
</body>