Python Forum
Thread Rating:
  • 2 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Highcharts: JS to Python
#6
(Nov-03-2017, 02:13 PM)Leaf Wrote: https://github.com/kyper-data/python-highcharts ((I my have misunderstood the python version of highcharts as being able to be visually displayed in a different way)). I don't quite understand wrappers, but I thought that this python version of it would allow me more flexibility (to allow me the option to use the browser or a different GUI).
That library create a HTML that can be displayed in browser or Jupyter Notebook,
so then is no need to run a server as i show with Flask.

To give a demo of how to run it,and also fix there wrong example code that's only work for Python 2.
Install is pip install python-highcharts.
This is the fix for Python 3.
data = list(range(1,20))
# hi_test.py
from highcharts import Highchart

# A chart is the container that your data will be rendered in, it can (obviously) support multiple data series within it.
chart = Highchart()

# Adding a series requires at minimum an array of data points.
# You can also change the series type, the name, or other series options as kwargs.
data = list(range(1,20))
chart.add_data_set(data, series_type='line', name='Example Series')

# This will generate and save a .html file at the location you assign
chart.save_file()
So running this code there will be no output but a Chart.html file that can be display in browser or Jupyter Notebook.
So can just open the HTML file it in browser or write a little script that do it.
import webbrowser

webbrowser.open_new_tab('file:///E:/1py_div/py_highchart/Chart.html')
Ouput in browser is:
[Image: y17wSk.jpg]
Quote:Is the github python version of highcharts different from other Python plotting libraries? Or would I use it the same as I would other python based plotting libraries?
There are similarity in all plotting libraries,look at link i have provide with Jupyter Notebook plotting examples.
Or search for plotting tutorial in Python,there are bunch of plotting stuff for Python,
as Python is very strong in data science that use plotting all the time.

Here a free book Python Data Science Handbook,has a lot of plotting example.
The whole book is written in Jupyter Notebook.
Reply


Messages In This Thread
Highcharts: JS to Python - by Leaf - Nov-01-2017, 10:46 PM
RE: Highcharts: JS to Python - by snippsat - Nov-02-2017, 02:41 PM
RE: Highcharts: JS to Python - by Leaf - Nov-03-2017, 10:47 AM
RE: Highcharts: JS to Python - by snippsat - Nov-03-2017, 01:05 PM
RE: Highcharts: JS to Python - by Leaf - Nov-03-2017, 02:13 PM
RE: Highcharts: JS to Python - by snippsat - Nov-03-2017, 03:32 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020