Skip to content

Commit

Permalink
Added options package
Browse files Browse the repository at this point in the history
  • Loading branch information
arnoutaertgeerts committed May 20, 2015
1 parent 1bfb18c commit 1914934
Show file tree
Hide file tree
Showing 9 changed files with 133,379 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,6 @@ docs/_build/

# PyBuilder
target/

large
.pypirc
Empty file added MANIFEST.in
Empty file.
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Python-Highcharts
=================

A python module that allows you to use the highchart javascript library in python or inline in IPython notebooks.
6 changes: 4 additions & 2 deletions charts/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
__author__ = 'arnout'

from charts import plot, plotasync
import data as data
from plot import plot, plotasync

import options
import data
54 changes: 54 additions & 0 deletions charts/options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
__author__ = 'Arnout Aertgeerts'


def default():
options = {
'chart': {
'zoomType': 'y'
},

'tooltip': {
'decimalValues': 2
},
'title': {
'text': 'Some test data'
},
'legend': {
'enabled': 'true'
},
'rangeSelector': {
'buttons': [
{
'type': 'day',
'count': '1',
'text': '1d'

}, {
'type': 'day',
'count': '7',
'text': '1w'

}, {
'type': 'month',
'count': '1',
'text': '1m'
}, {
'type': 'month',
'count': '3',
'text': '3m'
}, {
'type': 'month',
'count': '6',
'text': '6m'
}, {
'type': 'year',
'count': '1',
'text': '1y'
}, {
'type': 'all',
'text': 'All'
}]
}
}
return options

9 changes: 5 additions & 4 deletions charts/charts.py → charts/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def plot(series, options, height=400, save=False, stock=True, inline=True):
with open(os.path.join(package_directory, "index.html"), "r") as html:
string = MyTemplate(html.read()).substitute(
path=package_directory,
series=series,
options=options,
series=json.dumps(series),
options=json.dumps(options),
highstock=json.dumps(stock),
height=str(height) + "px"
)
Expand All @@ -53,6 +53,7 @@ def plotasync(series, options, height=400, name="chart", stock=True, inline=True
shutil.rmtree(name)
os.makedirs(name)

#TODO: Allow user saved json files to be read
for serie in series:
serie_name = serie["name"]
keys.append(serie_name)
Expand All @@ -67,14 +68,14 @@ def plotasync(series, options, height=400, name="chart", stock=True, inline=True

html = MyTemplate(read).substitute(
path=json.dumps(""),
options=options,
options=json.dumps(options),
highstock=json.dumps(stock),
height=str(height) + "px"
)

string = MyTemplate(read).substitute(
path=json.dumps(name),
options=options,
options=json.dumps(options),
highstock=json.dumps(stock),
height=str(height) + "px"
)
Expand Down
Loading

0 comments on commit 1914934

Please sign in to comment.