Kendo ui KendoUI将Northwind演示设置为

Kendo ui KendoUI将Northwind演示设置为,kendo-ui,kendo-dataviz,kendo-gauge,Kendo Ui,Kendo Dataviz,Kendo Gauge,我正在使用最新的KendoUI,并尝试设置一个标准,就像KendoUI的官方网站广告图片显示的那样 您可以在以下位置找到广告图片: 请看图片,它显示了一个名为“northwind dash”的应用程序,上面有一个绿色仪表,仪表内有一个白色文本“63%” 我尝试下面的代码: <!DOCTYPE html> <html> <head> <title></title> <link href="styles/kendo.c

我正在使用最新的KendoUI,并尝试设置一个标准,就像KendoUI的官方网站广告图片显示的那样

您可以在以下位置找到广告图片: 请看图片,它显示了一个名为“northwind dash”的应用程序,上面有一个绿色仪表,仪表内有一个白色文本“63%”

我尝试下面的代码:

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <link href="styles/kendo.common.min.css" rel="stylesheet" />
    <link href="styles/kendo.default.min.css" rel="stylesheet" />
    <link href="styles/kendo.dataviz.min.css" rel="stylesheet" />
    <link href="styles/kendo.dataviz.default.min.css" rel="stylesheet" />
    <script src="js/jquery.min.js"></script>
    <script src="js/angular.min.js"></script>
    <script src="js/kendo.all.min.js"></script>
</head>
<body>
            <div id="example" class="k-content">
            <div id="gauge-container">
                <div id="gauge"></div>

                <input id="gauge-value" value="65">
            </div>

            <script>
                function createGauge() {
                    $("#gauge").kendoRadialGauge({

                        pointer: {
                            value: $("#gauge-value").val()
                        },

                        scale: {
                            minorUnit: 5,
                            startAngle: -30,
                            endAngle: 210,
                            max: 180
                        }
                    });
                }

                $(document).ready(function() {
                    createGauge();

                    function updateValue() {
                        $("#gauge").data("kendoRadialGauge").value($("#gauge-value").val());
                    }

                    if (kendo.ui.Slider) {
                        $("#gauge-value").kendoSlider({
                            min: 0,
                            max: 180,
                            showButtons: false,
                            change: updateValue
                        });
                    } else {
                        $("#gauge-value").change(updateValue);
                    }


                    $(document).bind("kendo:skinChange", function(e) {
                        createGauge();
                    });
                });
            </script>

            <style scoped>
                #gauge-container {
                    background: transparent url("../content/dataviz/gauge/gauge-container-partial.png") no-repeat 50% 50%;
                    width: 386px;
                    height: 386px;
                    text-align: center;
                    margin: 0 auto 30px auto;
                }

                #gauge {
                    width: 350px;
                    height: 300px;
                    margin: 0 auto;
                }

                #gauge-container .k-slider {
                    margin-top: -11px;
                    width: 140px;
                }

            </style>
        </div>



</body>
</html>

函数createGauge(){
$(“#规格”)。肯多拉迪奥尔盖({
指针:{
值:$(“#仪表值”).val()
},
比例:{
minorUnit:5,
startAngle:-30,
端角:210,
最高:180
}
});
}
$(文档).ready(函数(){
createGauge();
函数updateValue(){
$(“#量规”).data(“kendoRadialGauge”).value($(“#量规值”).val());
}
if(kendo.ui.Slider){
$(“#仪表值”)。肯多斯里德({
分:0,,
最高:180,
显示按钮:错误,
更改:updateValue
});
}否则{
$(“#仪表值”)。更改(更新值);
}
$(文档).bind(“剑道:皮肤变化”,函数(e){
createGauge();
});
});
#计量容器{
背景:透明url(“../content/dataviz/gauge/gauge container partial.png”)不重复50%50%;
宽度:386px;
高度:386px;
文本对齐:居中;
保证金:0自动30px自动;
}
#仪表{
宽度:350px;
高度:300px;
保证金:0自动;
}
#量具容器。k滑块{
利润上限:-11px;
宽度:140px;
}
但是,我只能得到正常的径向规。 我在KendoUI的文档中到处找,但找不到任何关于northwind dash的演示或示例

谁知道如何改变仪表的样式,使其与图像显示的一样

你的,
Ivan

您可以在中找到KendoUI+Northwind应用程序的源代码,您可以看到在Telerik中运行的版本

但是不,它看起来不像他们的捕获,不确定这是这个项目的旧版本还是内部版本

然而,没有选择放置该百分比,您必须手动使用HTML和CSS

您可以使用以下数据源定义图表:

$("#value").kendoChart({
    // Define Data Source, the first element is the value to represent,
    //                     the second is 100 - first element.
    dataSource: {
        data: [
            { "value": 63 },
            // The remaining part of the Chart is transparent so we actually
            // only see the first value
            { "value": 37, color: "transparent" }
        ]
    },
    // Define a DataBound event handler used when we change the data and will
    // print the value inside the Chart.
    dataBound: function () {
        // Get current value and compute percentage.
        var percentage = (this.dataSource.at(0).value / 100);
        // Convert percentage to text and place it in inside the chart
        $("#value-label").text(kendo.toString(percentage, "p0"));
    },
    // No legend
    legend: {
        visible: false
    },
    seriesDefaults: {
        // Type of series: Donut
        type: "donut",
        // Size of the hole of the Donut
        holeSize: 60,
        // Thickness of the Donut
        size: 20
    },
    series: [
        // The value of the series is in "value" field while the color is 
        // a field called color.
        { field: "value", colorField: "color" }
    ],
    // No tooltip
    tooltip: { visible: false }
});
现在,将标签放置在图表顶部的HTML和CSS定义如下:

<div class="value-container">
    <div id="value"></div>
    <div id="value-label" class="overlay"></div>
</div>
其中,我们指定标签的大小及其从顶部到水平居中的位置(这里我硬编码了垂直位置(
220px
),但您可以找到在DIV中居中文本的方法

你可以在这里看到它的作用:


这看起来像:

为什么你认为63%是仪表的一部分,而不是上面打印的东西?
    .overlay {
        font-size: 24px;
        width: 100%;
        height: 100%;
        position: absolute;
        top: 220px;
        left: 0;
        text-align: center;
    }