{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Highstock Demos\n",
"================\n",
"Intraday area: http://www.highcharts.com/stock/demo/intraday-area\n",
"---------------------------------------------------------------"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from highcharts import Highstock\n",
"from highcharts.highstock.highstock_helper import jsonp_loader\n",
"from datetime import datetime\n",
"H = Highstock()\n",
"\n",
"data_url = 'http://www.highcharts.com/samples/data/jsonp.php?filename=new-intraday.json&callback=?'\n",
"data = jsonp_loader(data_url, sub_d = r'(\\/\\*.*\\*\\/)')\n",
"\n",
"H.add_data_set(data, 'area', 'AAPL', gapSize = 5,\n",
" tooltip = {\n",
" 'valueDecimals': 2\n",
" },\n",
" fillColor = {\n",
" 'linearGradient' : {\n",
" 'x1': 0,\n",
" 'y1': 0,\n",
" 'x2': 0,\n",
" 'y2': 1\n",
" },\n",
" 'stops' : [\n",
" [0, 'Highcharts.getOptions().colors[0]'],\n",
" [1, 'Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get(\"rgba\")']\n",
" ]\n",
" },\n",
" threshold = None)\n",
"\n",
"options = {\n",
" 'title': {\n",
" 'text': 'AAPL stock price by minute'\n",
" },\n",
"\n",
" 'subtitle': {\n",
" 'text': 'Using explicit breaks for nights and weekends'\n",
" },\n",
"\n",
" 'xAxis': {\n",
" 'breaks': [{ # Nights\n",
" 'from': datetime(2011, 10, 6, 16),\n",
" 'to': datetime(2011, 10, 7, 8),\n",
" 'repeat': 24 * 36 * 10**5\n",
" }, { # Weekends\n",
" 'from': datetime(2011, 10, 7, 16),\n",
" 'to': datetime(2011, 10, 10, 8),\n",
" 'repeat': 7 * 24 * 36 * 10**5\n",
" }]\n",
" },\n",
"\n",
" 'rangeSelector' : {\n",
" 'buttons' : [{\n",
" 'type' : 'hour',\n",
" 'count' : 1,\n",
" 'text' : '1h'\n",
" }, {\n",
" 'type' : 'day',\n",
" 'count' : 1,\n",
" 'text' : '1D'\n",
" }, {\n",
" 'type' : 'all',\n",
" 'count' : 1,\n",
" 'text' : 'All'\n",
" }],\n",
" 'selected' : 1,\n",
" 'inputEnabled' : False\n",
" },\n",
"\n",
"}\n",
"\n",
"H.set_dict_options(options)\n",
"\n",
"H"
]
}
],
"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.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}