Function: resolveDashPattern()
ts
function resolveDashPattern(dash, lineWidth, viewport?): number[];Experimental
Resolve a dash spec to on/off lengths in CSS px. Returns an empty array for a solid line.
- Named styles scale with the line width exactly like Plotly (
Drawing.dashStyle), usingmax(width, 3)so thin lines still get visible dashes. - Custom lists follow SVG
stroke-dasharray: unitless orpxvalues are CSS px; percentages are relative to the normalized viewport diagonalsqrt((w² + h²) / 2); an odd-length list is repeated to make it even; a negative value, a non-numeric token, or an all-zero list yields a solid line. - Lists longer than MAX_DASH_ENTRIES are truncated to an even prefix.
Parameters
| Parameter | Type |
|---|---|
dash | LineDash | undefined |
lineWidth | number |
viewport | { height: number; width: number; } |
viewport.height | number |
viewport.width | number |
Returns
number[]