0

我有一个案例,我使用相同的线性仪表测量负速度和正速度。我想知道是否可以让指针以中心作为零点开始?这是我的代码:

<script>
    function createSpeedGauge() {
        $("#speedBar").kendoLinearGauge({
            pointer: {
                value: 0,
                color: "black",
                start: 0
            },
            scale: {
                majorUnit: 20,
                minorUnit: 2,
                min: -120,
                max: 120,
                vertical: true,
                reverse: true,
                ranges: [
                    {
                        from: -120,
                        to: -30,
                        color: "#ffc700"
                    },
                    {
                        from: 120,
                        to: 30,
                        color: "#ffc700"
                    }
                ]
            }
        });
    }

    $(document).ready(function() {
        createSpeedGauge();
    });
</script>

仪表盘

我附上了一张它是如何设置的图片(右侧有问题的仪表)。如果按照我想要的方式进行设置,那么这个仪表会从这张照片中读取 -120。(现在,它在黑条上显示为“0”,因为这是我的 js 中设置的值。)有什么建议吗?

4

1 回答 1

0

通过将起点设置为 0 并使用 SignalR 更新条形的另一端来解决。(初始起点)

于 2013-11-29T11:38:26.637 回答