Skip to content

Commit 48091b9

Browse files
committed
doc(AnnotationLine): Add rotated alebsl with vertical line example
1 parent c612891 commit 48091b9

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

  • packages/layerchart/src/routes/docs/components/AnnotationLine

packages/layerchart/src/routes/docs/components/AnnotationLine/+page.svelte

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,49 @@
8282
</div>
8383
</Preview>
8484

85+
<h2>Vertical with rotation</h2>
86+
87+
<Preview data={data.appleStock}>
88+
<div class="h-[300px] p-4 border rounded-sm">
89+
<LineChart data={data.appleStock} x="date" y="value" {renderContext} {debug}>
90+
{#snippet aboveMarks({ context })}
91+
<AnnotationLine
92+
x={new Date('2010-01-01')}
93+
label="Start"
94+
labelXOffset={4}
95+
props={{
96+
line: { class: '[stroke-dasharray:2,2] stroke-danger' },
97+
label: {
98+
class: 'fill-danger',
99+
rotate: -90,
100+
textAnchor: 'end',
101+
verticalAnchor: 'end',
102+
dx: -2,
103+
dy: 0,
104+
},
105+
}}
106+
/>
107+
108+
<AnnotationLine
109+
x={new Date('2010-12-31')}
110+
label="End"
111+
labelXOffset={4}
112+
props={{
113+
line: { class: '[stroke-dasharray:2,2] stroke-danger' },
114+
label: {
115+
class: 'fill-danger',
116+
rotate: 90,
117+
verticalAnchor: 'end',
118+
dx: -4,
119+
dy: 0,
120+
},
121+
}}
122+
/>
123+
{/snippet}
124+
</LineChart>
125+
</div>
126+
</Preview>
127+
85128
<h2>Horizontal</h2>
86129

87130
<Preview data={data.appleStock}>

0 commit comments

Comments
 (0)