#

API Docs for: 3.10.3
Show: Inherited Protected Private Deprecated

# HorizontalLegendLayout Class

Defined in: `charts/js/CartesianChartLegend.js:49`
Module: charts-legend
Parent Module: charts

Contains methods for displaying items horizontally in a legend.

- Index
- Methods

## Item Index

### Methods

- _positionLegendItems
- _setRowArrays
- getStartPoint

## Methods

### `_positionLegendItems`

(

- `items`
- `maxWidth`
- `maxHeight`
- `totalWidth`
- `totalHeight`
- `padding`
- `horizontalGap`
- `verticalGap`
- `hAlign`

)
protected

Defined in `charts/js/CartesianChartLegend.js:57`

Displays items horizontally in a legend.

#### Parameters:

- `items` Array

  Array of items to display in the legend.

- `maxWidth` Number

  The width of the largest item in the legend.

- `maxHeight` Number

  The height of the largest item in the legend.

- `totalWidth` Number

  The total width of all items in a legend.

- `totalHeight` Number

  The total height of all items in a legend.

- `padding` Number

  The left, top, right and bottom padding properties for the legend.

- `horizontalGap` Number

  The horizontal distance between items in a legend.

- `verticalGap` Number

  The vertical distance between items in a legend.

- `hAlign` String

  The horizontal alignment of the legend.

### `_setRowArrays`

(

- `items`
- `limit`
- `horizontalGap`

)
protected

Defined in `charts/js/CartesianChartLegend.js:133`

Creates row and total width arrays used for displaying multiple rows of legend items based on the items, available width and horizontalGap for the legend.

#### Parameters:

- `items` Array

  Array of legend items to display in a legend.

- `limit` Number

  Total available width for displaying items in a legend.

- `horizontalGap` Number

  Horizontal distance between items in a legend.

### `getStartPoint`

(

- `w`
- `totalWidth`
- `align`
- `padding`

)
protected

Defined in `charts/js/CartesianChartLegend.js:177`

Returns the starting x-coordinate for a row of legend items.

#### Parameters:

- `w` Number

  Width of the legend.

- `totalWidth` Number

  Total width of all labels in the row.

- `align` String

  Horizontal alignment of items for the legend.

- `padding` Object

  Object contain left, top, right and bottom padding properties.

#### Returns:

Number