2

我的资料:

data: [
        [1990,"USA",66,"Canada",53],
        [1992,"USA",66,"Canada",53],
        [1994,"USA",66,"Canada",53],
        [1996,"USA",66,"Canada",53],
        [1998,"USA",66,"Canada",53],
        [2000,"USA",66,"Canada",53],
        [2002,"USA",66,"Canada",53],
        [2004,"USA",66,"Canada",53],
        [2006,"USA",81,"Canada",67],
        [2008,"USA",83,"Canada",46],
        [2010,"USA",61,"Canada",45],
        [2012,"USA",67,"Canada",53],
        [2014,"USA",68,"Canada",43],
        [2016,"USA",68,"Canada",43],
        [2018,"USA",68,"Canada",43],
        [2020,"USA",68,"Canada",43],
        [2022,"USA",67,"Canada",53],
        [2024,"USA",68,"Canada",43],
        [2026,"USA",68,"Canada",43],
        [2028,"USA",68,"Canada",43],
        [2030,"USA",68,"Canada",43],
        [2032,"USA",67,"Canada",53],
        [2034,"USA",68,"Canada",43],
        [2036,"USA",68,"Canada",43],
        [2038,"USA",68,"Canada",43],
        [2040,"USA",68,"Canada",43],
        [2042,"USA",67,"Canada",53],
        [2044,"USA",68,"Canada",43],
        [2046,"USA",68,"Canada",43],
        [2048,"USA",68,"Canada",43],
        [2050,"USA",68,"Canada",43]
    ]

在 X 轴上,我显示年份。这是小提琴:小提琴
Myproblem:

无论如何,这样我就可以将年份显示为 [1990''''2000''''2010''''2020]。我的意思是它们应该是 4 个小刻度,其间的年份应该不可见。感谢任何帮助。谢谢

4

1 回答 1

0

您可以配置renderer您的 axelabel为您不想显示的年份值返回一个空值:

{
    type: "Category",
    position: "bottom",
    minorTickSteps: 4,
    majorTickSteps: 5,
    maximum:50,
    minimum:0,
    fields: ["year"],
    title: "Year",

    label: {
        renderer: function(v) {
            return v % 10 === 0 ? v : '';
        }
    }
}
于 2013-06-11T12:22:02.477 回答