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

ValueAxis.labels

configuration

Configures the axis labels.

<div id="stock-chart"></div>
<script>
$("#stock-chart").kendoStockChart({
    valueAxis: {
        labels: {
            background: "#ff0000",
            color: "#ffffff"
        }
    },
    series: [{
        type: "line",
        data: [
            { date: new Date(2023, 0, 1), value: 10 },
            { date: new Date(2023, 0, 2), value: 20 },
            { date: new Date(2023, 0, 3), value: 15 }
        ]
    }]
});
</script>

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

<div id="stock-chart"></div>
<script>
$("#stock-chart").kendoStockChart({
    valueAxis: {
        labels: {
            background: "#ff0000"
        }
    },
    series: [{
        type: "line",
        data: [
            { date: new Date(2023, 0, 1), value: 10 },
            { date: new Date(2023, 0, 2), value: 20 },
            { date: new Date(2023, 0, 3), value: 15 }
        ]
    }]
});
</script>

The border of the labels.

<div id="stock-chart"></div>
<script>
$("#stock-chart").kendoStockChart({
    valueAxis: {
        labels: {
            border: {
                color: "#ff0000",
                width: 2
            }
        }
    },
    series: [{
        type: "line",
        data: [
            { date: new Date(2023, 0, 1), value: 10 },
            { date: new Date(2023, 0, 2), value: 20 },
            { date: new Date(2023, 0, 3), value: 15 }
        ]
    }]
});
</script>

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

<div id="stock-chart"></div>
<script>
$("#stock-chart").kendoStockChart({
    valueAxis: {
        labels: {
            color: "#ff0000"
        }
    },
    series: [{
        type: "line",
        data: [
            { date: new Date(2023, 0, 1), value: 10 },
            { date: new Date(2023, 0, 2), value: 20 },
            { date: new Date(2023, 0, 3), value: 15 }
        ]
    }]
});
</script>

The font style of the labels.

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

<div id="stock-chart"></div>
<script>
$("#stock-chart").kendoStockChart({
    valueAxis: {
        labels: {
            font: "16px Arial"
        }
    },
    series: [{
        type: "line",
        data: [
            { date: new Date(2023, 0, 1), value: 10 },
            { date: new Date(2023, 0, 2), value: 20 },
            { date: new Date(2023, 0, 3), value: 15 }
        ]
    }]
});
</script>

The format of the labels.

pseudo
    $("#chart").kendoChart({
        valueAxis: {
           labels: {
               // set the format to currency
               format: "C"
           }
        },
        //...
    });

The margin of the labels.

Default: 0

pseudo
    // 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="stock-chart"></div>
<script>
$("#stock-chart").kendoStockChart({
    dataSource: {
        data: [
            { date: "2012/01/01", open: 10, high: 15, low: 8, close: 12, volume: 1000 },
            { date: "2012/01/02", open: 12, high: 18, low: 10, close: 15, volume: 1200 }
        ]
    },
    dateField: "date",
    valueAxis: {
        labels: {
            mirror: true
        }
    },
    series: [{
        type: "candlestick",
        openField: "open",
        highField: "high", 
        lowField: "low",
        closeField: "close"
    }]
});
</script>

The padding of the labels.

Default: 0

pseudo
    // 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="stock-chart"></div>
<script>
$("#stock-chart").kendoStockChart({
    dataSource: {
        data: [
            { date: "2012/01/01", open: 10, high: 15, low: 8, close: 12, volume: 1000 },
            { date: "2012/01/02", open: 12, high: 18, low: 10, close: 15, volume: 1200 }
        ]
    },
    dateField: "date",
    valueAxis: {
        labels: {
            rotation: 45
        }
    },
    series: [{
        type: "candlestick",
        openField: "open",
        highField: "high", 
        lowField: "low",
        closeField: "close"
    }]
});
</script>

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

Default: 1

<div id="stock-chart"></div>
<script>
$("#stock-chart").kendoStockChart({
    dataSource: {
        data: [
            { date: "2012/01/01", open: 10, high: 15, low: 8, close: 12, volume: 1000 },
            { date: "2012/01/02", open: 12, high: 18, low: 10, close: 15, volume: 1200 },
            { date: "2012/01/03", open: 15, high: 20, low: 12, close: 18, volume: 1500 }
        ]
    },
    dateField: "date",
    valueAxis: {
        labels: {
            skip: 2
        }
    },
    series: [{
        type: "candlestick",
        openField: "open",
        highField: "high", 
        lowField: "low",
        closeField: "close"
    }]
});
</script>

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

Default: 1

<div id="stock-chart"></div>
<script>
$("#stock-chart").kendoStockChart({
    dataSource: {
        data: [
            { date: "2012/01/01", open: 10, high: 15, low: 8, close: 12, volume: 1000 },
            { date: "2012/01/02", open: 12, high: 18, low: 10, close: 15, volume: 1200 },
            { date: "2012/01/03", open: 15, high: 20, low: 12, close: 18, volume: 1500 },
            { date: "2012/01/04", open: 18, high: 22, low: 16, close: 20, volume: 1800 }
        ]
    },
    dateField: "date",
    valueAxis: {
        labels: {
            step: 2
        }
    },
    series: [{
        type: "candlestick",
        openField: "open",
        highField: "high", 
        lowField: "low",
        closeField: "close"
    }]
});
</script>

valueAxis.labels.template

String | Function

The label template. Template variables:

  • value - the value
<div id="chart"></div>
<script>
// chart initialization
$("#chart").kendoChart({
     title: {
         text: "My Chart Title"
     },
     series: [
         {
             name: "Series 1",
             data: [200, 450, 300, 125]
         }
     ],
     categoryAxis: {
         categories: [2000, 2001, 2002, 2003]
     },
     valueAxis: {
         labels: {
             // labels template
             template: "#= value #%"
         }
     }
});
</script>

The visibility of the labels.

Default: true

<div id="stock-chart"></div>
<script>
$("#stock-chart").kendoStockChart({
    dataSource: {
        data: [
            { date: "2012/01/01", open: 10, high: 15, low: 8, close: 12, volume: 1000 },
            { date: "2012/01/02", open: 12, high: 18, low: 10, close: 15, volume: 1200 }
        ]
    },
    dateField: "date",
    valueAxis: {
        labels: {
            visible: false
        }
    },
    series: [{
        type: "candlestick",
        openField: "open",
        highField: "high", 
        lowField: "low",
        closeField: "close"
    }]
});
</script>