Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
fb5ca7d
added install instructions
ksolan Sep 2, 2015
a2cc7f4
updated readme
ksolan Sep 2, 2015
9884e6b
updated notebook
ksolan Sep 2, 2015
d8d90cc
updated ipynb to be compatible with ipython 4.0
ksolan Sep 18, 2015
3e6e72f
v0.1.1
ksolan Sep 18, 2015
a164be4
fixed ipython bug with python3 + highstock/highmaps
ksolan Oct 17, 2015
42ce7cc
v0.1.2
ksolan Oct 17, 2015
3b3f0b4
cleaned up imports and added .iframe property
ksolan Oct 20, 2015
8acab90
v0.2.0
ksolan Oct 20, 2015
b357358
remove excess spacing in iframes
ksolan Oct 20, 2015
005aba8
add setOptions (lang and global options) capability
Mar 24, 2016
7e79250
add setOptions (lang and global options) capability
Mar 24, 2016
7530560
remove save_file in highmap example1
Mar 24, 2016
ef0ba31
update highcarts code to support highmaps and update jQuery to 1.9.1 …
Apr 23, 2016
e8063e4
Update highcharts.py
ayamahmod Jul 8, 2016
1445531
Update common.py
ayamahmod Jul 8, 2016
17ced17
Merge pull request #12 from ayamahmod/master
ksolan Oct 31, 2016
b10d904
incremented version to v0.3.0
ksolan Oct 31, 2016
bc8a112
added manifest
ksolan Oct 31, 2016
39769b7
fixed #17
ksolan Oct 31, 2016
c3dde65
fixed #16
ksolan Oct 31, 2016
ec063f9
added heatmap example
ksolan Nov 2, 2016
06b39db
Merge pull request #18 from kyper-data/v0.3.1
ksolan Nov 2, 2016
f058854
incremented version v0.3.1
ksolan Nov 2, 2016
0e4a39b
Merge pull request #19 from kyper-data/v0.3.1
ksolan Nov 2, 2016
6e49c80
added spline-irregular-time example
ksolan Nov 2, 2016
85a6712
Merge branch 'spline-irregular-time'
ksolan Nov 2, 2016
8920a3b
added build badge
ksolan Nov 2, 2016
d261025
Point event fix
Apr 26, 2017
5a84c12
Update options.py
Borchmann Jun 28, 2017
b021c04
Fixed #29
smalawi Jul 14, 2017
ef2e290
Correct dashStyle option type
adhiraj Jul 24, 2017
f122e52
offline mode
Aug 1, 2017
8adec3c
Merge pull request #36 from luv/master
ksolan Oct 5, 2017
951dd7e
Merge pull request #34 from smalawi/fix/spline-linkedto
ksolan Oct 12, 2017
be18fc2
Merge pull request #35 from adhiraj/patch-1
ksolan Oct 12, 2017
09448ff
Merge pull request #30 from eglenfield/master
ksolan Oct 12, 2017
0e714af
Merge pull request #32 from Borchmann/patch-1
ksolan Oct 12, 2017
354221f
Update urllib2 to python3 version, relying on the already available '…
othalan Dec 13, 2017
d59f9f8
Stock logarithmic (#40)
othalan Dec 13, 2017
6456782
JSONP multisource support (#42)
othalan Dec 19, 2017
0a8b0db
Ksolan/version bump (#43)
ksolan Dec 19, 2017
af7e4f8
Update JSsource urls to use Highcharts v6.x (#62)
dbowring Dec 14, 2018
a4c488a
Bumped version (0.4.2)
ksolan Dec 14, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include MANIFEST.in
include LICENSE

graft tests

global-exclude *.py[co]
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# python-highcharts
# python-highcharts [![CircleCI](https://circleci.com/gh/kyper-data/python-highcharts.svg?style=svg)](https://circleci.com/gh/kyper-data/python-highcharts)

## License

Expand All @@ -10,13 +10,16 @@ However, please be aware that the Highcharts project itself, as well as Highmaps

python-highcharts is a simple translation layer between Python and Javascript for Highcharts projects (highcharts, highmaps, and highstocks).

In addition, python-highcharts integrates with [Jupyter/IPython notebook](https://github.com/jupyter/notebook), which enables you to render Highcharts, Highmaps, and Highstock visualizations directly in notebooks. See examples [here](https://github.com/kyper-data/python-highcharts/tree/developer/examples/ipynb).
In addition, python-highcharts integrates with [Jupyter notebook](https://github.com/jupyter/notebook), which enables you to render Highcharts, Highmaps, and Highstock visualizations directly in notebooks. See examples [here](https://github.com/kyper-data/python-highcharts/tree/developer/examples/ipynb).

The original framework was inspired by [python-nvd3](https://github.com/areski/python-nvd3) and [PyHighcharts](https://github.com/fidyeates/PyHighcharts).

## Installation

-need to work on this-
python-highcharts supports Python 2.7/3.4+ and is available on PyPI. To install:
```
pip install python-highcharts
```

---------------------------------------------------------------------------------------------------------------
# Highcharts/Highstock
Expand Down Expand Up @@ -193,6 +196,12 @@ chart.add_data_set(data, 'spline', 'Temperature', marker={'enabled': False})
chart
```

### Example notebooks:

* [Highcharts](http://nbviewer.ipython.org/github/kyper-data/python-highcharts/blob/master/examples/ipynb/highcharts/Example1.ipynb)
* [Highmaps](http://nbviewer.ipython.org/github/kyper-data/python-highcharts/blob/master/examples/ipynb/highmaps/Example1.ipynb)
* [Highstock](http://nbviewer.ipython.org/github/kyper-data/python-highcharts/blob/master/examples/ipynb/highstock/Example1-basic-line.ipynb)

## Todo:

* More charts support
Expand Down Expand Up @@ -581,4 +590,4 @@ chart.save_file()
* More examples
* Clean code and put more explanation

Reference: [Highcharts API](http://api.highcharts.com/highcharts)
Reference: [Highcharts API](http://api.highcharts.com/highcharts)
107 changes: 107 additions & 0 deletions examples/highcharts/heatmap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# -*- coding: utf-8 -*-
"""
Highcharts Demos
Heatmap: http://www.highcharts.com/demo/heatmap
"""
from highcharts import Highchart
H = Highchart()

data = [
[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]
]

H.add_data_set(data, )

H.set_options('chart', {
'type': 'heatmap',
'marginTop': 40,
'marginBottom': 80,
'plotBorderWidth': 1
})

H.set_options('xAxis', {
'categories':
['Alexander', 'Marie', 'Maximilian', 'Sophia', 'Lukas', 'Maria', 'Leon', 'Anna', 'Tim', 'Laura']
})

H.set_options('yAxis', {
'categories': ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
'title': None
})

H.set_options('title', {
'text': "Sales per employee per weekday"
})

H.set_options('colorAxis', {
'min': 0,
'minColor': '#FFFFFF',
'maxColor': '#7CB5EC'
})

H.set_options('legend', {
'align': 'right',
'layout': 'vertical',
'margin': 0,
'verticalAlign': 'top',
'y': 25,
'symbolHeight': 280
})

H.set_options('tooltip', {
'formatter': "function () {" +
"return '<b>' + this.series.xAxis.categories[this.point.x] + '</b> sold <br><b>' +" +
"this.point.value + '</b> items on <br><b>' + this.series.yAxis.categories[this.point.y] + '</b>';" +
"}"
})

H.htmlcontent
119 changes: 119 additions & 0 deletions examples/highcharts/spline-irregular-time.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# -*- coding: utf-8 -*-
"""
Highcharts Demos
Time data with irregular intervals: http://www.highcharts.com/demo/spline-irregular-time
"""
from datetime import datetime
from highcharts import Highchart
H = Highchart()

winter_12_13_data = [
[datetime(1970, 10, 21), 0],
[datetime(1970, 11, 4), 0.28],
[datetime(1970, 11, 9), 0.25],
[datetime(1970, 11, 27), 0.2],
[datetime(1970, 12, 2), 0.28],
[datetime(1970, 12, 26), 0.28],
[datetime(1970, 12, 29), 0.47],
[datetime(1971, 1, 11), 0.79],
[datetime(1971, 1, 26), 0.72],
[datetime(1971, 2, 3), 1.02],
[datetime(1971, 2, 11), 1.12],
[datetime(1971, 2, 25), 1.2],
[datetime(1971, 3, 11), 1.18],
[datetime(1971, 4, 11), 1.19],
[datetime(1971, 5, 1), 1.85],
[datetime(1971, 5, 5), 2.22],
[datetime(1971, 5, 19), 1.15],
[datetime(1971, 6, 3), 0]
]

winter_13_14_data = [
[datetime(1970, 10, 29), 0],
[datetime(1970, 11, 9), 0.4],
[datetime(1970, 12, 1), 0.25],
[datetime(1971, 1, 1), 1.66],
[datetime(1971, 1, 10), 1.8],
[datetime(1971, 2, 19), 1.76],
[datetime(1971, 3, 25), 2.62],
[datetime(1971, 4, 19), 2.41],
[datetime(1971, 4, 30), 2.05],
[datetime(1971, 5, 14), 1.7],
[datetime(1971, 5, 24), 1.1],
[datetime(1971, 6, 10), 0]
]

winter_14_15_data = [
[datetime(1970, 11, 25), 0],
[datetime(1970, 12, 6), 0.25],
[datetime(1970, 12, 20), 1.41],
[datetime(1970, 12, 25), 1.64],
[datetime(1971, 1, 4), 1.6],
[datetime(1971, 1, 17), 2.55],
[datetime(1971, 1, 24), 2.62],
[datetime(1971, 2, 4), 2.5],
[datetime(1971, 2, 14), 2.42],
[datetime(1971, 3, 6), 2.74],
[datetime(1971, 3, 14), 2.62],
[datetime(1971, 3, 24), 2.6],
[datetime(1971, 4, 2), 2.81],
[datetime(1971, 4, 12), 2.63],
[datetime(1971, 4, 28), 2.77],
[datetime(1971, 5, 5), 2.68],
[datetime(1971, 5, 10), 2.56],
[datetime(1971, 5, 15), 2.39],
[datetime(1971, 5, 20), 2.3],
[datetime(1971, 6, 5), 2],
[datetime(1971, 6, 10), 1.85],
[datetime(1971, 6, 15), 1.49],
[datetime(1971, 6, 23), 1.08]
]

H.add_data_set(winter_12_13_data, series_type="spline", name="Winter 2012-2013")
H.add_data_set(winter_13_14_data, series_type="spline", name="Winter 2013-2014")
H.add_data_set(winter_14_15_data, series_type="spline", name="Winter 2014-2015")

H.set_options('chart', {
'type': 'spline'
})

H.set_options('xAxis', {
'type': 'datetime',
'dateTimeLabelFormats': { # don't display the dummy year
'month': '%e. %b',
'year': '%b'
},
'title': {
'text': 'Date'
}
})

H.set_options('yAxis', {
'title': {
'text': 'Snow depth (m)'
},
'min': 0
})

H.set_options('title', {
'text': "Snow depth at Vikjafjellet, Norway"
})

H.set_options('subtitle', {
'text': "Irregular time data in Highcharts JS"
})

H.set_options('tooltip', {
'headerFormat': '<b>{series.name}</b><br>',
'pointFormat': '{point.x:%e. %b}: {point.y:.2f} m'
})

H.set_options('plotOptions', {
'spline': {
'marker': {
'enabled': True
}
}
})

H.htmlcontent
12 changes: 6 additions & 6 deletions examples/ipynb/highcharts/3d-scatter-draggable.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 1,
"metadata": {
"collapsed": false,
"scrolled": false
Expand All @@ -21,7 +21,7 @@
{
"data": {
"text/html": [
"<iframe style=\"border:0;outline:none;overflow:hidden\" srcdoc=\"&lt;!DOCTYPE html&gt;\n",
"<iframe style=\"border:0;outline:none;overflow:hidden\" src=\"data:text/html,&lt;!DOCTYPE html&gt;\n",
"&lt;html lang=&quot;en&quot;&gt;\n",
" &lt;head&gt;\n",
" &lt;meta charset=&quot;utf-8&quot; /&gt;\n",
Expand Down Expand Up @@ -61,7 +61,7 @@
" }), &quot;zAxis&quot;: {&quot;max&quot;: 10, &quot;showFirstLabel&quot;: false, &quot;min&quot;: 0}, &quot;pane&quot;: {}, &quot;exporting&quot;: {}, &quot;drilldown&quot;: {}, &quot;navigation&quot;: {}, &quot;legend&quot;: {&quot;enabled&quot;: false}};\n",
"\n",
"\n",
" var data = [{&quot;colorByPoint&quot;: true, &quot;data&quot;: [[1, 6, 5], [8, 7, 9], [1, 3, 4], [4, 6, 8], [5, 7, 7], [6, 9, 6], [7, 0, 5], [2, 3, 3], [3, 9, 8], [3, 6, 5], [4, 9, 4], [2, 3, 3], [6, 9, 9], [0, 7, 0], [7, 7, 9], [7, 2, 9], [0, 6, 2], [4, 6, 7], [3, 7, 7], [0, 1, 7], [2, 8, 6], [2, 3, 7], [6, 4, 8], [3, 5, 9], [7, 9, 5], [3, 1, 7], [4, 4, 2], [3, 6, 2], [3, 1, 6], [6, 8, 5], [6, 6, 7], [4, 1, 1], [7, 2, 7], [7, 7, 0], [8, 8, 9], [9, 4, 1], [8, 3, 4], [9, 8, 9], [3, 5, 3], [0, 2, 4], [6, 0, 2], [2, 1, 3], [5, 8, 9], [2, 1, 1], [9, 7, 6], [3, 0, 2], [9, 9, 0], [3, 4, 8], [2, 6, 1], [8, 9, 2], [7, 6, 5], [6, 3, 1], [9, 3, 1], [8, 9, 3], [9, 1, 0], [3, 8, 7], [8, 0, 0], [4, 9, 7], [8, 6, 2], [4, 3, 0], [2, 3, 5], [9, 1, 4], [1, 1, 4], [6, 0, 2], [6, 1, 6], [3, 8, 8], [8, 8, 7], [5, 5, 0], [3, 9, 6], [5, 4, 3], [6, 8, 3], [0, 1, 5], [6, 7, 3], [8, 3, 2], [3, 8, 3], [2, 1, 6], [4, 6, 7], [8, 9, 9], [5, 4, 2], [6, 1, 3], [6, 9, 5], [4, 8, 2], [9, 7, 4], [5, 4, 2], [9, 6, 1], [2, 7, 3], [4, 5, 4], [6, 8, 1], [3, 4, 0], [2, 2, 6], [5, 1, 2], [9, 9, 7], [6, 9, 9], [8, 4, 3], [4, 1, 7], [6, 2, 5], [0, 4, 9], [3, 5, 9], [6, 9, 1], [1, 9, 2]], &quot;type&quot;: &quot;scatter&quot;, &quot;name&quot;: &quot;Reading&quot;}]\n",
" var data = [{&quot;colorByPoint&quot;: true, &quot;data&quot;: [[1, 6, 5], [8, 7, 9], [1, 3, 4], [4, 6, 8], [5, 7, 7], [6, 9, 6], [7, 0, 5], [2, 3, 3], [3, 9, 8], [3, 6, 5], [4, 9, 4], [2, 3, 3], [6, 9, 9], [0, 7, 0], [7, 7, 9], [7, 2, 9], [0, 6, 2], [4, 6, 7], [3, 7, 7], [0, 1, 7], [2, 8, 6], [2, 3, 7], [6, 4, 8], [3, 5, 9], [7, 9, 5], [3, 1, 7], [4, 4, 2], [3, 6, 2], [3, 1, 6], [6, 8, 5], [6, 6, 7], [4, 1, 1], [7, 2, 7], [7, 7, 0], [8, 8, 9], [9, 4, 1], [8, 3, 4], [9, 8, 9], [3, 5, 3], [0, 2, 4], [6, 0, 2], [2, 1, 3], [5, 8, 9], [2, 1, 1], [9, 7, 6], [3, 0, 2], [9, 9, 0], [3, 4, 8], [2, 6, 1], [8, 9, 2], [7, 6, 5], [6, 3, 1], [9, 3, 1], [8, 9, 3], [9, 1, 0], [3, 8, 7], [8, 0, 0], [4, 9, 7], [8, 6, 2], [4, 3, 0], [2, 3, 5], [9, 1, 4], [1, 1, 4], [6, 0, 2], [6, 1, 6], [3, 8, 8], [8, 8, 7], [5, 5, 0], [3, 9, 6], [5, 4, 3], [6, 8, 3], [0, 1, 5], [6, 7, 3], [8, 3, 2], [3, 8, 3], [2, 1, 6], [4, 6, 7], [8, 9, 9], [5, 4, 2], [6, 1, 3], [6, 9, 5], [4, 8, 2], [9, 7, 4], [5, 4, 2], [9, 6, 1], [2, 7, 3], [4, 5, 4], [6, 8, 1], [3, 4, 0], [2, 2, 6], [5, 1, 2], [9, 9, 7], [6, 9, 9], [8, 4, 3], [4, 1, 7], [6, 2, 5], [0, 4, 9], [3, 5, 9], [6, 9, 1], [1, 9, 2]], &quot;type&quot;: &quot;scatter&quot;, &quot;name&quot;: &quot;Reading&quot;}];\n",
" option.series = data;\n",
"\n",
" \n",
Expand Down Expand Up @@ -107,13 +107,13 @@
" &lt;/script&gt;\n",
"\n",
" &lt;/body&gt;\n",
"&lt;/html&gt;\" height=400 width=550></iframe>"
"&lt;/html&gt; \"height= 400 width =550></iframe>"
],
"text/plain": [
"<highcharts.highcharts.highcharts.Highchart at 0x7f8494432ad0>"
"<highcharts.highcharts.highcharts.Highchart at 0x7feb09fa5c10>"
]
},
"execution_count": 8,
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
Expand Down
Loading