Skip to content

@feds01/graphika


@feds01/graphika / legend/manager

legend/manager ​

Classes ​

default ​

Defined in: legend/manager.ts:32

Constructors ​

Constructor ​
ts
new default(graph, data): default;

Defined in: legend/manager.ts:59

Constructor for a legend manager object. This object is responsible for drawing the legend on the graph.

Parameters ​
ParameterTypeDescription
graphdefaultThe graph object that the legend is drawn on
dataDataSource[]The data sources that the legend is drawn for
Returns ​

default

Properties ​

PropertyModifierTypeDescriptionDefined in
alignmentpublicLegendAlignmentSince v0.0.1 The alignment of the legend box on the graph.legend/manager.ts:43
positionpublicLegendPositionSince v0.0.1 The position of where the legend box is drawn on the graph.legend/manager.ts:38
requiredSpacepublicnumberSince v0.0.1 The required space for the legend box to be drawn.legend/manager.ts:48

Methods ​

draw() ​
ts
draw(): void;

Defined in: legend/manager.ts:142

Function that draws this component.

Returns ​

void

drawLegend() ​
ts
drawLegend(
   label, 
   colour, 
   style, 
   x, 
   y
): void;

Defined in: legend/manager.ts:115

Function to draw a label with a key box denoting one of the graph legends.

Parameters ​
ParameterTypeDescription
labelstringThe name of the line that represents this legend.
colourstringThe colour of the key box.
styleBorderStyleBorder style of the key box.
xnumberX coordinate of where to draw the label.
ynumberY coordinate of where to draw the label.
Returns ​

void

getRequiredSpaceFor() ​
ts
getRequiredSpaceFor(item): number;

Defined in: legend/manager.ts:97

Parameters ​
ParameterType
itemstring
Returns ​

number

Type Aliases ​

LegendAlignment ​

ts
type LegendAlignment = "start" | "center" | "end";

Defined in: legend/manager.ts:29


LegendOptions ​

ts
type LegendOptions = {
  alignment?: LegendAlignment;
  draw?: boolean;
  position?: LegendPosition;
};

Defined in: legend/manager.ts:23

Properties ​

PropertyTypeDefined in
alignment?LegendAlignmentlegend/manager.ts:26
draw?booleanlegend/manager.ts:24
position?LegendPositionlegend/manager.ts:25

LegendPosition ​

ts
type LegendPosition = "left" | "right" | "top" | "bottom";

Defined in: legend/manager.ts:30

Released under the ISC License.