# Rationale behind viewBox settings on Chord Diagram

**URL:** https://talk.observablehq.com/t/rationale-behind-viewbox-settings-on-chord-diagram/2551
**Category:** Help
**Created:** [November 15, 2019, 2:33pm UTC](https://talk.observablehq.com/t/rationale-behind-viewbox-settings-on-chord-diagram/2551 "2019-11-15T14:33:11Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![bjl2n](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/bjl2n/32/2362_2.png) [@bjl2n](https://talk.observablehq.com/u/bjl2n)
#### Post date: [November 15, 2019, 2:33pm UTC](https://talk.observablehq.com/t/rationale-behind-viewbox-settings-on-chord-diagram/2551/1 "2019-11-15T14:33:11Z")

</div>

I am looking at the Chord Diagram example here:

> **[Chord Diagram](https://observablehq.com/@d3/chord-diagram)**
>
> An Observable notebook by D3.

and having trouble understanding the rationale behind setting the viewBox as it was set.

Can anyone shed some light on this please (maybe even @mbostock)?

---

<div class="post-metadata">

### Author: ![mbostock](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mbostock/32/9_2.png) [@mbostock](https://talk.observablehq.com/u/mbostock)
#### Post date: [November 15, 2019, 3:19pm UTC](https://talk.observablehq.com/t/rationale-behind-viewbox-settings-on-chord-diagram/2551/2 "2019-11-15T15:19:50Z")

</div>

The viewBox takes the form `x y width height` where _x_ is the left edge and _y_ is the top edge. Hence setting _x_ = -_width_/2 and _y_ = -_height_/2 places 0,0 at the center of the canvas. This is also the center point of circular arcs drawn by d3.arc, and hence this viewBox obviates the need for any additional transforms to center the diagram.

---

<div class="post-metadata">

### Author: ![bjl2n](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/bjl2n/32/2362_2.png) [@bjl2n](https://talk.observablehq.com/u/bjl2n)
#### Post date: [November 15, 2019, 3:25pm UTC](https://talk.observablehq.com/t/rationale-behind-viewbox-settings-on-chord-diagram/2551/3 "2019-11-15T15:25:23Z")

</div>

Excellent, thank you!
