代码之家  ›  专栏  ›  技术社区  ›  Asier Pomposo

X轴上的多条形图标签

  •  0
  • Asier Pomposo  · 技术社区  · 9 年前

    我试图设置自己的X轴标签,但我做不到。 我想将这些(0,1,2,3,4,5)设置为

    ['2015/08/07','2015/08/10','2015/08/13','2015/08/16','2015/08/19']

    enter image description here

    我已经尝试添加这些.tickValues属性,但没有任何结果,它只是将我的第一个值放在X轴的开始处。

    chart.xAxis
                    .axisLabel("Last week information")
                    .scale(10)
                    .tickValues(['2015/08/07','2015/08/10','2015/08/13','2015/08/16','2015/08/19']);
    

    我该怎么做?

    1 回复  |  直到 9 年前
        1
  •  0
  •   Asier Pomposo    9 年前

    解决了的

    > var dates =  ['2015/08/07','2015/08/10','2015/08/13','2015/08/16','2015/08/19','2015/08/19']
    > 
    >                 chart.xAxis.tickValues([0,1, 2, 3, 4, 5])
    >                 .tickFormat(function(d){
    >                     return dates[d]
    >                 });