egroupware/phpgwapi/js/jquery/jqplot/examples/highlighter2.html

62 lines
2.0 KiB
HTML
Raw Normal View History

2011-08-10 01:10:50 +02:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Highlighter Test</title>
<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="../excanvas.js"></script><![endif]-->
<link rel="stylesheet" type="text/css" href="../jquery.jqplot.css" />
<link rel="stylesheet" type="text/css" href="examples.css" />
<!-- BEGIN: load jquery -->
<script language="javascript" type="text/javascript" src="../jquery.js"></script>
<!-- END: load jquery -->
<!-- BEGIN: load jqplot -->
<script language="javascript" type="text/javascript" src="../jquery.jqplot.js"></script>
<!-- END: load jqplot -->
<script language="javascript" type="text/javascript">
$(document).ready(function(){
$.jqplot.config.enablePlugins = true;
// function that is run when the mouse moves inside of the plot.
function myMove (ev, gridpos, datapos, neighbor, plot) {
if (neighbor == null) {
$('#myToolTip').fadeOut().empty();
isShowing = false;
}
if (neighbor != null) {
if ($('#myToolTip').is(':hidden')) {
var d = new Date();
var myText = d.getSeconds(); // could be any function pulling data from anywhere.
$('#myToolTip').html(myText).css({left:gridpos.x, top:gridpos.y}).fadeIn();
}
}
}
// Here is how you attach the custom callback to the mouse move event on the plot.
$.jqplot.eventListenerHooks.push(['jqplotMouseMove', myMove]);
s1 = [3, 7, 4, 9, 11, 12];
plot1 = $.jqplot('chart1',[s1],{
title: 'Highlighting'
});
$('#chart1').append('<div id="myToolTip" style="position:absolute;display:none;background:#E5DACA;padding:4px;"></div>');
});
</script>
</head>
<body>
<?php include "nav.inc"; ?>
<p>This page demonstrates creating your own custom highlighter by attaching a callback to the 'jqplotMouseMove' event.</p>
<div id="chart1" class="plot" style="width:500px;height:300px;"></div>
</body>
</html>