valueAxis.labels Object

The axis labels configuration.

Example - configure the value axis labels

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      background: "green",
      color: "white"
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.background String

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

Example - set the value axis label background as a hex string

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: {
    labels: {
      background: "#aa00bb"
    }
  },
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

Example - set the value axis label background as a RGB value

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: {
    labels: {
      background: "rgb(128, 0, 255)"
    }
  },
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

Example - set the value axis label background by name

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: {
    labels: {
      background: "green"
    }
  },
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.border Object

The border of the labels.

Example - set the value axis label border

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      border: {
        color: "green",
        dashType: "dashDot",
        width: 1
      }
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.border.color String (default: "black")

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

Example - set the value axis label border color

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      border: {
        color: "green",
        width: 1
      }
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.border.dashType String (default: "solid")

The dash type of the border.

The following dash types are supported:

  • "dash" - a line consisting of dashes
  • "dashDot" - a line consisting of a repeating pattern of dash-dot
  • "dot" - a line consisting of dots
  • "longDash" - a line consisting of a repeating pattern of long-dash
  • "longDashDot" - a line consisting of a repeating pattern of long-dash-dot
  • "longDashDotDot" - a line consisting of a repeating pattern of long-dash-dot-dot
  • "solid" - a solid line

Example - set the value axis label border dash type

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      border: {
        dashType: "dashDot",
        width: 1
      }
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.border.width Number (default: 0)

The width of the border in pixels. By default the border width is set to zero which means that the border will not appear.

Example - set the value axis label border width

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      border: {
        width: 1
      }
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.color String

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

Example - set the value axis label color as a hex string

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: {
    labels: {
      color: "#aa00bb"
    }
  },
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

Example - set the value axis label color as a RGB value

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: {
    labels: {
      color: "rgb(128, 0, 255)"
    }
  },
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

Example - set the value axis label color by name

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: {
    labels: {
      color: "green"
    }
  },
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.font String (default: "12px Arial,Helvetica,sans-serif")

The font style of the labels. Accepts a valid CSS color string, for example "20px 'Courier New'".

Example - set the value axis label font

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
       font: "20px sans-serif",
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.format String (default: "{0}")

The format used to display the labels. Uses kendo.format. Contains one placeholder ("{0}") which represents the category value.

Example - set the value axis label format

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
       format: "{0:C}"
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.margin Number|Object (default: 0)

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

Example - set the value axis label margin as a number

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      margin: 20
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.margin.bottom Number (default: 0)

The bottom margin of the labels.

Example - set the value axis label bottom margin

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      margin: {
        bottom: 20
      }
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.margin.left Number (default: 0)

The left margin of the labels.

Example - set the value axis label left margin

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      margin: {
        left: 20
      }
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.margin.right Number (default: 0)

The right margin of the labels.

Example - set the value axis label right margin

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      margin: {
        right: 20
      }
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.margin.top Number (default: 0)

The top margin of the labels.

Example - set the value axis label top margin

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      margin: {
        top: 20
      }
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.mirror Boolean

If set to true the chart will mirror the axis labels and ticks. If the labels are normally on the left side of the axis, mirroring the axis will render them to the right.

Example - mirror the value axis labels

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      mirror: true
    },
    categories: ["2012", "2013"]
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.padding Number|Object (default: 0)

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

Example - set the value axis label padding as a number

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      padding: 20
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.padding.bottom Number (default: 0)

The bottom padding of the labels.

Example - set the value axis label bottom padding

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      padding: {
        bottom: 20
      }
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.padding.left Number (default: 0)

The left padding of the labels.

Example - set the value axis label left padding

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      padding: {
        left: 20
      }
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.padding.right Number (default: 0)

The right padding of the labels.

Example - set the value axis label right padding

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      padding: {
        right: 20
      }
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.padding.top Number (default: 0)

The top padding of the labels.

Example - set the value axis label top padding

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      padding: {
        top: 20
      }
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.position String (default: "onAxis")

The position of the axis labels. By default, labels are positioned next to the axis.

  • When position is set to end, the labels are placed at the end of the crossing axis— typically, at the top or right end of the Chart unless the crossing axis was reversed.
  • When position is set to start, the labels are placed at the start of the crossing axis— typically, at the left or bottom end of the Chart unless the crossing axis was reversed.

Example - position the value axis labels at the end of the category axis

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      position: 'end'
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.rotation Number|String|Object (default: 0)

The rotation angle (in degrees) of the labels. By default the labels are not rotated. Angles increase clockwise and zero is to the left. Negative values are acceptable. Can be set to "auto" if the axis is horizontal in which case the labels will be rotated only if the slot size is not sufficient for the entire labels.

Example - rotate the value axis labels

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      rotation: 90
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.rotation.align String (default: "end")

The alignment of the rotated labels relative to the slot center. The supported values are "end" and "center". By default the closest end of the label will be aligned to the center. If set to "center", the center of the rotated label will be aligned instead.

Example - align the rotated category axis labels center

<div id="chart"></div>
<script>
  $("#chart").kendoChart({
    valueAxis: [{
      labels: {
        rotation: 45,
        align: "center"
      }
    }],
    series: [
      { data: [1, 2, 3] }
    ]
  });
</script>

valueAxis.labels.rotation.angle Number|String (default: 0)

The rotation angle of the labels. By default the labels are not rotated. Can be set to "auto" if the axis is horizontal in which case the labels will be rotated only if the slot size is not sufficient for the entire labels.

Example - rotate the value axis labels

<div id="chart"></div>
<script>
  $("#chart").kendoChart({
    valueAxis: [{
      labels: {
        rotation: {
          angle: 90
        }
      }
    }],
    series: [
      { data: [1, 2, 3] }
    ]
  });
</script>

valueAxis.labels.skip Number (default: 0)

The number of labels to skip. By default no labels are skipped.

Example - skip value axis labels

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      skip: 1
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.step Number(default: 1)

Label rendering step. Every n-th label is rendered where n is the step

Example - render each 2nd label

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      step: 2
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.template String|Function

The template which renders the labels.

The fields which can be used in the template are:

  • value - the value value

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

Example - set the value axis template as a string

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      template: "Year: #: value #"
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

Example - set the value axis template as a function

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      template: kendo.template("Year: #: value #")
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.visible Boolean (default: true)

If set to true the chart will display the value axis labels. By default the category axis labels are visible.

Example - hide the value axis labels

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  valueAxis: [{
    labels: {
      visible: false
    }
  }],
  series: [
    { data: [1, 2, 3] }
  ]
});
</script>

valueAxis.labels.visual Function

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

  • createVisual - a function that can be used to get the default visual.
  • culture - the default culture (if set) on the label
  • format - the default format of the label
  • options - the label options.
  • rect - the kendo.geometry.Rect that defines where the visual should be rendered.
  • sender - the chart instance (may be undefined).
  • text - the label text.
  • value - the category value

Example - using custom visual for the labels

<div id="chart"></div>
<script>
  $("#chart").kendoChart({
    valueAxis: [{
      labels: {
        visual: function(e) {
          var center = e.rect.center();
          return new kendo.drawing.Text(e.text, e.rect.origin, {
            fill: {
              color: "red"
            }
          });
        }
      }
    }],
    series: [
      { data: [1, 2, 3] }
    ]
  });
</script>
In this article