chartit.templatetags package

Submodules

chartit.templatetags.chartit module

Implements the {% load_charts %} template tag!

chartit.templatetags.chartit.json_serializer(obj)

Return JSON representation of some special data types.

chartit.templatetags.chartit.load_charts(chart_list=None, render_to='')

Loads the Chart/PivotChart objects in the chart_list to the HTML elements with id’s specified in render_to.

Arguments:
  • chart_list - a list of Chart/PivotChart objects. If there is just a single element, the Chart/PivotChart object can be passed directly instead of a list with a single element.

  • render_to - a comma separated string of HTML element id’s where the charts needs to be rendered to. If the element id of a specific chart is already defined during the chart creation, the render_to for that specific chart can be an empty string or a space.

    For example, render_to = 'container1, , container3' renders three charts to three locations in the HTML page. The first one will be rendered in the HTML element with id container1, the second one to it’s default location that was specified in chart_options when the Chart/PivotChart object was created, and the third one in the element with id container3.

Returns:
  • a JSON array of the HighCharts Chart options. Also returns a link to the chartloader.js javascript file to be embedded in the webpage. The chartloader.js has a jQuery script that renders a HighChart for each of the options in the JSON array

Module contents