1

我必须创建一个显示 30 天图表的条形图。所以我将在图表上显示总共 30 个柱。但它在 x 轴上看起来非常拥挤。有没有一种方法可以只显示 6 个 x 轴刻度而不是所有 30 个 x 轴刻度?

4

2 回答 2

2

我知道这是一个老问题,但我也需要一些解决方案,所以这里是:
当你jqplot用来打印条时,你不能说它应该打印多少刻度,因为它只打印相关值,所以你必须打印所有刻度. 我的解决方案不是很好,但它有效。只需打印带有空标签的刻度。例如:

axes: {
      xaxis: {
             min:1,
             max: 30,
             ticks: [[1,""],[2,""],[3,""],[4,""],[5,"5"],
                    [6,""],[7,""],[8,""],[9,""],[10,"10"],
                    [11,""],[12,""],[13,""],[14,""],[15,"15"],
                    [16,""],[17,""],[18,""],[19,""],[20,"20"],
                    [21,""],[22,""],[23,""],[24,""],[25,"25"],
                    [26,""],[27,""],[28,""],[29,""],[30,"30"]]
            }
        }
于 2013-09-06T11:11:05.010 回答
0

通过使用ticks轴选项,您可以准确指定要显示的刻度。

链接到文档:http ://www.jqplot.com/docs/files/jqplot-core-js.html#Axis.ticks

于 2012-11-07T07:03:45.337 回答