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

198 lines
9 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>How you can annotate your charts interactively</title>
<meta name="keywords" content="OfficeExcel html5 canvas chart docs annotating" />
<meta name="description" content="Information about annotating your charts" />
<meta name="googlebot" content="NOODP">
<meta property="og:title" content="OfficeExcel: HTML5 Javascript charts library" />
<meta property="og:description" content="A chart library based on the HTML5 canvas tag" />
<meta property="og:image" content="http://www.OfficeExcel.net/images/logo.png"/>
<link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
<link rel="icon" type="image/png" href="../images/favicon.png">
<!-- Place this tag in your head or just before your close body tag -->
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<script src="../libraries/OfficeExcel.common.core.js" ></script>
<script src="../libraries/OfficeExcel.common.annotate.js" ></script>
<script src="../libraries/OfficeExcel.common.context.js" ></script>
<script src="../libraries/OfficeExcel.common.zoom.js" ></script>
<script src="../libraries/OfficeExcel.bar.js" ></script>
<!--[if lt IE 9]><script src="../excanvas/excanvas.original.js"></script><![endif]-->
<script>
window.onload = function ()
{
var bar = new OfficeExcel.Bar('myBar', [[45,64],[32,51],[41,52],[54,43],[43,50]]);
bar.Set('chart.title', 'An annotatable chart with context menu');
bar.Set('chart.labels', ['John','Fred', 'Barry', 'Charlie', 'Joan']);
bar.Set('chart.colors', ['red', 'blue']);
bar.Set('chart.background.barcolor1', '#fff');
bar.Set('chart.background.barcolor2', '#fff');
if (!OfficeExcel.isOld()) {
bar.Set('chart.annotatable', true);
bar.Set('chart.contextmenu', [['Show palette', OfficeExcel.Showpalette], ['Clear', function () {OfficeExcel.Clear(bar.canvas); bar.Draw();}]]);
}
bar.Draw();
OfficeExcel.AddCustomEventListener(bar, 'onannotatestart', function (obj) {cl('Started annotating: ' + obj.id);});
OfficeExcel.AddCustomEventListener(bar, 'onannotate', function (obj) {cl('Annotating: ' + obj.id);});
OfficeExcel.AddCustomEventListener(bar, 'onannotateend', function (obj) {cl('Finished annotating: ' + obj.id);});
OfficeExcel.AddCustomEventListener(bar, 'onannotatecolor', function (obj) {cl('Changed annotate color: ' + obj.Get('chart.annotate.color'));});
OfficeExcel.AddCustomEventListener(bar, 'onannotateclear', function (obj) {cl('Fired the annotation clear event');});
}
</script>
<?php PrintAnalyticsCode() ?>
</head>
<body>
<!-- Social networking buttons -->
<?php
$prefix = substr($_SERVER['SERVER_NAME'], 0, 3);
require("/OfficeExcel.{$prefix}/social.html");
?>
<!-- Social networking buttons -->
<div id="breadcrumb">
<a href="../index.html">OfficeExcel: HTML5 Javascript charts library</a>
>
<a href="./index.html">Documentation</a>
>
Annotating your charts
</div>
<h1>Annotating <span>your charts</span></h1>
<script>
if (OfficeExcel.isOld()) {
document.write('<div style="background-color: #fee; border: 2px dashed red; padding: 5px"><b>Important</b><br /><br /> Internet Explorer does not natively support the HTML5 canvas tag, so if you want to see the charts, you can either:<ul><li>Install <a href="http://code.google.com/chrome/chromeframe/">Google Chrome Frame</a></li><li>Use ExCanvas. This is provided in the OfficeExcel Archive.</li><li>Use another browser entirely. Your choices are Firefox 3.5+, Chrome 2+, Safari 4+ or Opera 10.5+. </li></ul> <b>Note:</b> Internet Explorer 9 fully supports the canvas tag.</div>');
}
</script>
<div style="float: right">
<canvas id="myBar" width="400" height="200">[No canvas support]</canvas><br />
</div>
<p>
The annotations feature brings presentation style functionality to OfficeExcel charts. You can use this feature
for highlighting your charts if you need to.
</p>
<ul>
<li><a href="#how">How do annotations work?</a></li>
<li><a href="#browser">Browser support</a></li>
<li><a href="#what">What can I use annotations for?</a></li>
<li><a href="#persistent">Are annotations persistent?</a></li>
<li><a href="#palette">How do I show the mini-palette?</a></li>
<li><a href="#clear">How can I clear the annotations?</a></li>
<li><a href="#replay">Replaying annotations when they're off</a></li>
<li><a href="#persist">Making your annotations persist</a></li>
</ul>
<a name="how"></a>
<h4>How do annotations work?</h4>
<p>
Enabling annotations is a very simple affair, and consists of doing the following:
</p>
<pre class="code" style="width: 55%">myGraph.Set('chart.annotatable', true);</pre>
<a name="browser"></a>
<h4>Browser support</h4>
<p>
Annotations are supported in all browsers that OfficeExcel works with - Firefox 3.5+, Chrome 2+, Safari 4+, Opera 10.5+ and
MSIE/Google Chrome Frame. They DO NOT however work with MSIE 8/ExCanvas.
</p>
<a name="what"></a>
<h4>What can I use annotations for?</h4>
<p>
As mentioned you can use it for presentations, highlighting things to yourself or others or just to have fun drawing (!).
</p>
<a name="persistent"></a>
<h4>Are annotations persistent?</h4>
<p>
That depends on which browser you're using. The annotation data is stored in the users web browser (not on the web server),
meaning currently (21st March 2010) browser support is limited to Firefox 3.5+, Safari 4+,
Chrome 4+ and Opera 10.5+. MSIE 8 also has the required storage capabilities, but since it doesn't yet support canvas, the point is moot.
The user does not have to
confirm anything for storage to be allowed - try it out on this page by drawing on the chart and then refreshing the page.
</p>
<a name="palette"></a>
<h4>How do I show the mini-palette?</h4>
<p>
You can show the palette by using the <i>OfficeExcel.Showpalette</i> function shown below as a context menu item:
</p>
<pre class="code">
myObj.Set('chart.contextmenu', [
['Show palette', OfficeExcel.Showpalette],
['Clear', function () {OfficeExcel.Clear(myObj.canvas); myObj.Draw();}]
]);
</pre>
<p>
This code will result in the same context menu as the chart above.
</p>
<a name="clear"></a>
<h4>How can I clear the annotations?</h4>
You can simply clear the chart and redraw it:
<pre class="code">OfficeExcel.Clear(myGraph.canvas); // Clear the chart
myGraph.Draw(); // Redraw it</pre>
<p>
In the chart above, there is a context menu that allows you to both clear the chart and also demonstrates the mini-palette
feature available to you.
</p>
<a name="replay"></a>
<h4>Replaying annotations when they're off</h4>
<p>
When annotations are not enabled, any prior annotations that may have been made are not displayed. To show them you need
to use the API function <i>OfficeExcel.ReplayAnnotations(object)</i> after the call to .Draw().
</p>
<a name="persist"></a>
<h4>Making your annotations persist across browsers/computers</h4>
<p>
With a little bit of custom Javascript and some server side scripting you can make your annotations persist across
different browsers/computers. You can find an example of this <a href="annotate_persist.html"><b>here</b></a>.
</p>
</html>