如何使用jqplot设置饼图的圆形大小?

时间:2014-10-22 08:39:43

标签: javascript jqplot

我想用jqplot设置饼图的圆圈大小....我有以下代码片段......

var plot = jQuery.jqplot ('chart', [data], 
                {                       
                    seriesDefaults: {
                        renderer: jQuery.jqplot.PieRenderer,
                        rendererOptions: {
                            showDataLabels: true
                        },
                        pointLabels: { show: true }                          
                    }, 
                    diameter : 1,
                    legend: { 
                        show:true,
                        location: 'e',                    
                        placement: 'inside'                    
                    },
                    title: {

                        fontSize:'14px',
                        fontWeight: 'bold',
                        fontFamily: 'Arial',                    
                        show: true
                    }
                }

这是设置圆的直径的正确方法吗?

2 个答案:

答案 0 :(得分:3)

应该在seriesDefault.renderOptions.diameter之下。请参阅http://www.jqplot.com/docs/files/jqPlotOptions-txt.html

上的文档
seriesDefaults: {
    rendererOptions: {
        diameter: 1, // diameter of pie, auto computed by default.
    }
}

答案 1 :(得分:1)

在rendererOptions下设置直径.....

var plot = jQuery.jqplot ('chart8', [xyOrgIP], 
                {
                    seriesDefaults: {
                        renderer: jQuery.jqplot.PieRenderer,
                        rendererOptions: {
                            showDataLabels: true,
                            diameter : 100
                        },
                        pointLabels: { show: true }

                    },                   
                    legend: { 
                        show:true,
                        location: 'e',                    
                        placement: 'inside'                    
                    },
                    title: {
                        text: 'Traffic Analysis by Origin IP (Last 7 Days)',   // title for the plot,
                        fontSize:'14px',
                        fontWeight: 'bold',
                        fontFamily: 'Arial',                    
                        show: true
                    }
                }