Skip to content

@feds01/graphika


@feds01/graphika / legend/draw-item

legend/draw-item

Type Aliases

LegendItemOptions

ts
type LegendItemOptions = {
  colour: string;
  font: string;
  fontSize: number;
  label: string;
  style: BorderStyle;
  textColour: string;
  x: number;
  y: number;
};

Defined in: legend/draw-item.ts:15

Properties

PropertyTypeDescriptionDefined in
colourstringThe colour for the legend box.legend/draw-item.ts:19
fontstringFont family for the label text.legend/draw-item.ts:31
fontSizenumberFont size for the label (also determines box size).legend/draw-item.ts:27
labelstringThe text label to display.legend/draw-item.ts:17
styleBorderStyleBorder style: 'solid' or 'dashed'.legend/draw-item.ts:21
textColourstringColour for the label text.legend/draw-item.ts:29
xnumberX coordinate for the legend box.legend/draw-item.ts:23
ynumberY coordinate for the legend box.legend/draw-item.ts:25

Functions

drawLegendItem()

ts
function drawLegendItem(ctx, options): void;

Defined in: legend/draw-item.ts:40

Draw a legend-style item (colored box + label) on the canvas.

Parameters

ParameterTypeDescription
ctxCanvasRenderingContext2DThe canvas rendering context.
optionsLegendItemOptionsConfiguration for the legend item.

Returns

void

Released under the ISC License.