0

I'm used the following code to generate the jqplot line chart there is some issues occurred in y-axis point .the x-axis value 'feb,march,apr,may ' the first point showing correctly and other points are moving to between march and apr points.kindly refer the images for clarification .Please help me .Thank in advance

$(document).ready(function(){

    $.jqplot.config.enablePlugins = true;
var line1 = new Array(2);

var line1=[['2013-02-28',1756403],['2013-03-31',0],['2013-04-30',0]];
var line2 = new Array(2);
var line2=[['2013-02-28',107],['2013-03-31',0],['2013-04-30',0]];



    var plot1 = $.jqplot('chart', [line1,line2], {
 gridPadding:{right:35},
        axes:{
            xaxis:{
                renderer:$.jqplot.DateAxisRenderer,
                rendererOptions:{
                    tickRenderer:$.jqplot.CanvasAxisTickRenderer
                },
                 tickOptions:{
                     formatString:'%b',
                     fontSize:'9pt',
                        fontFamily:'sans-serif',

                    tickInterval:'1 month'
},
  min:line1[0][0]

            },
            yaxis:{
                rendererOptions:{
                    tickRenderer:$.jqplot.CanvasAxisTickRenderer},
                    tickOptions:{
                        fontSize:'9pt',
                        fontFamily:'sans-serif',
                        formatString:'%i'



                    },
                    min: 1
            }
        },
        seriesColors: ["#49AD48", "#0BC2EF"],legend: {
        show: true
      },
        series:[{ lineWidth:4, markerOptions:{ style:'square' }, label: 'Actual'},{label: 'Plan' }],
         highlighter: {
        show: true,
        sizeAdjust: 7.5
      },
        cursor:{
            zoom:true,
            looseZoom: true,
            show:fals![enter image description here][1]e
        }
    });

});
4

1 回答 1

0

我整个上午都在为此苦苦挣扎。虽然我的日期是由我的数据库动态生成的,但我将所有条目的时间默认为上午 8:00(如 jqplots 示例中所示)。

日期图不仅是日期,而且是时间敏感的。我的解决方案是将我所有绘图的默认时间更改为上午 12:01,现在它们在网格上排列。

如前所述,我使用 PHP 动态生成我的绘图数组,它们现在看起来像这样:

[chart1] => Array
    (
        [plots] => ['2013-04-02 12:01AM',11, 11], ['2013-04-03 12:01AM',95, 95], ['2013-04-19 12:01AM',325, 325], ['2013-04-22 12:01AM',90, 90], 
    )
于 2013-04-23T18:40:06.107 回答