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

YAxis.labels

configuration

The axis labels configuration.

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

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

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

The border of the labels.

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

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

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

The culture to use when formatting date values. See the globalization overview for more information.

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  yAxis: {
    labels: {
      culture: "de-DE",
      format: "c"
    }
  },
  series: [
    { type: "line", data: [1000, 2000, 3000] }
  ]
});
</script>

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

The chart will choose the appropriate format for the current yAxis.baseUnit. Setting the categoryAxis.labels.format option will override the date formats.

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  series: [
    {
      type: "scatter",
      data: [
        [2, new Date("01/01/2013")],
        [2, new Date("01/02/2013")],
        [2, new Date("01/03/2013")]
      ]
    }
  ],
  yAxis: {
    type: "date",
    labels: {
      dateFormats: {
        days: "M-d"
      }
    }
  }
});
</script>

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

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

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

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

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  series: [
    { type: "scatter", data: [[1, 2]] }
  ],
  yAxis: {
    labels: {
      format: "{0:C}"
    }
  }
});
</script>
Number|Object

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

Default: 0

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

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.

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  series: [
    { type: "scatter", data: [[1, 2]] }
  ],
  yAxis: {
    labels: {
      mirror: true
    }
  }
});
</script>

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

Default: 0

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

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.

Default: "onAxis"

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

The rotation angle of the labels. By default the labels are not rotated.

Default: 0

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

The number of labels to skip.

Default: 1

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

The label rendering step - render every n-th label. By default every label is rendered.

Default: 1

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

yAxis.labels.template

String|Function

The template which renders the labels.

The fields which can be used in the template are:

  • value - the category value

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

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

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

Default: true

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

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
<div id="chart"></div>
<script>
  $("#chart").kendoChart({
    series: [
      {
        type: "scatter",
        data: [ [1, 2] ]
      }
    ],
    yAxis: {
      labels: {
        visual: function(e) {
          return new kendo.drawing.Text(e.text, e.rect.origin, {
            fill: {
              color: "red"
            }
          });
        }
      }
    }
  });
</script>