diff --git a/site/examples/brush/App.svelte b/site/examples/brush/App.svelte
index de47b9f8..2e888080 100755
--- a/site/examples/brush/App.svelte
+++ b/site/examples/brush/App.svelte
@@ -69,8 +69,8 @@
$: {
let keys = Object.keys(selectedPoints)
if (keys.length > 0) {
- averageA = keys.map(key => data.row(key).a).reduce((a, b) => a + b) / keys.length
- averageB = keys.map(key => data.row(key).b).reduce((a, b) => a + b) / keys.length
+ averageA = keys.map(key => data.row({ key }).a).reduce((a, b) => a + b) / keys.length
+ averageB = keys.map(key => data.row({ key }).b).reduce((a, b) => a + b) / keys.length
} else {
averageA = undefined
averageB = undefined
diff --git a/site/examples/candlestick/App.svelte b/site/examples/candlestick/App.svelte
index 9133341b..e9713ebd 100755
--- a/site/examples/candlestick/App.svelte
+++ b/site/examples/candlestick/App.svelte
@@ -1,70 +1,81 @@
{#if ready}
-
-
r[0] > r[1] ? '#da344d' : '#32936f') }
/>
-
+
-
+
+
{/if}
diff --git a/site/examples/choropleth-map/App.svelte b/site/examples/choropleth-map/App.svelte
index 18edea2b..3f801706 100644
--- a/site/examples/choropleth-map/App.svelte
+++ b/site/examples/choropleth-map/App.svelte
@@ -5,18 +5,23 @@
} from '@snlab/florence'
import DataContainer from '@snlab/florence-datacontainer'
- const COLORS = ['#d3d3d3', '#fff0d2', '#FDD1A5', '#FD9243', '#982f05', '#4e1802']
+ const COLORS = ['#fff0d2', '#FDD1A5', '#FD9243', '#982f05', '#4e1802']
let dataContainer, geoScales, priceColorScale, ready
(async () => {
const geojson = await json('/data/plan_areas_choropleth.json')
- dataContainer = new DataContainer(geojson).dropNA('resale_price_sqm')
- geoScales = createGeoScales(data.domain('$geometry'))
+ dataContainer = new DataContainer(geojson).mutate({
+ resale_price_sqm: r => r.resale_price_sqm === null ? undefined : r.resale_price_sqm
+ })
+ geoScales = createGeoScales(dataContainer.bbox())
- priceColorScale = dataContainer.classify({
- column: 'resale_price_sqm', method: 'Jenks', numClasses: COLORS.length
- }, COLORS)
+ priceColorScale = dataContainer
+ .dropNA('resale_price_sqm')
+ .classify({
+ column: 'resale_price_sqm', method: 'EqualInterval', numClasses: 5
+ }, COLORS)
+ .unknown('#d3d3d3')
ready = true
})()
@@ -24,7 +29,13 @@
{#if ready}
-
+
diff --git a/site/examples/density-contours/App.svelte b/site/examples/density-contours/App.svelte
index eead9151..3d095c75 100755
--- a/site/examples/density-contours/App.svelte
+++ b/site/examples/density-contours/App.svelte
@@ -1,20 +1,34 @@
{#if ready}
-
+
hoverKey === key ? 1 : 0.5}
stroke={'white'}
@@ -95,7 +96,7 @@
transition={1000}
/>
-
+ /> -->
@@ -126,6 +126,9 @@
fill={heatmapData.map('resale_price_sqm', priceColorScale)}
/>
+
+
+
{/if}
import { scaleLinear, scaleBand } from 'd3-scale'
- import { Graphic, Section, RectangleLayer, XAxis, YAxis } from '@snlab/florence'
import { formatPrefix } from 'd3-format'
+ import { Graphic, Section, RectangleLayer, XAxis, YAxis } from '@snlab/florence'
import DataContainer from '@snlab/florence-datacontainer'
import { data } from './population.js'
diff --git a/site/examples/scatterplot-temp-trends/App.svelte b/site/examples/scatterplot-temp-trends/App.svelte
index e27ae026..296e798e 100755
--- a/site/examples/scatterplot-temp-trends/App.svelte
+++ b/site/examples/scatterplot-temp-trends/App.svelte
@@ -21,13 +21,14 @@
valuesTo: 'value'
})
.mutate({
- date: row => new Date(row.date, months.indexOf(row.month), 1),
+ date: row => new Date(+row.Year, months.indexOf(row.month), 1),
value: row => +row.value
})
- scaleColor = scaleSequential()
- .domain(dataContainer.domain('value').reverse())
- .range(interpolateRdBu)
+ scaleColor = scaleSequential(interpolateRdBu).domain([
+ dataContainer.max('value'),
+ dataContainer.min('value')
+ ])
ready = true
})()
diff --git a/site/examples/stacked-area/App.svelte b/site/examples/stacked-area/App.svelte
index 3bf52858..9911979b 100755
--- a/site/examples/stacked-area/App.svelte
+++ b/site/examples/stacked-area/App.svelte
@@ -4,7 +4,7 @@
import { autoType } from 'd3-dsv'
import { csv } from 'd3-fetch'
import { Graphic, AreaLayer, XAxis, YAxis } from '@snlab/florence'
- import DataContainer from '@snlab/florene-datacontainer'
+ import DataContainer from '@snlab/florence-datacontainer'
let dataContainer, industries, scaleColor, ready
diff --git a/site/examples/stacked-horizontal-bars/App.svelte b/site/examples/stacked-horizontal-bars/App.svelte
index 0c328d3d..f4adcb8f 100755
--- a/site/examples/stacked-horizontal-bars/App.svelte
+++ b/site/examples/stacked-horizontal-bars/App.svelte
@@ -24,6 +24,8 @@
namesTo: 'ageGroup',
valuesTo: 'countInterval'
})
+ .mutate({ upper: r => r.countInterval[1] })
+ .arrange({ upper: 'descending' })
maxX = dataContainer.max('countInterval')
@@ -38,27 +40,31 @@
})()
-
+{#if ready}
- {#each dataContainer.rows() as stateGroup}
+
- d[0])}
- x2={stateGroup.$grouped.map('countInterval', d => d[1])}
- y1={stateGroup.state}
- y2={({ scaleY }) => scaleY(stateGroup.state) + scaleY.bandwidth()}
- fill={stateGroup.$grouped.map('ageGroup', scaleColor)}
- />
+ {#each dataContainer.rows() as stateGroup}
- {/each}
+ d[0])}
+ x2={stateGroup.$grouped.map('countInterval', d => d[1])}
+ y1={stateGroup.state}
+ y2={({ scaleY }) => scaleY(stateGroup.state) + scaleY.bandwidth()}
+ fill={stateGroup.$grouped.map('ageGroup', scaleColor)}
+ />
-
-
+ {/each}
-
+
+
+
+
+
+{/if}
diff --git a/site/package-lock.json b/site/package-lock.json
index 7adab67a..a8cdeaed 100644
--- a/site/package-lock.json
+++ b/site/package-lock.json
@@ -1239,7 +1239,7 @@
"@snlab/rendervous": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/@snlab/rendervous/-/rendervous-0.0.2.tgz",
- "integrity": "sha1-0ZD2NRJT5IKbzONHoN9vf5b7wUg=",
+ "integrity": "sha512-LebyG+mGLwYDnlRrxEd48datWqxrnHmmpUkn/9O1U/iso/xZibHhf5yaZdeBOJxc1ef7xZj2tflB6AhCUwneGQ==",
"dev": true,
"requires": {
"d3-scale": "^3.2.1"
@@ -1254,7 +1254,7 @@
"@snlab/transshape": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/@snlab/transshape/-/transshape-0.1.2.tgz",
- "integrity": "sha1-PwxQxWNzvpcs7MJ+TRHr65uGzic=",
+ "integrity": "sha512-+RYiw8s/UJ+2JaL8mfAp/PScAnEUBSxUSPXkSCvYOzpcqNSyglRzTMPi8Z1MQa5GMq7zLJgje1DvMyzhkw+YyA==",
"dev": true,
"requires": {
"d3-array": "^2.4.0",
@@ -2849,7 +2849,7 @@
"earcut": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.2.tgz",
- "integrity": "sha1-QbC8NfY+D+gNp83f8oUR5+LoDRE=",
+ "integrity": "sha512-eZoZPPJcUHnfRZ0PjLvx2qBordSiO8ofC3vt+qACLM95u+4DovnbYNpQtJh0DNsWj8RnxrQytD4WA8gj5cRIaQ==",
"dev": true
},
"electron-to-chromium": {
@@ -6433,7 +6433,13 @@
"quickselect": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/quickselect/-/quickselect-2.0.0.tgz",
- "integrity": "sha1-8ZaApIal7vtYEwPgI+mPqvJd0Bg=",
+ "integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==",
+ "dev": true
+ },
+ "ramda": {
+ "version": "0.27.1",
+ "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.27.1.tgz",
+ "integrity": "sha512-PgIdVpn5y5Yns8vqb8FzBUEYn98V3xcPgawAkkgj0YJ0qDsnHCiNmZYfOGMgOvoB0eWFLpYbhxUR3mxfDIMvpw==",
"dev": true
},
"ramda": {
@@ -6454,7 +6460,7 @@
"rbush": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/rbush/-/rbush-3.0.1.tgz",
- "integrity": "sha1-X6+op5s7mv3+UAhAOnIMwd6ILs8=",
+ "integrity": "sha512-XRaVO0YecOpEuIvbhbpTrZgoiI6xBlz6hnlr6EHhd+0x9ase6EmeN+hdwwUaJvLcsFFQ8iWVF1GAK1yB0BWi0w==",
"dev": true,
"requires": {
"quickselect": "^2.0.0"
diff --git a/site/src/routes/docs/_content-structure.js b/site/src/routes/docs/_content-structure.js
index 13a92298..3a8cb388 100644
--- a/site/src/routes/docs/_content-structure.js
+++ b/site/src/routes/docs/_content-structure.js
@@ -45,6 +45,10 @@ export const posts = [
{
title: 'Transitions',
path: '/docs/concepts/transitions'
+ },
+ {
+ title: 'Advanced rendering',
+ path: '/docs/concepts/advanced-rendering'
}
]
},
@@ -101,6 +105,32 @@ export const posts = [
{
title: 'Legend',
path: '/docs/guides/legend'
+ },
+ {
+ title: 'X-gridlines',
+ path: '/docs/guides/xgridlines'
+ },
+ {
+ title: 'Y-gridlines',
+ path: '/docs/guides/ygridlines'
+ }
+ ]
+ },
+ {
+ title: 'Helpers',
+ path: '/docs/helpers/create-geo-scales',
+ children: [
+ {
+ title: 'createGeoScales',
+ path: '/docs/helpers/create-geo-scales'
+ },
+ {
+ title: 'createPanHandler',
+ path: '/docs/helpers/create-pan-handler'
+ },
+ {
+ title: 'createZoomHandler',
+ path: '/docs/helpers/create-zoom-handler'
}
]
}
diff --git a/site/src/routes/docs/concepts/advanced-rendering.sveltex b/site/src/routes/docs/concepts/advanced-rendering.sveltex
new file mode 100644
index 00000000..59583151
--- /dev/null
+++ b/site/src/routes/docs/concepts/advanced-rendering.sveltex
@@ -0,0 +1 @@
+# Advanced rendering
diff --git a/site/src/routes/docs/concepts/examples/_Highlight.svelte b/site/src/routes/docs/concepts/examples/_Highlight.svelte
index dc10cb40..241bb646 100644
--- a/site/src/routes/docs/concepts/examples/_Highlight.svelte
+++ b/site/src/routes/docs/concepts/examples/_Highlight.svelte
@@ -2,10 +2,10 @@
import { Graphic, Section, PointLayer } from '@snlab/florence'
import { scaleLinear } from 'd3-scale'
- let selectedKey = null
+ let selectedIndex = null
- const x = [1, 3, 5, 3]
- const y = [3, 1, 3, 5]
+ const a = [1, 3, 5, 3]
+ const b = [3, 1, 3, 5]
const name = ['West', 'North', 'East', 'South']
@@ -18,16 +18,16 @@
>
key === selectedKey ? 'red' : 'black' }
- onMouseover={({ key }) => selectedKey = key}
- onMouseout={() => selectedKey = null}
+ fill={({ index }) => index === selectedIndex ? 'red' : 'black' }
+ onMouseover={({ index }) => selectedIndex = index}
+ onMouseout={() => selectedIndex = null}
/>
-{selectedKey === null ? 'None selected' : name[selectedKey]}
\ No newline at end of file
+{selectedIndex === null ? 'None selected' : name[selectedIndex]}
diff --git a/site/src/routes/docs/concepts/interactivity.sveltex b/site/src/routes/docs/concepts/interactivity.sveltex
index 93641039..58e58274 100644
--- a/site/src/routes/docs/concepts/interactivity.sveltex
+++ b/site/src/routes/docs/concepts/interactivity.sveltex
@@ -1,7 +1,5 @@
# Interactivity
-## Description
-
`florence` takes a different approach to interactivity than other data visualization libraries. Where libraries like [Vega Lite](https://vega.github.io/vega-lite/) or [G6](https://g6.antv.vision/) use a high-level 'grammar' specifically designed for interactivity, `florence` takes a more low-level approach. Instead of explaining to `florence` through a special language how an event (like a mouse click) should trigger an action (like a Mark changing color), `florence` relies on plain JavaScript combined with Svelte's built-in reactivity system as much as possible. Although this approach can result in more boilerplate code, it does provide more control and flexibility for the end user to create tailored and innovative interactions. At the same time, many tricky aspects of interactivity have been abstracted away, so you do not need to reinvent the wheel either!
## Caveats
@@ -142,7 +140,7 @@ Highlighting is a technique that allows the end user to request additional infor
import { Graphic, Section, PointLayer } from '@snlab/florence'
import { scaleLinear } from 'd3-scale'
-let selectedKey = null
+let selectedIndex = null
const a = [1, 3, 5, 3]
const b = [3, 1, 3, 5]
@@ -162,16 +160,16 @@ const name = ['West', 'North', 'East', 'South']
x={a}
y={b}
radius={10}
- fill={key => key === selectedKey ? 'red' : 'black' }
- onMouseover={({ key }) => selectedKey = key}
- onMouseout={() => selectedKey = null}
+ fill={({ index }) => index === selectedIndex ? 'red' : 'black' }
+ onMouseover={({ index }) => selectedIndex = index}
+ onMouseout={() => selectedIndex = null}
/>
-{selectedKey === null ? 'None selected' : name[selectedKey]}
+{selectedIndex === null ? 'None selected' : name[selectedIndex]}
```
```js exec
diff --git a/site/src/routes/docs/concepts/local-coordinates.sveltex b/site/src/routes/docs/concepts/local-coordinates.sveltex
index 4b675213..1dafce12 100644
--- a/site/src/routes/docs/concepts/local-coordinates.sveltex
+++ b/site/src/routes/docs/concepts/local-coordinates.sveltex
@@ -1,25 +1,20 @@
# Local coordinates
-## Description
-
-Understanding how local coordinates work is key to understanding `florence`.
-The `Graphic` and `Section` components can create local coordinate systems,
-and all other components are affected by local coordinate systems.
+Understanding how local coordinates work is key to understanding `florence`. The `Graphic` and `Section` components can create local coordinate systems, and all other components are affected by local coordinate systems.
## Creating local coordinate systems
-As stated above, local coordinate systems are created with the `Graphic` and `Section`
-components. The following props are used to create local coordinate systems:
+As stated above, local coordinate systems are created with the `Graphic` and `Section` components. The following props are used to create local coordinate systems:
-| Prop | Type(s) | Required | Default | Units |
-| -------------- | ------------------------------------------ | -------- | ------------ | ------------- |
-| scaleX | [d3 scale](https://github.com/d3/d3-scale) | no | `undefined` | - |
-| scaleY | [d3 scale](https://github.com/d3/d3-scale) | no | `undefined` | - |
-| transformation | `String`: `'identity'` or `'polar'` | no | `'identity'` | - |
-| flipX | `Boolean` | no | `false` | - |
-| flipY | `Boolean` | no | `false` | - |
-| padding | `Number`, `Object` | no | `undefined` | screen pixels |
-| zoomIdentity | `Object` | no | `undefined` | - |
+| Prop | Required | Type(s) | Default | Unit(s) |
+| -------------- | -------- | ------------------ | ------------ | ------------------------------------------ |
+| scaleX | `false` | `Function` | `undefined` | [d3 scale](https://github.com/d3/d3-scale) |
+| scaleY | `false` | `Function` | `undefined` | [d3 scale](https://github.com/d3/d3-scale) |
+| transformation | `false` | `String` | `'identity'` | Should be either `'identity'` or `'polar'` |
+| flipX | `false` | `Boolean` | `false` | - |
+| flipY | `false` | `Boolean` | `false` | - |
+| padding | `false` | `Number`, `Object` | `undefined` | Pixel |
+| zoomIdentity | `false` | `Object` | `undefined` | - |
The purpose of a local coordinate system is to convert coordinates, given to components within a `Graphic` or `Section`, to pixel values that end up on your screen. All marks and layers have so-called 'positioning props'. Below is a schematic representation of how `florence` converts local coordinates to pixel values:
@@ -30,7 +25,7 @@ The purpose of a local coordinate system is to convert coordinates, given to com
The three main steps in this process are:
1. Scaling
-2. Applying the coordinate transformation
+2. Applying the coordinate transformation, if any
3. Applying the 'final' transformation, which encompasses padding, zooming and flipping.
These three concepts will be explained in depth in the next paragraphs.
@@ -41,7 +36,7 @@ These three concepts will be explained in depth in the next paragraphs.
Scaling is the process of ["mapping a dimension of abstract data to a visual representation"](https://github.com/d3/d3-scale). In `florence`, this is not always true. The output of the scaling step is not necessarily the final 'visual representation' (a pixel value). If the user chooses to apply a coordinate transformation, the output of the scaling step goes through another step of processing. Or, if the user specifies the `padding`, `flipX`, `flipY` or `zoomIdentity` props, there will be another ('final') step before we obtain a pixel value. But for now, let's forget about coordinate transformations and things like padding and flipping, and look at how scaling works in isolation.
-To scale coordinates in a local coordinate system, pass a [d3 scale](https://github.com/d3/d3-scale) to `scaleX` or `scaleY`. D3 scales are functions that map domains to ranges, where a domain is the 'abstract data dimension' and the range is the output dimension. In `florence`, the range will be taken care of for you, so you only need to define the domain.
+To scale coordinates in a local coordinate system, pass a [d3 scale](https://github.com/d3/d3-scale) to `scaleX` or `scaleY`. D3 scales are functions that map domains to ranges, where a domain is the 'abstract data dimension' and the range is the output dimension- in this case, pixels on your screen. In `florence`, the range will be taken care of for you, so you only need to define the domain.
Say that we have the following point:
@@ -51,11 +46,11 @@ const point = { x: 5, y: 5 }
And we want to position this point in the middle of the following `Graphic`:
-```js
-import { Graphic } from '@snlab/florence'
```
+
-```
+ import { Graphic, Point } from '@snlab/florence'
+ import { scaleLinear } from 'd3-scale'
+
-```
+ import { Graphic, Rectangle } from '@snlab/florence'
+ import { scalePoint, scaleTime } from 'd3-scale'
+
+ const domainX = ['a', 'b', 'c', 'd', 'e']
+ const domainY = [new Date(2020, 1, 1), new Date(2020, 1, 10)])
+
-```
@@ -162,17 +157,24 @@ import CenterPointFunc from './examples/_CenterPointFunc.svelte'
```
```
-
+ import { Graphic, Point, Rectangle } from '@snlab/florence'
+ import { scaleLinear } from 'd3-scale'
+
+ const point = { x: 5, y: 5 }
+
+
+
-
+
- 100} y={() => 100} radius={10} fill="green" />
+ 100} y={() => 100} radius={10} fill={'green'} />
```
@@ -187,11 +189,14 @@ Currently, the only supported coordinate transformation is `'polar'`. More trans
import PolarShowcase from './examples/_PolarShowcase.svelte'
```
-```js
-let transformation = 'identity'
```
+
-```
Coordinates:
@@ -205,6 +210,7 @@ let transformation = 'identity'
height={500}
{transformation}
backgroundColor="#b2ffb2"
+ {flipY}
>
@@ -212,7 +218,7 @@ let transformation = 'identity'
@@ -239,6 +245,8 @@ import PolarScalingShowcase from './examples/_PolarScalingShowcase.svelte'
```
```
+...
+
+ import { Graphic, Rectangle } from '@snlab/florence'
+
-```
+ import { Graphic, Point, Label } from '@snlab/florence'
+
+ const zoomIdentity = {
+ x: 50,
+ y: -50,
+ kx: 2,
+ ky: 2
+ }
+
-```
+ import { Graphic, Section, Point } from '@snlab/florence'
+ import { scaleLinear } from 'd3-scale'
+
-```
-## Examples
-
-### Scaling example
+## Example
This example will illustrate working with `String`s and d3's [scalePoint](https://github.com/d3/d3-scale#scalePoint). Let's say that a street artist has three favorite locations to play: the square, the park, and the mall. Every day she randomly picks a location where she plays all day, and at the end of the day she writes down the location and how much money she made. To have some insight in which locations yield the best results, she decides to visualize the data of the last 100 days, which is stored in two `Array`s: `location` and `money`. How would she accomplish this in `florence`? For this example, we will also use axes, to make the result a bit easier to interpret.
@@ -486,16 +496,17 @@ This example will illustrate working with `String`s and d3's [scalePoint](https:
import StreetArtist from './examples/_StreetArtist.svelte'
```
-```js
-import { Graphic, PointLayer, XAxis, YAxis } from '@snlab/florence'
-import { scaleLinear, scalePoint } from 'd3-scale'
+```
+
-```
+ import { Graphic } from '@snlab/florence'
+
+
+
+
+
diff --git a/site/src/routes/docs/core/examples/_GridSimple.svelte b/site/src/routes/docs/core/examples/_GridSimple.svelte
index ef1e0eda..779185f0 100644
--- a/site/src/routes/docs/core/examples/_GridSimple.svelte
+++ b/site/src/routes/docs/core/examples/_GridSimple.svelte
@@ -5,9 +5,6 @@
let columns = 2
$: rows = Math.ceil(colors.length / columns)
-
- const width = 200
- const height = 200
@@ -15,17 +12,16 @@
-
-
- {#each colors as color}
-
- {/each}
+
+
+
+
+ {#each colors as color}
+
+
+
+ {/each}
+
-
+
diff --git a/site/src/routes/docs/core/examples/_SectionSimple.svelte b/site/src/routes/docs/core/examples/_SectionSimple.svelte
new file mode 100644
index 00000000..9766e417
--- /dev/null
+++ b/site/src/routes/docs/core/examples/_SectionSimple.svelte
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
diff --git a/site/src/routes/docs/core/examples/_TitleSimple.svelte b/site/src/routes/docs/core/examples/_TitleSimple.svelte
new file mode 100644
index 00000000..33808f78
--- /dev/null
+++ b/site/src/routes/docs/core/examples/_TitleSimple.svelte
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
diff --git a/site/src/routes/docs/core/examples/_ViewBoxSimple.svelte b/site/src/routes/docs/core/examples/_ViewBoxSimple.svelte
new file mode 100644
index 00000000..22845ab8
--- /dev/null
+++ b/site/src/routes/docs/core/examples/_ViewBoxSimple.svelte
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/site/src/routes/docs/core/graphic.sveltex b/site/src/routes/docs/core/graphic.sveltex
index be69e4bd..0d6ed6ca 100644
--- a/site/src/routes/docs/core/graphic.sveltex
+++ b/site/src/routes/docs/core/graphic.sveltex
@@ -1,59 +1,102 @@
# Graphic
-```svelte
-
+Every `florence` graphic starts with the `Graphic` component. Think of
+it as a supercharged `svg` root element.
+
+```markup
+
- ...
+
```
-## Description
+```js exec
+import SimpleExample from './examples/_GraphicSimple.svelte'
+```
-Every `florence` graphic starts with the `Graphic` component. Think of
-it as a supercharged `svg` root element.
+
## Caveats
- `florence` components cannot be used outside of a `Graphic` component
- `Graphic` components cannot be nested
-## Props
+## Properties
### Positioning
-| Prop | Type(s) | Required | Default | Units |
-| ------ | -------- | -------- | ------- | ------------- |
-| width | `Number` | yes | - | screen pixels |
-| height | `Number` | yes | - | screen pixels |
+| Prop | Required | Type(s) | Default | Unit(s) | | |
+| ------- | ------------------------------ | ------------------ | ---------------------------- | ----------------- | ----------- | ----------------------------------------------------------------------------------------- |
+| width | `true` | `Number`, `String` | `500` | Pixel, percentage | | |
+| height | `true` | `Number`, `String` | `500` | Pixel, percentage | | |
+| viewBox | `if (typeof width === 'string' && typeof height === 'string')` | `String` | `undefined` | [viewBox coordinates](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/viewBox) |
+
+In most cases, the `Graphic` will be positioned by providing the `width` and `height` in pixels, like so:
+
+```markup
+
+```
+
+However, in responsive layouts, it can be desirable to define the `Graphic`'s `width` and `height` in percentages relative to its parent element. In this case, the `viewBox` prop must be specified in [viewBox coordinates](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/viewBox), which will determine the `Graphic`'s local coordinate system. Note, however, that this changes all variables that are defined in pixels! The radius below, for example, is much larger than 20px (depending on your screen size):
+
+```markup
+
+
+
+
+
+
+
+```
+
+```js exec
+import ViewBoxExample from './examples/_ViewBoxSimple.svelte'
+```
+
+
+
+::: div callout
+`width` and `height` must always be of the same type, so either both `Number` or both `String`.
+:::
-### Aesthetic props
+### Aesthetics
-| Prop | Type(s) | Required | Default | Units |
-| --------------- | -------- | -------- | ----------- | ----------- |
-| backgroundColor | `String` | no | `undefined` | Color value |
-| paddingColor | `String` | no | `undefined` | Color value |
+| Prop | Required | Type(s) | Default | Unit(s) |
+| --------------- | -------- | -------- | ----------- | ---------------------------- |
+| backgroundColor | `false` | `String` | `undefined` | Named, hex, rgb or hsl color |
+| paddingColor | `false` | `String` | `undefined` | Named, hex, rgb or hsl color |
-Where `backgroundColor` is the area within the padded area, and `paddingColor` is the background of the padded area (see `padding` below).
+`backgroundColor` is the area within the padded area, and `paddingColor` is the background of the padded area (see `padding` below).
### Local coordinate system
-| Prop | Type(s) | Required | Default | Units |
-| -------------- | ------------------------------------------ | -------- | ------------ | ------------- |
-| scaleX | [d3 scale](https://github.com/d3/d3-scale) | no | `undefined` | - |
-| scaleY | [d3 scale](https://github.com/d3/d3-scale) | no | `undefined` | - |
-| transformation | `String`: `'identity'` or `'polar'` | no | `'identity'` | - |
-| flipX | `Boolean` | no | `false` | - |
-| flipY | `Boolean` | no | `false` | - |
-| padding | `Number`, `Object` | no | `undefined` | screen pixels |
-| zoomIdentity | `Object` | no | `undefined` | - |
+| Prop | Required | Type(s) | Default | Unit(s) |
+| -------------- | -------- | ------------------ | ------------ | ------------------------------------------ |
+| scaleX | `false` | `Function` | `undefined` | [d3 scale](https://github.com/d3/d3-scale) |
+| scaleY | `false` | `Function` | `undefined` | [d3 scale](https://github.com/d3/d3-scale) |
+| transformation | `false` | `String` | `'identity'` | Should be either `'identity'` or `'polar'` |
+| flipX | `false` | `Boolean` | `false` | - |
+| flipY | `false` | `Boolean` | `false` | - |
+| padding | `false` | `Number`, `Object` | `undefined` | Pixel |
+| zoomIdentity | `false` | `Object` | `undefined` | - |
For more how to use these props, see the [local coordinates](/docs/concepts/local-coordinates) documentation.
### Other
-| Prop | Type(s) | Required | Default | Units |
-| --------------- | --------- | -------- | ------- | ----- |
-| blockReindexing | `Boolean` | no | `false` | - |
+| Prop | Required | Type(s) | Default | Unit(s) |
+| --------------- | -------- | --------- | ------- | ------- |
+| blockReindexing | `false` | `Boolean` | `false` | - |
+| clip | `false` | `Boolean` | `true` | - |
-The purpose of `blockReindexing` is explained in the [interactivity](/docs/concepts/interactivity) documentation.
\ No newline at end of file
+The purpose of `blockReindexing` is explained in the [interactivity](/docs/concepts/interactivity) documentation. `clip` indicates whether the marks or layers inside of this `Graphic` should be clipped off if they extends this `Graphic`'s viewport (i.e. the area within the padding).
diff --git a/site/src/routes/docs/core/grid.sveltex b/site/src/routes/docs/core/grid.sveltex
index 83e96754..fc9c4afa 100644
--- a/site/src/routes/docs/core/grid.sveltex
+++ b/site/src/routes/docs/core/grid.sveltex
@@ -1,78 +1,110 @@
# Grid
-The Grid component is used to quickly position and align 'square' components in a grid format. 'Square' here refers to any component that has x1, x2, y1 and y2 props. This includes the Section component, the Rectangle mark, and any custom component that you would want to create, given it has the props mentioned above.
-```js exec
-import SimpleExample from './examples/_GridSimple.svelte'
-```
-
+The Grid component is used to quickly position and align 'square' components in a grid format. 'Square' here refers to any component that has x1, x2, y1 and y2 props. This includes the Section component, the Rectangle mark, and any custom component that you would want to create, given it has the props mentioned above.
```markup
-
-
- {#each colors as color}
-
- {/each}
+
+
+ Columns:
+
+
+
+
+
+
+
+ {#each colors as color}
+
+
+
+ {/each}
+
+
```
+```js exec
+import SimpleExample from './examples/_GridSimple.svelte'
+```
+
+
+
## Properties
+
### Positioning
-| Prop | Type(s) | Required | Default | Units |
-| ---- | --------------- | --------------- | ----------- | ----------------- |
-| x1 | see Section | see Section | `undefined` | local coordinates |
-| x2 | see Section | see Section | `undefined` | local coordinates |
-| y1 | see Section | see Section | `undefined` | local coordinates |
-| y2 | see Section | see Section | `undefined` | local coordinates |
+| Prop | Required | Types | Default | Unit(s) |
+| ---- | ----------------------- | -------------------------------------- | ----------- | ---------------------------------------------------- |
+| x1 | `if (x2 !== undefined)` | `Number`, `String`, `Date`, `Function` | `undefined` | [Local coordinate](/docs/concepts/local-coordinates) |
+| x2 | `if (x1 !== undefined)` | `Number`, `String`, `Date`, `Function` | `undefined` | [Local coordinate](/docs/concepts/local-coordinates) |
+| y1 | `if (y2 !== undefined)` | `Number`, `String`, `Date`, `Function` | `undefined` | [Local coordinate](/docs/concepts/local-coordinates) |
+| y2 | `if (y1 !== undefined)` | `Number`, `String`, `Date`, `Function` | `undefined` | [Local coordinate](/docs/concepts/local-coordinates) |
-The `Grid` positioning props work the same way as the [Section](/docs/core/section)
-positioning props.
+The `Grid` positioning props behave the same way as the [Section](/docs/core/section) positioning props.
### Grid settings
-| Prop | Type(s) | Required | Default | Units | Description |
-| ---------------- | --------- | -------- | ------- | ------------- | ----------- |
-| rows | `Number` | ✅ | `1` | Integer | Number of rows in grid |
-| columns | `Number` | ✅ | `1` | Integer | Number of columns in grid |
-| rowGap | `Number` | ✅ | `0` | Integer | Margin between rows |
-| columnGap | `Number` | ✅ | `0` | Integer | Margin between columns |
-| areaNames | []`String` | ✅ | [] | | An array of cell or facet names |
+| Prop | Required | Type(s) | Default | Unit(s) |
+| --------- | -------- | ---------- | ----------- | ------- |
+| names | `true` | `String[]` | `undefined` | - |
+| rows | `false` | `Number` | `undefined` | Integer |
+| columns | `false` | `Number` | `undefined` | Integer |
+| rowGap | `false` | `Number` | `0` | Pixel |
+| columnGap | `false` | `Number` | `0` | Pixel |
+`names` is the only required prop among the grid settings. If `rows` and `columns` are `undefined`, values will be chosen automatically based on the number of cells and the aspect ratio result from the positioning props. If only `rows` is defined, `columns` will be calculated automatically and vice versa. Finally, if both `rows` and `columns` are defined, the `Grid` component will give a warning if the number of `names` exceeds the number of cells.
+
+`rowGap` and `columnGap` are used to create spacing between the cells.
### Other
-| Prop | Type(s) | Required | Default | Units | Description |
-| ---------------- | --------- | -------- | ------- | ------------- | --------------------------------- | --------------------------------------------------------- |
-| viewGridTemplate | `Boolean` | | `false` | | Option to console log grid layout
-| viewGridShape | `Boolean` | | `false` | | Option to console log grid layout
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ---------------- | -------- | --------- | ------- | ------- |
+| viewGridTemplate | `false` | `Boolean` | `false` | - |
+| viewGridShape | `false` | `Boolean` | `false` | - |
+
+Setting either of these to `true` will `console.log` the grid template or shape whenever the data on which the `Grid` relies changes. This can be helpful when debugging the `Grid`.
-### Slot Scope
-Grid exposes value called `cells` using the `let:cells` syntax. The `cells` object holds a series of objects in which the key is the 'area name' element in `areaNames` array and the value is a position object that will be used to position the cells of the grid. This uses the [native Svelte slot syntax](https://svelte.dev/docs#slot_let). It is this `cells` object that can be used to position the children or cells of the Grid (i.e. `Section` components) in their corresponding cell.
+## Slot Scope
-```svelte
+`Grid` exposes a value called `cells` through its slot scope using the `let:cells` syntax. The `cells` object holds a series of objects in which the key is the 'area name' element in `areas` array and the value is a position object that will be used to position the cells of the grid. This uses the [native Svelte slot syntax](https://svelte.dev/docs#slot_let). It is this `cells` object is used to position the `Grid` component's children that form the cells of the Grid (i.e. `Section` components).
+
+With the following prop values:
+
+```html
+
+
+
+
+
+```
+
+the `cells` object will look something like this:
+
+```js
{
- "plot-1":{
- x1,
- y1,
- x2,
- y2
- },
- "plot-2":{
- x1,
- y1,
- x2,
- y2
+ someName: {
+ x1: ,
+ y1: ,
+ x2: ,
+ y2:
},
- ....
+ anotherName: {
+ x1: ,
+ y1: ,
+ x2: ,
+ y2:
+ }
}
-```
\ No newline at end of file
diff --git a/site/src/routes/docs/core/section.sveltex b/site/src/routes/docs/core/section.sveltex
index f90f0588..3d86901a 100644
--- a/site/src/routes/docs/core/section.sveltex
+++ b/site/src/routes/docs/core/section.sveltex
@@ -1,23 +1,37 @@
# Section
-```svelte
-
+The `Section` is one of the corner stones of `florence`. It is used to:
- ...
+- define local coordinate systems
+- apply coordinate transformations
+- specify zooming and panning behavior
+- enable interactions
-
-```
+```markup
+
-___
+
-## Description
+
-The `Section` is one of the corner stones of `florence`. It can be used to:
+
+```
-- define local coordinate systems
-- apply coordinate transformations
-- specify zooming and panning behavior
-- enable interactions
+```js exec
+import SimpleExample from './examples/_SectionSimple.svelte'
+```
+
+
## Caveats
@@ -28,16 +42,14 @@ The `Section` is one of the corner stones of `florence`. It can be used to:
### Positioning
-| Prop | Type(s) | Required | Default | Units |
-| ---- | --------------- | --------------- | ----------- | ----------------- |
-| x1 | see explanation | see explanation | `undefined` | local coordinates |
-| x2 | see explanation | see explanation | `undefined` | local coordinates |
-| y1 | see explanation | see explanation | `undefined` | local coordinates |
-| y2 | see explanation | see explanation | `undefined` | local coordinates |
+| Prop | Required | Types | Default | Unit(s) |
+| ---- | ----------------------- | -------------------------------------- | ----------- | ---------------------------------------------------- |
+| x1 | `if (x2 !== undefined)` | `Number`, `String`, `Date`, `Function` | `undefined` | [Local coordinate](/docs/concepts/local-coordinates) |
+| x2 | `if (x1 !== undefined)` | `Number`, `String`, `Date`, `Function` | `undefined` | [Local coordinate](/docs/concepts/local-coordinates) |
+| y1 | `if (y2 !== undefined)` | `Number`, `String`, `Date`, `Function` | `undefined` | [Local coordinate](/docs/concepts/local-coordinates) |
+| y2 | `if (y1 !== undefined)` | `Number`, `String`, `Date`, `Function` | `undefined` | [Local coordinate](/docs/concepts/local-coordinates) |
-It is possible to use the `Section` without providing any of the positioning props.
-This will result in the `Section` inheriting the extents of the parent `Section` or
-`Graphic`, taking padding into account. For example,
+It is possible to use the `Section` without providing any of the positioning props. This will result in the `Section` inheriting the extents of the parent `Section` or `Graphic`, taking padding into account. For example,
```svelte
@@ -136,59 +148,69 @@ would be equivalent to:
```
-### Aesthetic props
+### Aesthetics
-| Prop | Type(s) | Required | Default | Units |
-| --------------- | -------- | -------- | ----------- | ----------- |
-| backgroundColor | `String` | no | `undefined` | Color value |
-| paddingColor | `String` | no | `undefined` | Color value |
+| Prop | Required | Type(s) | Default | Units |
+| --------------- | -------- | -------- | ----------- | ---------------------------- |
+| backgroundColor | `false` | `String` | `undefined` | Named, hex, rgb or hsl color |
+| paddingColor | `false` | `String` | `undefined` | Named, hex, rgb or hsl color |
Where `backgroundColor` is the area within the padded area, and `paddingColor` is the background of the padded area (see `padding` below).
### Local coordinate system
-| Prop | Type(s) | Required | Default | Units |
-| -------------- | ---------------------------------------------------- | -------- | ------------ | ------------- |
-| scaleX | [d3 scale](https://github.com/d3/d3-scale) or domain | no | `undefined` | - |
-| scaleY | [d3 scale](https://github.com/d3/d3-scale) or domain | no | `undefined` | - |
-| transformation | `String`: `'identity'` or `'polar'` | no | `'identity'` | - |
-| flipX | `Boolean` | no | `false` | - |
-| flipY | `Boolean` | no | `false` | - |
-| padding | `Number`, `Object` | no | `undefnied` | screen pixels |
-| zoomIdentity | `Object` | no | `undefined` | - |
+| Prop | Required | Type(s) | Default | Unit(s) |
+| -------------- | -------- | ------------------ | ------------ | ------------------------------------------ |
+| scaleX | `false` | `Function` | `undefined` | [d3 scale](https://github.com/d3/d3-scale) |
+| scaleY | `false` | `Function` | `undefined` | [d3 scale](https://github.com/d3/d3-scale) |
+| transformation | `false` | `String` | `'identity'` | Should be either `'identity'` or `'polar'` |
+| flipX | `false` | `Boolean` | `false` | - |
+| flipY | `false` | `Boolean` | `false` | - |
+| padding | `false` | `Number`, `Object` | `undefined` | Pixel |
+| zoomIdentity | `false` | `Object` | `undefined` | - |
For more how to use these props, see the [local coordinates](/docs/concepts/local-coordinates) documentation.
-### Other
+### Interactions
+
+#### Mouse events
+
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ----------- | -------- | ---------- | ----------- | ------- |
+| onClick | `false` | `Function` | `undefined` | - |
+| onMousedown | `false` | `Function` | `undefined` | - |
+| onMouseup | `false` | `Function` | `undefined` | - |
+| onMouseover | `false` | `Function` | `undefined` | - |
+| onMouseout | `false` | `Function` | `undefined` | - |
+| onMousedrag | `false` | `Function` | `undefined` | - |
-| Prop | Type(s) | Required | Default | Units |
-| --------------- | --------- | -------- | ------- | ----- |
-| blockReindexing | `Boolean` | no | `false` | - |
+#### Touch events
-The purpose of `blockReindexing` is explained in the [interactivity](/docs/concepts/interactivity) documentation.
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ----------- | -------- | ---------- | ----------- | ------- |
+| onTouchdown | `false` | `Function` | `undefined` | - |
+| onTouchup | `false` | `Function` | `undefined` | - |
+| onTouchover | `false` | `Function` | `undefined` | - |
+| onTouchout | `false` | `Function` | `undefined` | - |
+| onTouchdrag | `false` | `Function` | `undefined` | - |
-### Mouse events
+#### Select events
-| Prop | Description |
-| ----------- | --------------------------------------------------------------------------------------- |
-| onClick | Fires when a user clicks anywhere in the `Section` |
-| onWheel | Fires when a user uses a mouse wheel or two-finger touchpad zoom while over a `Section` |
-| onMousedown | Fires when a user presses the mouse button down while over a `Section` |
-| onMouseup | Fires when a user releases the mouse button while over a `Section` |
-| onMouseover | Fires once when a user moves the mouse over a `Section` |
-| onMouseout | Fires once when a user moves the mouse out of a `Section` |
-| onMousemove | Fires every time the mouse moves while it is over a `Section` |
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ---------- | -------- | ---------- | ----------- | ------- |
+| onSelect | `false` | `Function` | `undefined` | - |
+| onDeselect | `false` | `Function` | `undefined` | - |
+
+See the [interactivity](/docs/concepts/interactivity) documentation for more information.
+
+### Other
-### Touch events
+| Prop | Required | Type(s) | Default | Unit(s) |
+| --------------- | -------- | --------- | ------- | ------- |
+| blockReindexing | `false` | `Boolean` | `false` | - |
+| clip | `false` | `Boolean` | `true` | - |
-| Prop | Description |
-| ----------- | ---------------------------------------------------------------------- |
-| onPinch | Fires when a user makes a 'pinch' gesture with two fingers |
-| onTouchdown | Fires when a user touches the area in a `Section` |
-| onTouchup | Fires when a user lifts his or her finger from the `Section` |
-| onTouchover | Fires when a user moves his or her finger into the `Section` |
-| onTouchout | Fires when a user moves his or her finger out of the `Section` |
-| onTouchmove | Fires every time the user moves his or her finger within the `Section` |
+The purpose of `blockReindexing` is explained in the [interactivity](/docs/concepts/interactivity) documentation. `clip` indicates whether the marks or layers inside of this `Graphic` should be clipped off if they extends this `Graphic`'s viewport (i.e. the area within the padding).
## Methods
@@ -214,4 +236,4 @@ section.selectRectangle(...)
```
-For more information on `Section` methods and how to use them to create advanced interactions like selection or brushing, check out the [interactivity](/docs/concepts/interactivity) documentation.
\ No newline at end of file
+For more information on `Section` methods and how to use them to create advanced interactions like selection or brushing, check out the [interactivity](/docs/concepts/interactivity) documentation.
diff --git a/site/src/routes/docs/core/title.sveltex b/site/src/routes/docs/core/title.sveltex
index f43fc5a4..8172ea69 100644
--- a/site/src/routes/docs/core/title.sveltex
+++ b/site/src/routes/docs/core/title.sveltex
@@ -1,38 +1,76 @@
# Plot title
-The `Title` component is used to create a plot title and has smart defaults for positioning and aesthetics/visual properties.
-
-```html
-
-
-
-
-
-
+
+The `Title` component is used to create titles and has smart defaults for positioning and aesthetics/visual properties.
+
+```markup
+
+
+
+
+
+
+
```
+```js exec
+import SimpleExample from './examples/_TitleSimple.svelte'
+```
+
+
+
## Properties
### Positioning
-| Prop | Type(s) | Description | Required | Default | Units |
-|------------|----------------------|-------------|----------|-------------|---------------------------------------------------|
-| x | `Number`, `Function` | Horizontal position of title | ✅ | `undefined` | local coordinates (`Number`), pixels (`Function`) |
-| y | `Number`, `Function` | Vertical position of title | ✅ | `undefined` | local coordinates (`Number`), pixels (`Function`) |
-| vjust | `String` | Vertical position of title | ❌ | `top` | `top`, `center`/`centre`, `bottom` |
-| hjust | `String` | Horizontal orientation of the title relative to the chart. | ❌ | `center` | `left`, `center`/`centre`, `right` |
-| xOffset | `String` | Offsets position of the title by pixel values | ❌ | `0` | pixels |
-| yOffset | `String` | Offsets position of the title by pixel values | ❌ | `10` | pixels |
-| usePadding | `Boolean` | Positions title either within parent Section/Graphic (`usePadding=false`) or within padding of parent (`usePadding=true`) | ❌ | `false` | boolean |
-| subtitleX | `Number` | Horizontal position of subtitle | ❌ | `undefined` | pixels |
-| subtitleY | `Number` | Vertical position of title | ❌ | `undefined` | pixels |
+
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ---------- | -------- | -------------------- | ----------- | ---------------------------------------------------- |
+| x | `false` | `Number`, `Function` | `undefined` | [Local coordinate](/docs/concepts/local-coordinates) |
+| y | `false` | `Number`, `Function` | `undefined` | [Local coordinate](/docs/concepts/local-coordinates) |
+| vjust | `false` | `String` | `'top'` | See explanation` |
+| hjust | `false` | `String` | `'center'` | See explanation |
+| xOffset | `false` | `String` | `0` | Pixel |
+| yOffset | `false` | `String` | `10` | Pixel |
+| usePadding | `false` | `Boolean` | `false` | - |
+| subtitleX | `false` | `Number` | `undefined` | Pixel |
+| subtitleY | `false` | `Number` | `undefined` | Pixel |
+
+
+| Prop | Type(s) | Required | Default | Units |
+| ---------- | -------------------- | -------- | ----------- | ------------------------------------------------- |
+| x | `Number`, `Function` | Horizontal position of title | ✅ | `undefined` | local coordinates (`Number`), pixels (`Function`) |
+| y | `Number`, `Function` | Vertical position of title | ✅ | `undefined` | local coordinates (`Number`), pixels (`Function`) |
+| vjust | `String` | Vertical position of title | ❌ | `top` | `top`, `center`/`centre`, `bottom` |
+| hjust | `String` | Horizontal orientation of the title relative to the chart. | ❌ | `center` | `left`, `center`/`centre`, `right` |
+| xOffset | `String` | Offsets position of the title by pixel values | ❌ | `0` | pixels |
+| yOffset | `String` | Offsets position of the title by pixel values | ❌ | `10` | pixels |
+| usePadding | `Boolean` | Positions title either within parent Section/Graphic (`usePadding=false`) or within padding of parent (`usePadding=true`) | ❌ | `false` | boolean |
+| subtitleX | `Number` | Horizontal position of subtitle | ❌ | `undefined` | pixels |
+| subtitleY | `Number` | Vertical position of title | ❌ | `undefined` | pixels |
+
+
+
### Title
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ------------------ | -------- | -------- | -------------- | ---------------------------- |
+| title | `false` | `String` | `'Title Text'` | - |
+| titleFill | `false` | `String` | `'black'` | Named, hex, rgb or hsl color |
+| titleStroke | `false` | `String` | `undefined` | Named, hex, rgb or hsl color |
+| titleStrokeWidth | `false` | `Number` | `undefined` | Pixel |
+| titleStrokeOpacity | `false` | `Number` | `undefined` | Number between 0 and 1 |
+| titleFillOpacity | `false` | `Number` | `undefined` | Number between 0 and 1 |
+| titleOpacity | `false` | `Number` | `1` | Number between 0 and 1 |
+| titleFontFamily | `false` | `String` | `'Helvetica'` | - |
+| titleFontSize | `false` | `Number` | `18` | Pixel |
+| titleFontWeight | `false` | `Number` | `'bold'` | - |
+| titleRotation | `false` | `Number` | `0` | Degree |
+| titleAnchorPoint | `false` | `Number` | `'center'` | See explanation |
+
+
+
| Prop | Type(s) | Description | Required | Default | Units |
|--------------------|----------|-----------------------------------------------|----------|--------------|--------------------------------------------------------------------------------|
| title | `String` | Title text | ✅ | `Title Text` | |
@@ -49,7 +87,25 @@ The `Title` component is used to create a plot title and has smart defaults for
| titleAnchorPoint | `Number` | Anchor point of text | ❌ | `center` | 'left', 'right', 'top', 'bottom', 'center', 'tl', 'tr', 'tc', 'bl', 'br', 'bc' |
-### Subtitle
+### Subtitle
+
+| Prop | Required | Type(s) | Default | Unit(s) |
+| --------------------- | -------- | -------- | ----------- | ---------------------------- |
+| subtitle | `false` | `String` | '' | - |
+| subtitleFill | `false` | `String` | `black` | Named, hex, rgb or hsl color |
+| subtitleStroke | `false` | `Number` | `undefined` | Named, hex, rgb or hsl color |
+| subtitleStrokeWidth | `false` | `Number` | `undefined` | Pixel |
+| subtitleStrokeOpacity | `false` | `Number` | `undefined` | Number between 0 and 1 |
+| subtitleFillOpacity | `false` | `Number` | `undefined` | Number between 0 and 1 |
+| subtitleOpacity | `false` | `Number` | `1` | Number between 0 and 1 |
+| subtitleFontFamily | `false` | `String` | `Helvetica` | - |
+| subtitleFontSize | `false` | `Number` | `14` | Pixel |
+| subtitleFontWeight | `false` | `Number` | `normal` | - |
+| subtitleRotation | `false` | `Number` | `0` | Degree |
+| subtitleAnchorPoint | `false` | `String` | `center` | See explanation |
+
+
+
| Prop | Type(s) | Description | Required | Default | Units |
|-----------------------|----------|--------------------------------------------------------|----------|-------------|--------------------------------------------------------------------------------|
| subtitle | `String` | Subtitle text | ❌ | '' | |
@@ -64,5 +120,3 @@ The `Title` component is used to create a plot title and has smart defaults for
| subtitleFontWeight | `Number` | Font weight of subtitle text | ❌ | `normal` | |
| subtitleRotation | `Number` | Rotation angle of subtitle text | ❌ | `0` | degrees |
| subtitleAnchorPoint | `String` | Anchor point of subtitle text | ❌ | `center` | 'left', 'right', 'top', 'bottom', 'center', 'tl', 'tr', 'tc', 'bl', 'br', 'bc' |
-
-## Examples
diff --git a/site/src/routes/docs/guides/legend.sveltex b/site/src/routes/docs/guides/legend.sveltex
index bed14657..6042a0cc 100644
--- a/site/src/routes/docs/guides/legend.sveltex
+++ b/site/src/routes/docs/guides/legend.sveltex
@@ -25,7 +25,7 @@
## Description
Legends are guides used to show mappings for aesthetics like color, shape, size, opacity to a given domain. Each legend is mapped to a single dimension or variable. Florence supports two types of legends that map values to color and/or opacity – gradient and discrete legends.
-## Props
+## Properties
### Positioning
diff --git a/site/src/routes/docs/guides/utils/_XAxisSimple.svelte b/site/src/routes/docs/guides/utils/_XAxisSimple.svelte
new file mode 100644
index 00000000..d74c1b57
--- /dev/null
+++ b/site/src/routes/docs/guides/utils/_XAxisSimple.svelte
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
diff --git a/site/src/routes/docs/guides/utils/_XGridLinesSimple.svelte b/site/src/routes/docs/guides/utils/_XGridLinesSimple.svelte
new file mode 100644
index 00000000..559a5ca4
--- /dev/null
+++ b/site/src/routes/docs/guides/utils/_XGridLinesSimple.svelte
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
diff --git a/site/src/routes/docs/guides/utils/_YAxisSimple.svelte b/site/src/routes/docs/guides/utils/_YAxisSimple.svelte
new file mode 100644
index 00000000..4bae58f0
--- /dev/null
+++ b/site/src/routes/docs/guides/utils/_YAxisSimple.svelte
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
diff --git a/site/src/routes/docs/guides/utils/_YGridLinesSimple.svelte b/site/src/routes/docs/guides/utils/_YGridLinesSimple.svelte
new file mode 100644
index 00000000..b69d65d5
--- /dev/null
+++ b/site/src/routes/docs/guides/utils/_YGridLinesSimple.svelte
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
diff --git a/site/src/routes/docs/guides/xaxis.sveltex b/site/src/routes/docs/guides/xaxis.sveltex
index 4736232d..0f44cddd 100644
--- a/site/src/routes/docs/guides/xaxis.sveltex
+++ b/site/src/routes/docs/guides/xaxis.sveltex
@@ -1,78 +1,125 @@
# X-axis
-```html
-
+Component that creates an x-axis in reference to its parent `Graphic` or `Section`'s local coordinate system.
+
+```markup
+
+
+
```
-## Description
+```js exec
+import SimpleExample from './utils/_XAxisSimple.svelte'
+```
-Component that creates an x-axis in reference to its parent `Graphic` or `Section`'s local coordinate system.
+
-## Props
+## Properties
### Positioning
-| Prop | Type(s) | Required | Default | Units |
-| ------- | ------------------ | -------- | ---------- | --------------- |
-| vjust | `String`, `Number` | no | `'bottom'` | See explanation |
-| yOffset | `Number` | no | `0` | Pixels |
-| flip | `Boolean` | no | `false` | - |
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ------- | -------- | ------------------ | ---------- | --------------- |
+| vjust | `false` | `String`, `Number` | `'bottom'` | See explanation |
+| yOffset | `false` | `Number` | `0` | Pixel |
+| flip | `false` | `Boolean` | `false` | - |
+
+- `vjust` can either be a `String` with the one of the values `'top'`, `'bottom'`, or `'center'`, or a `Number` where `0` corresponds to `'top'`, `1` corresponds to `'bottom'`, and `0.5` to `'center'`. This is the main way to determine where in the `Section` the `XAxis` will be positioned.
+- `yOffset` allows shifting the axis a few pixels up (when it is negative) or down (when it is positive) from where it has been positioned using `vjust`.
+- setting `flip` to `true` will make the `ticks` and `labels` switch sides accross the axis.
### Baseline
-| Prop | Type(s) | Required | Default | Units |
-| --------------- | --------- | -------- | --------- | ---------------------- |
-| baseLine | `Boolean` | no | `true` | - |
-| baseLineColor | `String` | no | `'black'` | Color value |
-| baseLineOpacity | `Number` | no | 1 | Number between 0 and 1 |
-| baseLineWidth | `Number` | no | 1 | Pixels |
+| Prop | Required | Type(s) | Default | Unit(s) |
+| --------------- | -------- | --------- | --------- | ---------------------------- |
+| baseLine | `false` | `Boolean` | `true` | - |
+| baseLineColor | `false` | `String` | `'black'` | Named, hex, rgb or hsl color |
+| baseLineOpacity | `false` | `Number` | `1` | Number between 0 and 1 |
+| baseLineWidth | `false` | `Number` | `1` | Pixel |
-### Ticks
+- setting `baseLine` to `false` will hide the horizontal axis line.
+- the rest should be self-explanatory.
-| Prop | Type(s) | Required | Default | Units |
-| ----------- | ------------------------------------------ | -------- | ----------- | ---------------------- |
-| scale | [d3 scale](https://github.com/d3/d3-scale) | no | `undefined` | - |
-| ticks | `Boolean` | no | `true` | - |
-| tickCount | `Number` | no | `10` | - |
-| tickExtra | `Boolean` | no | `false` | - |
-| tickValues | `Array` | no | `undefined` | Local coordinates |
-| tickSize | `Number` | no | `5` | Pixels |
-| tickWidth | `Number` | no | `0.5` | Pixels |
-| tickColor | `String` | no | `'black'` | Color value |
-| tickOpacity | `Number` | no | `1` | Number between 0 and 1 |
+### Ticks
-The `scale` prop can be used to override the parent's `scaleX`.
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ----------- | -------- | ---------- | ----------- | ---------------------------------------------------- |
+| scale | `false` | `Function` | `undefined` | [d3 scale](https://github.com/d3/d3-scale) |
+| ticks | `false` | `Boolean` | `true` | - |
+| tickCount | `false` | `Number` | `10` | - |
+| tickExtra | `false` | `Boolean` | `false` | - |
+| tickValues | `false` | `Array` | `undefined` | [Local coordinate](/docs/concepts/local-coordinates) |
+| tickSize | `false` | `Number` | `5` | Pixel |
+| tickWidth | `false` | `Number` | `0.5` | Pixel |
+| tickColor | `false` | `String` | `'black'` | Named, hex, rgb or hsl color |
+| tickOpacity | `false` | `Number` | `1` | Number between 0 and 1 |
+
+- the `scale` prop can be used to override the parent's `scaleX`.
+- setting `ticks` to `false` will hide the ticks.
+- `tickCount` will determine the number of ticks.
+- `tickExtra` will add an extra tick to mark the lower end of the domain.
+- `tickValues` can be used to manually place ticks, and will override `tickCount` and `tickExtra`.
+- `tickSize` refers to the length of the ticks.
+- `tickWidth` refers to the line width of the ticks.
+- `tickOpacity` refers to the opacity of the ticks.
### Tick labels
-| Prop | Type(s) | Required | Default | Units |
-| --------------- | ---------- | -------- | ------------- | ---------------------- |
-| labelFormat | `Function` | no | `undefined` | - |
-| labelOffset | `Number` | no | `2` | Pixels |
-| labelRotate | `Number` | no | `0` | Degrees |
-| labelFont | `String` | no | `'Helvetica'` | Font |
-| labelFontSize | `Number` | no | `10` | Pixels |
-| labelFontWeight | `String` | no | `'normal'` | See explanation |
-| labelOpacity | `Number` | no | `1` | Number between 0 and 1 |
-| labelColor | `String` | no | `'black'` | Color value |
+| Prop | Required | Type(s) | Default | Unit(s) |
+| --------------- | -------- | ---------- | ------------- | ----------------------------------- |
+| labelFormat | `false` | `Function` | `undefined` | - |
+| labelOffset | `false` | `Number` | `2` | Pixel |
+| labelRotate | `false` | `Number` | `0` | Degree |
+| labelFont | `false` | `String` | `'Helvetica'` | Font |
+| labelFontSize | `false` | `Number` | `10` | Pixel |
+| labelFontWeight | `false` | `String` | `'normal'` | See [Label](/docs/marks/label) Mark |
+| labelOpacity | `false` | `Number` | `1` | Number between 0 and 1 |
+| labelColor | `false` | `String` | `'black'` | Named, hex, rgb or hsl color |
+
+- `labelFormat` is a `Function` that receives a tick value, and can return a formatted tick value (for example, passing `Math.floor` to `labelFormat` in a numeric domain will coerce all tick values into integers).
+- `labelOffset` allows shifting the labels a few pixels up (negative) or down (positive).
+- `labelRotate` allows rotating the tick labels. This can be useful when the tick labels are close together.
+- the rest should be self-explanatory.
### Title
-| Prop | Type(s) | Required | Default | Units |
-| ---------------- | ------------------ | -------- | ------------- | ---------------------- |
-| titleHjust | `String`, `Number` | no | `'center'` | See explanation |
-| titleXOffset | `Number` | no | `0` | Pixels |
-| titleVjust | `String`, `Number` | no | `'axis'` | See explanation |
-| titleYOffset | `String`, `Number` | no | `'axis'` | See explanation |
-| title | `String` | no | `''` | - |
-| titleColor | `String` | no | `'black'` | Color value |
-| titleFont | `String` | no | `'Helvetica'` | Font |
-| titleFontSize | `Number` | no | `12` | Pixels |
-| titleFontWeight | `String` | no | `'normal'` | See explanation |
-| titleOpacity | `Number` | no | `1` | Number between 0 and 1 |
-| titleRotation | `Number` | no | `0` | Degrees |
-| titleAnchorPoint | `String` | no | `'t'` | See explanation |
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ---------------- | -------- | ------------------ | ------------- | ----------------------------------- |
+| titleHjust | `false` | `String`, `Number` | `'center'` | See explanation |
+| titleXOffset | `false` | `Number` | `0` | Pixel |
+| titleVjust | `false` | `String`, `Number` | `'axis'` | See explanation |
+| titleYOffset | `false` | `String`, `Number` | `'axis'` | See explanation |
+| titleAnchorPoint | `false` | `String` | `'t'` | See [Label](/docs/marks/label) Mark |
+| title | `false` | `String` | `''` | - |
+| titleColor | `false` | `String` | `'black'` | Named, hex, rgb or hsl color |
+| titleFont | `false` | `String` | `'Helvetica'` | Font |
+| titleFontSize | `false` | `Number` | `12` | Pixel |
+| titleFontWeight | `false` | `String` | `'normal'` | See explanation |
+| titleOpacity | `false` | `Number` | `1` | Number between 0 and 1 |
+| titleRotation | `false` | `Number` | `0` | Degree |
+
+`titleHjust`, `titleXOffset`, `titleVjust` and `titleYOffset` can be used to position the axis title similar to the `XAxis`'s `vjust` and `yOffset` props. The `titleVjust` and `titleYOffset` props, however, also allow a `String` with the value `'axis'`, which automatically places the title in a reasonable default position. For an explanation of `titleAnchorPoint`, see the `anchorPoint` explanation in the [Label](/docs/marks/label) Mark documentation.
+
+The rest should be self-explanatory.
+
+### Transitions
+
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ---------- | -------- | ------------------ | ----------- | -------------------------------- |
+| transition | `false` | `Number`, `Object` | `undefined` | Duration in ms or options object |
+
+Transitions will be applied to the marks (`Line`s and `Label`s) of which the axis consists. See the [transition](/docs/concepts/transitions) documentation for more information.
+
+### Other
+
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ---- | -------- | --------- | ------- | ------- |
+| clip | `false` | `Boolean` | `false` | - |
+
+Setting this to `true` will let the parent `Graphic` or `Section` clip off the axis if it leaves the viewport. Usually not desirable for axes.
diff --git a/site/src/routes/docs/guides/xgridlines.sveltex b/site/src/routes/docs/guides/xgridlines.sveltex
new file mode 100644
index 00000000..7c5c0464
--- /dev/null
+++ b/site/src/routes/docs/guides/xgridlines.sveltex
@@ -0,0 +1,36 @@
+# X-gridlines
+
+Component that creates grid lines extending the ticks of the [x-axis](/docs/guides/xaxis).
+
+```markup
+
+
+
+
+
+
+
+
+```
+
+```js exec
+import SimpleExample from './utils/_XGridLinesSimple.svelte'
+```
+
+
+
+## Properties
+
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ------- | -------- | ---------- | ----------- | ---------------------------------------------------- |
+| scale | `false` | `Function` | `undefined` | [d3 scale](https://github.com/d3/d3-scale) |
+| count | `false` | `Number` | `10` | - |
+| extra | `false` | `Boolean` | `false` | - |
+| values | `false` | `Array` | `undefined` | [Local coordinate](/docs/concepts/local-coordinates) |
+| width | `false` | `Number` | `0.25` | Pixel |
+| color | `false` | `String` | `'black'` | Named, hex, rgb or hsl color |
+| opacity | `false` | `Number` | `1` | Number between 0 and 1 |
+
+These properties mirror the 'ticks' properties of the [XAxis](/docs/guides/xaxis).
diff --git a/site/src/routes/docs/guides/yaxis.sveltex b/site/src/routes/docs/guides/yaxis.sveltex
index 8ab48bf6..db889986 100644
--- a/site/src/routes/docs/guides/yaxis.sveltex
+++ b/site/src/routes/docs/guides/yaxis.sveltex
@@ -1,78 +1,125 @@
# Y-axis
-```html
-
+Component that creates an y-axis in reference to its parent `Graphic` or `Section`'s local coordinate system.
+
+```markup
+
+
+
```
-## Description
+```js exec
+import SimpleExample from './utils/_YAxisSimple.svelte'
+```
-Component that creates an y-axis in reference to its parent `Graphic` or `Section`'s local coordinate system.
+
-## Props
+## Properties
### Positioning
-| Prop | Type(s) | Required | Default | Units |
-| ------- | ------------------ | -------- | ---------- | --------------- |
-| hjust | `String`, `Number` | no | `'bottom'` | See explanation |
-| xOffset | `Number` | no | `0` | Pixels |
-| flip | `Boolean` | no | `false` | - |
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ------- | -------- | ------------------ | -------- | --------------- |
+| hjust | `false` | `String`, `Number` | `'left'` | See explanation |
+| xOffset | `false` | `Number` | `0` | Pixel |
+| flip | `false` | `Boolean` | `false` | - |
+
+- `hjust` can either be a `String` with the one of the values `'left'`, `'right'`, or `'center'`, or a `Number` where `0` corresponds to `'left'`, `1` corresponds to `'right'`, and `0.5` to `'center'`. This is the main way to determine where in the `Section` the `YAxis` will be positioned.
+- `xOffset` allows shifting the axis a few pixels right (when it is negative) or left (when it is positive) from where it has been positioned using `hjust`.
+- setting `flip` to `true` will make the `ticks` and `labels` switch sides accross the axis.
### Baseline
-| Prop | Type(s) | Required | Default | Units |
-| --------------- | --------- | -------- | --------- | ---------------------- |
-| baseLine | `Boolean` | no | `true` | - |
-| baseLineColor | `String` | no | `'black'` | Color value |
-| baseLineOpacity | `Number` | no | 1 | Number between 0 and 1 |
-| baseLineWidth | `Number` | no | 1 | Pixels |
+| Prop | Required | Type(s) | Default | Unit(s) |
+| --------------- | -------- | --------- | --------- | ---------------------------- |
+| baseLine | `false` | `Boolean` | `true` | - |
+| baseLineColor | `false` | `String` | `'black'` | Named, hex, rgb or hsl color |
+| baseLineOpacity | `false` | `Number` | `1` | Number between 0 and 1 |
+| baseLineWidth | `false` | `Number` | `1` | Pixel |
-### Ticks
+- setting `baseLine` to `false` will hide the horizontal axis line.
+- the rest should be self-explanatory.
-| Prop | Type(s) | Required | Default | Units |
-| ----------- | ------------------------------------------ | -------- | ----------- | ---------------------- |
-| scale | [d3 scale](https://github.com/d3/d3-scale) | no | `undefined` | - |
-| ticks | `Boolean` | no | `true` | - |
-| tickCount | `Number` | no | `10` | - |
-| tickExtra | `Boolean` | no | `false` | - |
-| tickValues | `Array` | no | `undefined` | Local coordinates |
-| tickSize | `Number` | no | `5` | Pixels |
-| tickWidth | `Number` | no | `0.5` | Pixels |
-| tickColor | `String` | no | `'black'` | Color value |
-| tickOpacity | `Number` | no | `1` | Number between 0 and 1 |
+### Ticks
-The `scale` prop can be used to override the parent's `scaleY`.
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ----------- | -------- | ---------- | ----------- | ---------------------------------------------------- |
+| scale | `false` | `Function` | `undefined` | [d3 scale](https://github.com/d3/d3-scale) |
+| ticks | `false` | `Boolean` | `true` | - |
+| tickCount | `false` | `Number` | `10` | - |
+| tickExtra | `false` | `Boolean` | `false` | - |
+| tickValues | `false` | `Array` | `undefined` | [Local coordinate](/docs/concepts/local-coordinates) |
+| tickSize | `false` | `Number` | `5` | Pixel |
+| tickWidth | `false` | `Number` | `0.5` | Pixel |
+| tickColor | `false` | `String` | `'black'` | Named, hex, rgb or hsl color |
+| tickOpacity | `false` | `Number` | `1` | Number between 0 and 1 |
+
+- the `scale` prop can be used to override the parent's `scaleY`.
+- setting `ticks` to `false` will hide the ticks.
+- `tickCount` will determine the number of ticks.
+- `tickExtra` will add an extra tick to mark the lower end of the domain.
+- `tickValues` can be used to manually place ticks, and will override `tickCount` and `tickExtra`.
+- `tickSize` refers to the length of the ticks.
+- `tickWidth` refers to the line width of the ticks.
+- `tickOpacity` refers to the opacity of the ticks.
### Tick labels
-| Prop | Type(s) | Required | Default | Units |
-| --------------- | ---------- | -------- | ------------- | ---------------------- |
-| labelFormat | `Function` | no | `undefined` | - |
-| labelOffset | `Number` | no | `2` | Pixels |
-| labelRotate | `Number` | no | `0` | Degrees |
-| labelFont | `String` | no | `'Helvetica'` | Font |
-| labelFontSize | `Number` | no | `10` | Pixels |
-| labelFontWeight | `String` | no | `'normal'` | See explanation |
-| labelOpacity | `Number` | no | `1` | Number between 0 and 1 |
-| labelColor | `String` | no | `'black'` | Color value |
+| Prop | Required | Type(s) | Default | Unit(s) |
+| --------------- | -------- | ---------- | ------------- | ----------------------------------- |
+| labelFormat | `false` | `Function` | `undefined` | - |
+| labelOffset | `false` | `Number` | `2` | Pixel |
+| labelRotate | `false` | `Number` | `0` | Degree |
+| labelFont | `false` | `String` | `'Helvetica'` | Font |
+| labelFontSize | `false` | `Number` | `10` | Pixel |
+| labelFontWeight | `false` | `String` | `'normal'` | See [Label](/docs/marks/label) Mark |
+| labelOpacity | `false` | `Number` | `1` | Number between 0 and 1 |
+| labelColor | `false` | `String` | `'black'` | Named, hex, rgb or hsl color |
+
+- `labelFormat` is a `Function` that receives a tick value, and can return a formatted tick value (for example, passing `Math.floor` to `labelFormat` in a numeric domain will coerce all tick values into integers).
+- `labelOffset` allows shifting the labels a few pixels up (negative) or down (positive).
+- `labelRotate` allows rotating the tick labels. This can be useful when the tick labels are close together.
+- the rest should be self-explanatory.
### Title
-| Prop | Type(s) | Required | Default | Units |
-| ---------------- | ------------------ | -------- | ------------- | ---------------------- |
-| titleHjust | `String`, `Number` | no | `'axis'` | See explanation |
-| titleXOffset | `Number` | no | `'axis'` | Pixels |
-| titleVjust | `String`, `Number` | no | `'center'` | See explanation |
-| titleYOffset | `String`, `Number` | no | `0` | See explanation |
-| title | `String` | no | `''` | - |
-| titleColor | `String` | no | `'black'` | Color value |
-| titleFont | `String` | no | `'Helvetica'` | Font |
-| titleFontSize | `Number` | no | `12` | Pixels |
-| titleFontWeight | `String` | no | `'normal'` | See explanation |
-| titleOpacity | `Number` | no | `1` | Number between 0 and 1 |
-| titleRotation | `Number` | no | `-90` | Degrees |
-| titleAnchorPoint | `String` | no | `'center'` | See explanation |
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ---------------- | -------- | ------------------ | ------------- | ---------------------------- |
+| titleVjust | `false` | `String`, `Number` | `'center'` | See explanation |
+| titleYOffset | `false` | `Number` | `0` | Pixel |
+| titleHjust | `false` | `String`, `Number` | `'axis'` | See explanation |
+| titleXOffset | `false` | `String`, `Number` | `'axis'` | See explanation |
+| title | `false` | `String` | `''` | - |
+| titleColor | `false` | `String` | `'black'` | Named, hex, rgb or hsl color |
+| titleFont | `false` | `String` | `'Helvetica'` | Font |
+| titleFontSize | `false` | `Number` | `12` | Pixel |
+| titleFontWeight | `false` | `String` | `'normal'` | See explanation |
+| titleOpacity | `false` | `Number` | `1` | Number between 0 and 1 |
+| titleRotation | `false` | `Number` | `0` | Degree |
+| titleAnchorPoint | `false` | `String` | `'t'` | See explanation |
+
+`titleVjust`, `titleYOffset`, `titleHjust` and `titleXOffset` can be used to position the axis title similar to the `YAxis`'s `hjust` and `xOffset` props. The `titleHjust` and `titleXOffset` props, however, also allow a `String` with the value `'axis'`, which automatically places the title in a reasonable default position. For an explanation of `titleAnchorPoint`, see the `anchorPoint` explanation in the [Label](/docs/marks/label) Mark documentation.
+
+The rest should be self-explanatory.
+
+### Transitions
+
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ---------- | -------- | ------------------ | ----------- | -------------------------------- |
+| transition | `false` | `Number`, `Object` | `undefined` | Duration in ms or options object |
+
+Transitions will be applied to the marks (`Line`s and `Label`s) of which the axis consists. See the [transition](/docs/concepts/transitions) documentation for more information.
+
+### Other
+
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ---- | -------- | --------- | ------- | ------- |
+| clip | `false` | `Boolean` | `false` | - |
+
+Setting this to `true` will let the parent `Graphic` or `Section` clip off the axis if it leaves the viewport. Usually not desirable for axes.
diff --git a/site/src/routes/docs/guides/ygridlines.sveltex b/site/src/routes/docs/guides/ygridlines.sveltex
new file mode 100644
index 00000000..34d1fb10
--- /dev/null
+++ b/site/src/routes/docs/guides/ygridlines.sveltex
@@ -0,0 +1,36 @@
+# Y-gridlines
+
+Component that creates grid lines extending the ticks of the [y-axis](/docs/guides/yaxis).
+
+```markup
+
+
+
+
+
+
+
+
+```
+
+```js exec
+import SimpleExample from './utils/_YGridLinesSimple.svelte'
+```
+
+
+
+## Properties
+
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ------- | -------- | ---------- | ----------- | ---------------------------------------------------- |
+| scale | `false` | `Function` | `undefined` | [d3 scale](https://github.com/d3/d3-scale) |
+| count | `false` | `Number` | `10` | - |
+| extra | `false` | `Boolean` | `false` | - |
+| values | `false` | `Array` | `undefined` | [Local coordinate](/docs/concepts/local-coordinates) |
+| width | `false` | `Number` | `0.25` | Pixel |
+| color | `false` | `String` | `'black'` | Named, hex, rgb or hsl color |
+| opacity | `false` | `Number` | `1` | Number between 0 and 1 |
+
+These properties mirror the 'ticks' properties of the [YAxis](/docs/guides/xaxis).
diff --git a/site/src/routes/docs/helpers/create-geo-scales.sveltex b/site/src/routes/docs/helpers/create-geo-scales.sveltex
new file mode 100644
index 00000000..5611125a
--- /dev/null
+++ b/site/src/routes/docs/helpers/create-geo-scales.sveltex
@@ -0,0 +1,76 @@
+# createGeoScales
+
+Helper function for creating linear scales that maintain the aspect ratio of x and y domains. The main usecase for this is when creating maps.
+
+```markup
+
+
+
+
+
+
+
+
+
+```
+
+```js exec
+import BasicExample from './examples/_GeoBasic.svelte'
+```
+
+
+
+## Arguments
+
+
+| Argument | Required | Type(s) | Default | Unit(s) |
+| -------- | -------- | ---------- | ----------- | --------------- |
+| bbox | `true` | `Object` | `undefined` | See explanation |
+| bbox.x | `true` | `Number[]` | `undefined` | See explanation |
+| bbox.y | `true` | `Number[]` | `undefined` | See explanation |
+
+`bbox` is an Object with two members `x` and `y`, which are both `Array`s containing two numbers:
+
+```js
+const bbox = {
+ x: [, ],
+ y: [, ]
+}
+```
+
+The `x` and `y` members represent the domains of the variables that will be used as x and y dimensions.
+
+## Return value
+
+TODO
\ No newline at end of file
diff --git a/site/src/routes/docs/helpers/create-pan-handler.sveltex b/site/src/routes/docs/helpers/create-pan-handler.sveltex
new file mode 100644
index 00000000..6c27a9ba
--- /dev/null
+++ b/site/src/routes/docs/helpers/create-pan-handler.sveltex
@@ -0,0 +1,108 @@
+# createPanHandler
+
+Helper function to set up panning behavior on `Section`s.
+
+```markup
+
+
+
+
+
+
+
+```
+
+```js exec
+import SimpleExample from './examples/_PanExample.svelte'
+```
+
+
+
+## Arguments
+
+| Argument | Required | Type(s) | Default | Unit(s) |
+| ------------------------------ | -------- | ---------- | ----------------------- | ------------------------ |
+| zoomIdentity | `true` | `Object` | `undefined` | See explanation |
+| panSettings | `true` | `Object` | `undefined` | See explanation |
+| panSettings.setZoomIdentity | `true` | `Function` | `undefined` | See explanation |
+| panSettings.setBlockReindexing | `false` | `Function` | `() => {}` | See explanation |
+| panSettings.dimension | `false` | `String` | `'both'` | `'x'`, `'y'` or `'both'` |
+| panSettings.extentX | `false` | `Number[]` | `[-Infinity, Infinity]` | Pixel |
+| panSettings.extentY | `false` | `Number[]` | `[-Infinity, Infinity]` | Pixel |
+
+`zoomIdentity` must be an `Object` of the form:
+
+```js
+{
+ x: ,
+ y: ,
+ kx: ,
+ ky:
+}
+```
+Where `x` and `y` represent the amount in pixels that the `Section` is panned to the right and bottom. `kx` and `ky` represent zooming factors, which are not used for panning. Its default values (i.e. no zooming and panning) are:
+
+```js
+{
+ x: 0,
+ y: 0,
+ kx: 1,
+ ky: 1
+}
+```
+
+`panSettings` must be an `Object` with the following possible members:
+
+```js
+{
+ setZoomIdentity: ,
+ setBlockReindexing: ,
+ dimension: ,
+ extentX: ,
+ extentY:
+}
+```
+
+where
+
+- `setZoomIdentity` is a function that updates the `zoomIdentity`
+- `setBlockReindexing`is a function that updates the `blockReindexing`
+- `dimension` can be used to limit scrolling to a either the x or y dimension
+- `extentX` determines how far can be scrolled in the x dimension (if set to `[0, 0]` scrolling will be disabled in the x dimension)
+- `extentY` determines how far can be scrolled in the y dimension (if set to `[0, 0]` scrolling will be disabled in the y dimension)
+
+TODO explain `setZoomIdentity` and `setBlockReindexing`.
+
+## Return value
+
+TODO
diff --git a/site/src/routes/docs/helpers/create-zoom-handler.sveltex b/site/src/routes/docs/helpers/create-zoom-handler.sveltex
new file mode 100644
index 00000000..e68feb5c
--- /dev/null
+++ b/site/src/routes/docs/helpers/create-zoom-handler.sveltex
@@ -0,0 +1,3 @@
+# createZoomHandler
+
+TODO
\ No newline at end of file
diff --git a/site/src/routes/docs/helpers/examples/_GeoBasic.svelte b/site/src/routes/docs/helpers/examples/_GeoBasic.svelte
new file mode 100644
index 00000000..f9bd6059
--- /dev/null
+++ b/site/src/routes/docs/helpers/examples/_GeoBasic.svelte
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
diff --git a/site/src/routes/docs/helpers/examples/_PanExample.svelte b/site/src/routes/docs/helpers/examples/_PanExample.svelte
new file mode 100644
index 00000000..6ff33164
--- /dev/null
+++ b/site/src/routes/docs/helpers/examples/_PanExample.svelte
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/site/src/routes/docs/marks/area.sveltex b/site/src/routes/docs/marks/area.sveltex
index 0dd4bf5c..203665e2 100644
--- a/site/src/routes/docs/marks/area.sveltex
+++ b/site/src/routes/docs/marks/area.sveltex
@@ -40,7 +40,7 @@ import SimpleExample from './examples/_AreaSimple.svelte'
### Positioning
-| Name | Required | Type(s) | Default | Unit(s) |
+| Prop | Required | Type(s) | Default | Unit(s) |
| --------------- | -------- | -------------------------------------------- | ----------- | ---------------------------------------------------- |
| x1 | `true` | `Number[]`, `String[]`, `Date[]`, `Function` | `undefined` | [Local coordinate](/docs/concepts/local-coordinates) |
| x2 | `false` | `Number[]`, `String[]`, `Date[]`, `Function` | `undefined` | [Local coordinate](/docs/concepts/local-coordinates) |
@@ -59,7 +59,7 @@ import VerticalAreaBoth from './utils/_VerticalAreaBoth.svelte'
import HorizontalAreaLower from './utils/_HorizontalAreaLower.svelte'
```
-| Name | Description | Representation | | |
+| Prop | Description | Representation | | |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------- | --- | --- |
| x1 | X coordinates of both upper and lower bounds of an area when x is the independent variable; x coordinates of the right bound of an area when y is the independent variable. | | | |
| x2 | X coordinates of the left bound of an area when y is the independent variable. | | | |
@@ -87,14 +87,14 @@ For all positioning props, a function can be supplied that bypasses the scaling
### Aesthetics
-| Prop | Required | Type(s) | Default | Unit(s) |
-| ------------- | -------- | -------- | ----------- | --------------------------- |
-| stroke | `false` | `String` | `'none'` | Name, hex, rgb or hsl color |
-| strokeWidth | `false` | `Number` | `0` | Pixel |
-| strokeOpacity | `false` | `Number` | `undefined` | Number between 0 and 1 |
-| fill | `false` | `String` | `'#000000'` | Name, hex, rgb or hsl color |
-| fillOpacity | `false` | `Number` | `undefined` | Number between 0 and 1 |
-| opacity | `false` | `Number` | `1` | Number between 0 and 1 |
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ------------- | -------- | -------- | ----------- | ---------------------------- |
+| stroke | `false` | `String` | `'none'` | Named, hex, rgb or hsl color |
+| strokeWidth | `false` | `Number` | `0` | Pixel |
+| strokeOpacity | `false` | `Number` | `undefined` | Number between 0 and 1 |
+| fill | `false` | `String` | `'#000000'` | Named, hex, rgb or hsl color |
+| fillOpacity | `false` | `Number` | `undefined` | Number between 0 and 1 |
+| opacity | `false` | `Number` | `1` | Number between 0 and 1 |
These aesthetic props are similar to attributes of the SVG [path](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/path) element. The analogous `path` attributes are shown below in brackets:
@@ -107,15 +107,63 @@ These aesthetic props are similar to attributes of the SVG [path](https://develo
### Transitions
-TODO
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ---------- | -------- | ------------------ | ----------- | -------------------------------- |
+| transition | `false` | `Number`, `Object` | `undefined` | Duration in ms or options object |
+
+See the [transition](/docs/concepts/transitions) documentation for more information.
### Interactions
- TODO
+#### Mouse events
+
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ----------- | -------- | ---------- | ----------- | ------- |
+| onClick | `false` | `Function` | `undefined` | - |
+| onMousedown | `false` | `Function` | `undefined` | - |
+| onMouseup | `false` | `Function` | `undefined` | - |
+| onMouseover | `false` | `Function` | `undefined` | - |
+| onMouseout | `false` | `Function` | `undefined` | - |
+| onMousedrag | `false` | `Function` | `undefined` | - |
+
+#### Touch events
+
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ----------- | -------- | ---------- | ----------- | ------- |
+| onTouchdown | `false` | `Function` | `undefined` | - |
+| onTouchup | `false` | `Function` | `undefined` | - |
+| onTouchover | `false` | `Function` | `undefined` | - |
+| onTouchout | `false` | `Function` | `undefined` | - |
+| onTouchdrag | `false` | `Function` | `undefined` | - |
+
+#### Select events
+
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ---------- | -------- | ---------- | ----------- | ------- |
+| onSelect | `false` | `Function` | `undefined` | - |
+| onDeselect | `false` | `Function` | `undefined` | - |
+
+See the [interactivity](/docs/concepts/interactivity) documentation for more information.
### Other
-TODO
+| Prop | Required | Type(s) | Default | Unit(s) |
+| --------------- | -------- | --------- | ----------- | ------- |
+| renderSettings | `false` | `Object` | `undefined` | - |
+| blockReindexing | `false` | `Boolean` | `false` | - |
+| clip | `false` | `Boolean` | `true` | - |
+
+- `renderSettings`: see the [advanced rendering](/docs/concepts/advanced-rendering) documentation for more information
+- `blockReindexing`: see the [interactivity](/docs/concepts/interactivity) documentation for more information.
+- `clip`: indicates whether the Mark or Layer should be clipped off if it extends beyond its parent `Section` or `Graphic` viewport (i.e. the area within the padding).
+
+In addition, the `AreaLayer` has the `key` prop:
+
+| Prop | Required | Type(s) | Default | Unit(s) |
+| ---- | -------- | ---------- | ----------- | -------------------- |
+| key | `false` | `String[]` | `undefined` | Array of unique keys |
+
+See the [marks versus layers](/docs/concepts/marks-vs-layers) documentation for more information on how keys work.
## Examples
diff --git a/site/src/routes/docs/marks/funcline.sveltex b/site/src/routes/docs/marks/funcline.sveltex
index ec5221af..ed76912d 100644
--- a/site/src/routes/docs/marks/funcline.sveltex
+++ b/site/src/routes/docs/marks/funcline.sveltex
@@ -1,6 +1,6 @@
# FuncLine
-The `FuncLine` mark can be used to plot functions over intervals.
+The `FuncLine` mark can be used to plot functions over intervals. It is the only mark that does not have a corresponding layer element.
```markup
diff --git a/test/sandbox/src/examples/RecycleTest.svelte b/test/sandbox/src/examples/RecycleTest.svelte
new file mode 100644
index 00000000..481db6fd
--- /dev/null
+++ b/test/sandbox/src/examples/RecycleTest.svelte
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file