| 3284 |
vikas |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
|
2 |
<html>
|
|
|
3 |
<head>
|
|
|
4 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
5 |
<title>Flot Examples</title>
|
|
|
6 |
<link href="layout.css" rel="stylesheet" type="text/css">
|
|
|
7 |
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
|
|
|
8 |
<script language="javascript" type="text/javascript" src="../jquery.js"></script>
|
|
|
9 |
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
|
|
|
10 |
<script language="javascript" type="text/javascript" src="../jquery.flot.resize.js"></script>
|
|
|
11 |
<style type="text/css">
|
|
|
12 |
html, body {
|
|
|
13 |
height: 100%; /* make the percentage height on placeholder work */
|
|
|
14 |
}
|
|
|
15 |
.message {
|
|
|
16 |
padding-left: 50px;
|
|
|
17 |
font-size: smaller;
|
|
|
18 |
}
|
|
|
19 |
</style>
|
|
|
20 |
</head>
|
|
|
21 |
<body>
|
|
|
22 |
<h1>Flot Examples</h1>
|
|
|
23 |
|
|
|
24 |
<div id="placeholder" style="width:80%;height:40%;"></div>
|
|
|
25 |
|
|
|
26 |
<p class="message"></p>
|
|
|
27 |
|
|
|
28 |
<p>Sometimes it makes more sense to just let the plot take up the
|
|
|
29 |
available space. In that case, we need to redraw the plot each
|
|
|
30 |
time the placeholder changes its size. If you include the resize
|
|
|
31 |
plugin, this is handled automatically.</p>
|
|
|
32 |
|
|
|
33 |
<p>Try resizing the window.</p>
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
<script type="text/javascript">
|
|
|
37 |
$(function () {
|
|
|
38 |
var d1 = [];
|
|
|
39 |
for (var i = 0; i < 14; i += 0.5)
|
|
|
40 |
d1.push([i, Math.sin(i)]);
|
|
|
41 |
|
|
|
42 |
var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];
|
|
|
43 |
var d3 = [[0, 12], [7, 12], null, [7, 2.5], [12, 2.5]];
|
|
|
44 |
|
|
|
45 |
var placeholder = $("#placeholder");
|
|
|
46 |
|
|
|
47 |
var plot = $.plot(placeholder, [d1, d2, d3]);
|
|
|
48 |
|
|
|
49 |
// the plugin includes a jQuery plugin for adding resize events to
|
|
|
50 |
// any element, let's just add a callback so we can display the
|
|
|
51 |
// placeholder size
|
|
|
52 |
placeholder.resize(function () {
|
|
|
53 |
$(".message").text("Placeholder is now "
|
|
|
54 |
+ $(this).width() + "x" + $(this).height()
|
|
|
55 |
+ " pixels");
|
|
|
56 |
});
|
|
|
57 |
});
|
|
|
58 |
</script>
|
|
|
59 |
|
|
|
60 |
</body>
|
|
|
61 |
</html>
|