我正在尝试使用Highchart来显示图表。数据作为图的数据属性给出。一切都按照我想要的方式渲染,除了我不能让X轴标签(日期)显示出来。我一直在调试并在Highchart的xAxis.labels.formatter函数中,但this.value总是“NaN”,而日期在工具提示中渲染得很好。
这是一个复制我的问题的JSFiddle页面。
http://jsfiddle.net/xlory/nKhuA/
<figure id="seo-demand-figure" data-filename="SEODemand"
data-graph="[
{"name":"Agents of SHIELD
cast","label_suffix":"","data":
[[1397286000000,0.09533],[1397890800000,0.08988],[1398495600000,0.06456],
[1399100400000,0.06224],[1399705200000,0.0594],[1400310000000,0.05941],
[1400914800000,0.02861],[1401519600000,0.0307],[1402124400000,0.02971],
[1402729200000,0.0],[1403334000000,0.03265],[1403938800000,0.0],
[1404543600000,0.0]]},
{"name":"Alec
Baldwin","label_suffix":"","data":
[[1397286000000,0.2916],[1397890800000,0.2832],[1398495600000,0.2396],
[1399100400000,0.2397],[1399705200000,0.2377],[1400310000000,1.099],
[1400914800000,0.3148],[1401519600000,0.2763],[1402124400000,0.2674],
[1402729200000,0.2286],[1403334000000,0.2612],[1403938800000,0.3079],
[1404543600000,0.318]]},
{"name":"Kim Kardashian
divorce","label_suffix":"","data":
[[1397286000000,0.02179],[1397890800000,0.02179],[1398495600000,0.02179],
[1399100400000,0.02179],[1399705200000,0.02971],[1400310000000,0.02971],
[1400914800000,0.05942],[1401519600000,0.08913],[1402124400000,0.05942],
[1402729200000,0.03265],[1403334000000,0.03265],[1403938800000,0.03367],
[1404543600000,0.03593]]}
]"
data-decimal-point="." data-thousandssep="," class="figure">
</figure>
(JSFiddle页面中的JS代码..这里发布的时间太长了......)
如何才能正确显示标签?
答案 0 :(得分:0)
问题是我的startOfWeek值不正确。我把'星期日'但它应该是一个对应于星期几的数字,所以就像'0'。这搞砸了勾选标记。