Skip to main content

Insert nvd3 charts into django-cms driven sites

Project description

Requirements

The plugin works under Python 2.7 and Python 3.4 with all versions of Django supported by Django-CMS. The following libraries (along with those required by django-CMS) are necessary:

  • Django >= 1.5

  • django-cms >= 2.4 (include all of Django CMS 3.x releases)

  • python-nvd3

More detailed docs with examples are available here.

Installation

It is assumed that django-cms is already installed. Additionally, you need to install python-nvd3.

$ pip install python-nvd3
$ pip install cmsplugin-nvd3

Insert the plugin app in your settings.py

INSTALLED_APPS = [
    # ...
    'cmsplugin_nvd3',
        #...
]

Create necessary database tables. If you are working with Django 1.7 and higher, do:

manage.py makemigrations cmsplugin_nvd3

manage.py migrate cmsplugin_nvd3

If your Django version is lower 1.7, use syncdb command

manage.py syncdb

The plugin can be used in a single manner or embedded into text plugins.

Configuration

Behaviour of the plugin is controlled by the following settings (defaults are listed below):

# Value separator for x-data
CMSNVD3_DATASEP = ','

# Group separator for y-series
CMSNVD3_YDATAGROUPSEP = ';'

# Length of random part of id
CMSNVD3_ID_RANDOM_LENGTH = 7

# Container prefix; used only if <container name> field is left empty.
CMSNVD3_CONT_ID_PREFIX = 'nvd3id_'

# Default container width;
CMSNVD3_CONT_WIDTH = 600

# Default container height;
CMSNVD3_CONT_HEIGHT = 400

# Maximum allowed container size; all values of width or height will be
# reduced to defaults if they exceed this value
CMSNVD3_MAX_CONT_DIM = 3000

# D3, NVD3 sources.
CMSNVD3_D3JS_SOURCE = '//cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js'
CMSNVD3_JS_SOURCE = '//cdn.rawgit.com/novus/nvd3/v1.8.1/build/nv.d3.min.js'
CMSNVD3_CSS = '//cdn.rawgit.com/novus/nvd3/v1.8.1/build/nv.d3.css'
# If one or all of these constants was set up to 'local' (e.g. CMSNVD3_CSS='local'),
# the static resource(s) will be loaded via path CMSNVD3_URL

#a path for d3, nvd3 static files, defined as: STATIC_URL+CMSNVD3_URL
CMSNVD3_URL = 'nvd3plugin/'

#Floating point delimiter. You probably will never need to change it.
    CMSNVD3_FLT_DELIMITER = '.'

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

cmsplugin-nvd3-0.5.0.tar.gz (108.7 kB view details)

Uploaded Source

File details

Details for the file cmsplugin-nvd3-0.5.0.tar.gz.

File metadata

File hashes

Hashes for cmsplugin-nvd3-0.5.0.tar.gz
Algorithm Hash digest
SHA256 ebafba09813871de02d097e8d436ea1b9a14fab8c04f62b7ca95dcfdf65388a7
MD5 eac9b53b55093c7e995cd52e0a5fe6ff
BLAKE2b-256 24efcf9bd5a360dfce472032f09e716f5ffe35e15f60bfe0e7adfb8a58dd72e7

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