JQuery:JQPlot中的TickInterval

时间:2011-11-10 09:20:21

标签: jquery jqplot

如何为jqplot.CanvasAxisTickRenderer设置x轴的tickInterval? x轴标签是字符串。

我尝试下面的代码,但它不起作用。请帮助,谢谢。

xaxis: {
        tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
         tickOptions: {
             angle: -90,
             fontSize: '12pt'
         },
         tickInterval : 10,
         renderer: $.jqplot.CategoryAxisRenderer,
         ticks: ticks,
         label: '<%= chartBy.replace("_", " ").toUpperCase()%>',
         labelOptions:{
              enableFontSupport:true,
              fontFamily:'Verdana',
              fontSize: '12pt'
         }

2 个答案:

答案 0 :(得分:12)

属性tickInterval是一个字符串字段。尝试设置如下:

xaxis:{
//Other options
tickInterval: '1 day',
//Another options
}

我已经搜索了其他选项,这些是我测试过的(他们有效):

  • '1 day'
  • 'x days'其中x是大于1的任何整数
  • '1 week'
  • 'x weeks'其中x是大于1的任何整数
  • '1 month'
  • 'x months'其中x是大于1的任何整数

请注意,这些是区分大小写的选项。因此,'month''Month'不同。

答案 1 :(得分:3)

如果您遇到AdrianoRR的回复问题(就像我一样),请点击以下链接: jqPlot DateAxis tickInterval not working

相关问题