dmn-elex-tx-house-flippers
v1.0.9
Published
A choropleth of Texas' congressional districts, shaded by their 2018 versus 2016 results.
Downloads
12
Readme
dmn-elex-tx-house-flippers
A choropleth of Texas' congressional districts, shaded by their 2018 versus 2016 results.
Install
$ npm install --save dmn-elex-tx-house-flippers
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, TXHouseFlippersChart
:
<script src="some/path/to/global-chart.js"></script>
To use as a module, simply import the chart object:
import TXHouseFlippersChart from 'dmn-elex-tx-house-flippers';
The chart object has two methods, one to create the chart, initially, and another to update it.
var myChart = new TXHouseFlippersChart();
// create needs a selection string and prefectched current-year data, historical data and candidate objects
myChart.create('#chart', data, historicalData, candidateData);
// update needs only new current-year data
myChart.update(newData);
// resize based on how the container has changed
myChart.resize('#chart')
To apply this chart's default styles when using SCSS, simply define the variable $TXHouseFlippers-container
to represent the ID or class of the chart's container(s) and import the _chart-styles.scss
partial.
$TXHouseFlippers-container: '#chart';
@import 'path/to/dmn-elex-tx-house-flippers/src/scss/_chart-styles';
Developing
Just run gulp:
$ gulp
Or to minimize javascript before publishing:
$ gulp --production