Jquery 如何修改x&;在我的数据点Jqplot图表中,Y轴从包含的点开始
我的asp.net mvc中有以下数据点jqplot图表:-Jquery 如何修改x&;在我的数据点Jqplot图表中,Y轴从包含的点开始,jquery,asp.net-mvc-3,jqplot,Jquery,Asp.net Mvc 3,Jqplot,我的asp.net mvc中有以下数据点jqplot图表:- <script type="text/javascript"> $(document).ready(function () { var line1 = [['23-May-08', 578.55], ['20-Jun-08', 566.5], ['25-Jul-08', 480.88], ['22-Aug-08', 509.84],
<script type="text/javascript">
$(document).ready(function () {
var line1 = [['23-May-08', 578.55], ['20-Jun-08', 566.5],
['25-Jul-08', 480.88], ['22-Aug-08', 509.84],
['26-Sep-08', 454.13], ['24-Oct-08', 379.75],
['21-Nov-08', 303], ['26-Dec-08', 308.56],
['23-Jan-09', 299.14], ['20-Feb-09', 346.51],
['20-Mar-09', 325.99], ['24-Apr-09', 386.15],
['26-Apr-09', 386.15], ['17-Apr-09', 386.15],
['24-Apr-09', 386.15], ['24-Apr-09', 386.15]];
var plot1 = $.jqplot('chart1', [line1],
{ title: 'Data Point Highlighting',
axes:
{ xaxis:
{ renderer: $.jqplot.DateAxisRenderer,
tickOptions: { formatString: '%b %#d' }
},
yaxis: { tickOptions: { formatString: '%.2f'} }
},
highlighter: { show: true, sizeAdjust: 7.5 },
cursor: { show: false }
});
});
</script>
$(文档).ready(函数(){
变量行1=['08年5月23日',578.55],'08年6月20日',566.5],
[08年7月25日,480.88],[08年8月22日,509.84],
[08年9月26日,454.13],[08年10月24日,379.75],
[08年11月21日,303年],[08年12月26日,308.56],
[09年1月23日,299.14],[09年2月20日,346.51],
[09年3月20日,325.99],[09年4月24日,386.15],
[09年4月26日,386.15],[09年4月17日,386.15],
[09年4月24日,386.15],[09年4月24日,386.15];
变量plot1=$.jqplot('chart1',[line1],
{标题:'数据点突出显示',
轴线:
{xaxis:
{渲染器:$.jqplot.DateAxisRenderer,
选项:{formatString:'%b%#d'}
},
yaxis:{tickOptions:{formatString:'%.2f'}}
},
荧光灯:{show:true,sizeAdjust:7.5},
光标:{show:false}
});
});
如何强制X轴和Y轴编号从上述第1行值中的第一个值开始;例如,当前x轴将从5月17日开始,尽管列表中的第一个值是5月23日。在
xaxis
括号内添加此行:pad:0,
xaxis:
{
renderer: $.jqplot.DateAxisRenderer,
pad: 0,
tickOptions: { formatString: '%b %#d' }
},
它将取消轴起始值和结束值填充,因为默认填充设置为1.2
从以下方面:
pad
this.pad=1.2
填充以扩展数据边界上下的范围。数据范围乘以该系数以确定最小和最大轴边界。值0将被解释为没有填充,并且填充将被设置为1.0。我指定填充:0,但它仅在y轴上工作,但x轴仍具有默认填充!!!。BRI我不确定使用
dateaxisranderer
是否可以使用0值的pad。但无论如何,请尝试pad:1.0
只提供1天的容差。