Skip to content
EliteChart

lineStyleToDash

Documentation


Documentation / @elitechart/core / lineStyleToDash

code
function lineStyleToDash(style): readonly number[] | undefined;

Defined in: drawing/types.ts:97

Convert a LineStyle preset to the canvas dash array. Returns undefined when style is undefined so callers can pass through to setLineDash without branching.

Parameters

style

LineStyle | undefined

Returns

readonly number[] | undefined

Example

code
import { lineStyleToDash } from '@elitechart/core';
lineStyleToDash('dashed'); // [6, 4]
lineStyleToDash('dotted'); // [2, 3]
lineStyleToDash('solid');  // []