Search results

PivotChartSettingsLegendSettings API in JavaScript (ES5) Pivot Table API control

Allow options for customizing legends with different properties such as legend visibility, height, width, position, legend padding, alignment, textStyle, border, margin, background, opacity, description, tabIndex in the pivot chart.

Properties

alignment

Alignment

Allows to set the legend in chart can be aligned as follows:

  • Near: Aligns the legend to the left of the chart.
  • Center: Aligns the legend to the center of the chart.
  • Far: Aligns the legend to the right of the chart.

Defaults to ‘Center’

background

string

Allows to set the background color of the legend that accepts value in hex and rgba as a valid CSS color string.

Defaults to ‘transparent’

border

PivotChartBorderModel

Allows options to customize the border of the legend.

description

string

Allows to set the description for legends.

Defaults to null

height

string

Allows to set the height of the legend in pixels.

Defaults to null

location

PivotChartLocationModel

Allows to set the location of the legend, relative to the chart. If x is 20, legend moves by 20 pixels to the right of the chart. It requires the position to be Custom.

...
  legendSettings: {
    visible: true,
    position: 'Custom',
    location: { x: 100, y: 150 },
  },
...

margin

PivotChartMarginModel

Allows options to customize left, right, top and bottom margins of the chart.

opacity

number

Allows to set the opacity of the legend.

Defaults to 1

padding

number

Allows option to customize the padding between legend items.

Defaults to 8

position

LegendPosition

Allows to set the position of the legend in the chart are,

  • Auto: Places the legend based on area type.
  • Top: Displays the legend at the top of the chart.
  • Left: Displays the legend at the left of the chart.
  • Bottom: Displays the legend at the bottom of the chart.
  • Right: Displays the legend at the right of the chart.
  • Custom: Displays the legend based on the given x and y values.

Defaults to ‘Auto’

shapeHeight

number

Allows to set the shape height of the legend in pixels.

Defaults to 10

shapePadding

number

Allows to set the padding between the legend shape and text.

Defaults to 5

shapeWidth

number

Allows to set the shape width of the legend in pixels.

Defaults to 10

tabIndex

number

Allows to set the tabindex value for the legend.

Defaults to 3

textStyle

PivotChartFontModel

Allows options to customize the legend text.

toggleVisibility

boolean

If set to true, series’ visibility collapses based on the legend visibility.

Defaults to true

visible

boolean

If set to true, legend will be visible.

Defaults to true

width

string

Allows to set the width of the legend in pixels.

Defaults to null