Version 3.17.2
Show:

HorizontalLegendLayout Class

Module: charts-legend
Parent Module: charts

Contains methods for displaying items horizontally in a legend.

Methods

_positionLegendItems

(
  • items
  • maxWidth
  • maxHeight
  • totalWidth
  • totalHeight
  • padding
  • horizontalGap
  • verticalGap
  • hAlign
)
protected

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

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

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