# d3plus-project-template

> A starter environment for D3plus modules.

Latest version **0.3.1** (published 2017-04-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install d3plus-project-template
pnpm add d3plus-project-template
yarn add d3plus-project-template
bun add d3plus-project-template
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2017-04-07 |
| First published | 2016-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Dave Landry |
| Maintainers | davelandry |
| Keywords | project-template, d3, d3plus, data, visualization |

## Links

- npm: https://www.npmjs.com/package/d3plus-project-template
- Repository: https://github.com/d3plus/d3plus-project-template
- Homepage: https://d3plus.org
- Issues: https://github.com/d3plus/d3plus-project-template/issues
- npm.io page: https://npm.io/package/d3plus-project-template

## Dependencies (1)

- [d3plus-common](https://npm.io/package/d3plus-common.md) ^0.6.15

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 0.3.1 (latest) — 2017-04-07
- 0.3.0 — 2016-12-01
- 0.2.3 — 2016-07-22
- 0.2.2 — 2016-06-20
- 0.2.1 — 2016-06-20
- 0.2.0 — 2016-06-20
- 0.1.0 — 2016-04-25

## README

# d3plus-project-template

[![NPM Release](http://img.shields.io/npm/v/d3plus-project-template.svg?style=flat)](https://www.npmjs.org/package/d3plus-project-template)
[![Build Status](https://travis-ci.org/d3plus/d3plus-project-template.svg?branch=master)](https://travis-ci.org/d3plus/d3plus-project-template)
[![Dependency Status](http://img.shields.io/david/d3plus/d3plus-project-template.svg?style=flat)](https://david-dm.org/d3plus/d3plus-project-template)
[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg?style=flat)](https://gitter.im/d3plus/)

A starter environment for D3plus modules.

## Installing

If you use NPM, `npm install d3plus-project-template`. Otherwise, download the [latest release](https://github.com/d3plus/d3plus-project-template/releases/latest). The released bundle supports AMD, CommonJS, and vanilla environments. Create a [custom bundle using Rollup](https://github.com/rollup/rollup) or your preferred bundler. You can also load directly from [d3plus.org](https://d3plus.org):

```html
<script src="https://d3plus.org/js/d3plus-project-template.v0.3.full.min.js"></script>
```

[width]: 100
[height]: 100

## Getting Started

This is the place to be if you want to create your own D3plus module. Here are the steps to get your module up and running:

1. Copy the contents of this repo into your new repository.
2. Install the Node Package Manager (NPM).
> <sub>If on a Mac, we suggest using [Homebrew](http://brew.sh/) to install packages on your machine. Once that's installed, you can install node (which includes npm) by running: `brew install node`</sub>
3. Install all current dependencies:
```sh
npm i
```

And that's it! Now your environment should be all set up and ready to go.

### Writing Code

With the introduction of modules in D3plus 2.0, all code is transpiled using [buble](http://buble.surge.sh/), which allows usage of most of good bits from ES6. If you are unfamiliar with ES6, then normal vanilla javascript works fine as well. All source code lives in the `/src/` director.

### Running the Development Server

To test your code live in a browser, with auto-compiling and hot reloading, type this into your shell:

```sh
npm run dev
```

You can then go to `http://localhost:4000/test/` in your preferred browser to test your code live.

### Code Documentation

All of the Documentation you see in the README file is generated automagically based on the [JSDoc](http://usejsdoc.org/) formatted comments within each source file. This removes the nuscence of having to write documentation after the fact, and enforces strict code commenting. To regenerate the documentation, simply run:

```sh
npm run docs
```

### Tests

Any time you write a new feature in your module, you should also be writing tests. D3plus modules come bundled with a test suite that let's you write [tape](https://github.com/substack/tape) tests using full ES6, which are then run directly in a headless Electron browser.

All tests need to be placed in the `/test/` directory, and the filenames should match up to the components in `/src/`. To run all tests, run:

```sh
npm test
```

### Examples

All D3plus 2.0 examples seen on [d3plus.org](https://d3plus.org) are created from within their respective repositories. The examples are parsed from any markdown files placed in the `/example/` directory, with the following rules:

#### Title

Example titles are extracted from the first H1 present in the file. Generally, the first line of the file will be the title:

```md
## My Cool Example
```

#### Slug

The slug used in the URL on [d3plus.org](https://d3plus.org) is taken directly from the filename. A file with the following path:

```sh
/example/my-cool-example.md
```

Would end up at the following URL:

```sh
https://d3plus.org/examples/d3plus-project-template/my-cool-example/
```

#### HTML

Any `css`, `html`, or `js` code block present in an example will be extracted and rendered into a static HTML file. This is what gets used on [d3plus.org](https://d3plus.org), and also let's us take screenshots!

#### Screenshots

A screenshot of each example is generated from the rendered HTML. By default, each screenshot is 990x400 in size, but specific dimensions can be given using markdown relative links:

```md
[width]: 100
[height]: 100
```

For the purposes of this example, let's make a red square that will be rendered in HTML.

```css
.square {
  background-color: red;
  height: 100px;
  width: 100px;
}
```

```html
<div class="square"></div>
```


[<kbd><img src="/example/getting-started.png" width="100px" /></kbd>](https://d3plus.org/examples/d3plus-project-template/getting-started/)

[Click here](https://d3plus.org/examples/d3plus-project-template/getting-started/) to view this example live on the web.





## API Reference
<a name="Sample"></a>

### Sample
**Kind**: global class  

* [Sample](#Sample)
    * [new Sample([data])](#new_Sample_new)
    * [.constant([*value*])](#Sample.constant)
    * [.id([*value*])](#Sample.id)

<a name="new_Sample_new"></a>

#### new Sample([data])
A sample chainable function.


| Param | Type | Default |
| --- | --- | --- |
| [data] | <code>Array</code> | <code>[]</code> | 

<a name="Sample.constant"></a>

#### Sample.constant([*value*])
If *value* is specified, sets the constant to the specified function or value and returns this generator. If *value* is not specified, returns the current constant.

**Kind**: static method of <code>[Sample](#Sample)</code>  

| Param | Type | Default |
| --- | --- | --- |
| [*value*] | <code>function</code> \| <code>Number</code> \| <code>String</code> | <code>&quot;sample&quot;</code> | 

<a name="Sample.id"></a>

#### Sample.id([*value*])
If *value* is specified, sets the id accessor to the specified function and returns this generator. If *value* is not specified, returns the current id accessor.

**Kind**: static method of <code>[Sample](#Sample)</code>  

| Param | Type |
| --- | --- |
| [*value*] | <code>function</code> | 

**Example**  
```js
function(d) {
  return d.id;
}
```


###### <sub>Documentation generated on Fri, 07 Apr 2017 17:42:48 GMT</sub>

---
_Source: https://npm.io/package/d3plus-project-template · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
