Skip to content

@feds01/graphika


@feds01/graphika / legend/manager

legend/manager

Classes

default

Defined in: legend/manager.ts:31

Constructors

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

Defined in: legend/manager.ts:58

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:42
positionpublicLegendPositionSince v0.0.1 The position of where the legend box is drawn on the graph.legend/manager.ts:37
requiredSpacepublicnumberSince v0.0.1 The required space for the legend box to be drawn.legend/manager.ts:47

Methods

draw()
ts
draw(): void;

Defined in: legend/manager.ts:136

Function that draws this component.

Returns

void

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

Defined in: legend/manager.ts:111

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
styleLegendBoxBorderStyleBorder 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:93

Parameters
ParameterType
itemstring
Returns

number

Type Aliases

LegendAlignment

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

Defined in: legend/manager.ts:27


LegendBoxBorderStyle

ts
type LegendBoxBorderStyle = "solid" | "dashed";

Defined in: legend/manager.ts:29


LegendOptions

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

Defined in: legend/manager.ts:21

Properties

PropertyTypeDefined in
alignment?LegendAlignmentlegend/manager.ts:24
draw?booleanlegend/manager.ts:22
position?LegendPositionlegend/manager.ts:23

LegendPosition

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

Defined in: legend/manager.ts:28

Released under the ISC License.