Skip to content

Commit 06b39db

Browse files
authored
Merge pull request #18 from kyper-data/v0.3.1
V0.3.1
2 parents b10d904 + ec063f9 commit 06b39db

File tree

6 files changed

+279
-2
lines changed

6 files changed

+279
-2
lines changed

MANIFEST.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
include MANIFEST.in
2+
include LICENSE
3+
4+
graft tests
5+
6+
global-exclude *.py[co]

examples/highcharts/heatmap.py

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Highcharts Demos
4+
Heatmap: http://www.highcharts.com/demo/heatmap
5+
"""
6+
from highcharts import Highchart
7+
H = Highchart()
8+
9+
data = [
10+
[0, 0, 10],
11+
[0, 1, 19],
12+
[0, 2, 8],
13+
[0, 3, 24],
14+
[0, 4, 67],
15+
[1, 0, 92],
16+
[1, 1, 58],
17+
[1, 2, 78],
18+
[1, 3, 117],
19+
[1, 4, 48],
20+
[2, 0, 35],
21+
[2, 1, 15],
22+
[2, 2, 123],
23+
[2, 3, 64],
24+
[2, 4, 52],
25+
[3, 0, 72],
26+
[3, 1, 132],
27+
[3, 2, 114],
28+
[3, 3, 19],
29+
[3, 4, 16],
30+
[4, 0, 38],
31+
[4, 1, 5],
32+
[4, 2, 8],
33+
[4, 3, 117],
34+
[4, 4, 115],
35+
[5, 0, 88],
36+
[5, 1, 32],
37+
[5, 2, 12],
38+
[5, 3, 6],
39+
[5, 4, 120],
40+
[6, 0, 13],
41+
[6, 1, 44],
42+
[6, 2, 88],
43+
[6, 3, 98],
44+
[6, 4, 96],
45+
[7, 0, 31],
46+
[7, 1, 1],
47+
[7, 2, 82],
48+
[7, 3, 32],
49+
[7, 4, 30],
50+
[8, 0, 85],
51+
[8, 1, 97],
52+
[8, 2, 123],
53+
[8, 3, 64],
54+
[8, 4, 84],
55+
[9, 0, 47],
56+
[9, 1, 114],
57+
[9, 2, 31],
58+
[9, 3, 48],
59+
[9, 4, 91]
60+
]
61+
62+
H.add_data_set(data, )
63+
64+
H.set_options('chart', {
65+
'type': 'heatmap',
66+
'marginTop': 40,
67+
'marginBottom': 80,
68+
'plotBorderWidth': 1
69+
})
70+
71+
H.set_options('xAxis', {
72+
'categories':
73+
['Alexander', 'Marie', 'Maximilian', 'Sophia', 'Lukas', 'Maria', 'Leon', 'Anna', 'Tim', 'Laura']
74+
})
75+
76+
H.set_options('yAxis', {
77+
'categories': ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
78+
'title': None
79+
})
80+
81+
H.set_options('title', {
82+
'text': "Sales per employee per weekday"
83+
})
84+
85+
H.set_options('colorAxis', {
86+
'min': 0,
87+
'minColor': '#FFFFFF',
88+
'maxColor': '#7CB5EC'
89+
})
90+
91+
H.set_options('legend', {
92+
'align': 'right',
93+
'layout': 'vertical',
94+
'margin': 0,
95+
'verticalAlign': 'top',
96+
'y': 25,
97+
'symbolHeight': 280
98+
})
99+
100+
H.set_options('tooltip', {
101+
'formatter': "function () {" +
102+
"return '<b>' + this.series.xAxis.categories[this.point.x] + '</b> sold <br><b>' +" +
103+
"this.point.value + '</b> items on <br><b>' + this.series.yAxis.categories[this.point.y] + '</b>';" +
104+
"}"
105+
})
106+
107+
H.htmlcontent
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 8,
6+
"metadata": {
7+
"collapsed": false
8+
},
9+
"outputs": [
10+
{
11+
"data": {
12+
"text/html": [
13+
"<iframe style=\"border:0;outline:none;overflow:hidden\" srcdoc=\"&lt;!DOCTYPE html&gt; &lt;html lang=&quot;en&quot;&gt; &lt;head&gt; &lt;meta charset=&quot;utf-8&quot; /&gt; &lt;link href=&quot;https://www.highcharts.com/highslide/highslide.css&quot; rel=&quot;stylesheet&quot; /&gt; &lt;script type=&quot;text/javascript&quot; src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot; src=&quot;https://code.highcharts.com/highcharts.js&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot; src=&quot;https://code.highcharts.com/highcharts-more.js&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot; src=&quot;https://code.highcharts.com/modules/heatmap.js&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot; src=&quot;https://code.highcharts.com/modules/exporting.js&quot;&gt;&lt;/script&gt; &lt;/head&gt; &lt;body style=&quot;margin:0;padding:0&quot;&gt; &lt;div id=&quot;container&quot; style=&quot;&quot;&gt;Loading....&lt;/div&gt; &lt;script&gt; $(function(){ Highcharts.setOptions({&quot;lang&quot;: {}, &quot;global&quot;: {}}); var option = {&quot;drilldown&quot;: {}, &quot;yAxis&quot;: {&quot;categories&quot;: [&quot;Monday&quot;, &quot;Tuesday&quot;, &quot;Wednesday&quot;, &quot;Thursday&quot;, &quot;Friday&quot;]}, &quot;legend&quot;: {&quot;verticalAlign&quot;: &quot;top&quot;, &quot;layout&quot;: &quot;vertical&quot;, &quot;align&quot;: &quot;right&quot;, &quot;y&quot;: 25, &quot;margin&quot;: 0, &quot;symbolHeight&quot;: 280}, &quot;loading&quot;: {}, &quot;colorAxis&quot;: {&quot;maxColor&quot;: &quot;#7CB5EC&quot;, &quot;minColor&quot;: &quot;#FFFFFF&quot;, &quot;min&quot;: 0}, &quot;plotOptions&quot;: {}, &quot;exporting&quot;: {}, &quot;credits&quot;: {&quot;enabled&quot;: false}, &quot;colors&quot;: {}, &quot;title&quot;: {&quot;text&quot;: &quot;Sales per employee per weekday&quot;}, &quot;series&quot;: {}, &quot;tooltip&quot;: {&quot;formatter&quot;: function () {return &#x27;&lt;b&gt;&#x27; + this.series.xAxis.categories[this.point.x] + &#x27;&lt;/b&gt; sold &lt;br&gt;&lt;b&gt;&#x27; +this.point.value + &#x27;&lt;/b&gt; items on &lt;br&gt;&lt;b&gt;&#x27; + this.series.yAxis.categories[this.point.y] + &#x27;&lt;/b&gt;&#x27;;}}, &quot;xAxis&quot;: {&quot;categories&quot;: [&quot;Alexander&quot;, &quot;Marie&quot;, &quot;Maximilian&quot;, &quot;Sophia&quot;, &quot;Lukas&quot;, &quot;Maria&quot;, &quot;Leon&quot;, &quot;Anna&quot;, &quot;Tim&quot;, &quot;Laura&quot;]}, &quot;pane&quot;: {}, &quot;subtitle&quot;: {}, &quot;labels&quot;: {}, &quot;chart&quot;: {&quot;plotBorderWidth&quot;: 1, &quot;marginBottom&quot;: 80, &quot;marginTop&quot;: 40, &quot;type&quot;: &quot;heatmap&quot;, &quot;renderTo&quot;: &quot;container&quot;}, &quot;navigation&quot;: {}}; var data = [{&quot;type&quot;: &quot;heatmap&quot;, &quot;name&quot;: &quot;Series 1&quot;, &quot;dataLabels&quot;: {&quot;enabled&quot;: true, &quot;color&quot;: &quot;#000000&quot;}, &quot;data&quot;: [[0, 0, 10], [0, 1, 19], [0, 2, 8], [0, 3, 24], [0, 4, 67], [1, 0, 92], [1, 1, 58], [1, 2, 78], [1, 3, 117], [1, 4, 48], [2, 0, 35], [2, 1, 15], [2, 2, 123], [2, 3, 64], [2, 4, 52], [3, 0, 72], [3, 1, 132], [3, 2, 114], [3, 3, 19], [3, 4, 16], [4, 0, 38], [4, 1, 5], [4, 2, 8], [4, 3, 117], [4, 4, 115], [5, 0, 88], [5, 1, 32], [5, 2, 12], [5, 3, 6], [5, 4, 120], [6, 0, 13], [6, 1, 44], [6, 2, 88], [6, 3, 98], [6, 4, 96], [7, 0, 31], [7, 1, 1], [7, 2, 82], [7, 3, 32], [7, 4, 30], [8, 0, 85], [8, 1, 97], [8, 2, 123], [8, 3, 64], [8, 4, 84], [9, 0, 47], [9, 1, 114], [9, 2, 31], [9, 3, 48], [9, 4, 91]], &quot;borderWidth&quot;: 1}]; option.series = data; var chart = new Highcharts.Chart(option); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;\" height=520 width=820></iframe>"
14+
],
15+
"text/plain": [
16+
"<highcharts.highcharts.highcharts.Highchart at 0x10c4ce080>"
17+
]
18+
},
19+
"execution_count": 8,
20+
"metadata": {},
21+
"output_type": "execute_result"
22+
}
23+
],
24+
"source": [
25+
"# -*- coding: utf-8 -*-\n",
26+
"\"\"\"\n",
27+
"Highcharts Demos\n",
28+
"Heatmap: http://www.highcharts.com/demo/heatmap\n",
29+
"\"\"\"\n",
30+
"from highcharts import Highchart\n",
31+
"H = Highchart()\n",
32+
"\n",
33+
"data = [\n",
34+
" [0, 0, 10],\n",
35+
" [0, 1, 19],\n",
36+
" [0, 2, 8],\n",
37+
" [0, 3, 24],\n",
38+
" [0, 4, 67],\n",
39+
" [1, 0, 92],\n",
40+
" [1, 1, 58],\n",
41+
" [1, 2, 78],\n",
42+
" [1, 3, 117],\n",
43+
" [1, 4, 48],\n",
44+
" [2, 0, 35],\n",
45+
" [2, 1, 15],\n",
46+
" [2, 2, 123],\n",
47+
" [2, 3, 64],\n",
48+
" [2, 4, 52],\n",
49+
" [3, 0, 72],\n",
50+
" [3, 1, 132],\n",
51+
" [3, 2, 114],\n",
52+
" [3, 3, 19],\n",
53+
" [3, 4, 16],\n",
54+
" [4, 0, 38],\n",
55+
" [4, 1, 5],\n",
56+
" [4, 2, 8],\n",
57+
" [4, 3, 117],\n",
58+
" [4, 4, 115],\n",
59+
" [5, 0, 88],\n",
60+
" [5, 1, 32],\n",
61+
" [5, 2, 12],\n",
62+
" [5, 3, 6],\n",
63+
" [5, 4, 120],\n",
64+
" [6, 0, 13],\n",
65+
" [6, 1, 44],\n",
66+
" [6, 2, 88],\n",
67+
" [6, 3, 98],\n",
68+
" [6, 4, 96],\n",
69+
" [7, 0, 31],\n",
70+
" [7, 1, 1],\n",
71+
" [7, 2, 82],\n",
72+
" [7, 3, 32],\n",
73+
" [7, 4, 30],\n",
74+
" [8, 0, 85],\n",
75+
" [8, 1, 97],\n",
76+
" [8, 2, 123],\n",
77+
" [8, 3, 64],\n",
78+
" [8, 4, 84],\n",
79+
" [9, 0, 47],\n",
80+
" [9, 1, 114],\n",
81+
" [9, 2, 31],\n",
82+
" [9, 3, 48],\n",
83+
" [9, 4, 91]\n",
84+
"]\n",
85+
"\n",
86+
"H.add_data_set(data, series_type='heatmap', borderWidth=1, dataLabels={\n",
87+
" 'enabled': True,\n",
88+
" 'color': '#000000'\n",
89+
"})\n",
90+
"\n",
91+
"H.set_options('chart', {\n",
92+
" 'type': 'heatmap',\n",
93+
" 'marginTop': 40,\n",
94+
" 'marginBottom': 80,\n",
95+
" 'plotBorderWidth': 1\n",
96+
"})\n",
97+
"\n",
98+
"H.set_options('xAxis', {\n",
99+
" 'categories': \n",
100+
" ['Alexander', 'Marie', 'Maximilian', 'Sophia', 'Lukas', 'Maria', 'Leon', 'Anna', 'Tim', 'Laura']\n",
101+
"})\n",
102+
"\n",
103+
"H.set_options('yAxis', {\n",
104+
" 'categories': ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],\n",
105+
" 'title': None\n",
106+
"})\n",
107+
"\n",
108+
"H.set_options('title', {\n",
109+
" 'text': \"Sales per employee per weekday\"\n",
110+
"})\n",
111+
"\n",
112+
"H.set_options('colorAxis', {\n",
113+
" 'min': 0,\n",
114+
" 'minColor': '#FFFFFF',\n",
115+
" 'maxColor': '#7CB5EC'\n",
116+
"})\n",
117+
"\n",
118+
"H.set_options('legend', {\n",
119+
" 'align': 'right',\n",
120+
" 'layout': 'vertical',\n",
121+
" 'margin': 0,\n",
122+
" 'verticalAlign': 'top',\n",
123+
" 'y': 25,\n",
124+
" 'symbolHeight': 280\n",
125+
"})\n",
126+
"\n",
127+
"H.set_options('tooltip', {\n",
128+
" 'formatter': \"function () {\" + \n",
129+
" \"return '<b>' + this.series.xAxis.categories[this.point.x] + '</b> sold <br><b>' +\" +\n",
130+
" \"this.point.value + '</b> items on <br><b>' + this.series.yAxis.categories[this.point.y] + '</b>';\" +\n",
131+
" \"}\"\n",
132+
"})\n",
133+
"\n",
134+
"H"
135+
]
136+
}
137+
],
138+
"metadata": {
139+
"kernelspec": {
140+
"display_name": "Python 3",
141+
"language": "python",
142+
"name": "python3"
143+
},
144+
"language_info": {
145+
"codemirror_mode": {
146+
"name": "ipython",
147+
"version": 3
148+
},
149+
"file_extension": ".py",
150+
"mimetype": "text/x-python",
151+
"name": "python",
152+
"nbconvert_exporter": "python",
153+
"pygments_lexer": "ipython3",
154+
"version": "3.5.1"
155+
}
156+
},
157+
"nbformat": 4,
158+
"nbformat_minor": 1
159+
}

highcharts/highcharts/highchart_types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@
479479
"selected": bool,
480480
"sliced": bool,
481481
"showInLegend": bool,
482+
"stack": basestring,
482483
"type": basestring,
483484
"visible": bool,
484485
"x": [int, float],
@@ -617,7 +618,7 @@ def __getattr__(self,item):
617618
class Series(object):
618619
"""Series class for input data """
619620

620-
def __init__(self,data,series_type="line",supress_errors=False,**kwargs):
621+
def __init__(self, data, series_type="line", supress_errors=False, **kwargs):
621622

622623
# List of dictionaries. Each dict contains data and properties,
623624
# which need to handle before construct the object for series

highcharts/highstock/options.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ class PlotOptions(BaseOptions):
301301
"arearange": (SeriesOptions, dict),
302302
"areaspline": (SeriesOptions, dict),
303303
"areasplinerange": (SeriesOptions, dict),
304+
"candlestick": (SeriesOptions, dict),
304305
"column": (SeriesOptions, dict),
305306
"columnrange": (SeriesOptions, dict),
306307
"flags": (SeriesOptions, dict),

tests/test_highcharts.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ def test_Example1(self):
5656
execfile(os.path.join(self.PATH_ROOT, 'Example1.py'))
5757
os.remove("highcharts.html")
5858

59+
def test_error_bar(self):
60+
execfile(os.path.join(self.PATH_ROOT, 'heatmap.py'))
61+
5962
def test_line_time_series(self):
6063
execfile(os.path.join(self.PATH_ROOT, 'line-time-series.py'))
6164

@@ -82,4 +85,4 @@ def test_spline_symbols(self):
8285

8386
def test_treemap_levels(self):
8487
execfile(os.path.join(self.PATH_ROOT, 'treemap-levels.py'))
85-
88+

0 commit comments

Comments
 (0)