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

140 lines
5.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>An example of displaying financial data</title>
<meta name="keywords" content="OfficeExcel html5 canvas financial chart example" />
<meta name="description" content="An example of using the Scatter chart to show financial data" />
<meta name="googlebot" content="NOODP">
<meta property="og:title" content="OfficeExcel: HTML5 Javascript charts library" />
<meta property="og:description" content="A charts library based on the HTML5 canvas tag" />
<meta property="og:image" content="http://www.OfficeExcel.net/images/logo.jpg"/>
<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.tooltips.js"></script>
<script src="../libraries/OfficeExcel.scatter.js"></script>
<script src="../libraries/financial-data.js"></script>
<!--[if IE 8]><script src="../excanvas/excanvas.original.js"></script><![endif]-->
<?php PrintAnalyticsCode() ?>
<script>
window.onload = function ()
{
var s = new OfficeExcel.Scatter('cvs', data);
s.Set('chart.ymin', 0.5);
s.Set('chart.ymax', 1);
s.Set('chart.xmin', Date.UTC(2007,0,1));
s.Set('chart.xmax', Date.UTC(2010,11,31));
s.Set('chart.labels', [ ['2007', Date.UTC(2007,0,1)],['2008', Date.UTC(2008,0,1)],['2009', Date.UTC(2009,0,1)],['2010', Date.UTC(2010,0,1)]]);
s.Set('chart.labels.specific.align', 'center');
s.Set('chart.tickmarks', null);
s.Set('chart.line', true);
s.Set('chart.line.colors', ['red']);
s.Set('chart.units.pre', '$');
s.Set('chart.gutter.left', 40);
s.Set('chart.title', 'Euro/Dollar exchange rate data over the past 4 years');
s.Set('chart.tooltips.effect', 'snap');
s.Set('chart.background.grid.autofit.numvlines', 16);
s.Set('chart.scale.decimals', 2);
s.Draw();
}
</script>
</head>
<body id="licensing">
<a name="top"></a>
<!-- 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>
>
Displaying financial data
</div>
<h1>Displaying <span>financial data</span></h1>
<canvas id="cvs" width="600" height="250" style="float: right">[No canvas support]</canvas>
<p>
OfficeExcel can be used to display financial information, as shown here. In this case the chart is showing exchange rate
information for the period 2008 - 2010.
</p>
<p>
Because the Line chart has no concept of an X axis scale, the Scatter chart with a connecting line is used to show the data.
</p>
<p>
<b>Note:</b>
If you don't have a lot of data then if you use a connecting line (as it is here) it may look jagged - particularly if
your data jumps from a high value to a low value or vice versa.
</p>
<p>
The chart uses data that is held in a separate file (because there's a lot of it). You can see this file here:
<a href="../libraries/financial-data.js">financial-data.js</a>
</p>
<br clear="all" />
<pre class="code">
&lt;script&gt;
window.onload = function ()
{
// The data variable is defined in the external file
var s = new OfficeExcel.Scatter('cvs', data);
s.Set('chart.ymin', 0.5);
s.Set('chart.xmin', Date.UTC(2007,0,1));
s.Set('chart.xmax', Date.UTC(2010,11,31));
s.Set('chart.labels', [ ['2007', Date.UTC(2007,0,1)],['2008', Date.UTC(2008,0,1)],['2009', Date.UTC(2009,0,1)],['2010', Date.UTC(2010,0,1)]]);
s.Set('chart.labels.specific.align', 'center');
s.Set('chart.tickmarks', null);
s.Set('chart.line', true);
s.Set('chart.line.colors', ['red']);
s.Set('chart.units.pre', '$');
s.Set('chart.gutter.left', 35);
s.Set('chart.title', 'Euro exchange rate data over the past 4 years');
s.Set('chart.tooltips.effect', 'snap');
s.Set('chart.background.grid.autofit.numvlines', 16);
s.Set('chart.scale.decimals', 2);
s.Draw();
}
&lt;/script&gt;
</pre>
</body>
</html>