New to Kendo UI for jQuery? Start a free 30-day trial

Legend.title

configuration

The legend title configuration options or text.

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  legend: {
    title: {
      text: "Legend Title",
      align: "center",
      background: "lightgray",
      color: "darkblue",
      font: "18px Arial",
      border: {
        color: "black",
        width: 1,
        dashType: "solid"
      }
    }
  },
  series: [
    { name: "Series 1", data: [1, 2, 3] },
    { name: "Series 2", data: [4, 5, 6] }
  ]
});
</script>

The alignment of the title.

  • "center" - the text is aligned to the middle.
  • "left" - the text is aligned to the left.
  • "right" - the text is aligned to the right.

Default: "center"

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  legend: {
    title: {
      text: "Chart Legend",
      align: "left"
    }
  },
  series: [
    { name: "Series 1", data: [1, 2, 3] },
    { name: "Series 2", data: [4, 5, 6] }
  ]
});
</script>

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

Default: "white"

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  legend: {
    title: {
      text: "Legend",
      background: "lightblue"
    }
  },
  series: [
    { name: "Series 1", data: [1, 2, 3] },
    { name: "Series 2", data: [4, 5, 6] }
  ]
});
</script>

The border of the title.

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  legend: {
    title: {
      text: "Legend",
      border: {
        color: "red",
        width: 2,
        dashType: "dash"
      }
    }
  },
  series: [
    { name: "Series 1", data: [1, 2, 3] },
    { name: "Series 2", data: [4, 5, 6] }
  ]
});
</script>

The text color of the title. Accepts a valid CSS color string, including hex and rgb.

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  legend: {
    title: {
      text: "Legend",
      color: "red"
    }
  },
  series: [
    { name: "Series 1", data: [1, 2, 3] },
    { name: "Series 2", data: [4, 5, 6] }
  ]
});
</script>

The font of the title.

Default: "16px Arial,Helvetica,sans-serif"

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  legend: {
    title: {
      text: "Legend",
      font: "20px Times New Roman"
    }
  },
  series: [
    { name: "Series 1", data: [1, 2, 3] },
    { name: "Series 2", data: [4, 5, 6] }
  ]
});
</script>
Number|Object

The margin of the title. A numeric value will set all margins.

Default: 5

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  legend: {
    title: {
      text: "Legend",
      margin: {
        top: 10,
        bottom: 5,
        left: 15,
        right: 15
      }
    }
  },
  series: [
    { name: "Series 1", data: [1, 2, 3] },
    { name: "Series 2", data: [4, 5, 6] }
  ]
});
</script>

The padding of the title. A numeric value will set all margins.

Default: 5

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  legend: {
    title: {
      text: "Legend",
      padding: {
        top: 8,
        bottom: 8,
        left: 12,
        right: 12
      }
    }
  },
  series: [
    { name: "Series 1", data: [1, 2, 3] },
    { name: "Series 2", data: [4, 5, 6] }
  ]
});
</script>

The position of the title.

  • "bottom" - the title is positioned on the bottom.
  • "top" - the title is positioned on the top.

Default: "top"

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  legend: {
    title: {
      text: "Legend",
      position: "bottom"
    }
  },
  series: [
    { name: "Series 1", data: [1, 2, 3] },
    { name: "Series 2", data: [4, 5, 6] }
  ]
});
</script>

The text of the legend title. You can also set the text directly for a title with default options.

The text can be split into multiple lines by using line feed characters ("\n").

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  legend: {
    title: {
      text: "Chart Series\nData Legend"
    }
  },
  series: [
    { name: "Series 1", data: [1, 2, 3] },
    { name: "Series 2", data: [4, 5, 6] }
  ]
});
</script>

If set to true the chart will display the title. By default the title will be displayed.

Default: true

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  legend: {
    title: {
      text: "Legend",
      visible: false
    }
  },
  series: [
    { name: "Series 1", data: [1, 2, 3] },
    { name: "Series 2", data: [4, 5, 6] }
  ]
});
</script>