Skip to content

Commit

Permalink
Fixed pretest prefix bug; new version
Browse files Browse the repository at this point in the history
  • Loading branch information
rwakulszowa committed Nov 15, 2016
1 parent 9348506 commit c98a1cd
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,24 @@

Create a mesh of SVG elements the d3 way

## Description

The main goal of this module is to provide an easy way to split an area into regularly shaped pieces. You can divide an svg container into smaller ones, an svg circle into rings or a HTML div into a table-like structure (or an actual table, because why not).
d3-mesh only handles the computation of desired dimensions - it doesn't actually manipulate the DOM, but it provides lots of utilities to make it fancy, while d3 makes the actual creation easy.

But what's the point of using a library to convert an SVG element into some weird array? There's problably none. You should rethink your life. Or, if you actually know some useful application of it, please let me know and I'll rethink mine.

## Examples

* [A fancy circle](https://rawgit.com/rwakulszowa/d3-mesh/master/examples/circles.html)
* [Some cool shapes](https://rawgit.com/rwakulszowa/d3-mesh/master/examples/shapes.html)
* [Insertion sort visualization](https://rawgit.com/rwakulszowa/d3-mesh/master/examples/insertion.html)

## Installing

If you use NPM, `npm install d3-mesh`. Otherwise, download the [latest release](https://github.com/rwakulszowa/d3-mesh/releases/latest).
If you are super lazy, I also keep the non-minified source in
`https://raw.githubusercontent.com/rwakulszowa/d3-mesh/v0.3.0/examples/d3-mesh.js`
`https://raw.githubusercontent.com/rwakulszowa/d3-mesh/v0.3.1/examples/d3-mesh.js`
which you can probably include in your script.

## API Reference
Expand Down Expand Up @@ -286,8 +299,3 @@ var m = d3_mesh
.matrix();
m[0][0].shape(); // { x: 0.5, y: 0.5 }
```

## Examples
* [A fancy circle](https://rawgit.com/rwakulszowa/d3-mesh/master/examples/circles.html)
* [Some cool shapes](https://rawgit.com/rwakulszowa/d3-mesh/master/examples/shapes.html)
* [Insertion sort visualization](https://rawgit.com/rwakulszowa/d3-mesh/master/examples/insertion.html)
2 changes: 1 addition & 1 deletion examples/circles.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
var d1 = 12, // circles
d2 = 6; // cells per circle

var mesh = d3_mesh.mesh();
var mesh = d3.mesh();
mesh.x()
.domain([0, height / 2])
.shape([1, 4]);
Expand Down
2 changes: 1 addition & 1 deletion examples/d3-mesh.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.d3_mesh = global.d3_mesh || {})));
(factory((global.d3 = global.d3 || {})));
}(this, (function (exports) { 'use strict';

// Public - create a new Cell
Expand Down
2 changes: 1 addition & 1 deletion examples/insertion.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
var container = svg.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");

var mesh = d3_mesh.mesh();
var mesh = d3.mesh();
mesh.x()
.domain([0, width]);

Expand Down
4 changes: 2 additions & 2 deletions examples/shapes.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
// How many replicas of the basis will be drawn
var segmentCount = 5;

var mesh = d3_mesh.mesh();
var mesh = d3.mesh();
mesh.x()
.domain([0, height / 2]);
mesh.y()
Expand All @@ -48,7 +48,7 @@


// A helper function for drawing arccells (there's no such word; I mean those little elements of a circle)
function arcCell(radius, angle) { // TODO: make this O(n+k) instead of O(nk)
function arcCell(radius, angle) {
var arc = d3.svg.arc()
.innerRadius(radius.a)
.outerRadius(radius.b)
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "d3-mesh",
"version": "0.3.0",
"version": "0.3.1",
"description": "Create a mesh of elements the d3 way",
"keywords": [
"d3", "mesh", "grid", "table"
"d3-module", "d3", "mesh", "grid", "table"
],
"license": "MIT",
"author": {
Expand All @@ -18,13 +18,12 @@
"url": "https://github.com/rwakulszowa/d3-mesh.git"
},
"scripts": {
"pretest": "rm -rf build && mkdir build && json2module package.json > build/package.js && rollup -f umd -n d3_mesh -o build/d3-mesh.js -- index.js",
"pretest": "rm -rf build && mkdir build && rollup -g d3-mesh:d3 -f umd -n d3 -o build/d3-mesh.js -- index.js",
"test": "tape 'test/**/*-test.js'",
"prepublish": "npm run test && uglifyjs build/d3-mesh.js -c -m -o build/d3-mesh.min.js && cp build/d3-mesh.js examples/d3-mesh.js",
"postpublish": "zip -j build/d3-mesh.zip -- LICENSE README.md build/d3-mesh.js build/d3-mesh.min.js"
},
"devDependencies": {
"json2module": "0.0",
"rollup": "0.34",
"tape": "4",
"uglify-js": "2"
Expand Down

0 comments on commit c98a1cd

Please sign in to comment.