Custom Line Slot (#line)
Line slot allows custom rendering of line path and line labels.
1. Slot Syntax by Platform
- Vue:
#line - React:
<RGSlotOnLine> - Svelte:
slot="line"
2. Slot Props
Typical props:
lineConfig: RGGenerateLineConfigchecked?: booleangraphInstanceId?: stringdefaultLineTextOnPath?: boolean
3. Typical Rendering Pattern
A common pattern is:
- use instance API to generate line path info
- render line path component (or custom SVG path)
- render one or more line text blocks
- forward click events to graph instance
4. Basic Example (Vue style pseudo)
<template #line="{ lineConfig, checked, graphInstanceId }">
<MyLineContent
:lineConfig="lineConfig"
:checked="checked"
:graphInstanceId="graphInstanceId"
/>
</template>
5. Critical Styling Rule
Do not set line color/width only through ad-hoc path CSS in slot.
Prefer:
line.color,line.lineWidthgraphOptions.defaultLineColor,graphOptions.defaultLineWidth
These feed both main view and minimap rendering consistency.
6. Good Patterns
- Render multiple labels (start/center/end) when needed.
- Use
line.typeto switch templates. - Keep line click handling unified by forwarding events into graph instance APIs.