Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery JqPlot:在日期轴上设置最小/最大值_Jquery_Jqplot - Fatal编程技术网

Jquery JqPlot:在日期轴上设置最小/最大值

Jquery JqPlot:在日期轴上设置最小/最大值,jquery,jqplot,Jquery,Jqplot,需要一些关于设置DateAxisRenderer轴的最大值的建议-我试过pad,运气不好。假设我希望xaxis的最大值比我上次的日期大一天,我该如何设置 xaxis:{ max:'??', tickInterval: '86400000', renderer:$.jqplot.DateAxisRenderer, tickOptions:{ formatString:'%b %#d' }} 您可以通过以下方式获得系列赛的最大x值: var max\u day=pl

需要一些关于设置DateAxisRenderer轴的最大值的建议-我试过pad,运气不好。假设我希望xaxis的最大值比我上次的日期大一天,我该如何设置

       xaxis:{ max:'??', tickInterval: '86400000', renderer:$.jqplot.DateAxisRenderer, tickOptions:{ formatString:'%b %#d' }}

您可以通过以下方式获得系列赛的最大x值:

var max\u day=plot2.axes.xaxis.\u dataBounds.max

向该值添加1天由

最大天数+=86400000
(时间单位为毫秒)

然后可以将此新绑定应用于绘图

plot1.axes.xaxis.max=最大日


最后,别忘了回复:
plot1.replot()

如果需要从yaxis定义最小值和最大值,可以这样做:[在此处输入链接说明][1]

HTML


检查pad属性pad属性不适用于DateAxisRenderer-这就是问题所在…谢谢Anthony-它可以工作。自从发帖后,我改变了主意,不管怎样,我还是用不同的方式处理这个问题。还是谢谢你。
<div id="chart" style="height:500px"></div>
$(document).ready(function(){ 

var line1=[['1', 0.0],['2', 8.3],['3', 10.1],['4', 10.0],['5', 8.3],['6', 8.3],['7', 20.8],['8', 23.8],['9', 27.1],['10', 23.8],['11', 22.3],['12', 24.4]];

var plot1 = $.jqplot('chart', [line1], {
title:'Default Date Axis',
axes:{
    xaxis:{
        renderer: $.jqplot.DateAxisRenderer,
        tickOptions:{formatString:'%b'},
    },
    yaxis:{
        //renderer:$.jqplot.DateAxisRenderer,
        tickOptions:{formatString: '%.1f %'},
        min:0,
        max:100,
        tickInterval:'10'
    }
}, 
 series:[{color:'#5FAB78'}], 
 highlighter: { 
     show: false, 
     sizeAdjust: 1 
 }, 
 cursor: { 
     show: false 
 },
 seriesDefaults: {  
      showMarker:true, 
      pointLabels: { show:true }  
 } 
 });
});