Skip to content

Commit 0d19ee6

Browse files
Update chart legend api
1 parent 5dba6e2 commit 0d19ee6

File tree

1 file changed

+84
-6
lines changed

1 file changed

+84
-6
lines changed

api/javascript/dataviz/ui/chart.md

Lines changed: 84 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5428,6 +5428,33 @@ The chart legend configuration options.
54285428
});
54295429
</script>
54305430

5431+
### legend.align `String` *(default: "center")*
5432+
5433+
The legend horizontal alignment when the [legend.position](#configuration-legend.position) is "top" or "bottom" and the vertical alignment when the [legend.position](#configuration-legend.position) is "left" or "right".
5434+
5435+
The supported values are:
5436+
5437+
* "start" - the legend is aligned to the start.
5438+
5439+
* "center" - the legend is aligned to the center.
5440+
5441+
* "end" - the legend is aligned to the end.
5442+
5443+
#### Example - set the chart legend alignment to start
5444+
5445+
<div id="chart"></div>
5446+
<script>
5447+
$("#chart").kendoChart({
5448+
legend: {
5449+
align: "start"
5450+
},
5451+
series: [
5452+
{ name: "Series 1", data: [1, 2, 3] },
5453+
{ name: "Series 2", data: [3, 4, 5] }
5454+
]
5455+
});
5456+
</script>
5457+
54315458
### legend.background `String` *(default: "white")*
54325459

54335460
The background color of the legend. Accepts a valid CSS color string, including hex and rgb.
@@ -5571,9 +5598,9 @@ The width of the border in pixels. By default the border width is set to zero wh
55715598

55725599
### legend.height `Number`
55735600

5574-
The legend height when the [legend.position](#configuration-legend.position) is set to "custom" and the [legend.orientation](#configuration-legend.orientation) is set to "vertical".
5601+
The legend height when the [legend.orientation](#configuration-legend.orientation) is set to "vertical".
55755602

5576-
#### Example - set the chart legend height
5603+
#### Example - set the chart legend height for custom positioned legend
55775604

55785605
<div id="chart"></div>
55795606
<script>
@@ -5591,6 +5618,23 @@ The legend height when the [legend.position](#configuration-legend.position) is
55915618
});
55925619
</script>
55935620

5621+
#### Example - set the chart legend height for legend with predefined position
5622+
5623+
<div id="chart"></div>
5624+
<script>
5625+
$("#chart").kendoChart({
5626+
legend: {
5627+
position: "left",
5628+
height: 50
5629+
},
5630+
series: [
5631+
{ name: "Series 1", data: [1, 2, 3] },
5632+
{ name: "Series 2", data: [3, 4, 5] },
5633+
{ name: "Series 3", data: [6, 7, 8] }
5634+
]
5635+
});
5636+
</script>
5637+
55945638
### legend.inactiveItems `Object`
55955639

55965640
The chart inactive legend items configuration.
@@ -6339,15 +6383,15 @@ A negative value will move the legend upwards from its current position.
63396383

63406384
### legend.orientation `String` *(default: "vertical")*
63416385

6342-
The orientation of the legend items when the position [legend.position](#configuration-legend.position) is set to "custom".
6386+
The orientation of the legend items.
63436387

63446388
The supported values are:
63456389

63466390
* "vertical" - the legend items are added vertically.
63476391

63486392
* "horizontal" - the legend items are added horizontally.
63496393

6350-
#### Example - set horizontal orientation to the chart legend
6394+
#### Example - set horizontal orientation for custom positioned legend
63516395

63526396
<div id="chart"></div>
63536397
<script>
@@ -6364,6 +6408,23 @@ The supported values are:
63646408
});
63656409
</script>
63666410

6411+
#### Example - set horizontal orientation for legend with predefined position
6412+
6413+
<div id="chart"></div>
6414+
<script>
6415+
$("#chart").kendoChart({
6416+
legend: {
6417+
position: "left",
6418+
orientation: "horizontal"
6419+
},
6420+
series: [
6421+
{ name: "Series 1", data: [1, 2, 3] },
6422+
{ name: "Series 2", data: [3, 4, 5] },
6423+
{ name: "Series 3", data: [6, 7, 8] }
6424+
]
6425+
});
6426+
</script>
6427+
63676428
### legend.padding `Number|Object` *(default: 5)*
63686429

63696430
The padding of the chart legend. A numeric value will set all paddings.
@@ -6510,9 +6571,9 @@ If set to `true` the chart will display the legend. By default the chart legend
65106571

65116572
### legend.width `Number`
65126573

6513-
The legend width when the [legend.position](#configuration-legend.position) is set to "custom" and the [legend.orientation](#configuration-legend.orientation) is set to "horizontal".
6574+
The legend width when the [legend.orientation](#configuration-legend.orientation) is set to "horizontal".
65146575

6515-
#### Example - set the chart legend width
6576+
#### Example - set the chart legend width for custom positioned legend
65166577

65176578
<div id="chart"></div>
65186579
<script>
@@ -6530,6 +6591,23 @@ The legend width when the [legend.position](#configuration-legend.position) is s
65306591
});
65316592
</script>
65326593

6594+
#### Example - set the chart legend width for legend with predefined position
6595+
6596+
<div id="chart"></div>
6597+
<script>
6598+
$("#chart").kendoChart({
6599+
legend: {
6600+
position: "top",
6601+
width: 200
6602+
},
6603+
series: [
6604+
{ name: "Series 1", data: [1, 2, 3] },
6605+
{ name: "Series 2", data: [3, 4, 5] },
6606+
{ name: "Series 3", data: [6, 7, 8] }
6607+
]
6608+
});
6609+
</script>
6610+
65336611
### panes `Array`
65346612

65356613
The chart panes configuration.

0 commit comments

Comments
 (0)