javascript - Category labels on a kendo UI bar chart - Stack Overflow

I'm trying to display category labels on the x-axis on a bar chart but can't work out how to

I'm trying to display category labels on the x-axis on a bar chart but can't work out how to do this. Here's the HTML and JS:

<!DOCTYPE html>
<html xmlns="">
<head>
    <title></title>
</head>
<body>
    <div id="chart"></div>
    <script src="js/thirdParty/jquery.js"></script>
    <script src="js/thirdParty/kendo.all.min.js"></script>
    <script>
        $(function () {
            $("#chart").kendoChart({
                legend: {
                    visible: false
                },
                seriesDefaults: {
                    type: "column"
                },
                series: [{
                    name: "Category A",
                    data: [5]
                }, {
                    name: "Category B",
                    data: [20]
                }, {
                    name: "Category C",
                    data: [10]
                }],
            })
        });
    </script>
</body>
</html>

The following screen shot highlights in a red box where I am trying to put the labels:

Any help would be appreciated.

I'm trying to display category labels on the x-axis on a bar chart but can't work out how to do this. Here's the HTML and JS:

<!DOCTYPE html>
<html xmlns="http://www.w3/1999/xhtml">
<head>
    <title></title>
</head>
<body>
    <div id="chart"></div>
    <script src="js/thirdParty/jquery.js"></script>
    <script src="js/thirdParty/kendo.all.min.js"></script>
    <script>
        $(function () {
            $("#chart").kendoChart({
                legend: {
                    visible: false
                },
                seriesDefaults: {
                    type: "column"
                },
                series: [{
                    name: "Category A",
                    data: [5]
                }, {
                    name: "Category B",
                    data: [20]
                }, {
                    name: "Category C",
                    data: [10]
                }],
            })
        });
    </script>
</body>
</html>

The following screen shot highlights in a red box where I am trying to put the labels:

Any help would be appreciated.

Share Improve this question asked Aug 17, 2013 at 12:15 Carl RipponCarl Rippon 4,6739 gold badges53 silver badges66 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

In your case, you have provided 3 series. if you were intention was to create single series with three different X plot points, then the right way to do that is as below:

$("#chart2").kendoChart({
                legend: {
                    visible: true
                },
                seriesDefaults: {
                    type: "column"
                },
                series: [{
                    data: [5,10,20]
                }],
              categoryAxis: [{
        categories: ["Category A", "Category B","Category C"]
      }]

            });

What I have done is - I have said that Xaxis will have 3 plot points and the series contains a single array data with 3 y plot points.

here is the JSBin - http://jsbin./aroquki/1/edit

Hope this helps.

You see, this example will solve your problem.

JSbin Code

Document kendo Chart

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745304525a4621630.html

相关推荐

  • javascript - Category labels on a kendo UI bar chart - Stack Overflow

    I'm trying to display category labels on the x-axis on a bar chart but can't work out how to

    7小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信