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

CategoryAxis.title

configuration

The title configuration of the category axis.

The categoryAxis.title.text option must be set in order to display the title.

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  categoryAxis: {
    categories: ["2012", "2013"],
    title: {
      text: "Years",
      background: "green",
      border: {
        width: 1,
      }
    }
  },
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

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

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  categoryAxis: {
    categories: ["2012", "2013"],
    title: {
      text: "Years",
      background: "green"
    }
  },
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

The border of the title.

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  categoryAxis: [{
    title: {
      text: "Years",
      border: {
        color: "green",
        dashType: "dashDot",
        width: 1
      }
    },
    categories: ["2012", "2013"]
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

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

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  categoryAxis: {
    categories: [ "2012", "2013"],
    title: {
      text: "Years",
      color: "#aa00bb"
    }
  },
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>
<div id="chart"></div>
<script>
$("#chart").kendoChart({
  categoryAxis: {
    categories: [ "2012", "2013"],
    title: {
      text: "Years",
      color: "rgb(128, 0, 255)"
    }
  },
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>
<div id="chart"></div>
<script>
$("#chart").kendoChart({
  categoryAxis: {
    categories: [ "2012", "2013"],
    title: {
      text: "Years",
      color: "green"
    }
  },
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

The font style of the title.

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

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  categoryAxis: [{
    title: {
       text: "Years",
       font: "20px sans-serif",
    },
    categories: ["2012", "2013"]
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

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

Default: 5

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  categoryAxis: [{
    title: {
      text: "Years",
      margin: 20
    },
    categories: ["2012", "2013"]
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

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

Default: 0

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  categoryAxis: [{
    title: {
      text: "Years",
      padding: 20
    },
    categories: ["2012", "2013"]
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

The position of the title.

The supported values are:

  • "top" - the axis title is positioned on the top (applicable to vertical axis)
  • "bottom" - the axis title is positioned on the bottom (applicable to vertical axis)
  • "left" - the axis title is positioned on the left (applicable to horizontal axis)
  • "right" - the axis title is positioned on the right (applicable to horizontal axis)
  • "center" - the axis title is positioned in the center

Default: "center"

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  categoryAxis: {
    categories: ["2012", "2013"],
    title: {
      text: "Years",
      position: "left"
    }
  },
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

The rotation angle of the title. By default the title is not rotated.

Default: 0

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  categoryAxis: [{
    title: {
      text: "Years",
      rotation: 90
    },
    categories: ["2012", "2013"]
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

The text of the title.

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

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  categoryAxis: [{
    title: {
      text: "Years"
    },
    categories: ["2012", "2013"]
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

If set to true the chart will display the category axis title. By default the category axis title is visible.

Default: true

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  categoryAxis: [{
    title: {
      text: "Years",
      visible: false
    },
    categories: ["2012", "2013"]
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

A function that can be used to create a custom visual for the title. The available argument fields are:

  • text - the label text.
  • rect - the kendo.geometry.Rect that defines where the visual should be rendered.
  • sender - the chart instance (may be undefined).
  • options - the label options.
  • createVisual - a function that can be used to get the default visual.
<div id="chart"></div>
<script>
  $("#chart").kendoChart({
    categoryAxis: [{
      title: {
        text: "foo bar",
        visual: function (e) {
          var layout = new kendo.drawing.Layout(e.rect, {
            orientation: "vertical",
            alignContent: "center",
            justifyContent: "end"
          });
          var words = e.text.split(" ");
          for (var i = 0; i < words.length; i++) {
            layout.append(new kendo.drawing.Text(words[i]));
          }
          layout.reflow();
          return layout;
        }
      },
      categories: ["2012", "2013"]
    }],
    series: [
      { data: [1, 2, 3] }
    ]
  });
</script>