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
2 changes: 1 addition & 1 deletion docs/src/examples/components/Marker/line.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
})
);

const markerTypes = ['arrow', 'triangle', 'dot', 'circle', 'circle-stroke', 'line'] as const;
const markerTypes = ['arrow', 'triangle', 'dot', 'circle', 'circle-stroke', 'line', 'square', 'square-stroke'] as const;
export { data };
</script>

Expand Down
2 changes: 1 addition & 1 deletion docs/src/examples/components/Marker/spline.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
phase: 0
});

const markerTypes = ['arrow', 'triangle', 'dot', 'circle', 'circle-stroke', 'line'] as const;
const markerTypes = ['arrow', 'triangle', 'dot', 'circle', 'circle-stroke', 'line', 'square', 'square-stroke'] as const;

const motion = $derived(config.tweened ? 'tween' : 'none');
const data = $derived(
Expand Down
11 changes: 8 additions & 3 deletions packages/layerchart/src/lib/components/Marker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* Pass `children` to render a custom element/component inside the marker instead.
*/
type?: 'arrow' | 'triangle' | 'line' | 'circle' | 'circle-stroke' | 'dot';
type?: 'arrow' | 'triangle' | 'line' | 'circle' | 'circle-stroke' | 'dot' | 'square' | 'square-stroke';

/**
* Unique identifier for the marker
Expand Down Expand Up @@ -117,6 +117,8 @@
<circle cx={5} cy={5} r={5} class="lc-marker-circle" />
{:else if type === 'line'}
<polyline points="5 0, 5 10" class="lc-marker-line" />
{:else if type === 'square' || type === 'square-stroke'}
<rect x={0} y={0} width={10} height={10} class="lc-marker-square" />
{/if}
</marker>
</defs>
Expand All @@ -128,6 +130,7 @@

&[data-type='arrow'],
&[data-type='circle-stroke'],
&[data-type='square-stroke'],
&[data-type='line'] {
fill: none;
stroke: context-stroke;
Expand All @@ -141,11 +144,13 @@

&[data-type='triangle'],
&[data-type='dot'],
&[data-type='circle'] {
&[data-type='circle'],
&[data-type='square'] {
fill: context-stroke;
}

&[data-type='circle-stroke'] {
&[data-type='circle-stroke'],
&[data-type='square-stroke'] {
fill: var(--color-surface-100, light-dark(white, black));
}
}
Expand Down
Loading