【问题标题】:Does the dateAxisRenderer in jqPlot ignore the numberTicks option?jqPlot 中的 dateAxisRenderer 是否忽略 numberTicks 选项?
【发布时间】:2011-05-07 23:06:09
【问题描述】:

我正在尝试使用 jqPlot 更改绘图中存在的刻度数。我正在为我的 x 轴使用 dateAxisRenderer 插件,并希望减少显示的日期刻度数。这是我的示例代码:

var dummyData = [['2011-05-03 10:15:30', 25], ['2011-05-04 11:30:30', 30], ['2011-05-05 10:15:30', 25], ['2011-05-06 11:30:30', 33], '2011-05-07 10:15:30', 25]];

$.jqplot(chartId, [dummyData], {
        grid:{
            //background:'#f0ffff',
            background:'#F0F8FF',
            gridLineColor:'#dfdfdf',
            borderWidth:1.5
        },
        axes:{
            xaxis:{
                pad:1.0,
                renderer:$.jqplot.DateAxisRenderer,
                numberTicks:3,
                tickOptions:{
                    formatString:'%#m/%#d%n%#I%p', 
                    fontSize:'7pt', 
                    fontFamily:'"Lucida Grande",Verdana, Georgia, "Times New Roman", Times, serif'
                }
            },
            yaxis:{padMin:1.01, padMax:1.1, tickOptions:{formatString:'$%d'}}
        },
        seriesDefaults: {
            fill: true,
            fillAndStroke: true,
            shadow:false,
            rendererDefaults: {
                highlightMouseOver:false,
                highlightMouseDown:false,
                highlightColor:null
            },
            markerOptions:{
                show:false,
                size:4
            },
            trendline:{
                show:false,
                type:'exp'
            }

        },
        series:[{color:'rgba(255, 117, 26, 0.7)'}]
});

【问题讨论】:

    标签: jqplot


    【解决方案1】:

    $.jqplot.DateAxisRenderer 有一个tickInterval 选项。

    例如:

        xaxis: {
                pad:1.0,
                renderer:$.jqplot.DateAxisRenderer,
                tickInterval: "7 days",
            },
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-10-24
      • 2015-02-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-27
      • 2017-07-02
      • 2021-04-08
      相关资源
      最近更新 更多