Skip to main content

Makes it easy to convert Python data structures to JSON strings suitable for flot series and options

Project description

PyFlot makes it easy to generate flot graphs. Its primary goal is to allow one to specify data inputs and options in a Python application and generate the appropriate JSON. Common uses of this will be rendering into a template as flot() arguments or as the payload of an XHR response. PyFlot takes care of all the annoying details of converting types to match up with how flot expects them.

For example:

>>> import pyflot
>>> graph = pyflot.Flot()
>>> graph.add_line([(1, 1), (2, 2), (3, 3)])
>>> print graph.series_json
[{"data": [[1, 1], [2, 2], [3, 3]]}]

In this simple example the series_json is a JSON string in the format expected by flot.

The following Django template snippet shows how you might use it in a Django template:

<script id="source" language="javascript" type="text/javascript">
$(function () {
    $.plot($("#linear-graph"), {{ graph.series_json|safe }}, {{ graph.options_json|safe }});
});
</script>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-flot-utils-0.2.1.tar.gz (54.6 kB view details)

Uploaded Source

File details

Details for the file python-flot-utils-0.2.1.tar.gz.

File metadata

File hashes

Hashes for python-flot-utils-0.2.1.tar.gz
Algorithm Hash digest
SHA256 0f678eaee810fdd5ce24d93d7f1c9dfd2608f26939d3c67afd0e40f91e190ed2
MD5 d8fae33e30c6a3e62b6a320976b5fd10
BLAKE2b-256 62301e9b3c8f929fdff399724953c04db5e8192036c390a8d7547e93cb7d05f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page