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

ValueAxis.labels

configuration

Configures the axis labels.

<div id="sparkline"></div>
<script>
$("#sparkline").kendoSparkline({
    valueAxis: {
        labels: {
            visible: true,
            background: "lightgray",
            color: "blue",
            font: "12px Arial",
            format: "C",
            rotation: 45
        }
    },
    series: [{
        data: [10, 15, 8, 12]
    }]
});
</script>

The background color of the labels. Any valid CSS color string will work here, including hex and rgb

<div id="sparkline"></div>
<script>
$("#sparkline").kendoSparkline({
    type: "column",
    valueAxis: {
        labels: {
            visible: true,
            background: "yellow"
        }
    },
    series: [{
        data: [10, 15, 8, 12]
    }]
});
</script>

The border of the labels.

<div id="sparkline"></div>
<script>
$("#sparkline").kendoSparkline({
    type: "column",
    valueAxis: {
        labels: {
            visible: true,
            border: {
                color: "red",
                width: 2,
                dashType: "solid"
            }
        }
    },
    series: [{
        data: [10, 15, 8, 12]
    }]
});
</script>

The text color of the labels. Any valid CSS color string will work here, including hex and rgb.

<div id="sparkline"></div>
<script>
$("#sparkline").kendoSparkline({
    type: "column",
    valueAxis: {
        labels: {
            visible: true,
            color: "#ff6600"
        }
    },
    series: [{
        data: [10, 15, 8, 12]
    }]
});
</script>

The font style of the labels.

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

<div id="sparkline"></div>
<script>
$("#sparkline").kendoSparkline({
    type: "column",
    valueAxis: {
        labels: {
            visible: true,
            font: "14px Georgia, serif"
        }
    },
    series: [{
        data: [10, 15, 8, 12]
    }]
});
</script>

The format of the labels.

<div id="sparkline"></div>
<script>
$("#sparkline").kendoSparkline({
    type: "column",
    valueAxis: {
        labels: {
            visible: true,
            format: "{0}%"
        }
    },
    series: [{
        data: [10, 15, 8, 12]
    }]
});
</script>

The margin of the labels.

Default: 0

js
// sets the top, right, bottom and left margin to 3px.
margin: 3

// sets the top and left margin to 1px
// margin right and bottom are with 0px (by default)
margin: { top: 1, left: 1 }

Mirrors 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="sparkline"></div>
<script>
$("#sparkline").kendoSparkline({
    type: "column",
    valueAxis: {
        labels: {
            visible: true,
            mirror: true
        }
    },
    series: [{
        data: [10, 15, 8, 12]
    }]
});
</script>

The padding of the labels.

Default: 0

js
// sets the top, right, bottom and left padding to 3px.
padding: 3

// sets the top and left padding to 1px
// padding right and bottom are with 0px (by default)
padding: { top: 1, left: 1 }

The rotation angle of the labels.

Default: 0

<div id="sparkline"></div>
<script>
$("#sparkline").kendoSparkline({
    type: "column",
    valueAxis: {
        labels: {
            visible: true,
            rotation: 45
        }
    },
    series: [{
        data: [10, 15, 8, 12]
    }]
});
</script>

Number of labels to skip. Skips rendering the first n labels.

Default: 1

<div id="sparkline"></div>
<script>
$("#sparkline").kendoSparkline({
    type: "column",
    valueAxis: {
        labels: {
            visible: true,
            skip: 2
        }
    },
    series: [{
        data: [10, 15, 8, 12, 20, 25, 18]
    }]
});
</script>

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

Default: 1

<div id="sparkline"></div>
<script>
$("#sparkline").kendoSparkline({
    type: "column",
    valueAxis: {
        labels: {
            visible: true,
            step: 2
        }
    },
    series: [{
        data: [10, 15, 8, 12, 20, 25, 18]
    }]
});
</script>

valueAxis.labels.template

String | Function

The label template. Template variables:

  • value- the value
<div id="sparkline"></div>
<script>
$("#sparkline").kendoSparkline({
    type: "column",
    valueAxis: {
        labels: {
            visible: true,
            template: (data) => `Val: ${data.value}`
        }
    },
    series: [{
        data: [10, 15, 8, 12]
    }]
});
</script>

The visibility of the labels.

Default: true

<div id="sparkline"></div>
<script>
$("#sparkline").kendoSparkline({
    type: "column",
    valueAxis: {
        labels: {
            visible: false
        }
    },
    series: [{
        data: [10, 15, 8, 12]
    }]
});
</script>