DocumentServer/OfficeWeb/sdk/Common/Charts/docs/basic_events.html
nikolay ivanov a8be6b9e72 init repo
2014-07-05 18:22:49 +00:00

97 lines
3.8 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<!--
/**
* o------------------------------------------------------------------------------o
* | This file is part of the OfficeExcel package - you can learn more at: |
* | |
* | http://www.OfficeExcel.net |
* | |
* | This package is licensed under the OfficeExcel license. For all kinds of business |
* | purposes there is a small one-time licensing fee to pay and for non |
* | commercial purposes it is free to use. You can read the full license here: |
* | |
* | http://www.OfficeExcel.net/LICENSE.txt |
* o------------------------------------------------------------------------------o
*/
-->
<title>A basic example of a chart that uses the OfficeExcel pseudo events</title>
<meta name="keywords" content="OfficeExcel javascript charts html5 canvas basic example" />
<meta name="description" content="A basic example of the OfficeExcel pseudo-events" />
<meta name="googlebot" content="NOODP">
<!-- 1/3. Include the OfficeExcel libraries -->
<script src="../libraries/OfficeExcel.common.core.js" ></script>
<script src="../libraries/OfficeExcel.bar.js" ></script>
<!--[if lt IE 9]><script src="../excanvas/excanvas.original.js"></script><![endif]-->
</head>
<body>
<h1>A basic example of the OfficeExcel pseudo-events</h1>
<!-- 2/3. This is the canvas that the chart is drawn on -->
<canvas id="cvs" width="1000" height="250">[No canvas support]</canvas>
<!--
3/3. This creates and displays the chart. As below, you can call this from the window.onload event,
allowing you to put it in your pages header.
-->
<script>
window.onload = function ()
{
/**
* This is the function for the mousemove event. It changes the pointer to the hand.
* When the mouse is moved away from the bar the pointer is changed back to what it was
* automatically for you.
*
* @param object e The event object
* @param array bar The details of the bar thats was mouseover'ed
*/
function myMousemove (e, bar)
{
e.target.style.cursor = 'pointer';
}
/**
* This is the function for the click event.
*
* @param object e The event object
* @param array bar The details of the bar thats was clicked
*/
function myClick (e, bar)
{
alert('A bar was clicked');
}
var bar = new OfficeExcel.Bar('cvs', [12,13,16,15,16,19,19,12,23,16,13,24]);
bar.Set('chart.events.mousemove', myMousemove);
bar.Set('chart.events.click', myClick);
bar.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
bar.Draw();
}
</script>
<p>
This is a basic example that shows you how to use the pseudo-events that OfficeExcel has:
</p>
<ul>
<li>chart.events.click</li>
<li>chart.events.mousemove</li>
</ul>
<p>
Here the mousemove event is used to change the mouse cursor (it's automatically changed back for you). And the click event
is used to show an alert.
</p>
</body>
</html>