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


<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;
<h1 id="amcharts">Amcharts</h1>
<h2 id="introduction">Introduction</h2>
<a href="">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.
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>
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.
Copy in all files from the svn amcharts/amcharts directory. For example:
<pre>q)\ls chart/amcharts
Visit the <a href="">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>
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>
Load q, and load the amcharts.q script, and any data to be displayed. The following example uses
the demo data from <a href="">buildhdb</a>.
<pre>q)\l chart/amcharts/amcharts.q
q)\l db/tickdemo
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
<img src="images/amcharts.png"/>
<h2 id="plottypes">Plot types</h2>
The first column should be a date or time type. The column name is not used.
The remaining columns define types as follows:
Book Depth - side,price,size
OHLC - open,high,low,close[,size]
Price - [sym,]price|close[,size]. If sym is given, this is an amcharts multiplot. Either price or close may be used.
RegNMS - minute,inside,outside
Volume Profile - minute,volume
VWAP - high,low,vwap[,size]
<h2 id="demos">Demos</h2>
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.
14 Jan 2011
You can’t perform that action at this time.