How to get the month names in kendo chart by using function

后端 未结 2 1550
半阙折子戏
半阙折子戏 2021-01-26 04:44

How to create a function to get the month as Jan,feb.. displayed in kendo chart x axis.

var internetUsers = [ {
                            \"Month\": \"1\",
           


        
相关标签:
2条回答
  • 2021-01-26 05:02

    You could use kendoui's time format function:

    kendo.toString(new Date(2000, value, 1), "MMMM"); // if value = 9, it would output September
    

    Check out kendoui's date format page. It is VERY helpful. http://docs.telerik.com/kendo-ui/getting-started/framework/globalization/dateformatting

    0 讨论(0)
  • 2021-01-26 05:06

    First add an array to hold the month names, like so:

    var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug"];
    

    then modify the categoryAxis to use this array

    categoryAxis: {
        field: "Month",
        labels: {
            template: "#=monthNames[value - 1]#"
        },
    },
    
    0 讨论(0)
提交回复
热议问题