Skip to content

Commit 7b45bb0

Browse files
committed
document rect stacking
1 parent 81e2185 commit 7b45bb0

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

src/routes/marks/rect/+page.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,90 @@ RectY can be used for range annotations:
133133

134134
## Stacking
135135

136+
RectX marks can be stacked along the x dimension (over identical y1 values):
137+
136138
```svelte live
139+
<script>
140+
import { Plot, RectX } from 'svelteplot';
141+
142+
const data = [
143+
{
144+
width: 2.5,
145+
height: 1,
146+
category: 'A'
147+
},
148+
{
149+
width: 3,
150+
height: 4,
151+
category: 'B'
152+
},
153+
{
154+
width: 4,
155+
height: 3,
156+
category: 'C'
157+
}
158+
];
159+
</script>
137160
161+
<Plot height={300} color={{ legend: true }}>
162+
<RectX
163+
{data}
164+
x="width"
165+
y1={0}
166+
y2="height"
167+
fill="category"
168+
insetRight={1} />
169+
</Plot>
138170
```
171+
172+
```svelte
173+
<Plot>
174+
<RectX
175+
{data}
176+
x="width"
177+
y1={0}
178+
y2="height"
179+
fill="category"
180+
insetRight={1} />
181+
</Plot>
182+
```
183+
184+
[fork](https://svelte.dev/playground/9fe225752dbd43fdb00123dcf7bf9441?version=5)
185+
186+
RectY marks can be stacked along y (over identical x1 values).
187+
188+
```svelte live
189+
<script>
190+
import { Plot, RectY } from 'svelteplot';
191+
192+
const data = [
193+
{ width: 2.5, height: 1, category: 'A' },
194+
{ width: 3, height: 4, category: 'B' },
195+
{ width: 4, height: 3, category: 'C' }
196+
];
197+
</script>
198+
199+
<Plot height={300} color={{ legend: true }}>
200+
<RectY
201+
{data}
202+
x1={0}
203+
x2="width"
204+
y="height"
205+
fill="category"
206+
insetBottom={1} />
207+
</Plot>
208+
```
209+
210+
```svelte
211+
<Plot>
212+
<RectY
213+
{data}
214+
x1={0}
215+
x2="width"
216+
y="height"
217+
fill="category"
218+
insetBottom={1} />
219+
</Plot>
220+
```
221+
222+
[fork](https://svelte.dev/playground/4db4c6caea4f4329a30c1f18c46ea7d9?version=5.33.2)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy