\Kendo\Dataviz\UI\ChartLegend

A PHP class representing the legend setting of Chart.

Methods

align

The legend horizontal alignment when the legend.position is "top" or "bottom" and the vertical alignment when the legend.position is "left" or "right".The supported values are: "start" - the legend is aligned to the start.; "center" - the legend is aligned to the center. or "end" - the legend is aligned to the end..

Returns

\Kendo\Dataviz\UI\ChartLegend

Parameters

$value string

Example

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$legend->align('value');
?>

background

The background color of the legend. Accepts a valid CSS color string, including hex and rgb.

Returns

\Kendo\Dataviz\UI\ChartLegend

Parameters

$value string

Example

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$legend->background('value');
?>

border

The border of the legend.

Returns

\Kendo\Dataviz\UI\ChartLegend

Parameters

$value \Kendo\Dataviz\UI\ChartLegendBorder|array

Example - using \Kendo\Dataviz\UI\ChartLegendBorder

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$border = new \Kendo\Dataviz\UI\ChartLegendBorder();
$color = 'value';
$border->color($color);
$legend->border($border);
?>

Example - using array

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$color = 'value';
$legend->border(array('color' => $color));
?>

height

The legend height when the legend.orientation is set to "vertical".

Returns

\Kendo\Dataviz\UI\ChartLegend

Parameters

$value float

Example

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$legend->height(1);
?>

inactiveItems

The chart inactive legend items configuration.

Returns

\Kendo\Dataviz\UI\ChartLegend

Parameters

$value \Kendo\Dataviz\UI\ChartLegendInactiveItems|array

Example - using \Kendo\Dataviz\UI\ChartLegendInactiveItems

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$inactiveItems = new \Kendo\Dataviz\UI\ChartLegendInactiveItems();
$labels = new \Kendo\Dataviz\UI\ChartLegendInactiveItemsLabels();
$inactiveItems->labels($labels);
$legend->inactiveItems($inactiveItems);
?>

Example - using array

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$labels = new \Kendo\Dataviz\UI\ChartLegendInactiveItemsLabels();
$legend->inactiveItems(array('labels' => $labels));
?>

item

The configuration of the Chart legend item.To override the marker configuration of individual series, use the series.legendItem settings of the series.

Returns

\Kendo\Dataviz\UI\ChartLegend

Parameters

$value \Kendo\Dataviz\UI\ChartLegendItem|array

Example - using \Kendo\Dataviz\UI\ChartLegendItem

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$item = new \Kendo\Dataviz\UI\ChartLegendItem();
$cursor = 'value';
$item->cursor($cursor);
$legend->item($item);
?>

Example - using array

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$cursor = 'value';
$legend->item(array('cursor' => $cursor));
?>

labels

The chart legend label configuration.

Returns

\Kendo\Dataviz\UI\ChartLegend

Parameters

$value \Kendo\Dataviz\UI\ChartLegendLabels|array

Example - using \Kendo\Dataviz\UI\ChartLegendLabels

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$labels = new \Kendo\Dataviz\UI\ChartLegendLabels();
$color = 'value';
$labels->color($color);
$legend->labels($labels);
?>

Example - using array

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$color = 'value';
$legend->labels(array('color' => $color));
?>

margin

The margin of the chart legend. A numeric value will set all paddings.

Returns

\Kendo\Dataviz\UI\ChartLegend

Parameters

$value float|\Kendo\Dataviz\UI\ChartLegendMargin|array

Example - using float

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$legend->margin(1);
?>

Example - using \Kendo\Dataviz\UI\ChartLegendMargin

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$margin = new \Kendo\Dataviz\UI\ChartLegendMargin();
$bottom = 1;
$margin->bottom($bottom);
$legend->margin($margin);
?>

Example - using array

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$bottom = 1;
$legend->margin(array('bottom' => $bottom));
?>

offsetX

The X offset of the chart legend. The offset is relative to the default position of the legend. For instance, a value of 20 will move the legend 20 pixels to the right of its initial position. A negative value will move the legend to the left of its current position.

Returns

\Kendo\Dataviz\UI\ChartLegend

Parameters

$value float

Example

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$legend->offsetX(1);
?>

offsetY

The Y offset of the chart legend. The offset is relative to the current position of the legend. For instance, a value of 20 will move the legend 20 pixels down from its initial position. A negative value will move the legend upwards from its current position.

Returns

\Kendo\Dataviz\UI\ChartLegend

Parameters

$value float

Example

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$legend->offsetY(1);
?>

orientation

The orientation of the legend items.The supported values are: "vertical" - the legend items are added vertically. or "horizontal" - the legend items are added horizontally..

Returns

\Kendo\Dataviz\UI\ChartLegend

Parameters

$value string

Example

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$legend->orientation('value');
?>

padding

The padding of the chart legend. A numeric value will set all paddings.

Returns

\Kendo\Dataviz\UI\ChartLegend

Parameters

$value float|\Kendo\Dataviz\UI\ChartLegendPadding|array

Example - using float

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$legend->padding(1);
?>

Example - using \Kendo\Dataviz\UI\ChartLegendPadding

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$padding = new \Kendo\Dataviz\UI\ChartLegendPadding();
$bottom = 1;
$padding->bottom($bottom);
$legend->padding($padding);
?>

Example - using array

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$bottom = 1;
$legend->padding(array('bottom' => $bottom));
?>

position

The positions of the chart legend.The supported values are: "top" - the legend is positioned on the top.; "bottom" - the legend is positioned on the bottom.; "left" - the legend is positioned on the left.; "right" - the legend is positioned on the right. or "custom" - the legend is positioned using legend.offsetX and legend.offsetY..

Returns

\Kendo\Dataviz\UI\ChartLegend

Parameters

$value string

Example

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$legend->position('value');
?>

reverse

If set to true the legend items will be reversed.Available in versions 2013.3.1306 and later.

Returns

\Kendo\Dataviz\UI\ChartLegend

Parameters

$value boolean

Example

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$legend->reverse(true);
?>

spacing

The spacing between the labels in pixels when the legend.orientation is "horizontal".

Returns

\Kendo\Dataviz\UI\ChartLegend

Parameters

$value float

Example

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$legend->spacing(1);
?>

title

The legend title configuration options or text.

Returns

\Kendo\Dataviz\UI\ChartLegend

Parameters

$value \Kendo\Dataviz\UI\ChartLegendTitle|array

Example - using \Kendo\Dataviz\UI\ChartLegendTitle

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$title = new \Kendo\Dataviz\UI\ChartLegendTitle();
$align = 'value';
$title->align($align);
$legend->title($title);
?>

Example - using array

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$align = 'value';
$legend->title(array('align' => $align));
?>

visible

If set to true the chart will display the legend. By default the chart legend is visible.

Returns

\Kendo\Dataviz\UI\ChartLegend

Parameters

$value boolean

Example

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$legend->visible(true);
?>

width

The legend width when the legend.orientation is set to "horizontal".

Returns

\Kendo\Dataviz\UI\ChartLegend

Parameters

$value float

Example

<?php
$legend = new \Kendo\Dataviz\UI\ChartLegend();
$legend->width(1);
?>
In this article
Not finding the help you need?