score:2
install django-highcharts using pip (we do recommend to do it in a virtualenv).
git clone https://github.com/novapost/django-highcharts.git
cd django-highcharts
pip install -e ./
to integrate it into a django project, simply add it to your installed_apps:
installed_apps = [
# some interesting stuff...
'highcharts',
# some other stuff...
]
don’t forget to set your static_root path and to run the following command to update the static files:
python manage.py collectstatic
view
from highcharts.views import highchartsbarview
class barview(highchartsbarview):
categories = ['orange', 'bananas', 'apples']
@property
def series(self):
result = []
for name in ('joe', 'jack', 'william', 'averell'):
data = []
for x in range(len(self.categories)):
data.append(random.randint(0, 10))
result.append({'name': name, "data": data})
return result
template
{% load staticfiles %}<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>hello</title>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="{% static 'js/highcharts/highcharts.js' %}"></script>
<script type="text/javascript">
$(function () {
$.getjson("{% url 'bar' %}", function(data) {
$('#container').highcharts(data);
});
});
</script>
</head>
<body>
<div id="container" style="height: 300px"></div>
</body>
</html>
please note that the highcharts.js file should be called after the jquery library.
look into documentation pdf for details.
edit 1
install the package using pip
pip install pandas-highcharts
import it in your views
import pandas_highcharts
df = ... # create your dataframe here
chart = pandas_highcharts.serialize(df, render_to='my-chart', output_type='json')
n your templates
<div id="my-chart"></div>
<script type="text/javascript">
new highcharts.chart({{chart|safe}});
</script>
Source: stackoverflow.com
Related Query
- How to add a newline to a Highchart tooltip?
- How to add a background image (pattern) to highchart column graph?
- How to add box shadow for highchart chart?
- How to Add button in React Highchart Tooltip?
- How to add Highchart Bar lines and lables?
- How to add Legend in highchart compare stock chart
- How to add % symbol to Y axis values in HighChart graph?
- How do i add mouse wheel code in Angular2 highcharts in typescript
- How to add highchart in my view.py?
- How to add php data into highchart js file in php
- how to add dynamic xaxis category label name in new point highchart
- How to add radio button in highchart legend symbol
- How to add comma in stacked column highchart in indian format?
- how to add dynamic y axis in highchart from specific point of x-axis
- how to add an color picker control to highchart for changing the color of series by user
- How to add value of y-axis under the x-axis labels in highchart with given dataset
- How to add a new Highchart dynamically using Highchartsng
- How to add a line break in Highchart legend in R?
- how to set chart in center on full screen view in highchart
- how to add height and width to highchart dynamically
- How to add rotation event to an ember highchart graph?
- How do I add an array of data points to a Highchart series
- How to add a vertical plot line in multiple line series and show the tooltip on Plot line in highchart
- how to add data from database and set it to data serie in highchart C#
- How can I add customized y axis in highchart basic bar?
- How to add Highcharts view data table option to the exports dropdown?
- How to add text verticaly and horizantaly centered inside highchart solid gauge
- How to add the "isSum" bar in Highchart Waterfall chart in R?
- Highchart multiple axes - How can I add different starting coordinates?
- How to add another series into my highchart
More Query from same tag
- Can not get series data in Highcharts, Highstock
- bug display of many Highcharts and Highstocks on the same page
- Highcharts polar background color
- How to change time in hours on HighChart xAxis from Military to Standard time?
- HighCharts x-axis & y-axis label center align
- How do I prevent from falling out bubble in highcharts?
- Combining a horizontal bar graph and stock chart (with navigator) HighCharts
- How to show only one pair of linked Highcharts series at a time
- Highcharts drilldown async multi serie issue
- charts cause memory leak
- How to format y values in a tool tip to show commas?
- Spacing bug in tooltip formatter?
- Unable to set the Selected state in Highcharts, when point marker is disabled
- highcharts not responsive after reflow
- Javascript setInterval/setTimeout not working when browser tab not focused
- individual point settings in a scatter/line plot
- highcharts - is it possible to zoom pie charts
- HighCharts/Maps: How to display values lower than a certain value appear different from the rest of the graphic?
- Highchart: Bar Chart with time duration
- % not showing in tooltip pie chart highcharts angular js
- How to do Drilldown in Piechart of Highchart?
- How to disable range selector from highstocks charts
- Highcharts - where to place style and changing style for one wedge in a pie chart
- Highcharts Tooltip At Column Chart
- Reduce gap between series data in Bar Highchart
- how to set xAxis pointInterval(update: tickInterval) in highcharts
- Highcharts custom export hidding on Reset
- how push some elements of an array to another
- same js highcharts display not the same
- Export chart without hidden series labels in legend