1

在下面的代码中,我在给定日期的几个小时内有价值。我每天(每小时)需要 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}],

        });
4

0 回答 0