javascript - jqPlot:折线图:线条和刻度线未显示

标签 javascript jqplot linegraph

我正在努力创建 jqPlot 折线图,希望有人能提供帮助。由于某种原因,我的线条和刻度线没有显示,我不明白为什么。我复制了下面的麻烦代码。

谁能告诉我我做错了什么?

如果我还能做任何事情来帮助说明或解决问题,请告诉我。

$(document).ready(function(){   

    var line1 = [['07-01-2014',0],['08-01-2014',87],['09-01-2014',0],['10-01-2014',0],['11-01-2014',0],['12-01-2014',0],['01-01-2015',0],['02-01-2015',71],['03-01-2015',0],['04-01-2015',83],['05-01-2015',0],['06-01-2015',82]]
    var line2 = [['07-01-2014',0],['08-01-2014',85],['09-01-2014',0],['10-01-2014',0],['11-01-2014',1],['12-01-2014',0],['01-01-2015',0],['02-01-2015',71],['03-01-2015',0],['04-01-2015',83],['05-01-2015',0],['06-01-2015',82]]
    var jqpData = [line1, line2];

    var xLabels = ['07-01-2014','08-01-2014','09-01-2014','10-01-2014','11-01-2014','12-01-2014','01-01-2015','02-01-2015','03-01-2015','04-01-2015','05-01-2015','06-01-2015'],
        lLables = ['Series 1','Series 2'];

    $(function () {
        var plot1 = $.jqplot('chart1', jqpData, {
            title: 'July through June',
            seriesDefaults:{

                rendererOptions: {smooth: true},
                label:' ',
                lineWidth: 2
            },
            axesDefaults: {
                labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
                tickRenderer: $.jqplot.CanvasAxisTickRenderer
            },
            legend:{
                show: true,
                location: 'sw',
                placement: 'outsideGrid',
                labels: lLables
            },
            axes: {
                xaxis: {
                    renderer:$.jqplot.DateAxisRenderer,
                    tickOptions:{
                        angle:-30,
                        fontFamily:'Trebuchet MS,Arial,Helvetica,sans-serif',
                        fontSize: '1em',
                        min:'07-01-2014', 
                        tickInterval:'1 month'
                    }
                },
                yaxis:{
                    label:'',
                    min:0,
                    max:96.9849
                }
            }
        });
    });
});

最佳答案

尝试将其添加为选项之一:

axes: {
    xaxis:{
        renderer: $.jqplot.CategoryAxisRenderer, //etc

更多信息请点击这里: 如果您还没有查看此链接,请查看:

http://www.jqplot.com/docs/files/jqplot-axisTickRenderer-js.html

然后按如下所示应用:

http://www.jqplot.com/tests/rotated-tick-labels.php

关于javascript - jqPlot:折线图:线条和刻度线未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26706504/

相关文章:

python - Bokeh Python : Select dropdown is updating ColumnDataSource but not updating the graph

javascript - 如果超过逗号(,),如何删除逗号

jquery - jqplot 饼图无法正确呈现。

jqPlot DateAxisRenderer 奇怪的行为

r - 为ggplot2中的每一行分配颜色

r - 在 R ggplot 中手动应用不同的颜色

javascript - 访问不存在的图像 URL 是否会影响 Web 服务器?

javascript函数不返回预期的几何序列

javascript - onmousemove 事件发生两次

JavaScript图表——动态添加数据点