设置PolarLine图表的大小

时间:2017-05-29 08:33:56

标签: javascript html kendo-ui

有没有办法设置PolarLine Chart的特定大小(不是ChartArea,图表)

在图像中可以看到“我不知道是什么空间保存”

所以有两个选项,确定图表的大小,或者将图表的大小均衡到ChartArea。

$("#chart2").kendoChart({
                chartArea: {
                    background:"",
                    border: {
                        width: 2,
                        color: "green"
                    }  
                },
                legend:{
                    visible: false
                },
                seriesDefaults: {
                    type: "polarLine",
                    style: "smooth"
                },
                series: [{
                    data: [
[0,75.07200602],[10,81.64361286],
[20,91.39178047],[30,98.75515111],
[40,99.92040115],[50,92.10607453],
[60,74.91674346],[70,50.02020242],
[80,11.87856731],[90,0.998505703]
]
                }],
                xAxis:
                {
                    startAngle: 90,
                    majorUnit: 10,

                    reverse :true,
                    majorGridLines: {
                        max: 360,
                        min: 0,
                        visible: true
                    },
                    labels:
                    {
                        visible: false,
                        margin:3,
                        template:"#: value # º"
                    }
                },
                yAxis:
                {
                    max: 100,
                    min :0,
                    majorUnit: 10,
                    labels:
                    {
                        visible: false
                    }
                },
                tooltip: {
                    visible: true,
                    format: "{0}",
                    template: "#: value #"
                },
                transitions:false
            });

White space problem

1 个答案:

答案 0 :(得分:0)

解决方案是创建一个函数,根据投币器的大小计算一次图表重新计算,在我的例子中是:

function reziseChart(ParentDiv)
        {
           var clientHeight = document.getElementById(ParentDiv).clientHeight;
            var c = $("#chart2").data("kendoChart");
            c.options.chartArea.margin = - clientHeight * 0.425;
            c.refresh(); 
        }