dmn-elex-vote-history

v1.0.2
[![npm version](https://badge.fury.io/js/dmn-elex-vote-history.svg)](https://badge.fury.io/js/dmn-elex-vote-history)

dmn-elex-vote-history

npm version

Chart module for historical county voting data.

Install

$ npm install --save dmn-elex-vote-history
Requirements

This module uses ES6 syntax. To use as a pre-compiled module, you'll need a compiler like babel.

Use

In the client, include the global-chart.js bundle, which defines a global chart object, VoteHistory:

<script src="some/path/to/global-chart.js"></script>

To use as a module, simply import the chart object:

import VoteHistory from 'dmn-elex-vote-history';

The chart object has three methods, one to create the chart, initially, another to update it and a third to resize the chart. Update will also resize the chart when called with data.

var myChart = new VoteHistory();

// create needs a selection string and prefectched data and geoData
myChart.create('#chart', data, geoData);

// update needs only new data
myChart.update(newData);

// resize
myChart.resize();

To apply this chart's default styles when using SCSS, simply define the variable $VoteHistory-container to represent the ID or class of the chart's container(s) and import the _chart-styles.scss partial.

$VoteHistory-container: '#chart';

@import 'path/to/dmn-elex-vote-history/src/scss/_chart-styles';

Developing

Write your chart code in chart.js and add custom styles to _chart-styles.scss.

Then, just run gulp:

$ gulp

Or to minimize javascript before publishing:

$ gulp --production

Metadata

  • ISC
  • Whatever
  • Unknown
  • released 11/4/2016

Downloads

Maintainers