Sha256: ccdff70697c4a918339a2cbbe5665e059d4da8149c46a9603cb4a195b5347528
Contents?: true
Size: 1.94 KB
Versions: 2
Compression:
Stored size: 1.94 KB
Contents
<!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(){ console.log("document ready"); var offset = 0; $('#replot').bind('click', function(){ offset = 0; var intervalId = setInterval(function(){ plot(); offset = offset + 0.1; if (offset > 10){ clearInterval(intervalId); } }); }); plot(); function plot(){ var sin = [], cos = []; for (var i = 0; i < 12; i += 0.2) { sin.push([i, Math.sin(i + offset)]); cos.push([i, Math.cos(i + offset)]); } var options = { series: { lines: { show: true }, points: { show: true } }, grid: { hoverable: true //IMPORTANT! this is needed for tooltip to work }, yaxis: { min: -1.2, max: 1.2 }, tooltip: { show: true, content: "'%s' of %x.1 is %y.4", shifts: { x: -60, y: 25 } } }; var plotObj = $.plot( $("#placeholder"), [ { data: sin, label: "sin(x)"}, { data: cos, label: "cos(x)" } ], options ); } }); </script> </body> </html>
Version data entries
2 entries across 2 versions & 1 rubygems