Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
amcharts
images
readme.htm

readme.htm

<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<style>body {margin: 1em 5% 1em 5%}
b,pre,tt {color:#000080}
pre {background:#fffaf4; border:1pt solid #aebdcc; padding:5pt}
h1,h2,h3 {color:#015293;font-family:sans-serif;border-bottom:2px solid silver;
 margin-top:1.2em;margin-bottom:0.5em;line-height:1.3}
</style>
<title>Amcharts</title>
</head><body>
<h1 id="amcharts">Amcharts</h1>
<h2 id="introduction">Introduction</h2>
<p>
<a href="http://www.amcharts.com">Amcharts</a> is a set of flash charts designed for web applications.
It includes stock charts that are useful for visualizing kdb+ data. This is a commercial
product, however the charts can be used without a commercial license; if so, a small
amcharts logo is displayed on the chart.
<p>
Typically, the charts would be embedded in a web page, where some javascript and php
is needed to support them. However, they can be run directly, and the amcharts.q script has
utilities to do this. When an amcharts swf is loaded, it reads an xml
configuration file that defines the chart.
The q utility script builds the appropriate xml configuration file.
<h2 id="installation">Installation</h2>
<p>
Create a directory for the amcharts.
The following description uses a subdirectory chart/amcharts of the q
installation directory.
If you use another directory, update the directory definition at the beginning
of the amcharts.q and demo.q scripts.
<p>
Copy in all files from the svn amcharts/amcharts directory. For example:
<pre>q)\ls chart/amcharts
"amcharts.q"
"amcolumn_bookdepth.xml"
"amcolumn_settings.xml"
...
</pre>
Visit the <a href="http://www.amcharts.com">Amcharts</a> website and download the Stock and
Column &amp; Bar products into a temporary directory. Unzip each and copy the two .swf files
into your chart/amcharts directory. No other files are needed from the download.
<h2 id="viewingthecharts">Viewing the charts</h2>
<p>
The charts are in the two .swf files. These can be viewed in any browser that
supports flash. It is helpful to bookmark each .swf file.
Typically, the browser page should be refreshed after a plot is redrawn.
<h2 id="usage">Usage</h2>
<p>
Load q, and load the amcharts.q script, and any data to be displayed. The following example uses
the demo data from <a href="https://code.kx.com/trac/browser/contrib/cburke/buildhdb">buildhdb</a>.
<pre>q)\l chart/amcharts/amcharts.q
q)\l db/tickdemo
</pre>
The .am.plot function takes a table argument, and updates the xml configuration file
depending on the table columns. For example:
<pre>q).am.plot select date,close,size from daily where sym=`IBM
</pre>
<img src="images/amcharts.png"/>
<h2 id="plottypes">Plot types</h2>
<p>
The first column should be a date or time type. The column name is not used.
The remaining columns define types as follows:
<ul>
<li>
Book Depth - side,price,size
<li>
OHLC - open,high,low,close[,size]
<li>
Price - [sym,]price|close[,size]. If sym is given, this is an amcharts multiplot. Either price or close may be used.
<li>
RegNMS - minute,inside,outside
<li>
Volume Profile - minute,volume
<li>
VWAP - high,low,vwap[,size]
</ul>
<h2 id="demos">Demos</h2>
<p>
The script demo.q has several examples, as functions and typical usage. These
need to be run line by line. The examples use amstock.swf, except for the
last example (Book Depth) which uses amcolumn.swf.
<hr>
<p>
cdb 
<br>
14 Jan 2011
</body></html>
You can’t perform that action at this time.