@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
| Parameter | Type | Description |
|---|---|---|
graph | default | The graph object that the legend is drawn on |
data | DataSource[] | The data sources that the legend is drawn for |
Returns
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
alignment | public | LegendAlignment | Since v0.0.1 The alignment of the legend box on the graph. | legend/manager.ts:42 |
position | public | LegendPosition | Since v0.0.1 The position of where the legend box is drawn on the graph. | legend/manager.ts:37 |
requiredSpace | public | number | Since 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
| Parameter | Type | Description |
|---|---|---|
label | string | The name of the line that represents this legend |
colour | string | The colour of the key box |
style | LegendBoxBorderStyle | Border style of the key box |
x | number | x coordinate of where to draw the label |
y | number | y coordinate of where to draw the label |
Returns
void
getRequiredSpaceFor()
ts
getRequiredSpaceFor(item): number;Defined in: legend/manager.ts:93
Parameters
| Parameter | Type |
|---|---|
item | string |
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
| Property | Type | Defined in |
|---|---|---|
alignment? | LegendAlignment | legend/manager.ts:24 |
draw? | boolean | legend/manager.ts:22 |
position? | LegendPosition | legend/manager.ts:23 |
LegendPosition
ts
type LegendPosition = "left" | "right" | "top" | "bottom";Defined in: legend/manager.ts:28