78 lines
1.8 KiB
78 lines
1.8 KiB
<!doctype html> |
|
|
|
<html> |
|
<head> |
|
<meta charset="utf-8"> |
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
|
|
|
<title>flot.tooltip plugin example page</title> |
|
<meta name="author" content="@krzysu, myviews.pl"> |
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
|
|
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script> |
|
<!--[if lte IE 8]><script src="js/excanvas.min.js"></script><![endif]--> |
|
<script src="js/jquery.flot.js"></script> |
|
<script src="../js/jquery.flot.tooltip.js"></script> |
|
|
|
<style type="text/css"> |
|
body {font-family: sans-serif; font-size: 16px; margin: 50px; max-width: 800px;} |
|
#flotTip {} |
|
</style> |
|
</head> |
|
|
|
<body> |
|
<h1>flot.tooltip plugin example page</h1> |
|
|
|
<div id="placeholder" style="width: 825px; height: 150px;"></div> |
|
<a href="javascript:void(0);" class="button" id="replot">Plot</a> |
|
|
|
<script type="text/javascript"> |
|
$(document).ready(function(){ |
|
|
|
plot(); |
|
|
|
function plot(){ |
|
var values = [ [0, 450], [1, 550], [2, 320], [3, 700] ] |
|
|
|
var options = { |
|
series: { |
|
lines: { show: true }, |
|
points: { show: true } |
|
}, |
|
grid: { |
|
hoverable: true //IMPORTANT! this is needed for tooltip to work |
|
}, |
|
xaxis: { |
|
ticks: [ |
|
[0, "great"], |
|
[1, "greater"], |
|
[2, "greatest"] |
|
] |
|
}, |
|
yaxis: { |
|
ticks: [ |
|
[320, "lowest"], |
|
[450, "low"], |
|
[550, "medium"], |
|
[700, "high"] |
|
] |
|
}, |
|
tooltip: { |
|
show: true, |
|
content: "%s: value of %x is %y", |
|
shifts: { |
|
x: -60, |
|
y: 25 |
|
} |
|
} |
|
}; |
|
|
|
var plotObj = $.plot( $("#placeholder"), |
|
[ { data: values, label: "Series 1"}], |
|
options ); |
|
} |
|
}); |
|
</script> |
|
|
|
</body> |
|
</html>
|
|
|