首页 文章

条形图不显示在jqplot条形图中

提问于
浏览
0

我的问题是,使用JqPlot,条形图中根本不显示条形图 .

这是代码:

var line = [['Clients' , 15] , ['Prospects' , 8]];
var plot4 = jQuery.jqplot('chartdiv4', [line] ,
                            {
                                seriesDefaults:{
                                    renderer:jQuery.jqplot.BarRenderer,
                                    rendererOptions: {
                                        varyBarColor: true
                                        }
                                },
                                axes:{
                                    xaxis:{
                                        renderer: jQuery.jqplot.CategoryAxisRenderer,
                                    }
                                }
                              });

1 回答

  • 0

    请参阅http://jsfiddle.net/BpEK2/3/处的示例 . 这显示了在屏幕上绘制的条形图 . 确保查看包含的依赖项(外部资源),因为您需要所有这些依赖项 . 从本质上讲,你需要做的是

    var s1 = [15, 8];
    
    var ticks = ['Clients', 'Prospects'];
    
    var plot1 = $.jqplot('chart1', [s1], {
        seriesDefaults: {
            renderer: $.jqplot.BarRenderer,
            rendererOptions: {
                fillToZero: true, 
                varyBarColor: true
            }
        },
        axes: {
            xaxis: {
                renderer: $.jqplot.CategoryAxisRenderer,
                ticks: ticks
            }
        }
    });
    

相关问题