Kendo UI图表中的轴Y和X标签

时间:2016-01-25 09:35:12

标签: javascript kendo-ui kendo-dataviz

如何在剑道图中为X轴和Y轴设置水平标题?

例如,对于this chart,我想设置标题(访客),如下图所示 -

enter image description here

2 个答案:

答案 0 :(得分:3)

valueAxis:[{         标题:{             文字:“我的文字X”         } }], 标题:{ 文字:“我的文字Y”, 位置:“底部” }

答案 1 :(得分:0)

感谢这一点,这在解决我的问题时非常有帮助,这很相似。我对示例进行了相应的编辑:http://dojo.telerik.com/OBOZefEr/2我将整个代码都摘录了下来,欢迎您从此处运行。

<!DOCTYPE html>
<html>
<head>
    <base href="http://demos.telerik.com/kendo-ui/bar-charts/index">
    <style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
    <title></title>
    <link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.1.112/styles/kendo.common-material.min.css" />
    <link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.1.112/styles/kendo.material.min.css" />

    <script src="//kendo.cdn.telerik.com/2016.1.112/js/jquery.min.js"></script>
    <script src="//kendo.cdn.telerik.com/2016.1.112/js/kendo.all.min.js"></script>
</head>
<body>
<div id="example">
    <div class="demo-section k-content wide">
        <div id="chart" style="background: center no-repeat url('../content/shared/styles/world-map.png');"></div>
    </div>
    <script>
        function createChart() {
            $("#chart").kendoChart({
                title: {
                    text: "Site Visitors Stats \n /thousands/"
                },
                legend: {
                    visible: false
                },
                seriesDefaults: {
                    type: "bar"
                },
                series: [{
                    name: "Total Visits",
                    data: [56000, 63000, 74000, 91000, 117000, 138000]
                }, {
                    name: "Unique visitors",
                    data: [52000, 34000, 23000, 48000, 67000, 83000]
                }],
                valueAxis: {
                    max: 140000,
                    line: {
                        visible: false
                    },
                    minorGridLines: {
                        visible: true
                    },
                    labels: {
                        rotation: "auto"
                    },
                  title: {
      							text: "VISITORS"
    							}
                },
                categoryAxis: {
                    categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun"],
                    majorGridLines: {
                        visible: false
                    },
                  title: {
      							text: "Month"
    							}
                },
                tooltip: {
                    visible: true,
                    template: "#= series.name #: #= value #"
                }              	
            });
        }

        $(document).ready(createChart);
        $(document).bind("kendo:skinChange", createChart);
    </script>
</div>


</body>
</html>