如何在jqplot中给出每天每小时的滴答间隔?

时间:2013-10-24 07:44:21

标签: javascript jquery jqplot

在下面的代码中,我在给定日期的某些小时有价值。我每天需要24点(每小时)。所以这里我的图表应该有2个部分(2天),每个部分应该有24个点,即使有些时间没有数据。现在显示“2013-10-15 4:00”和“2013-10-16 11:00”之间的时间间隔,即从第一天的第4个小时开始到第二天的第11个小时结束。如何更改我的图表?请给我一个解决方案

  line1=[['2013-10-15 4:00',4], ['2013-10-15 6:00',6.5], ['2013-10-16 9:00',5.7], ['2013-10-16 11:00',9]];


        var plot1 = $.jqplot('chart1', [line1], {
            title:'Server Activity',
            axesDefaults: {
                tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
                tickOptions: {
                    fontFamily: 'Georgia',
                    fontSize: '10pt',
                    angle: -40
                }
            },
            series:[{lineWidth:1}],
            rendererOptions: {
                smooth: true
            },
            gridPadding:{right:35},
            axes:{
                xaxis:{
                    renderer:$.jqplot.DateAxisRenderer, tickOptions:{
                        //                                formatString:'%b %d, %Y %H:00',
                        formatString:'%b %d, %Y %H:00',
                        tickOptions: {
                            mark: 'outside',    // Where to put the tick mark on the axis
                            show: true,         // wether to show the tick (mark and label),
                            showLabel: true,    // w    ether to show the text label at the tick,
                            formatString: '',  // format string to use with the axis tick formatter
                            fontSize:11,
                            markSize: 10
                        }
                    } ,
                    tickInterval : '1 hour'
                    //numberTicks: 20

                },
                yaxis:{
                    min:0,
                    tickOptions: {
                        mark: 'inside',    // Where to put the tick mark on the axis
                        show: true,         // wether to show the tick (mark and label),
                        showLabel: true,    // wether to show the text label at the tick,
                        formatString: '%d' , // format string to use with the axis tick formatter
                        fontSize:11
                    }
                }
            },
            highlighter: {
                show: true,
                sizeAdjust: 7.5
            },
            cursor: {
                show: false
            }
            //series:[{lineWidth:2}],

        });

0 个答案:

没有答案