Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/derbyjs/d-barchart-vanilla

a barchart component for Derby built without d3.js to illustrate a pattern
https://github.com/derbyjs/d-barchart-vanilla

Last synced: about 1 month ago
JSON representation

a barchart component for Derby built without d3.js to illustrate a pattern

Awesome Lists containing this project

README

        

d-barchart-vanilla
==================

Example Bar chart Derby component built in vanilla JS (with no d3) to illustrate the difference.
see also:
[d-barchart](http://github.com/derbyjs/d-barchart)
[d-d3-barchart](http://github.com/derbyjs/d-d3-barchart)

# Usage
[Example usage](http://github.com/derbyjs/derby-examples/charts)

## In your template
```

```
some optional arguments
```

```

## Your data
```
model.set("_page.data", [ { value: 1 }, { value: 10 } ]);
```

Optional data
```
model.set("_page.margins", {top: 0, right: 20, bottom: 0, left: 20 });
```

## Implementation pattern

In this example we take advantage of derby's bindings to associate our data with the DOM.
We use the __layout__ pattern where we transform input data into layout data, and then render the layout data.
We don't use any d3 to both show a more bare-bones Derby example, as well as show what d3 makes more convenient regarding laying out data.