Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@ sudo npm install -g disc

## Command-Line Interface ##

***Note:*** *you'll need to build your bundle with the `--full-paths` flag,
***Note:*** *you'll need to build your bundle with the `--full-paths` flag,
and pass a fully qualified (not relative) input path to browserify
for disc to do its thing.*

``` bash
discify [bundle(s)...] {options}

Options:
-h, --help Displays these instructions.
-o, --output Output path of the bundle. Defaults to stdout.
-O, --open Opens disc in a new browser window automatically
-m, --mode the default file scale mode to display: should be
either "count" or "size". Default: size
-h, --help Displays these instructions.
-o, --output Output path of the bundle. Defaults to stdout.
-O, --open Opens disc in a new browser window automatically
-m, --mode the default file scale mode to display: should be
either "count" or "size". Default: size
-r, --no-rotate Turns off rotate animation
```

When you install disc globally, you the `discify` command-line tool is made
Expand Down Expand Up @@ -97,6 +98,8 @@ This method takes the following options:
description on the demo page.
* `mode`: the default file scale mode to display: one of either `"count"` or
`"size"`, defaulting to `"size"`.
* `rotate`: whether visualization should use a rotate animation: boolean,
defaulting to `true`

### `disc.bundle(bundles, [opts], callback)` ###

Expand Down
4 changes: 4 additions & 0 deletions bin/discify
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ var argv = optimist
.alias('m', 'mode')
.describe('m', 'the default file scale mode to display: should be either "count" or "size". Default: size')

.alias('r', 'no-rotate')
.describe('r', 'Turns off rotate animation')

.argv

if (argv.help) {
Expand Down Expand Up @@ -55,6 +58,7 @@ if (!files.length) {
function handle(bundles) {
disc.bundle(bundles, {
mode: argv.mode
, rotate: argv.rotate
}, function(err, html) {
if (err) throw err
if (argv.output) return fs.writeFileSync(argv.output, html)
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ function bundle(bundles, opts, callback) {
if (err) return callback(err)

data.mode = opts.mode || 'size'
data.rotate = typeof opts.rotate === 'undefined' ? true : opts.rotate
data = '<script type="text/javascript">'
+ ';window.disc = ('
+ JSON.stringify(data)
Expand Down
15 changes: 8 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ domready(function() {
, width = window.innerWidth
, height = Math.max(window.innerHeight - 100, 100)
, radius = Math.min(width, height) * 0.45
, deg = 120
, deg = window.disc.rotate ? 120 : 0

var svg = d3.select('.chart').append('svg')
.attr('width', width)
Expand Down Expand Up @@ -219,12 +219,13 @@ domready(function() {
// arcs back towards their original
// position.
//
groups.transition()
.duration(3250)
.delay(function(d, i) {
return d.x * 100 + (i % 4) * 250 + d.y / maxdepth * 0.25 + 250
})
.attrTween('transform', rotateTween(deg))
if (window.disc.rotate)
groups.transition()
.duration(3250)
.delay(function(d, i) {
return d.x * 100 + (i % 4) * 250 + d.y / maxdepth * 0.25 + 250
})
.attrTween('transform', rotateTween(deg))

groups.on('mouseover', function(d) {
highlight(d)
Expand Down