{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Server running in the folder /Users/arnoutaertgeerts/Projects/python-highcharts at 127.0.0.1:52697\n" ] } ], "source": [ "import charts\n", "import pandas as pd\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "start = pd.Timestamp(\"20150101\")\n", "end = pd.Timestamp(\"20150201\")\n", "index = pd.DatetimeIndex(freq='900S', start=start, end=end)\n", "columns = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', \n", "'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']\n", "\n", "data = np.zeros((26, len(index)))\n", "for i, c in enumerate(columns):\n", " data[i] = i*np.linspace(0, 100, len(index))\n", "\n", "df = pd.DataFrame(index=index, columns=columns, data=data.T)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false, "scrolled": false }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "
\n", "
\n", "
\n", "
\n", "
\n", " \n", " \n", "
\n", "
\n", " Settings\n", "
\n", "
\n", "\n", " \n", " \n", " \n", " \n", " \n", "
\n", "\n", " Apply\n", " \n", "
\n", "
\n", "\n", "
\n", "
\n", " \n", "
\n", "
\n", "
\n", "
\n", "
\n", "
" ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "charts.plot(df, show='inline', stock=True, display=['A', 'F', 'Z'])" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false, "scrolled": false }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "
\n", "
\n", "
\n", "
\n", "
\n", " \n", " \n", "
\n", "
\n", " Settings\n", "
\n", "
\n", "\n", " \n", " \n", " \n", " \n", " \n", "
\n", "\n", " Apply\n", " \n", "
\n", "
\n", "\n", "
\n", "
\n", " \n", "
\n", "
\n", "
\n", "
\n", "
\n", "
" ], "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "series = [1,2,3,2,1]\n", "charts.plot(series, show='inline', name='List')" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "
\n", "
\n", "
\n", "
\n", "
\n", " \n", " \n", "
\n", "
\n", " Settings\n", "
\n", "
\n", "\n", " \n", " \n", " \n", " \n", " \n", "
\n", "\n", " Apply\n", " \n", "
\n", "
\n", "\n", "
\n", "
\n", " \n", "
\n", "
\n", "
\n", "
\n", "
\n", "
" ], "text/plain": [ "" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "charts.spline(series, name='Spline', show='inline', options=dict(title=dict(text='Title')))" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "
\n", "
\n", "
\n", "
\n", "
\n", " \n", " \n", "
\n", "
\n", " Settings\n", "
\n", "
\n", "\n", " \n", " \n", " \n", " \n", " \n", "
\n", "\n", " Apply\n", " \n", "
\n", "
\n", "\n", "
\n", "
\n", " \n", "
\n", "
\n", "
\n", "
\n", "
\n", "
" ], "text/plain": [ "" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "series = np.array(series)\n", "charts.plot(series, show='inline', name='Numpy series')" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false, "scrolled": false }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "
\n", "
\n", "
\n", "
\n", "
\n", " \n", " \n", "
\n", "
\n", " Settings\n", "
\n", "
\n", "\n", " \n", " \n", " \n", " \n", " \n", "
\n", "\n", " Apply\n", " \n", "
\n", "
\n", "\n", "
\n", "
\n", " \n", "
\n", "
\n", "
\n", "
\n", "
\n", "
" ], "text/plain": [ "" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "aapl = dict(name='Numpy AAPL', data=np.array(charts.data.aapl()['data']))\n", "msft = charts.data.msft()\n", "ohlc = charts.data.ohlc()\n", "\n", "series = [\n", " aapl,\n", " msft,\n", " ohlc\n", "]\n", "options = charts.options.default()\n", "\n", "charts.plot(series, options, height=500, stock=True, show='inline', display=['MSFT'])" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Opening new tab...\n" ] } ], "source": [ "aapl = dict(name='AAPL', data=np.array(charts.data.aapl()['data']))\n", "msft = charts.data.msft()\n", "ohlc = charts.data.ohlc()\n", "\n", "series = [\n", " aapl,\n", " msft,\n", " ohlc\n", "]\n", "options = charts.options.default()\n", "\n", "charts.plot(series, options, height=500, stock=True, show='tab', display=['AAPL'])" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.9" } }, "nbformat": 4, "nbformat_minor": 0 }