mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-11 09:11:05 +01:00
80 lines
2.6 KiB
HTML
80 lines
2.6 KiB
HTML
|
<!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.min.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="examples.css" />
|
||
|
|
||
|
<!-- BEGIN: load jquery -->
|
||
|
<script language="javascript" type="text/javascript" src="../jquery.min.js"></script>
|
||
|
<!-- END: load jquery -->
|
||
|
|
||
|
<!-- BEGIN: load jqplot -->
|
||
|
<script language="javascript" type="text/javascript" src="../jquery.jqplot.min.js"></script>
|
||
|
<!-- END: load jqplot -->
|
||
|
|
||
|
|
||
|
<script language="javascript" class="code" type="text/javascript">
|
||
|
|
||
|
$(document).ready(function(){
|
||
|
$.jqplot.config.enablePlugins = true;
|
||
|
|
||
|
//////
|
||
|
// Function that is run when the mouse moves inside of the plot.
|
||
|
//
|
||
|
// A more efficient way to do this would be to bind to the
|
||
|
// 'jqplotDataHighlight' and 'jqplotDataUnhighlight' event.
|
||
|
// This is shown as a more general example.
|
||
|
//////
|
||
|
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.
|
||
|
//
|
||
|
// A more efficient way to do this would be to bind to the
|
||
|
// 'jqplotDataHighlight' and 'jqplotDataUnhighlight' event.
|
||
|
// This is shown as a more general example.
|
||
|
//////
|
||
|
$.jqplot.eventListenerHooks.push(['jqplotMouseMove', myMove]);
|
||
|
|
||
|
s1 = [3, 7, 4, 9, 11, 12];
|
||
|
|
||
|
plot1 = $.jqplot('chart1',[s1],{
|
||
|
title: 'Custom Highlighting Tooltip'
|
||
|
});
|
||
|
|
||
|
$('#chart1').append('<div id="myToolTip" style="position:absolute;display:none;background:#E5DACA;padding:4px;"></div>');
|
||
|
|
||
|
});
|
||
|
|
||
|
</script>
|
||
|
|
||
|
<script type="text/javascript" src="example.js"></script>
|
||
|
</head>
|
||
|
<body>
|
||
|
<?php include "topbanner.inc"; ?>
|
||
|
<div class="example-content">
|
||
|
<?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>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|