0

JQPlot に問題があります。グラフにバーを表示することはできましたが、何らかの理由で線が描画されません。

JSFiddle でコードを確認できます (Internet Explorer では機能しませんでした): http://jsfiddle.net/gkp2N/

「seriesDefaults」を「series」に変更すると、2 本の線が表示されますが、バーは描画されません。これを理解するのに2時間費やしたので、誰かが私を助けてくれることを願っています、ありがとう!

JSコードは次のとおりです。

var s1 = [
    ['2013-02-04 4:00PM', 11],
    ['2013-02-05 4:00PM', 11],
    ['2013-02-06 4:00PM', 15],
    ['2013-02-07 4:00PM', 12],
    ['2013-02-08 4:00PM', 16],
    ['2013-02-09 4:00PM', 7],
    ['2013-02-10 4:00PM', 9],
    ['2013-02-11 4:00PM', 6],
    ['2013-02-12 4:00PM', 13],
    ['2013-02-13 4:00PM', 12],
    ['2013-02-14 4:00PM', 6],
    ['2013-02-15 4:00PM', 13],
    ['2013-02-16 4:00PM', 3],
    ['2013-02-17 4:00PM', 9],
    ['2013-02-18 4:00PM', 18],
    ['2013-02-19 4:00PM', 18],
    ['2013-02-20 4:00PM', 12],
    ['2013-02-21 4:00PM', 14],
    ['2013-02-22 4:00PM', 7],
    ['2013-02-23 4:00PM', 5],
    ['2013-02-24 4:00PM', 3],
    ['2013-02-25 4:00PM', 9],
    ['2013-02-26 4:00PM', 15],
    ['2013-02-27 4:00PM', 14],
    ['2013-02-28 4:00PM', 4],
    ['2013-03-01 4:00PM', 0],
    ['2013-03-02 4:00PM', 0],
    ['2013-03-03 4:00PM', 0],
    ['2013-03-04 4:00PM', 0],
    ['2013-03-05 4:00PM', 0]
];



var s2 = [
    ['2013-02-04 4:00PM', 55],
    ['2013-02-05 4:00PM', 55],
    ['2013-02-06 4:00PM', 75],
    ['2013-02-07 4:00PM', 60],
    ['2013-02-08 4:00PM', 80],
    ['2013-02-09 4:00PM', 35],
    ['2013-02-10 4:00PM', 45],
    ['2013-02-11 4:00PM', 30],
    ['2013-02-12 4:00PM', 65],
    ['2013-02-13 4:00PM', 60],
    ['2013-02-14 4:00PM', 30],
    ['2013-02-15 4:00PM', 65],
    ['2013-02-16 4:00PM', 15],
    ['2013-02-17 4:00PM', 45],
    ['2013-02-18 4:00PM', 90],
    ['2013-02-19 4:00PM', 90],
    ['2013-02-20 4:00PM', 60],
    ['2013-02-21 4:00PM', 70],
    ['2013-02-22 4:00PM', 35],
    ['2013-02-23 4:00PM', 25],
    ['2013-02-24 4:00PM', 15],
    ['2013-02-25 4:00PM', 45],
    ['2013-02-26 4:00PM', 75],
    ['2013-02-27 4:00PM', 70],
    ['2013-02-28 4:00PM', 20],
    ['2013-03-01 4:00PM', 0],
    ['2013-03-02 4:00PM', 0],
    ['2013-03-03 4:00PM', 0],
    ['2013-03-04 4:00PM', 0],
    ['2013-03-05 4:00PM', 0]
];
var plot = $.jqplot('placeholder', [s1, s2], {

    // Turns on animatino for all series in this plot.
    animate: true,
    // Will animate plot on calls to plot1.replot({resetAxes:true})
    animateReplot: true,
    cursor: {
        show: true,
        zoom: true,
        looseZoom: true,
        showTooltip: false
    },

    seriesColors: ["#eee", "#ccc"],
    highlighter: {
        show: true,
        showLabel: true,
        tooltipAxes: 'y',
        sizeAdjust: 7.5,
        tooltipLocation: 'ne'
    },

    seriesDefaults: {
        renderer: $.jqplot.BarRenderer,
        xaxis: 'xaxis',
        yaxis: 'yaxis',
        rendererOptions: {
            // Speed up the animation a little bit.
            // This is a number of milliseconds.  
            // Default for bar series is 3000.  
            animation: {
                speed: 2500
            },
            barWidth: 15,
            barPadding: -15,
            barMargin: 0,
            highlightMouseOver: false

        }
    },
    axesDefaults: {
        tickRenderer: $.jqplot.CanvasAxisTickRenderer,
        tickOptions: {
            angle: 30
        },
        showTicks: false
    },
    axes: {
        xaxis: {
            renderer: $.jqplot.DateAxisRenderer,
            tickInterval: '1 day'

        },
        x2axis: {
            renderer: $.jqplot.DateAxisRenderer
        }

    }


});
4

1 に答える 1

1

必要なプラグイン(barRenderer)を含めることを忘れないでください:

<script class="include" src=" http://www.jqplot.com/deploy/dist/plugins/jqplot.barRenderer.min.js"></script>

編集

フィドルの実例

于 2013-03-06T08:41:04.240 に答える